PKI-Lite - v1.0.5
    Preparing search index...

    Interface for asynchronous builder pattern implementations.

    Some builders require asynchronous operations during construction, such as cryptographic operations, network requests, or file I/O. This interface defines the contract for such builders.

    class SignedDataBuilder implements AsyncBuilder<SignedData> {
    private data: Uint8Array
    private signers: Signer[] = []

    setData(data: Uint8Array): this {
    this.data = data
    return this
    }

    addSigner(signer: Signer): this {
    this.signers.push(signer)
    return this
    }

    async build(): Promise<SignedData> {
    // Perform async cryptographic operations
    const signatures = await this.computeSignatures()
    return new SignedData(this.data, signatures)
    }
    }

    const signedData = await new SignedDataBuilder()
    .setData(documentBytes)
    .addSigner(signer)
    .build()
    interface AsyncBuilder<T> {
        build(): Promise<T>;
    }

    Type Parameters

    • T

      The type of object being built

    Implemented by

    Index

    Methods

    Methods