AuthHttpClient
Client for making authenticated requests to the Token gateway.
Constructor Summary
Public Constructor | ||
public |
constructor(options: Object) Initializes the client for the environment, memberId, and CryptoEngine. |
Member Summary
Private Members | ||
private |
_authHeader: * |
|
private |
_context: * |
|
private |
|
|
private |
|
|
private |
_instance: * |
|
private |
_interceptor: * |
|
private |
_memberId: * |
|
private |
|
Method Summary
Public Methods | ||
public |
async addAddress(name: string, address: Object): Object Adds an address to the member. |
|
public |
Adds an alias to the member. |
|
public |
async addAliases(prevHash: string, aliases: Array): Object Adds aliases to the member. |
|
public |
async addRecoveryRule(prevHash: string, rule: Object): Object Set member's recovery rule. |
|
public |
async addTrustedBeneficiary(memberId: string): Object Adds a Token member to this member's list of trusted beneficiaries. |
|
public |
async approveKey(prevHash: string, key: Object): Object Adds a key to the member. |
|
public |
async approveKeys(prevHash: string, keys: Array): Object Adds keys to the member. |
|
public |
async cancelToken(token: Object, blocking: bool): Object Cancels a token. |
|
public |
this method was deprecated.
Clears the AuthContext, so this client no longer acts on behalf of another member. |
|
public |
Clears the security metadata. |
|
public |
async createAccessToken(payload: Object, tokenRequestId: string): Object Creates an access token. |
|
public |
async createBlob(ownerId: string, type: string, name: string, data: Buffer): Object Uploads a blob to the server. |
|
public |
async createCustomization(logo: Object, colors: Object, consentText: string, name: string, appName: string): Promise Creates customization. |
|
public |
async createTestBankAccount(balance: Number, currency: string): Object Creates a test bank account. |
|
public |
async createTransferToken(payload: Object, tokenRequestId: string): Object Creates a transfer token. |
|
public |
async deleteAddress(addressId: string): Object Deletes an address. |
|
public |
async deleteMember(): Object Deletes the member. |
|
public |
async endorseToken(token: Object): Object Endorses a token. |
|
public |
async getAccount(accountId: string): Object Gets an account. |
|
public |
async getAccounts(): Object Gets all accounts linked to the member. |
|
public |
async getActiveAccessToken(toMemberId: string): Object Looks up a existing access token where the calling member is the grantor and given member is the grantee. |
|
public |
async getAddress(addressId: string): Object Gets an address by id. |
|
public |
async getAddresses(): Object Gets all addresses. |
|
public |
async getAliases(): Object Gets logged-in member's aliases, verified or not. |
|
public |
async getBalance(accountId: string, keyLevel: string): Object Gets the balance of an account. |
|
public |
async getBalances(accountIds: Array, keyLevel: string): Object Gets the balances of an array of accounts. |
|
public |
async getBankInfo(bankId: string): Object Gets info about a bank. |
|
public |
Gets a blob from the server. |
|
public |
async getDefaultAccount(): Promise Gets the default bank account. |
|
public |
async getDefaultRecoveryAgent(): Object Get default recovery agent. |
|
public |
async getNotification(notificationId: string): Object Gets a notification by id. |
|
public |
async getNotifications(offset: string, limit: Number): Object Gets all notifications. |
|
public |
async getProfile(id: string): Object Gets a member's public profile. |
|
public |
async getProfilePicture(id: string, size: Object): Object Gets a member's public profile picture. |
|
public |
async getReceiptContact(): Object Gets member's receipt contact. |
|
public |
Returns the security metadata. |
|
public |
Creates the necessary signer objects, based on the level requested. |
|
public |
async getSubscriber(subscriberId: string): Object Gets a subscriber by id. |
|
public |
async getSubscribers(): Object Gets all subscribers for a member. |
|
public |
async getTestBankNotification(subscriberId: string, notificationId: string): Object Gets test bank notification. |
|
public |
async getTestBankNotifications(subscriberId: string): Object Gets test bank notifications. |
|
public |
Gets a token by its id. |
|
public |
async getTokenBlob(tokenId: string, blobId: string): Object Gets a blob that is a attached to a token. |
|
public |
Gets all tokens of the member, of a certain type. |
|
public |
async getTransaction(accountId: string, transactionId: string, keyLevel: string): Object Gets a transaction for an account, by its id. |
|
public |
Gets all transactions for an account. |
|
public |
async getTransfer(transferId: string): Object Gets a transfer by id. |
|
public |
async getTransfers(tokenId: string, offset: string, limit: Number): Object Gets all transfers on a token. |
|
public |
async getTrustedBeneficiaries(): Object Get the member's list of trusted beneficiaries. |
|
public |
async linkAccounts(bankAuthorization: Object): Object this method was deprecated. - use linkAccountsOauth
Links accounts to the member. |
|
public |
async linkAccountsOauth(authorization: string): Object Links accounts to the member. |
|
public |
async redeemToken(transferToken: Object, amount: Number, currency: string, description: string, destinations: Array, refId: string): Object Redeems a transfer token. |
|
public |
async removeAlias(prevHash: string, alias: Object): Object Removes an alias from the member. |
|
public |
async removeAliases(prevHash: string, aliases: Array): Object Removes aliases from the member. |
|
public |
Removes a key from the member. |
|
public |
async removeKeys(prevHash: string, keyIds: Array): Object Removes keys from the member. |
|
public |
async removeTrustedBeneficiary(memberId: string): Object Removes a Token member from this member's list of trusted beneficiaries. |
|
public |
async replaceAndEndorseToken(tokenToCancel: Object, newResources: Array): Object this method was deprecated. use replaceAccessToken and endorseToken instead
Replaces an access token with one with updated resources, and endorses it.
|
|
public |
async replaceToken(tokenToCancel: Object, newResources: Array): Object Replaces an access token with one with updated resources. |
|
public |
async resolveTransferDestinations(accountId: string): Object Resolves transfer destinations for the given account ID. |
|
public |
async setAccountName(accountId: string, name: string): Object Sets the name of an account. |
|
public |
Sets the customer initiated request flag to true. |
|
public |
async setDefaultAccount(accountId: string): Promise Sets the member's default bank account. |
|
public |
async setProfile(profile: Object): Object Replaces the authenticated member's public profile. |
|
public |
async setProfilePicture(type: string, data: Buffer): Object Uploads member's public profile picture. |
|
public |
async setReceiptContact(contact: Object): Object Replaces member's receipt contact. |
|
public |
setSecurityMetadata(securityMetadata: object) Sets the security metadata to be sent with each request. |
|
public |
async signTokenRequestState(tokenRequestId: string, tokenId: string, state: string): Object Sign with a Token signature a token request state payload. |
|
public |
async storeTokenRequest(tokenRequest: Object): Promise Stores a request for a token. |
|
public |
async subscribeToNotifications(handler: string, handlerInstructions: string): Object Subscribes to push notifications. |
|
public |
async triggerBalanceStepUpNotification(accountIds: Array): Object Trigger a balance step up notification. |
|
public |
async triggerStepUpNotification(tokenId: string): Object Trigger a token step up notification. |
|
public |
async triggerTransactionStepUpNotification(accountId: string, transactionId: string): Object Trigger a transaction step up notification. |
|
public |
async unlinkAccounts(accountIds: Array): Object Unlinks bank accounts previously linked by the linkAccounts call. |
|
public |
async unsubscribeFromNotifications(subscriberId: string): Object Unsubscribes from notifications (deletes a subscriber). |
|
public |
useAccessToken(accessTokenId: string) Use the given access token. |
|
public |
useKeyLevel(keyLevel: string) Use the given key level to sign the request. |
|
public |
async verifyAffiliate(memberId: string): Object Verifies an affiliated TPP. |
Private Methods | ||
private |
async _memberUpdate(update: *, prevHash: *, metadata: *): * |
|
private |
|
|
private |
async _tokenOperation(token: *, operation: *, suffix: *, blocking: *): * |
|
private |
async _tokenOperationRequest(token: *, suffix: *): {"tokenId": *, "signature": *} |
|
private |
async _tokenOperationSignature(tokenPayload: *, suffix: *): {"memberId": *, "keyId": *, "signature": *} |
Public Constructors
Private Members
private _authHeader: * source
private _context: * source
private _cryptoEngine: * source
private _developerKey: * source
private _instance: * source
private _interceptor: * source
private _memberId: * source
private _securityMetadata: * source
Public Methods
public async addAddress(name: string, address: Object): Object source
Adds an address to the member.
public async addAliases(prevHash: string, aliases: Array): Object source
Adds aliases to the member.
public async addRecoveryRule(prevHash: string, rule: Object): Object source
Set member's recovery rule.
public async addTrustedBeneficiary(memberId: string): Object source
Adds a Token member to this member's list of trusted beneficiaries.
Params:
Name | Type | Attribute | Description |
memberId | string | member ID of the trusted beneficiary to add |
public async cancelToken(token: Object, blocking: bool): Object source
Cancels a token.
Params:
Name | Type | Attribute | Description |
token | Object | token to cancel |
|
blocking | bool | creates a blocking request |
public clearAccessToken() source
Clears the AuthContext, so this client no longer acts on behalf of another member.
public async createAccessToken(payload: Object, tokenRequestId: string): Object source
Creates an access token.
public async createBlob(ownerId: string, type: string, name: string, data: Buffer): Object source
Uploads a blob to the server.
public async createCustomization(logo: Object, colors: Object, consentText: string, name: string, appName: string): Promise source
Creates customization.
public async createTestBankAccount(balance: Number, currency: string): Object source
Creates a test bank account.
public async createTransferToken(payload: Object, tokenRequestId: string): Object source
Creates a transfer token.
public async deleteAddress(addressId: string): Object source
Deletes an address.
Params:
Name | Type | Attribute | Description |
addressId | string | address to delete |
public async endorseToken(token: Object): Object source
Endorses a token.
Params:
Name | Type | Attribute | Description |
token | Object | token to endorse |
public async getAccount(accountId: string): Object source
Gets an account.
Params:
Name | Type | Attribute | Description |
accountId | string | account to get |
public async getActiveAccessToken(toMemberId: string): Object source
Looks up a existing access token where the calling member is the grantor and given member is the grantee.
Params:
Name | Type | Attribute | Description |
toMemberId | string | beneficiary of the active access token |
public async getAddress(addressId: string): Object source
Gets an address by id.
Params:
Name | Type | Attribute | Description |
addressId | string | address to get |
public async getBalance(accountId: string, keyLevel: string): Object source
Gets the balance of an account.
public async getBalances(accountIds: Array, keyLevel: string): Object source
Gets the balances of an array of accounts.
public async getBankInfo(bankId: string): Object source
Gets info about a bank.
Params:
Name | Type | Attribute | Description |
bankId | string | id of the bank to lookup |
public async getBlob(blobId: string): Object source
Gets a blob from the server.
Params:
Name | Type | Attribute | Description |
blobId | string | id of the blob |
public async getNotification(notificationId: string): Object source
Gets a notification by id.
Params:
Name | Type | Attribute | Description |
notificationId | string | Id of the notification to get |
public async getProfile(id: string): Object source
Gets a member's public profile.
Params:
Name | Type | Attribute | Description |
id | string | member id whose profile to get |
public async getProfilePicture(id: string, size: Object): Object source
Gets a member's public profile picture.
public async getSigner(level: string): Promise source
Creates the necessary signer objects, based on the level requested. If the level is not available, attempts to fetch a lower level.
Params:
Name | Type | Attribute | Description |
level | string | requested level of key |
public async getSubscriber(subscriberId: string): Object source
Gets a subscriber by id.
Params:
Name | Type | Attribute | Description |
subscriberId | string | Id of the subscriber to get |
public async getTestBankNotification(subscriberId: string, notificationId: string): Object source
Gets test bank notification.
public async getTestBankNotifications(subscriberId: string): Object source
Gets test bank notifications.
Params:
Name | Type | Attribute | Description |
subscriberId | string | id of subscriber |
public async getToken(tokenId: string): Object source
Gets a token by its id.
Params:
Name | Type | Attribute | Description |
tokenId | string | id of the token to get |
public async getTokenBlob(tokenId: string, blobId: string): Object source
Gets a blob that is a attached to a token.
public async getTokens(type: string, offset: string, limit: Number): Object source
Gets all tokens of the member, of a certain type.
public async getTransaction(accountId: string, transactionId: string, keyLevel: string): Object source
Gets a transaction for an account, by its id.
public async getTransactions(accountId: string, offset: string, limit: Number, keyLevel: string): Object source
Gets all transactions for an account.
public async getTransfer(transferId: string): Object source
Gets a transfer by id.
Params:
Name | Type | Attribute | Description |
transferId | string | id of the transfer |
public async getTransfers(tokenId: string, offset: string, limit: Number): Object source
Gets all transfers on a token.
public async getTrustedBeneficiaries(): Object source
Get the member's list of trusted beneficiaries.
public async linkAccounts(bankAuthorization: Object): Object source
Links accounts to the member.
Params:
Name | Type | Attribute | Description |
bankAuthorization | Object | encrypted authorization to accounts |
public async linkAccountsOauth(authorization: string): Object source
Links accounts to the member.
Params:
Name | Type | Attribute | Description |
authorization | string | oauthBankAuthorization continaing bank_id and access_token |
public async redeemToken(transferToken: Object, amount: Number, currency: string, description: string, destinations: Array, refId: string): Object source
Redeems a transfer token.
public async removeAlias(prevHash: string, alias: Object): Object source
Removes an alias from the member.
public async removeAliases(prevHash: string, aliases: Array): Object source
Removes aliases from the member.
public async removeKey(prevHash: string, keyId: string): Object source
Removes a key from the member.
public async removeKeys(prevHash: string, keyIds: Array): Object source
Removes keys from the member.
public async removeTrustedBeneficiary(memberId: string): Object source
Removes a Token member from this member's list of trusted beneficiaries.
Params:
Name | Type | Attribute | Description |
memberId | string | member ID of the trusted beneficiary to remove |
public async replaceAndEndorseToken(tokenToCancel: Object, newResources: Array): Object source
public async replaceToken(tokenToCancel: Object, newResources: Array): Object source
Replaces an access token with one with updated resources.
public async resolveTransferDestinations(accountId: string): Object source
Resolves transfer destinations for the given account ID.
Params:
Name | Type | Attribute | Description |
accountId | string | id of account to resolve destinations for |
public async setAccountName(accountId: string, name: string): Object source
Sets the name of an account.
public async setDefaultAccount(accountId: string): Promise source
Sets the member's default bank account.
Params:
Name | Type | Attribute | Description |
accountId | string | the bank account id |
public async setProfile(profile: Object): Object source
Replaces the authenticated member's public profile.
Params:
Name | Type | Attribute | Description |
profile | Object | profile to set |
public async setProfilePicture(type: string, data: Buffer): Object source
Uploads member's public profile picture.
Params:
Name | Type | Attribute | Description |
type | string | MIME type |
|
data | Buffer | data in bytes |
public async setReceiptContact(contact: Object): Object source
Replaces member's receipt contact.
Params:
Name | Type | Attribute | Description |
contact | Object | receipt contact to set: value + type |
public setSecurityMetadata(securityMetadata: object) source
Sets the security metadata to be sent with each request.
Params:
Name | Type | Attribute | Description |
securityMetadata | object | security metadata |
public async signTokenRequestState(tokenRequestId: string, tokenId: string, state: string): Object source
Sign with a Token signature a token request state payload.
public async storeTokenRequest(tokenRequest: Object): Promise source
Stores a request for a token. Called by a merchant or a TPP that wants access from a user.
Params:
Name | Type | Attribute | Description |
tokenRequest | Object | token request to store |
public async subscribeToNotifications(handler: string, handlerInstructions: string): Object source
Subscribes to push notifications.
public async triggerBalanceStepUpNotification(accountIds: Array): Object source
Trigger a balance step up notification.
Params:
Name | Type | Attribute | Description |
accountIds | Array | array of account ids |
public async triggerStepUpNotification(tokenId: string): Object source
Trigger a token step up notification.
Params:
Name | Type | Attribute | Description |
tokenId | string | token ID |
public async triggerTransactionStepUpNotification(accountId: string, transactionId: string): Object source
Trigger a transaction step up notification.
public async unlinkAccounts(accountIds: Array): Object source
Unlinks bank accounts previously linked by the linkAccounts call.
Params:
Name | Type | Attribute | Description |
accountIds | Array | account ids to unlink |
public async unsubscribeFromNotifications(subscriberId: string): Object source
Unsubscribes from notifications (deletes a subscriber).
Params:
Name | Type | Attribute | Description |
subscriberId | string | subscriber to delete |
public useAccessToken(accessTokenId: string) source
Use the given access token. (Act on behalf of this member).
Params:
Name | Type | Attribute | Description |
accessTokenId | string | Id of the access token |
public useKeyLevel(keyLevel: string) source
Use the given key level to sign the request.
Params:
Name | Type | Attribute | Description |
keyLevel | string | key level |
public async verifyAffiliate(memberId: string): Object source
Verifies an affiliated TPP.
Params:
Name | Type | Attribute | Description |
memberId | string | id of the member to verify |
Private Methods
private async _memberUpdate(update: *, prevHash: *, metadata: *): * source
Params:
Name | Type | Attribute | Description |
update | * | ||
prevHash | * | ||
metadata | * |
Return:
* |
private _resetRequestInterceptor() source
private async _tokenOperation(token: *, operation: *, suffix: *, blocking: *): * source
Params:
Name | Type | Attribute | Description |
token | * | ||
operation | * | ||
suffix | * | ||
blocking | * |
Return:
* |
private async _tokenOperationRequest(token: *, suffix: *): {"tokenId": *, "signature": *} source
Params:
Name | Type | Attribute | Description |
token | * | ||
suffix | * |
Return:
{"tokenId": *, "signature": *} |
private async _tokenOperationSignature(tokenPayload: *, suffix: *): {"memberId": *, "keyId": *, "signature": *} source
Params:
Name | Type | Attribute | Description |
tokenPayload | * | ||
suffix | * |
Return:
{"memberId": *, "keyId": *, "signature": *} |