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

    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>>;
    }
    Index

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

    • 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

      • merkleHashVersionSource: MerkleHashVersionSource

        the source of the merkle hash version

      Returns Promise<Buffer<ArrayBufferLike>>

      the signed transaction, serialized as a Buffer