• Signs a document with a DID-related signer.

    Type Parameters

    • T

    Parameters

    • args: {
          challenge?: string;
          created?: null | Date;
          cryptosuites?: readonly CryptoSuite<any, string, string>[];
          document: T;
          domain?: string;
          expires?: Date;
          id?: string;
          previousProof?: string;
          proofPurpose?: string;
          signerDid: Did | DidDocument<DidUrl>;
          signers: readonly SignerInterface<string, string>[];
      }

      Object holding all function arguments.

      • Optional challenge?: string

        A challenge supplied by a verifier in a challenge-response protocol, which allows verifiers to assure signature freshness, preventing unauthorized re-use.

      • 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 cryptosuites?: readonly CryptoSuite<any, string, string>[]

        One or more cryptosuites that take care of processing and normalizing the document. The actual suite used will be based on a match between algorithms supported by the signers and the suite's requiredAlgorithm.

      • document: T

        An unsigned document. Any existing proofs will be overwritten.

      • 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

        Controls the proofPurpose property and which verificationMethods can be used for signing. Defaults to 'authentication'.

      • signerDid: Did | DidDocument<DidUrl>

        The DID or DID Document identifying the signing party. The DID Document will be resolved by this function if not passed in.

      • signers: readonly SignerInterface<string, string>[]

        One or more signers associated with the signerDid to be used for signing the document. If omitted, the signing step is skipped.

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

    The original document with a DataIntegrity signature proof attached.