Package io.token.rpc

Class UnauthenticatedClient


  • public class UnauthenticatedClient
    extends java.lang.Object
    Similar to Client but is only used for a handful of requests that don't require authentication. We use this client to create new member or getMember an existing one and switch to the authenticated Client.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected io.token.proto.gateway.GatewayServiceGrpc.GatewayServiceFutureStub gateway  
    • Constructor Summary

      Constructors 
      Constructor Description
      UnauthenticatedClient​(io.token.proto.gateway.GatewayServiceGrpc.GatewayServiceFutureStub gateway)
      Creates an instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      io.reactivex.Observable<java.lang.String> beginRecovery​(io.token.proto.common.alias.AliasProtos.Alias alias)
      Begins account recovery.
      io.reactivex.Observable<io.token.proto.common.member.MemberProtos.Member> completeRecovery​(java.lang.String memberId, java.util.List<io.token.proto.common.member.MemberProtos.MemberRecoveryOperation> recoveryOperations, io.token.proto.common.security.SecurityProtos.Key privilegedKey, CryptoEngine cryptoEngine)
      Completes account recovery.
      io.reactivex.Observable<io.token.proto.common.member.MemberProtos.Member> completeRecoveryWithDefaultRule​(java.lang.String memberId, java.lang.String verificationId, java.lang.String code, CryptoEngine cryptoEngine)
      Completes account recovery if the default recovery rule was set.
      io.reactivex.Observable<io.token.proto.common.member.MemberProtos.Member> createMember​(java.lang.String memberId, java.util.List<io.token.proto.common.member.MemberProtos.MemberOperation> operations, java.util.List<io.token.proto.common.member.MemberProtos.MemberOperationMetadata> metadata, io.token.security.Signer signer)
      Creates a new token member.
      io.reactivex.Observable<java.lang.String> createMemberId​(io.token.proto.common.member.MemberProtos.CreateMemberType memberType, java.lang.String tokenRequestId, java.lang.String partnerId, java.lang.String realmId)
      Creates new member ID.
      io.reactivex.Observable<io.token.proto.common.member.MemberProtos.MemberRecoveryOperation.Authorization> createRecoveryAuthorization​(java.lang.String memberId, io.token.proto.common.security.SecurityProtos.Key privilegedKey)
      Create a recovery authorization for some agent to sign.
      io.reactivex.Observable<java.util.List<io.token.proto.common.bank.BankProtos.Bank>> getBanks​(java.util.List<java.lang.String> bankIds, java.lang.String search, java.lang.String country, java.lang.Integer page, java.lang.Integer perPage, java.lang.String sort, java.lang.String provider, io.token.proto.common.bank.BankProtos.BankFilter.BankFeatures bankFeatures)
      Returns a list of token enabled banks.
      io.reactivex.Observable<java.util.List<java.lang.String>> getCountries​(java.lang.String provider)
      Returns a list of countries with Token-enabled banks.
      io.reactivex.Observable<java.lang.String> getDefaultAgent()
      Get the default recovery agent id.
      io.reactivex.Observable<java.lang.String> getMemberId​(io.token.proto.common.alias.AliasProtos.Alias alias)
      Looks up member id for a given alias.
      io.reactivex.Observable<io.token.proto.common.member.MemberProtos.MemberRecoveryOperation> getRecoveryAuthorization​(java.lang.String verificationId, java.lang.String code, io.token.proto.common.security.SecurityProtos.Key privilegedKey)
      Gets recovery authorization from Token.
      io.reactivex.Observable<io.token.proto.common.token.TokenProtos.TokenMember> resolveAlias​(io.token.proto.common.alias.AliasProtos.Alias alias)
      Resolve an alias to a TokenMember object, containing member ID and the alias with the correct type.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • gateway

        protected final io.token.proto.gateway.GatewayServiceGrpc.GatewayServiceFutureStub gateway
    • Constructor Detail

      • UnauthenticatedClient

        public UnauthenticatedClient​(io.token.proto.gateway.GatewayServiceGrpc.GatewayServiceFutureStub gateway)
        Creates an instance.
        Parameters:
        gateway - gateway gRPC stub
    • Method Detail

      • resolveAlias

        public io.reactivex.Observable<io.token.proto.common.token.TokenProtos.TokenMember> resolveAlias​(io.token.proto.common.alias.AliasProtos.Alias alias)
        Resolve an alias to a TokenMember object, containing member ID and the alias with the correct type.
        Parameters:
        alias - alias to resolve
        Returns:
        TokenMember
      • getMemberId

        public io.reactivex.Observable<java.lang.String> getMemberId​(io.token.proto.common.alias.AliasProtos.Alias alias)
        Looks up member id for a given alias.
        Parameters:
        alias - alias to check
        Returns:
        member id, or throws exception if member not found
      • createMemberId

        public io.reactivex.Observable<java.lang.String> createMemberId​(io.token.proto.common.member.MemberProtos.CreateMemberType memberType,
                                                                        @Nullable
                                                                        java.lang.String tokenRequestId,
                                                                        @Nullable
                                                                        java.lang.String partnerId,
                                                                        @Nullable
                                                                        java.lang.String realmId)
        Creates new member ID. After the method returns the ID is reserved on the server.
        Parameters:
        memberType - the type of member to register
        tokenRequestId - (optional) token request id
        partnerId - ID of partner member
        realmId - member id of the Member to which this new member will belong
        Returns:
        newly created member id
      • createMember

        public io.reactivex.Observable<io.token.proto.common.member.MemberProtos.Member> createMember​(java.lang.String memberId,
                                                                                                      java.util.List<io.token.proto.common.member.MemberProtos.MemberOperation> operations,
                                                                                                      java.util.List<io.token.proto.common.member.MemberProtos.MemberOperationMetadata> metadata,
                                                                                                      io.token.security.Signer signer)
        Creates a new token member.
        Parameters:
        memberId - member ID
        operations - operations to set up member keys and aliases
        metadata - metadata of operations
        signer - the signer used to sign the requests
        Returns:
        member information
      • beginRecovery

        public io.reactivex.Observable<java.lang.String> beginRecovery​(io.token.proto.common.alias.AliasProtos.Alias alias)
        Begins account recovery.
        Parameters:
        alias - the alias used to recover
        Returns:
        the verification id
      • createRecoveryAuthorization

        public io.reactivex.Observable<io.token.proto.common.member.MemberProtos.MemberRecoveryOperation.Authorization> createRecoveryAuthorization​(java.lang.String memberId,
                                                                                                                                                    io.token.proto.common.security.SecurityProtos.Key privilegedKey)
        Create a recovery authorization for some agent to sign.
        Parameters:
        memberId - Id of member we claim to be.
        privilegedKey - new privileged key we want to use.
        Returns:
        authorization structure for agent to sign
      • completeRecovery

        public io.reactivex.Observable<io.token.proto.common.member.MemberProtos.Member> completeRecovery​(java.lang.String memberId,
                                                                                                          java.util.List<io.token.proto.common.member.MemberProtos.MemberRecoveryOperation> recoveryOperations,
                                                                                                          io.token.proto.common.security.SecurityProtos.Key privilegedKey,
                                                                                                          CryptoEngine cryptoEngine)
        Completes account recovery.
        Parameters:
        memberId - the member id
        recoveryOperations - the member recovery operations
        privilegedKey - the privileged public key in the member recovery operations
        cryptoEngine - the new crypto engine
        Returns:
        an observable of the updatedMember
      • completeRecoveryWithDefaultRule

        public io.reactivex.Observable<io.token.proto.common.member.MemberProtos.Member> completeRecoveryWithDefaultRule​(java.lang.String memberId,
                                                                                                                         java.lang.String verificationId,
                                                                                                                         java.lang.String code,
                                                                                                                         CryptoEngine cryptoEngine)
        Completes account recovery if the default recovery rule was set.
        Parameters:
        memberId - the member id
        verificationId - the verification id
        code - the code
        cryptoEngine - the new crypto engine
        Returns:
        the recovery entry
      • getRecoveryAuthorization

        public io.reactivex.Observable<io.token.proto.common.member.MemberProtos.MemberRecoveryOperation> getRecoveryAuthorization​(java.lang.String verificationId,
                                                                                                                                   java.lang.String code,
                                                                                                                                   io.token.proto.common.security.SecurityProtos.Key privilegedKey)
                                                                                                                            throws VerificationException
        Gets recovery authorization from Token.
        Parameters:
        verificationId - the verification id
        code - the code
        privilegedKey - the privileged key
        Returns:
        the recovery entry
        Throws:
        VerificationException - if the code verification fails
      • getBanks

        public io.reactivex.Observable<java.util.List<io.token.proto.common.bank.BankProtos.Bank>> getBanks​(@Nullable
                                                                                                            java.util.List<java.lang.String> bankIds,
                                                                                                            @Nullable
                                                                                                            java.lang.String search,
                                                                                                            @Nullable
                                                                                                            java.lang.String country,
                                                                                                            @Nullable
                                                                                                            java.lang.Integer page,
                                                                                                            @Nullable
                                                                                                            java.lang.Integer perPage,
                                                                                                            @Nullable
                                                                                                            java.lang.String sort,
                                                                                                            @Nullable
                                                                                                            java.lang.String provider,
                                                                                                            @Nullable
                                                                                                            io.token.proto.common.bank.BankProtos.BankFilter.BankFeatures bankFeatures)
        Returns a list of token enabled banks.
        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 given provider (case insensitive).
        bankFeatures - If specified, return banks who meet the bank features requirement.
        Returns:
        a list of banks
      • getCountries

        public io.reactivex.Observable<java.util.List<java.lang.String>> getCountries​(java.lang.String provider)
        Returns a list of countries with Token-enabled banks.
        Parameters:
        provider - If specified, return banks whose 'provider' matches the given provider (case insensitive).
        Returns:
        a list of country codes
      • getDefaultAgent

        public io.reactivex.Observable<java.lang.String> getDefaultAgent()
        Get the default recovery agent id.
        Returns:
        the default recovery agent id.