UNPKG

vc-notarization

Version:

Notarize verifiable credentials on DLT for provability and order

33 lines (32 loc) 2.03 kB
import { VerifiableCredential, NotarizationResponse } from './types'; import { DLT } from './enums.js'; /** * Takes a hash string or verifiabel credential object and notarizes it on the desired DLT specified by the DLT enum * * @param object - Hash string or verifiabel credential object which shall be notarized * @param dlt - The DLT enum of the DLT where the credential * @returns The DLT transaction id */ export declare function notarize(object: VerifiableCredential | string, dlt?: DLT): Promise<NotarizationResponse>; /** * Takes a hash string or verifiable credential object and tries to look up the timestamp of the notarization on the DLT specified by the DLT enum * * @param object - Verifiable credential or hash string for which the timestamp shall be retrieved * @param dlt - The DLT enum of the DLT where the credential shall be notarized * @param proof - Optional proof of inlclushion if the transaction can not be retrieved from the DLT * @returns The timestamp of the latest possible event creation */ export declare function getTimestamp(object: VerifiableCredential | string, dlt?: DLT, proof?: any): Promise<Date>; /** * Takes a verifiable credential and verifies its issuance date using the notarized timestamp on the DLT specified by the DLT enum. * Throws an error if the tolerance is exceeded or the notarization happened before the issuance * * @param credential - Verifiable credential for which the timestamp shall be verified * @param dlt - The DLT enum of the DLT where the hash is notarized * @param proof - Optional proof of inlclusion if the transaction can not be retrieved from the DLT * @param tolerance - Optional time tolerance between issuance and notarization in milliseconds - Default is 300 seconds * @returns The timestamp of the latest possible event creation */ export declare function verifyTimestamp(credential: VerifiableCredential, dlt?: DLT, proof?: any, tolerance?: number): Promise<Date>; export { DLT } from './enums.js'; export type * from './types';