edockit
Version:
A JavaScript library for listing, parsing, and verifying the contents and signatures of electronic documents (eDoc) and Associated Signature Containers (ASiC-E), supporting EU eIDAS standards for digital signatures and electronic seals.
33 lines (32 loc) • 1.57 kB
TypeScript
import { TimestampInfo, TimestampVerificationResult, TimestampVerificationOptions } from "./types";
/**
* Parse RFC 3161 TimeStampToken from base64
* @param timestampBase64 Base64-encoded timestamp token
* @returns Parsed timestamp info or null if parsing fails
*/
export declare function parseTimestamp(timestampBase64: string): TimestampInfo | null;
/**
* Verify that timestamp covers the signature value
*
* Per XAdES (ETSI EN 319 132-1), the SignatureTimeStamp covers the canonicalized
* ds:SignatureValue XML element, not just its base64 content.
*
* @param timestampInfo Parsed timestamp info
* @param canonicalSignatureValue Canonicalized ds:SignatureValue XML element
* @returns True if the timestamp covers the signature
*/
export declare function verifyTimestampCoversSignature(timestampInfo: TimestampInfo, canonicalSignatureValue: string): Promise<boolean>;
/**
* Verify an RFC 3161 timestamp token
* @param timestampBase64 Base64-encoded timestamp token
* @param options Verification options
* @returns Timestamp verification result
*/
export declare function verifyTimestamp(timestampBase64: string, options?: TimestampVerificationOptions): Promise<TimestampVerificationResult>;
/**
* Get the trusted timestamp time from a signature
* This should be used instead of the self-declared signingTime for certificate validation
* @param timestampBase64 Base64-encoded timestamp token
* @returns The timestamp generation time, or null if parsing fails
*/
export declare function getTimestampTime(timestampBase64: string): Date | null;