A utility class that is responsible for keeping track of authorization details. Such as what operations there is, what they require in terms of privileges and selecting the correct auth descriptor for authorizing an operation.

interface AuthDataService {
    connection: Connection;
    getAllowedAuthDescriptor(operation, accountId, adIds): Promise<null | Buffer>;
    getAuthDescriptorCounter(accountId, authDescriptorId): Promise<null | number>;
    getAuthHandlerForOperation(operationName): Promise<null | AuthHandler>;
    getAuthMessageTemplate(operation): Promise<string>;
    getBlockchainRid(): Buffer;
    getLoginConfig(name?): Promise<LoginConfig>;
    isOperationExposed(operationName): Promise<boolean>;
}

Properties

connection: Connection

Methods

  • Selects an auth descriptor from a list of auth descriptors which will be allowed to authorize the specified operation

    Parameters

    • operation: Operation

      the operation that is being authorized

    • accountId: BufferId

      the account for which the operation is being authorized

    • adIds: BufferId[]

      a list of auth descriptor ids to select from

    Returns Promise<null | Buffer>

    first auth descriptor id from the provided list that will be allowed to authorize the operation, or null if none of the provided auth descriptors would be allowed.

  • Fetches the current counter value for an auth descriptor when authorizing against a certain account.

    Parameters

    • accountId: BufferId

      the account id to authorize against

    • authDescriptorId: BufferId

      the auth descriptor to get the counter for

    Returns Promise<null | number>

    current counter value, or null if none was found

    Remarks

    if more than one operation is performed with this auth descriptor on this account in the same transaction, then this counter has to be manually increased after the first operation

  • Retrieves the auth handler that is defined for the operation with the provided name. If the operation does not have an auth handler specified, null is returned

    Parameters

    • operationName: string

      the name of the operation to get the auth handler for

    Returns Promise<null | AuthHandler>

  • Returns the auth message template to use when signing a specified operation.

    Parameters

    • operation: RellOperation | Operation

      the operation to get the message for

    Returns Promise<string>

  • Returns the blockchain rid to which this auth data service is configured.

    Returns Buffer

  • Retrieves the login config for a specific config name. If no name is provided, the default login config will be used.

    Parameters

    • Optional name: string

      the name of the login config

    Returns Promise<LoginConfig>

  • Checks if an operation with the specified name exists on the blockchain.

    Parameters

    • operationName: string

      the operation name to check

    Returns Promise<boolean>

    true if the operation exists, else false.