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, operation, context, authDataService): Promise<Operation[]>;
    getSigners(): Buffer[];
    satisfiesAuthRequirements(flags): boolean;
    sign(transaction): Promise<Buffer>;
}

Properties

authDescriptor: AnyAuthDescriptor
keyStore: KeyStore

Methods

  • 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[]>

  • Returns the signers of this key handler

    Returns Buffer[]

  • Checks 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

  • Signs a transaction using the wrapped KeyStore

    Parameters

    • transaction: GTX

      the transaction to sign

    Returns Promise<Buffer>

    the signed transaction, serialized as a Buffer