TokenIOSync

@interface TokenIOSync : NSObject

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

The class provides async API with TokenIOSync providing a synchronous version. TokenIO instance can be obtained by calling sync method.

  • Asynchronous API.

    Declaration

    Objective-C

    @property (readonly, retain, atomic) TokenIO *async;

    Swift

    var async: TokenIO! { get }
  • Creates a new builder object that can be used to customize the TokenIO 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 Token host and port. The instance is backed by the async implementation that it delegates all the calls to.

    Declaration

    Objective-C

    - (id)initWithDelegate:(TokenIO *)delegate;

    Swift

    init!(delegate: TokenIO!)
  • Checks if a given alias already exists.

    Declaration

    Objective-C

    - (BOOL)aliasExists:(Alias *)alias;

    Swift

    func aliasExists(_ alias: Alias!) -> Any!

    Parameters

    alias

    alias to check

    Return Value

    true if alias already exists, false otherwise

  • Looks up member id for a given alias.

    Declaration

    Objective-C

    - (NSString *)getMemberId:(Alias *)alias;

    Swift

    func getMemberId(_ alias: Alias!) -> Any!

    Parameters

    alias

    alias to check

    Return Value

    member id if alias exists, nil otherwise

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

    Declaration

    Objective-C

    - (TokenMember *)getTokenMember:(Alias *)alias;

    Swift

    func getTokenMember(_ alias: Alias!) -> TokenMember!

    Parameters

    alias

    alias to check

    Return Value

    token member if alias exists, nil otherwise

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

    Declaration

    Objective-C

    - (TKMemberSync *)createMember:(Alias *)alias;

    Swift

    func createMember(_ alias: Alias!) -> TKMemberSync!

    Parameters

    alias

    member alias to use, must be unique

    Return Value

    newly created member

  • 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

    - (DeviceInfo *)provisionDevice:(Alias *)alias;

    Swift

    func provisionDevice(_ alias: Alias!) -> DeviceInfo!

    Parameters

    alias

    member id to provision the device for

    Return Value

    device information

  • Logs in an existing member to the system.

    Declaration

    Objective-C

    - (TKMemberSync *)getMember:(NSString *)memberId;

    Swift

    func getMember(_ memberId: Any!) -> TKMemberSync!

    Parameters

    memberId

    member id

    Return Value

    logged in member

  • Returns a list of token enabled banks.

    Declaration

    Objective-C

    - (NSArray<Bank *> *)getBanks:(NSArray<NSString *> *)bankIds
                           search:(NSString *)search
                          country:(NSString *)country
                             page:(int)page
                          perPage:(int)perPage
                             sort:(NSString *)sort
                         provider:(NSString *)provider;

    Swift

    func getBanks(_ bankIds: Any!, search: Any!, country: Any!, page: Int32, perPage: Int32, sort: Any!, provider: Any!) -> Any!

    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)

    Return Value

    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;

    Swift

    func notifyPaymentRequest(_ token: TokenPayload!)

    Parameters

    token

    payload of a token to be sent

  • Sends a notification to request adding keys

    Declaration

    Objective-C

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

    Swift

    func notifyAddKey(_ alias: Alias!, keys: Any!, deviceMetadata: DeviceMetadata!)

    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.

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

    Declaration

    Objective-C

    - (NotifyResult *)notifyEndorseAndAddKey:(TokenPayload *)tokenPayload
                                        keys:(NSArray<Key *> *)keys
                              deviceMetadata:(DeviceMetadata *)deviceMetadata
                              tokenRequestId:(NSString *)tokenRequestId
                                      bankId:(NSString *)bankId
                                       state:(NSString *)state
                                     contact:(ReceiptContact *)contact;

    Swift

    func notifyEndorseAndAddKey(_ tokenPayload: TokenPayload!, keys: Any!, deviceMetadata: DeviceMetadata!, tokenRequestId: Any!, bankId: Any!, state: Any!, contact: ReceiptContact!) -> NotifyResult!

    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

    Return Value

    notify result

  • Invalidate a notification.

    Declaration

    Objective-C

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

    Swift

    func invalidateNotification(_ notificationId: Any!, onSuccess: @escaping OnSuccessWithNotifyStatus, onError: @escaping OnError) -> Any!

    Parameters

    notificationId

    notification id to invalidate

    Return Value

    notify status

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

    Declaration

    Objective-C

    - (TokenRequestResult *)getTokenRequestResult:(NSString *)tokenRequestId;

    Swift

    func getTokenRequestResult(_ tokenRequestId: Any!) -> TokenRequestResult!

    Parameters

    tokenRequestId

    token request id

    Return Value

    token request result

  • 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 TokenIOSync instance.

    Declaration

    Objective-C

    - (NSString *)beginMemberRecovery:(Alias *)alias;

    Swift

    func beginMemberRecovery(_ alias: Alias!) -> Any!

    Parameters

    alias

    alias to recover

    Return Value

    verificationId for the recovery process

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

    Declaration

    Objective-C

    - (void)verifyMemberRecovery:(Alias *)alias
                        memberId:(NSString *)memberId
                  verificationId:(NSString *)verificationId
                            code:(NSString *)code;

    Swift

    func verifyMemberRecovery(_ alias: Alias!, memberId: Any!, verificationId: Any!, code: Any!)

    Parameters

    alias

    alias to recover

    memberId

    memberId to recover

    verificationId

    verification Id from beginMemberRecovery call

    code

    code from verification message

  • 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

    - (TKMemberSync *)completeMemberRecovery:(Alias *)alias
                                    memberId:(NSString *)memberId
                              verificationId:(NSString *)verificationId
                                        code:(NSString *)code;

    Swift

    func completeMemberRecovery(_ alias: Alias!, memberId: Any!, verificationId: Any!, code: Any!) -> TKMemberSync!

    Parameters

    alias

    alias to recover

    memberId

    memberId to recover

    verificationId

    verification Id from beginMemberRecovery call

    code

    code from verification message