Interface
KeyHandler
Type that represents a key that is associated with an account. It is responsible for using the wrapped key to sign and authorize operations against an account.
interface KeyHandler {
authDescriptor: AnyAuthDescriptor;
keyStore: KeyStore;
authorize(
accountId: BufferId,
operation: Operation,
context: TxContext,
authDataService: AuthDataService,
): Promise<Operation[]>;
getSigners(): Buffer<ArrayBufferLike>[];
satisfiesAuthRequirements(flags: string[]): boolean;
sign(
transaction: GTX,
merkleHashVersionSource: MerkleHashVersionSource,
): Promise<Buffer<ArrayBufferLike>>;
}Properties
authDescriptor
authDescriptor: AnyAuthDescriptorkeyStore
keyStore: KeyStoreMethods
authorize
authorize( accountId: BufferId, operation: Operation, context: TxContext, authDataService: AuthDataService, ): Promise<Operation[]>Authorizes an operation using the provided information and produces an array of operations that at least contains the operation to authorize. It might also contain auth operations as appropriate.
Parameters
- accountId: BufferId
id of the account to authorize against
- operation: Operation
the operation to authorize
- context: TxContext
the context for the current transaction
- authDataService: AuthDataService
the auth data service to use when authorizing this operation
Returns Promise<Operation[]>
- accountId: BufferId
getSigners
getSigners(): Buffer<ArrayBufferLike>[]Returns the signers of this key handler
Returns Buffer<ArrayBufferLike>[]
satisfiesAuthRequirements
satisfiesAuthRequirements(flags: string[]): booleanChecks wether this key handler satisfies the auth requirements. In other words, it checks if the underlying key has all of the flags specified
Parameters
- flags: string[]
the flags to check
Returns boolean
true if this key has all of the specified flags, else false
- flags: string[]
sign
sign( transaction: GTX, merkleHashVersionSource: MerkleHashVersionSource, ): Promise<Buffer<ArrayBufferLike>>Signs a transaction using the wrapped KeyStore
Parameters
- transaction: GTX
the transaction to sign
- merkleHashVersionSource: MerkleHashVersionSource
the source of the merkle hash version
Returns Promise<Buffer<ArrayBufferLike>>
the signed transaction, serialized as a
Buffer- transaction: GTX