TokenIO

@interface TokenIO : NSObject

Use this class to create a new member with createMember method or use an existing member with getMember.

The class provides async API

  • Creates a new builder object that can be used to customize the TokenIOAsync instance being built.

    Declaration

    Objective-C

    + (TokenIOBuilder *)builder;

    Swift

    class func builder() -> TokenIOBuilder!
  • Creates a new builder object with host, port, and useSsl set for the sandbox testing environment.

    Declaration

    Objective-C

    + (TokenIOBuilder *)sandboxBuilder;

    Swift

    class func sandboxBuilder() -> TokenIOBuilder!
  • Creates a new instance that connects to the specified TokenCluster and port.

    Declaration

    Objective-C

    - (id)initWithTokenCluster:(TokenCluster *)tokenCluster
                          port:(int)port
                     timeoutMs:(int)timeout
                  developerKey:(NSString *)developerKey
                  languageCode:(NSString *)languageCode
                        crypto:(id<TKCryptoEngineFactory>)cryptoEngineFactory
                browserFactory:(TKBrowserFactory)browserFactory
                        useSsl:(BOOL)useSsl
                     certsPath:(NSString *)certsPath
        globalRpcErrorCallback:(OnError)globalRpcErrorCallback;

    Parameters

    tokenCluster

    TokenCluster to connect to

    port

    gRPC port to connect to

    timeout

    timeout value in ms

    developerKey

    developer ID

    languageCode

    the SDK language code

    cryptoEngineFactory

    crypto module to use

    useSsl

    use SSL if true

    browserFactory

    use customized authorization browser if set

    certsPath

    use custom certs; otherwise, use the default root certs

    globalRpcErrorCallback

    global RPC error callback to invoke on error

  • Creates a new Token member with a pair of auto generated keys and the given alias.

    Declaration

    Objective-C

    - (void)createMember:(Alias *)alias
               onSuccess:(OnSuccessWithTKMember)onSuccess
                 onError:(OnError)onError;

    Swift

    func createMember(_ alias: Alias!, onSuccess: @escaping OnSuccessWithTKMember, onError: @escaping OnError)

    Parameters

    alias

    member alias to use, must be unique

  • Provisions a new device for an existing user. The call generates a set of keys that are returned back. The keys need to be approved by an existing device/keys.

    Declaration

    Objective-C

    - (void)provisionDevice:(Alias *)alias
                  onSuccess:(OnSuccessWithDeviceInfo)onSuccess
                    onError:(OnError)onError;

    Swift

    func provisionDevice(_ alias: Alias!, onSuccess: @escaping OnSuccessWithDeviceInfo, onError: @escaping OnError)

    Parameters

    alias

    member id to provision the device for

  • Checks if a given alias already exists.

    Declaration

    Objective-C

    - (void)aliasExists:(Alias *)alias
              onSuccess:(OnSuccessWithBoolean)onSuccess
                onError:(OnError)onError;

    Swift

    func aliasExists(_ alias: Alias!, onSuccess: @escaping OnSuccessWithBoolean, onError: @escaping OnError)

    Parameters

    alias

    alias to check

  • Looks up member id for a given alias.

    Declaration

    Objective-C

    - (void)getMemberId:(Alias *)alias
              onSuccess:(OnSuccessWithString)onSuccess
                onError:(OnError)onError;

    Swift

    func getMemberId(_ alias: Alias!, onSuccess: @escaping OnSuccessWithString, onError: @escaping OnError)

    Parameters

    alias

    alias to check

  • Looks up token member for a given unknown alias. Set alias Alias_Type_Unknown if the alias type is unknown

    Declaration

    Objective-C

    - (void)getTokenMember:(Alias *)alias
                 onSuccess:(OnSuccessWithTokenMember)onSuccess
                   onError:(OnError)onError;

    Swift

    func getTokenMember(_ alias: Alias!, onSuccess: @escaping OnSuccessWithTokenMember, onError: @escaping OnError)

    Parameters

    alias

    alias to check

    onSuccess

    invoked if successful; return token member if alias already exists, nil otherwise

  • Gets a TKMember using already-stored keys. (Logs in an existing member to the system.)

    Declaration

    Objective-C

    - (void)getMember:(NSString *)memberId
            onSuccess:(OnSuccessWithTKMember)onSuccess
              onError:(OnError)onError;

    Swift

    func getMember(_ memberId: String!, onSuccess: @escaping OnSuccessWithTKMember, onError: @escaping OnError)

    Parameters

    memberId

    member id

  • Returns a list of token enabled banks.

    Declaration

    Objective-C

    - (void)getBanks:(NSArray<NSString *> *)bankIds
              search:(NSString *)search
             country:(NSString *)country
                page:(int)page
             perPage:(int)perPage
                sort:(NSString *)sort
            provider:(NSString *)provider
           onSuccess:(OnSuccessWithBanks)onSuccess
             onError:(OnError)onError;

    Swift

    func getBanks(_ bankIds: [String]!, search: String!, country: String!, page: Int32, perPage: Int32, sort: String!, provider: String!, onSuccess: @escaping OnSuccessWithBanks, onError: @escaping OnError)

    Parameters

    bankIds

    If specified, return banks whose ‘id’ matches any one of the given ids (case-insensitive). Can be at most 1000.

    search

    If specified, return banks whose ‘name’ or ‘identifier’ contains the given search string (case-insensitive)

    country

    If specified, return banks whose ‘country’ matches the given ISO 3166-1 alpha-2 country code (case-insensitive)

    page

    Result page to retrieve. Default to 1 if not specified.

    perPage

    Maximum number of records per page. Can be at most 200. Default to 200 if not specified.

    sort

    The key to sort the results. Could be one of: name, provider and country. Defaults to name if not specified.

    provider

    If specified, return banks whose ‘provider’ matches the provider (case-insensitive)

    onSuccess

    invoked on success with a list of banks

  • Sends a notification to request payment. The from alias in tokenpayload will be notified.

    Declaration

    Objective-C

    - (void)notifyPaymentRequest:(TokenPayload *)token
                       onSuccess:(OnSuccess)onSuccess
                         onError:(OnError)onError;

    Swift

    func notifyPaymentRequest(_ token: TokenPayload!, onSuccess: @escaping OnSuccess, onError: @escaping OnError)

    Parameters

    token

    payload of a token to be sent

    onSuccess

    invoked if successful

    onError

    invoked if failed

  • Sends a notification to request adding keys

    Declaration

    Objective-C

    - (void)notifyAddKey:(Alias *)alias
                    keys:(NSArray<Key *> *)keys
          deviceMetadata:(DeviceMetadata *)deviceMetadata
               onSuccess:(OnSuccess)onSuccess
                 onError:(OnError)onError;

    Swift

    func notifyAddKey(_ alias: Alias!, keys: [Key]!, deviceMetadata: DeviceMetadata!, onSuccess: @escaping OnSuccess, onError: @escaping OnError)

    Parameters

    alias

    alias to notify

    keys

    list of new keys to add

    deviceMetadata

    device metadata of the keys. It will be shown in the pop up.

    onSuccess

    invoked if successful

    onError

    invoked if failed

  • Notifies subscribed devices that a token payload should be endorsed and keys should be added.

    Declaration

    Objective-C

    - (void)notifyEndorseAndAddKey:(TokenPayload *)tokenPayload
                              keys:(NSArray<Key *> *)keys
                    deviceMetadata:(DeviceMetadata *)deviceMetadata
                    tokenRequestId:(NSString *)tokenRequestId
                            bankId:(NSString *)bankId
                             state:(NSString *)state
                           contact:(ReceiptContact *)contact
                         onSuccess:(OnSuccessWithNotifyResult)onSuccess
                           onError:(OnError)onError;

    Swift

    func notifyEndorseAndAddKey(_ tokenPayload: TokenPayload!, keys: [Key]!, deviceMetadata: DeviceMetadata!, tokenRequestId: String!, bankId: String!, state: String!, contact: ReceiptContact!, onSuccess: @escaping OnSuccessWithNotifyResult, onError: @escaping OnError)

    Parameters

    tokenPayload

    the token payload to be sent

    keys

    keys to be added

    deviceMetadata

    device metadata of the keys

    tokenRequestId

    optional token request id

    bankId

    optional bank id

    state

    optional token request state for signing

    contact

    receipt contact

    onSuccess

    invoked if successful

    onError

    invoked if failed

  • Invalidate a notification.

    Declaration

    Objective-C

    - (void)invalidateNotification:(NSString *)notificationId
                         onSuccess:(OnSuccessWithNotifyStatus)onSuccess
                           onError:(OnError)onError;

    Swift

    func invalidateNotification(_ notificationId: String!, onSuccess: @escaping OnSuccessWithNotifyStatus, onError: @escaping OnError)

    Parameters

    notificationId

    notification id to invalidate

    onSuccess

    invoked if successful

    onError

    invoked if failed

  • Get the token request result based on a token’s tokenRequestId.

    Declaration

    Objective-C

    - (void)getTokenRequestResult:(NSString *)tokenRequestId
                        onSuccess:(OnSuccessWithTokenRequestResult)onSuccess
                          onError:(OnError)onError;

    Swift

    func getTokenRequestResult(_ tokenRequestId: String!, onSuccess: @escaping OnSuccessWithTokenRequestResult, onError: @escaping OnError)

    Parameters

    tokenRequestId

    token request id

    onSuccess

    invoked if successful

    onError

    invoked if failed

  • Begins member account recovery process by contacting alias. The verification message will be sent if the alias is valid. All the member recovery methods shall be called by the same TokenIO instance.

    Declaration

    Objective-C

    - (void)beginMemberRecovery:(Alias *)alias
                      onSuccess:(OnSuccessWithString)onSuccess
                        onError:(OnError)onError;

    Swift

    func beginMemberRecovery(_ alias: Alias!, onSuccess: @escaping OnSuccessWithString, onError: @escaping OnError)

    Parameters

    alias

    alias to recover

    onSuccess

    invoked if successful with verification Id

    onError

    invoked if failed

  • Verifies member recovery code after beginMemberRecovery is successful. All the member recovery methods shall be called by the same TokenIO instance.

    Declaration

    Objective-C

    - (void)verifyMemberRecovery:(Alias *)alias
                        memberId:(NSString *)memberId
                  verificationId:(NSString *)verificationId
                            code:(NSString *)code
                       onSuccess:(OnSuccess)onSuccess
                         onError:(OnError)onError;

    Swift

    func verifyMemberRecovery(_ alias: Alias!, memberId: String!, verificationId: String!, code: String!, onSuccess: @escaping OnSuccess, onError: @escaping OnError)

    Parameters

    alias

    alias to recover

    memberId

    memberId to recover

    verificationId

    verification Id from beginMemberRecovery call

    code

    code from verification message

    onSuccess

    invoked if successful

    onError

    invoked if failed

  • Completes member recovery process after verifyMemberRecoveryCode is successful. Uploads member’s public keys from this device to Token directory. All the member recovery methods shall be called by the same TokenIO instance.

    Declaration

    Objective-C

    - (void)completeMemberRecovery:(Alias *)alias
                          memberId:(NSString *)memberId
                    verificationId:(NSString *)verificationId
                              code:(NSString *)code
                         onSuccess:(OnSuccessWithTKMember)onSuccess
                           onError:(OnError)onError;

    Swift

    func completeMemberRecovery(_ alias: Alias!, memberId: String!, verificationId: String!, code: String!, onSuccess: @escaping OnSuccessWithTKMember, onError: @escaping OnError)

    Parameters

    alias

    alias to recover

    memberId

    memberId to recover

    verificationId

    verification Id from beginMemberRecovery call

    code

    code from verification message

    onSuccess

    invoked if successful with TkMember

    onError

    invoked if failed