Package io.token.bank.rpc
Class UserClient
- java.lang.Object
-
- io.token.rpc.Client
-
- io.token.bank.rpc.UserClient
-
public class UserClient extends io.token.rpc.Client
An authenticated RPC client that is used to talk to Token gateway. The class is a thin wrapper on top of gRPC generated client. Makes the API easier to use.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected io.token.rpc.AuthenticationContext
authenticationContext()
io.reactivex.Observable<io.token.proto.common.token.TokenProtos.Token>
createAccessToken(io.token.proto.common.token.TokenProtos.TokenPayload tokenPayload, java.util.Optional<java.lang.String> tokenRequestId)
Creates a new access token.io.reactivex.Observable<io.token.proto.common.token.TokenProtos.Token>
createToken(io.token.proto.common.token.TokenProtos.TokenPayload payload, io.token.proto.common.security.SecurityProtos.Signature signature, java.util.Optional<java.lang.String> tokenRequestId)
Creates a new token.io.reactivex.Observable<io.token.proto.common.token.TokenProtos.TokenOperationResult>
endorseToken(io.token.proto.common.token.TokenProtos.Token token)
Endorses a token.io.reactivex.Observable<io.token.proto.common.token.TokenProtos.Token>
getActiveAccessToken(java.lang.String toMemberId)
Looks up a existing access token where the calling member is the grantor and given member is the grantee.io.reactivex.Observable<java.util.List<io.token.proto.common.account.AccountProtos.Account>>
linkAccounts(io.token.proto.banklink.Banklink.BankAuthorization authorization)
Links a funding bank account to Token.io.reactivex.Observable<io.token.proto.common.token.TokenProtos.TokenPayload>
prepareToken(io.token.proto.common.token.TokenProtos.TokenPayload payload)
Prepare a token, resolving the payload.io.reactivex.Observable<PrepareTokenResult>
prepareTokenAndGetPolicy(io.token.proto.common.token.TokenProtos.TokenPayload payload)
Prepare a token, resolving the payload and returning the policy.io.reactivex.Observable<io.token.proto.common.token.TokenProtos.TokenOperationResult>
replace(io.token.proto.common.token.TokenProtos.Token tokenToCancel, io.token.proto.common.token.TokenProtos.TokenPayload tokenToCreate)
Cancels the existing token and creates a replacement for it.io.reactivex.Observable<io.token.proto.common.security.SecurityProtos.Signature>
signTokenRequestState(java.lang.String tokenRequestId, java.lang.String tokenId, java.lang.String state)
Sign with a Token signature a token request state payload.-
Methods inherited from class io.token.rpc.Client
authenticationContext, authenticationContext, authorizeRecovery, confirmFunds, createAndLinkTestBankAccount, deleteMember, equals, getAccount, getAccounts, getAliases, getBalance, getBalances, getBankInfo, getCryptoEngine, getDefaultAgent, getMember, getOnBehalfOf, getProfile, getProfilePicture, getStandingOrder, getStandingOrders, getTransaction, getTransactions, hashCode, linkAccounts, pageBuilder, resolveTransferDestinations, retryVerification, signTokenPayload, tokenAction, updateMember, updateMember, useDefaultRecoveryRule, verifyAlias
-
-
-
-
Method Detail
-
linkAccounts
public io.reactivex.Observable<java.util.List<io.token.proto.common.account.AccountProtos.Account>> linkAccounts(io.token.proto.banklink.Banklink.BankAuthorization authorization)
Links a funding bank account to Token.- Parameters:
authorization
- an authorization to accounts, from the bank- Returns:
- list of linked accounts ids.
-
prepareToken
public io.reactivex.Observable<io.token.proto.common.token.TokenProtos.TokenPayload> prepareToken(io.token.proto.common.token.TokenProtos.TokenPayload payload)
Prepare a token, resolving the payload. Policy is omitted in the bank sdk.- Parameters:
payload
- token payload- Returns:
- resolved payload
-
prepareTokenAndGetPolicy
public io.reactivex.Observable<PrepareTokenResult> prepareTokenAndGetPolicy(io.token.proto.common.token.TokenProtos.TokenPayload payload)
Prepare a token, resolving the payload and returning the policy.- Parameters:
payload
- token payload- Returns:
- resolved payload and policy
-
createToken
public io.reactivex.Observable<io.token.proto.common.token.TokenProtos.Token> createToken(io.token.proto.common.token.TokenProtos.TokenPayload payload, io.token.proto.common.security.SecurityProtos.Signature signature, java.util.Optional<java.lang.String> tokenRequestId)
Creates a new token.- Parameters:
payload
- token payloadsignature
- signature of the token payloadtokenRequestId
- token request ID- Returns:
- token returned by server
-
getActiveAccessToken
public io.reactivex.Observable<io.token.proto.common.token.TokenProtos.Token> getActiveAccessToken(java.lang.String toMemberId)
Looks up a existing access token where the calling member is the grantor and given member is the grantee.- Parameters:
toMemberId
- beneficiary of the active access token- Returns:
- token returned by the server
-
createAccessToken
public io.reactivex.Observable<io.token.proto.common.token.TokenProtos.Token> createAccessToken(io.token.proto.common.token.TokenProtos.TokenPayload tokenPayload, java.util.Optional<java.lang.String> tokenRequestId)
Creates a new access token.- Parameters:
tokenPayload
- token payloadtokenRequestId
- token request id- Returns:
- token returned by server
-
replace
public io.reactivex.Observable<io.token.proto.common.token.TokenProtos.TokenOperationResult> replace(io.token.proto.common.token.TokenProtos.Token tokenToCancel, io.token.proto.common.token.TokenProtos.TokenPayload tokenToCreate)
Cancels the existing token and creates a replacement for it. Supported only for access tokens.- Parameters:
tokenToCancel
- old token to canceltokenToCreate
- new token to create- Returns:
- result of the replacement operation, returned by the server
-
endorseToken
public io.reactivex.Observable<io.token.proto.common.token.TokenProtos.TokenOperationResult> endorseToken(io.token.proto.common.token.TokenProtos.Token token)
Endorses a token.- Parameters:
token
- token to endorse- Returns:
- result of the endorse operation, returned by the server
-
signTokenRequestState
public io.reactivex.Observable<io.token.proto.common.security.SecurityProtos.Signature> signTokenRequestState(java.lang.String tokenRequestId, java.lang.String tokenId, java.lang.String state)
Sign with a Token signature a token request state payload.- Parameters:
tokenRequestId
- token request idtokenId
- token idstate
- state- Returns:
- signature
-
authenticationContext
protected io.token.rpc.AuthenticationContext authenticationContext()
- Overrides:
authenticationContext
in classio.token.rpc.Client
-
-