@chromia/ft4 - v2.1.0
    Preparing search index...

    Interface AuthDataService

    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: Operation,
            accountId: BufferId,
            adIds: BufferId[],
        ): Promise<Buffer<ArrayBufferLike> | null>;
        getAuthDescriptorCounter(
            accountId: BufferId,
            authDescriptorId: BufferId,
        ): Promise<number | null>;
        getAuthHandlerForOperation(
            operationName: string,
        ): Promise<AuthHandler | null>;
        getAuthMessageTemplate(
            operation: RellOperation | Operation,
        ): Promise<string>;
        getBlockchainRid(): Buffer;
        getLoginConfig(name?: string): Promise<LoginConfig>;
    }
    Index

    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<Buffer<ArrayBufferLike> | null>

      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<number | null>

      current counter value, or null if none was found

      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<AuthHandler | null>

    • 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

      • Optionalname: string

        the name of the login config

      Returns Promise<LoginConfig>