HyperwalletAuthenticationTokenProvider

@objc
public protocol HyperwalletAuthenticationTokenProvider

The HyperwalletAuthenticationTokenProvider protocol provides the Hyperwallet iOS Core SDK with an abstraction to retrieve an authentication token. An authentication token is a JSON Web Token that will be used to authenticate the User to the Hyperwallet platform.

Implementations of HyperwalletAuthenticationTokenProvider are expected to be non-blocking and thread safe.

  • A callback interface to handle the submission of an authentication token or an error message in case of failure.

    The authentication token is a JSON web token that contains as part of its claim set the principal that will be interacting with the Hyperwallet platform.

    Authentication token will be used until it expires.

    The HyperwalletAuthenticationErrorType will contain error in case authentication token is not retrieved successfully.

    Declaration

    Swift

    typealias CompletionHandler = (_ authenticationToken: String?, _ error: Error?) -> Void

    Parameters

    authenticationToken

    a JWT token identifying a Hyperwallet User principal

    error

    an HyperwalletAuthenticationErrorType indicating the cause of the authentication token retrieval error

  • Invoked when the Hyperwallet iOS Core SDK requires an authentication token.

    Implementations of this function are expected to call the HyperwalletAuthenticationTokenProvider.CompletionHandler(String, nil) method when an authentication token is retrieved and the HyperwalletAuthenticationTokenProvider.CompletionHandler(nil, AuthenticationErrorType) when an authentication token is not retrieved.

    Declaration

    Swift

    func retrieveAuthenticationToken(completionHandler: @escaping CompletionHandler)

    Parameters

    completionHandler

    A completion handler for authentication tokens