Interface
Authenticator
On this page
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: BufferId,
): Promise<number | null>;
getKeyHandlerForOperation(
operation: Operation,
txContext: TxContext,
): Promise<KeyHandler | null>;
}Properties
accountId
accountId: BufferauthDataService
authDataService: AuthDataServicekeyHandlers
keyHandlers: KeyHandler[]Methods
getAuthDescriptorCounter
getAuthDescriptorCounter(authDescriptorId: BufferId): Promise<number | null>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<number | null>
- authDescriptorId: BufferId
getKeyHandlerForOperation
getKeyHandlerForOperation( operation: Operation, txContext: TxContext, ): Promise<KeyHandler | null>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<KeyHandler | null>
a key handler that will be allowed to authenticate the specified operation. Or null if no such key handler exists
- operation: Operation