An authenticator holds keys that are associated with a specific account and is responsible for selecting the correct key when trying to authenticate an operation.

The "correct key" in this case refers to the key with the least possible privileges that will still be allowed to authenticate the operation.

interface Authenticator {
    accountId: Buffer;
    authDataService: AuthDataService;
    keyHandlers: KeyHandler[];
    getAuthDescriptorCounter(authDescriptorId): Promise<null | number>;
    getKeyHandlerForOperation(operation, txContext): Promise<null | KeyHandler>;
}

Properties

accountId: Buffer
authDataService: AuthDataService
keyHandlers: KeyHandler[]

Methods

  • Returns the counter value for the specified auth descriptor for the account that this authenticator is connected to.

    Parameters

    • authDescriptorId: BufferId

      the id of the auth descriptor to get the counter for

    Returns Promise<null | number>

  • Selects a KeyHandler from the list of key handlers available in this authenticator that will be able to authenticate the specified operation.

    Parameters

    • operation: Operation

      the operation to authenticate

    • txContext: TxContext

      a context object that is used in the context of a transaction

    Returns Promise<null | KeyHandler>

    a key handler that will be allowed to authenticate the specified operation. Or null if no such key handler exists