• Creates a data integrity proof for the provided document. This function:

    • Validates that the signer's algorithm matches the suite's required algorithm.
    • Adds the data integrity json-ld context definitions to the document if necessary.
    • Constructs a proof with default and provided properties.
    • Transforms and hashes the proof and document.
    • Generates a signature using the signer.
    • Appends the signature to the proof.

    Type Parameters

    • T

    Parameters

    • inputDocument: T

      The unsecured document for which the proof needs to be created.

    • suite: CryptoSuite<any, string, string>

      The cryptographic suite to use for creating the proof.

    • signer: SignerInterface<string, string>

      The signer interface to sign the document.

    • opts: {
          challenge?: string;
          created?: null | Date;
          domain?: string;
          expires?: Date;
          id?: string;
          previousProof?: string;
          proofPurpose?: string;
      } = {}

      Optional parameters for the proof creation.

      • Optional challenge?: string

        A challenge string to be included in the proof, if any.

      • Optional created?: null | Date

        A Date object indicating the date and time at which this proof becomes valid. Defaults to the current time. Can be unset with null.

      • Optional domain?: string

        A domain string to be included in the proof, if any.

      • Optional expires?: Date

        A Date object indicating the date and time at which this proof expires.

      • Optional id?: string

        Assigns an id to the proof. Can be used to implement proof chains.

      • Optional previousProof?: string

        Allows referencing an existing proof by id for the purpose of implementing proof chains.

      • Optional proofPurpose?: string

        The purpose of the proof (default is 'authentication').

    Returns Promise<T & {
        proof: DataIntegrityProof;
    }>

    The original document augmented with the generated proof.