• Verifies integrity of a document secured by a data integrity proof (proof type: DataIntegrityProof). This function performs multiple checks to ensure the authenticity and correctness of the proof:

    • Ensures essential properties like type, verificationMethod, and proofPurpose exist in the proof and have allowable values.
    • Matches the cryptosuite of the proof with cryptosuites supplied to this function via proof options.
    • Decodes the signature from base58btc multibase encoding.
    • Retrieves the verification method and ensures it matches expected controllers.
    • Transforms the document and proof.
    • Verifies the signature against transformed data.
    • Optionally checks for challenge & domain, if provided in the proof options.

    Parameters

    • document: Partial<SecuredDocument>

      The document secured by proof (may contain additional proofs).

    • proof: DataIntegrityProof

      The data integrity proof to verify.

    • proofOptions: {
          challenge?: string;
          cryptosuites: CryptoSuite<any, string, string>[];
          didResolver?: ((did, resolutionOptions?) => Promise<ResolutionResult>);
          domain?: string;
          expectedController?: string;
          expectedProofPurpose?: string;
          now?: Date;
          tolerance?: number;
      }

      Options for the verification process.

      • Optional challenge?: string

        Expected challenge for the proof. Throws if mismatched.

      • cryptosuites: CryptoSuite<any, string, string>[]

        Array of cryptographic suites to be used for verification; determines which proofs can be verified.

      • Optional didResolver?: ((did, resolutionOptions?) => Promise<ResolutionResult>)
          • (did, resolutionOptions?): Promise<ResolutionResult>
          • Implementation of resolve compliant with W3C DID specifications. Additionally, this function returns an id-only DID document in the case where a DID has been deleted or upgraded. If a DID is invalid or has not been registered, this is indicated by the error property on the didResolutionMetadata.

            Parameters

            Returns Promise<ResolutionResult>

            The resolution result for the resolve function as specified in the W3C DID specifications.

      • Optional domain?: string

        Expected domain for the proof. Throws if mismatched.

      • Optional expectedController?: string

        Expected controller of the verification method. Throws if mismatched.

      • Optional expectedProofPurpose?: string

        Expected purpose of the proof. Throws if mismatched.

      • Optional now?: Date

        The reference time for verification as Date (default is current time).

      • Optional tolerance?: number

        The allowed time drift in milliseconds for time-sensitive checks (default is 0).

    Returns Promise<boolean>

    Returns true if the verification is successful; otherwise, it returns false or throws an error.