Home Reference Source
import {Member} from '@token-io/core/src/main/Member.js'
public class | source

Member

Represents a Token member.

Constructor Summary

Public Constructor
public

constructor(options: object)

Member Summary

Private Members
private
private
private
private

Method Summary

Public Methods
public

addAlias(alias: Alias): Promise<void>

Adds an alias to this member.

public

addAliases(aliases: Array<Alias>): Promise<void>

Adds aliases to this member.

public

aliases(): Promise<Array<Alias>>

Gets all of the member's aliases.

public

approveKey(key: Key): Promise<void>

Approves a new key for this member.

public

approveKeys(keys: Array<Key>): Promise<void>

Approves new keys for this member.

public

confirmFunds(accountId: string, amount: number | string, currency: string): Promise<boolean>

Confirms if an account has sufficient funds for a purchase.

public

Creates a test bank account in a fake bank and link it

public

createTestBankAccount(balance: number, currency: string): Promise<OauthBankAuthorization>

Creates a test bank account in a fake bank

public

Deletes the member.

public

firstAlias(): PromiseAlias>

Gets the member's first alias.

public

getBalance(accountId: string, keyLevel: KeyLevel): Promise<Balance>

Looks up the balance of an account.

public

getBalances(accountIds: Array<string>, keyLevel: KeyLevel): Promise<Array<Balance>>

Looks up the balances of an array of accounts.

public

getBankInfo(bankId: string): Promise<BankInfo>

Gets the info of a bank, including a link for pairing accounts at this bank.

public

getStandingOrder(accountId: string, standingOrderId: string, keyLevel: KeyLevel): Promise<StandingOrder>

Looks up an existing standing order for a given account.

public

getStandingOrders(accountId: string, offset: string, limit: number, keyLevel: KeyLevel): Promise<object>

Looks up standing orders for a given account.

public

getTestBankNotification(subscriberId: string, notificationId: string): Promise<Notification>

Gets test bank notification.

public

getTestBankNotifications(subscriberId: string): Promise<Array<Notification>>

Gets test bank notifications.

public

getTransaction(accountId: string, transactionId: string, keyLevel: KeyLevel): Promise<Transaction>

Looks up a transaction.

public

getTransactions(accountId: *, offset: *, limit: *, keyLevel: *): *

Looks up all of the member's transactions for an account.

public

keys(): Promise<Array<Key>>

Gets the member's public keys.

public

Gets the member's last hash.

public

Gets the member ID.

public

removeAlias(alias: Alias): Promise<void>

Removes an alias from the member.

public

removeAliases(aliases: Array<Alias>): Promise<void>

Removes aliases from the member.

public

removeKey(keyId: string): Promise<void>

Removes a key from this member.

public

removeKeys(keyIds: Array<string>): Promise<void>

Removes keys from this member.

public

resolveTransferDestinations(accountId: string): Promise<TransferDestination>

Resolves transfer destinations for the given account ID.

public

signTokenPayload(tokenPayload: Object, keyLevel: KeyLevel): Promise<Signature>

Signs a token payload with specified level of keys.

public

useDefaultRecoveryRule(): Promise<RecoveryRule>

Set the 'normal consumer' rule as member's recovery rule. (As of Nov 2017, this rule was: To recover, verify an alias.)

Private Methods
private
private

_normalizeAlias(alias: Alias, partnerId: string): Promise<Alias>

Public Constructors

public constructor(options: object) source

Params:

NameTypeAttributeDescription
options object

Private Members

private _client: AuthHttpClient source

private _id: string source

private _options: Object source

private _unauthenticatedClient: HttpClient source

Public Methods

public addAlias(alias: Alias): Promise<void> source

Adds an alias to this member.

Params:

NameTypeAttributeDescription
alias Alias

alias to add

Return:

Promise<void>

empty promise

public addAliases(aliases: Array<Alias>): Promise<void> source

Adds aliases to this member.

Params:

NameTypeAttributeDescription
aliases Array<Alias>

aliases to add

Return:

Promise<void>

empty promise

public aliases(): Promise<Array<Alias>> source

Gets all of the member's aliases.

Return:

Promise<Array<Alias>>

the member's aliases

public approveKey(key: Key): Promise<void> source

Approves a new key for this member.

Params:

NameTypeAttributeDescription
key Key

key to add

Return:

Promise<void>

empty promise

public approveKeys(keys: Array<Key>): Promise<void> source

Approves new keys for this member.

Params:

NameTypeAttributeDescription
keys Array<Key>

keys to add

Return:

Promise<void>

empty promise

public confirmFunds(accountId: string, amount: number | string, currency: string): Promise<boolean> source

Confirms if an account has sufficient funds for a purchase.

Params:

NameTypeAttributeDescription
accountId string

accountId

amount number | string

amount

currency string

currency

Return:

Promise<boolean>

true if account has sufficient funds

public createAndLinkTestBankAccount(balance: number, currency: string): Promise<Account> source

Creates a test bank account in a fake bank and link it

Params:

NameTypeAttributeDescription
balance number

balance of the account

currency string

currency of the account

Return:

Promise<Account>

bank authorization to use with linkAccounts

public createTestBankAccount(balance: number, currency: string): Promise<OauthBankAuthorization> source

Creates a test bank account in a fake bank

Params:

NameTypeAttributeDescription
balance number

balance of the account

currency string

currency of the account

Return:

Promise<OauthBankAuthorization>

bank authorization to use with linkAccounts

public deleteMember(): Promise<void> source

Deletes the member.

Return:

Promise<void>

response to the api call

public firstAlias(): PromiseAlias> source

Gets the member's first alias.

Return:

PromiseAlias>

the member's first alias

public getBalance(accountId: string, keyLevel: KeyLevel): Promise<Balance> source

Looks up the balance of an account.

Params:

NameTypeAttributeDescription
accountId string

ID of the account

keyLevel KeyLevel

key level

Return:

Promise<Balance>

Promise of get balance response object

public getBalances(accountIds: Array<string>, keyLevel: KeyLevel): Promise<Array<Balance>> source

Looks up the balances of an array of accounts.

Params:

NameTypeAttributeDescription
accountIds Array<string>

array of account IDs

keyLevel KeyLevel

key level

Return:

Promise<Array<Balance>>

Promise of get balances response object

public getBankInfo(bankId: string): Promise<BankInfo> source

Gets the info of a bank, including a link for pairing accounts at this bank.

Params:

NameTypeAttributeDescription
bankId string

ID of the bank

Return:

Promise<BankInfo>

info

public getStandingOrder(accountId: string, standingOrderId: string, keyLevel: KeyLevel): Promise<StandingOrder> source

Looks up an existing standing order for a given account.

Params:

NameTypeAttributeDescription
accountId string

accountId

standingOrderId string

standingOrderId

keyLevel KeyLevel

keyLevel

Return:

Promise<StandingOrder>

standing order

public getStandingOrders(accountId: string, offset: string, limit: number, keyLevel: KeyLevel): Promise<object> source

Looks up standing orders for a given account.

Params:

NameTypeAttributeDescription
accountId string

accountId

offset string

offset

limit number

limit

keyLevel KeyLevel

keyLevel

Return:

Promise<object>

standing orders

public getTestBankNotification(subscriberId: string, notificationId: string): Promise<Notification> source

Gets test bank notification.

Params:

NameTypeAttributeDescription
subscriberId string

ID of subscriber

notificationId string

ID of notification

Return:

Promise<Notification>

response to the API call

public getTestBankNotifications(subscriberId: string): Promise<Array<Notification>> source

Gets test bank notifications.

Params:

NameTypeAttributeDescription
subscriberId string

ID of subscriber

Return:

Promise<Array<Notification>>

response to the API call

public getTransaction(accountId: string, transactionId: string, keyLevel: KeyLevel): Promise<Transaction> source

Looks up a transaction.

Params:

NameTypeAttributeDescription
accountId string

ID of the account

transactionId string

which transaction to look up

keyLevel KeyLevel

key level

Return:

Promise<Transaction>

the Transaction

public getTransactions(accountId: *, offset: *, limit: *, keyLevel: *): * source

Looks up all of the member's transactions for an account.

Params:

NameTypeAttributeDescription
accountId *

ID of the account

offset *

where to start looking

limit *

how many to retrieve

keyLevel *

key level

Return:

*

Transactions

public keys(): Promise<Array<Key>> source

Gets the member's public keys.

Return:

Promise<Array<Key>>

keys objects

public lastHash(): string source

Gets the member's last hash.

Return:

string

the hash of the member object

public memberId(): string source

Gets the member ID.

Return:

string

the member ID

public removeAlias(alias: Alias): Promise<void> source

Removes an alias from the member.

Params:

NameTypeAttributeDescription
alias Alias

alias to remove

Return:

Promise<void>

empty promise

public removeAliases(aliases: Array<Alias>): Promise<void> source

Removes aliases from the member.

Params:

NameTypeAttributeDescription
aliases Array<Alias>

aliases to remove

Return:

Promise<void>

empty promise

public removeKey(keyId: string): Promise<void> source

Removes a key from this member.

Params:

NameTypeAttributeDescription
keyId string

keyId to remove. Note, keyId is the hash of the pk

Return:

Promise<void>

empty promise

public removeKeys(keyIds: Array<string>): Promise<void> source

Removes keys from this member.

Params:

NameTypeAttributeDescription
keyIds Array<string>

keyIds to remove. Note, keyId is the hash of the pk

Return:

Promise<void>

empty promise

public resolveTransferDestinations(accountId: string): Promise<TransferDestination> source

Resolves transfer destinations for the given account ID.

Params:

NameTypeAttributeDescription
accountId string

ID of account to resolve destinations for

Return:

Promise<TransferDestination>

resolved transfer destinations

public signTokenPayload(tokenPayload: Object, keyLevel: KeyLevel): Promise<Signature> source

Signs a token payload with specified level of keys.

Params:

NameTypeAttributeDescription
tokenPayload Object

tokenPayload

keyLevel KeyLevel

keyLevel

Return:

Promise<Signature>

the proto signature

public useDefaultRecoveryRule(): Promise<RecoveryRule> source

Set the 'normal consumer' rule as member's recovery rule. (As of Nov 2017, this rule was: To recover, verify an alias.)

Return:

Promise<RecoveryRule>

promise containing RecoveryRule proto buffer.

Private Methods

private _getMember(): Object source

Return:

Object

private _normalizeAlias(alias: Alias, partnerId: string): Promise<Alias> source

Params:

NameTypeAttributeDescription
alias Alias
partnerId string

Return:

Promise<Alias>