TokenIO
Main entry object. Allows creation of members, provisioning of devices, logging in, sending notifications, etc, as well as access to other SDK classes.
Static Method Summary
Static Public Methods | ||
public static |
disableIframePassthrough(): void If we're on a token page, this disables passthrough |
|
public static |
enableIframePassthrough(env: string): void If we're on a token page, sets up an iframe to avoid CORS preflights. All requests in this window will be routed through the iframe. |
Constructor Summary
Public Constructor | ||
public |
constructor(options: object) Construct the Token SDK object, pointing to the given environment. |
Member Summary
Public Members | ||
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
Private Members | ||
private |
|
Method Summary
Public Methods | ||
public |
aliasExists(alias: Alias): Promise<boolean> Checks if a given alias already exists |
|
public |
createAccessTokenRequest(resources: Array<ResourceTypeEnum>): TokenRequest Create a TokenRequest for an access token |
|
public |
createBusinessMember(alias: Alias, CryptoEngine: KeyStoreCryptoEngine): Promise<Member> Creates a member with a alias and a keypair, using the provided engine |
|
public |
createClaimedMember(alias: Alias, CryptoEngine: KeyStoreCryptoEngine, tokenRequestId: string): Promise<Member> Creates a claimed member with a alias and a keypair, using the provided engine |
|
public |
createMember(alias: Alias, CryptoEngine: KeyStoreCryptoEngine, memberType: string, tokenRequestId: string): Promise<Member> Creates a member with a alias and a keypair, using the provided engine and member type. |
|
public |
createTransferTokenRequest(lifetimeAmount: number | string, currency: string): TokenRequest Create a TokenRequest for a transfer token |
|
public |
generateTokenRequestUrl(requestId: string, state: string, csrfToken: string): string Generate a token request authorization URL. |
|
public |
Gets a list of available banks for linking |
|
public |
Downloads a blob from the server. |
|
public |
getCountries(options: object): Promise<object> Gets a list of available countries for linking |
|
public |
getMember(CryptoEngine: KeyStoreCryptoEngine, memberId: any): Member Returns 'logged-in' member that uses keys already in the CryptoEngine. |
|
public |
getTokenRequestResult(tokenRequestId: string): Promise<object> Get the token request result based on its token request ID. |
|
public |
invalidateNotification(notificationId: string): Promise<NotifyStatusEnum> Invalidate a notification. |
|
public |
normalizeAlias(alias: Alias): Promise<Alias> Normalizes an alias you probably won't need to call this as this is automatically called before addAlias() |
|
public |
notifyAddKey(alias: Alias, keys: Array<Key>, deviceMetadata: DeviceMetadata): Promise<NotifyStatusEnum> Notifies subscribers that a key should be added and passes the public Key and optional name |
|
public |
notifyCreateAndEndorseToken(tokenRequestId: string, keys: Array<Key>, deviceMetadata: DeviceMetadata, receiptContact: ReceiptContact): Object Notifies subscribed devices that a token should be created and endorsed. |
|
public |
notifyEndorseAndAddKey(tokenPayload: TokenPayload, keys: Array<Key>, deviceMetadata: DeviceMetadata, tokenRequestId: string, bankId: string, state: string, receiptContact: ReceiptContact): Promise<object> this method was deprecated. use notifyCreateAndEndorseToken instead
Notifies subscribed devices that a token payload should be endorsed and keys should be added. |
|
public |
notifyPaymentRequest(tokenPayload: TokenPayload): Promise<NotifyStatusEnum> Sends a notification to a user to request a payment. |
|
public |
parseTokenRequestCallbackUrl(callbackUrl: string, csrfToken: string): Promise<object> Parse a token request callback URL, verify the state and signature, and return the inner state and token id. |
|
public |
provisionDevice(alias: Alias, CryptoEngine: KeyStoreCryptoEngine): Promise<object> Provisions a new device for an existing user. |
|
public |
provisionDeviceLow(alias: Alias, CryptoEngine: KeyStoreCryptoEngine, expirationMs: number): Promise<object> Provisions a new device for an existing user. |
|
public |
resolveAlias(alias: Alias): Promise<TokenMember|undefined> Resolve an alias to a member |
|
public |
retrieveTokenRequest(requestId: string): Promiseobject> Retrieves a request for a token. |
|
public |
updateTokenRequest(requestId: string, options: Object): Promise<void> Updates an existing token request. |
Static Public Methods
public static disableIframePassthrough(): void source
If we're on a token page, this disables passthrough
Return:
void |
public static enableIframePassthrough(env: string): void source
If we're on a token page, sets up an iframe to avoid CORS preflights. All requests in this window will be routed through the iframe.
Params:
Name | Type | Attribute | Description |
env | string | which environment (gateway) to use, (e.g. prd) |
Return:
void |
Public Constructors
Public Members
public BrowserCryptoEngine: BrowserCryptoEngine source
public ManualCryptoEngine: ManualCryptoEngine source
public MemoryCryptoEngine: MemoryCryptoEngine source
public TokenRequest: TokenRequest source
public UnsecuredFileCryptoEngine: UnsecuredFileCryptoEngine source
Private Members
private _unauthenticatedClient: HttpClient source
Public Methods
public aliasExists(alias: Alias): Promise<boolean> source
Checks if a given alias already exists
Params:
Name | Type | Attribute | Description |
alias | Alias | alias to check |
public createAccessTokenRequest(resources: Array<ResourceTypeEnum>): TokenRequest source
Create a TokenRequest for an access token
Params:
Name | Type | Attribute | Description |
resources | Array<ResourceTypeEnum> | resources to request access of |
public createBusinessMember(alias: Alias, CryptoEngine: KeyStoreCryptoEngine): Promise<Member> source
Creates a member with a alias and a keypair, using the provided engine
Params:
Name | Type | Attribute | Description |
alias | Alias |
|
alias - alias to set for member, falsy value or empty object for a temporary member without an alias |
CryptoEngine | KeyStoreCryptoEngine | CryptoEngine - engine to use for key creation and storage |
public createClaimedMember(alias: Alias, CryptoEngine: KeyStoreCryptoEngine, tokenRequestId: string): Promise<Member> source
Creates a claimed member with a alias and a keypair, using the provided engine
Params:
Name | Type | Attribute | Description |
alias | Alias |
|
alias - alias to set for member, falsy value or empty object for a temporary member without an alias |
CryptoEngine | KeyStoreCryptoEngine | CryptoEngine - engine to use for key creation and storage |
|
tokenRequestId | string | tokenRequestId - token request id |
public createMember(alias: Alias, CryptoEngine: KeyStoreCryptoEngine, memberType: string, tokenRequestId: string): Promise<Member> source
Creates a member with a alias and a keypair, using the provided engine and member type.
Params:
Name | Type | Attribute | Description |
alias | Alias |
|
alias - alias to set for member, falsy value or empty object for a temporary member without an alias |
CryptoEngine | KeyStoreCryptoEngine | CryptoEngine - engine to use for key creation and storage |
|
memberType | string | memberType - type of member to create. "PERSONAL" if undefined |
|
tokenRequestId | string | tokenRequestId - (optional) token request id if the member is being claimed |
public createTransferTokenRequest(lifetimeAmount: number | string, currency: string): TokenRequest source
Create a TokenRequest for a transfer token
public generateTokenRequestUrl(requestId: string, state: string, csrfToken: string): string source
Generate a token request authorization URL.
public getBanks(options: object): Promise<object> source
Gets a list of available banks for linking
Params:
Name | Type | Attribute | Description |
options | object | optional parameters for getBanks |
public getBlob(blobId: string): Promise<Blob> source
Downloads a blob from the server.
Params:
Name | Type | Attribute | Description |
blobId | string | id of the blob |
Throw:
* |
error if blob not found |
public getCountries(options: object): Promise<object> source
Gets a list of available countries for linking
Params:
Name | Type | Attribute | Description |
options | object | optional parameters for getBanksCountries |
public getMember(CryptoEngine: KeyStoreCryptoEngine, memberId: any): Member source
Returns 'logged-in' member that uses keys already in the CryptoEngine. If memberId is not provided, the last member to 'log in' will be used.
Params:
Name | Type | Attribute | Description |
CryptoEngine | KeyStoreCryptoEngine | CryptoEngine - engine to use for key creation and storage |
|
memberId | any | optional id of the member we want to log in |
public getTokenRequestResult(tokenRequestId: string): Promise<object> source
Get the token request result based on its token request ID.
Params:
Name | Type | Attribute | Description |
tokenRequestId | string | token request id |
public invalidateNotification(notificationId: string): Promise<NotifyStatusEnum> source
Invalidate a notification.
Params:
Name | Type | Attribute | Description |
notificationId | string | the notification id to invalidate |
public normalizeAlias(alias: Alias): Promise<Alias> source
Normalizes an alias you probably won't need to call this as this is automatically called before addAlias()
Params:
Name | Type | Attribute | Description |
alias | Alias | alias to normalize |
public notifyAddKey(alias: Alias, keys: Array<Key>, deviceMetadata: DeviceMetadata): Promise<NotifyStatusEnum> source
Notifies subscribers that a key should be added and passes the public Key and optional name
Params:
Name | Type | Attribute | Description |
alias | Alias | alias to notify |
|
keys | Array<Key> | token keys to be added |
|
deviceMetadata | DeviceMetadata | device metadata of the keys |
public notifyCreateAndEndorseToken(tokenRequestId: string, keys: Array<Key>, deviceMetadata: DeviceMetadata, receiptContact: ReceiptContact): Object source
Notifies subscribed devices that a token should be created and endorsed.
Params:
Name | Type | Attribute | Description |
tokenRequestId | string | token request ID |
|
keys | Array<Key> | (optional) token keys to be added |
|
deviceMetadata | DeviceMetadata | device metadata of the keys |
|
receiptContact | ReceiptContact | (optional) receipt contact |
public notifyEndorseAndAddKey(tokenPayload: TokenPayload, keys: Array<Key>, deviceMetadata: DeviceMetadata, tokenRequestId: string, bankId: string, state: string, receiptContact: ReceiptContact): Promise<object> source
Notifies subscribed devices that a token payload should be endorsed and keys should be added.
Params:
Name | Type | Attribute | Description |
tokenPayload | TokenPayload | the endorseAndAddKey payload to be sent |
|
keys | Array<Key> | token keys to be added |
|
deviceMetadata | DeviceMetadata | device metadata of the keys |
|
tokenRequestId | string | (optional) token request Id |
|
bankId | string | (optional) bank Id |
|
state | string | (optional) token request state for signing |
|
receiptContact | ReceiptContact | (optional) receipt contact |
public notifyPaymentRequest(tokenPayload: TokenPayload): Promise<NotifyStatusEnum> source
Sends a notification to a user to request a payment.
Params:
Name | Type | Attribute | Description |
tokenPayload | TokenPayload | requested transfer token |
public parseTokenRequestCallbackUrl(callbackUrl: string, csrfToken: string): Promise<object> source
Parse a token request callback URL, verify the state and signature, and return the inner state and token id.
public provisionDevice(alias: Alias, CryptoEngine: KeyStoreCryptoEngine): Promise<object> source
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.
Params:
Name | Type | Attribute | Description |
alias | Alias | user to provision the device for |
|
CryptoEngine | KeyStoreCryptoEngine | CryptoEngine - engine to use for key creation and storage |
public provisionDeviceLow(alias: Alias, CryptoEngine: KeyStoreCryptoEngine, expirationMs: number): Promise<object> source
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. This only generates one (LOW) key.
Params:
Name | Type | Attribute | Description |
alias | Alias | user to provision the device for |
|
CryptoEngine | KeyStoreCryptoEngine | CryptoEngine - engine to use for key creation and storage |
|
expirationMs | number |
|
(optional) expiration duration of key in milliseconds |
public resolveAlias(alias: Alias): Promise<TokenMember|undefined> source
Resolve an alias to a member
Params:
Name | Type | Attribute | Description |
alias | Alias | alias to lookup |