retrieveCredentials(forBorderAgent:completion:)
Requests Thread credentials for a Border Agent.
Declaration
func retrieveCredentials(forBorderAgent borderAgentID: Data, completion: @escaping @Sendable (THCredentials?, (any Error)?) -> Void)func credentials(forBorderAgentID borderAgentID: Data) async throws -> THCredentialsParameters
- borderAgentID:
The identifer of a Thread network Border Agent.
- completion:
The completion handler the framework calls when the credentials become available.
Mentioned in
Discussion
The framework identifies the developer by the team ID. When calling this method, you receive credentials for your team ID only.
Call the method as follows:
func obtainCredentials(borderAgentID: Data) async -> (cred: THCredentials? ,err: Error? ) {
let client = THClient()
var credential: THCredentials?
var err:Error?
do {
credential = try await client.credentials(forBorderAgentID: borderAgentID as Data)
} catch {
err = error
}
return (credential, err)
}