edockit 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,52 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.1] - 2025-12-30
9
+
10
+ ### Added
11
+
12
+ - **CORS Proxy Support** - New `proxyUrl` option in `revocationOptions` for browser environments
13
+ - Routes OCSP, CRL, and CA issuer certificate requests through a CORS proxy
14
+ - Enables revocation checking in browsers where direct requests are blocked by CORS
15
+
16
+ ## [0.2.0] - 2025-12-29
17
+
18
+ ### Added
19
+
20
+ - **Certificate Revocation Checking** - OCSP-first verification with CRL fallback
21
+ - Soft-fail mode: network errors return `status: 'unknown'`, signature remains valid
22
+ - Issuer certificate retrieval from XAdES chain or AIA extension
23
+ - Optional via `checkRevocation: false` for offline-only verification
24
+ - **RFC 3161 Timestamp Verification**
25
+ - Parse and verify RFC 3161 timestamps (SignatureTimeStamp)
26
+ - Check TSA certificate validity and revocation (OCSP/CRL)
27
+ - Use trusted TSA time for signer certificate validation
28
+ - `revocationOptions` pass-through to `verifySignature()`
29
+
30
+ ### Changed
31
+
32
+ - Refactored encoding utilities (consolidated base64/hex/ArrayBuffer helpers)
33
+
34
+ ### Fixed
35
+
36
+ - Browser compatibility import fixes (direct paths vs barrel imports)
37
+ - Fixed vulnerable dev dependencies
38
+
39
+ ## [0.1.2] - 2025-12-29
40
+
41
+ ### Added
42
+
43
+ - Initial public release
44
+ - Parse ASiC-E containers (including Latvian eDoc files)
45
+ - Extract and verify XAdES signatures
46
+ - Certificate validity checking
47
+ - File checksum verification (SHA-256/384/512)
48
+ - Browser and Node.js support
49
+
50
+ [0.2.1]: https://github.com/edgarsj/edockit/compare/v0.2.0...v0.2.1
51
+ [0.2.0]: https://github.com/edgarsj/edockit/compare/v0.1.2...v0.2.0
52
+ [0.1.2]: https://github.com/edgarsj/edockit/releases/tag/v0.1.2
package/README.md CHANGED
@@ -4,8 +4,6 @@ A JavaScript/TypeScript library for viewing and verifying EU standard ASiC-E con
4
4
 
5
5
  > **Note: Work in Progress** - This library is under active development and requires more real-world testing with various ASiC-E implementations from different European countries. If you have sample files or encounter issues, please contribute!
6
6
 
7
- > **Important:** Certificate validation currently lacks OCSP checks (Online Certificate Status Protocol). Adding OCSP support is on the roadmap and will be implemented in a future release.
8
-
9
7
  ## About
10
8
 
11
9
  This library supports standard European ASiC-E (.asice, .sce) containers as defined by the ETSI standards. Latvian eDoc (.edoc) files are effectively ASiC-E containers with a different file extension, so they are also supported. While the core functionality exists, extensive testing with real-world documents from various EU countries is still needed to ensure complete compatibility across different implementations.
@@ -41,13 +39,36 @@ const container = parseEdoc(fileBuffer);
41
39
  // List files in container
42
40
  console.log(Array.from(container.files.keys()));
43
41
 
44
- // Verify a signature
45
- const result = await verifySignature(container.signatures[0], container.files);
42
+ // Verify a signature (with revocation and timestamp checking)
43
+ const result = await verifySignature(container.signatures[0], container.files, {
44
+ checkRevocation: true, // OCSP/CRL checking (default: true)
45
+ revocationOptions: { // Optional: configure revocation check behavior
46
+ ocspTimeout: 5000, // OCSP request timeout in ms (default: 5000)
47
+ crlTimeout: 10000, // CRL fetch timeout in ms (default: 10000)
48
+ proxyUrl: 'https://cors-proxy.example.com/?url=', // CORS proxy for browser (optional)
49
+ },
50
+ verifyTimestamps: true, // RFC 3161 timestamp verification (default: true)
51
+ verifyTime: new Date() // Verify certificate at specific time (default: timestamp time if present, otherwise now)
52
+ });
46
53
  // result = {
47
54
  // isValid: boolean, // Overall validity
48
- // certificate: {isValid: boolean}, // Certificate validation result
55
+ // certificate: {
56
+ // isValid: boolean, // Certificate validity (time-based)
57
+ // revocation: { // Revocation check result
58
+ // status: 'good' | 'revoked' | 'unknown' | 'error',
59
+ // method: 'ocsp' | 'crl' | 'none',
60
+ // checkedAt: Date,
61
+ // isValid: boolean
62
+ // }
63
+ // },
49
64
  // checksums: {isValid: boolean}, // File checksums validation result
50
65
  // signature: {isValid: boolean}, // XML signature validation result
66
+ // timestamp: { // Timestamp verification (if present)
67
+ // isValid: boolean,
68
+ // info: { genTime: Date, policy: string, ... },
69
+ // coversSignature: boolean,
70
+ // tsaRevocation: { status, method, ... }
71
+ // },
51
72
  // errors: string[] // Any validation errors (if present)
52
73
  // }
53
74
  console.log(`Signature valid: ${result.isValid}`);
@@ -56,18 +77,29 @@ console.log(`Signature valid: ${result.isValid}`);
56
77
  ### Node.js Example
57
78
 
58
79
  ```typescript
59
- import { readFileSync } from 'fs';
60
- import { parseEdoc, verifySignature } from 'edockit';
80
+ import { readFileSync } from "fs";
81
+ import { parseEdoc, verifySignature } from "edockit";
61
82
 
62
83
  // Read file
63
- const fileBuffer = readFileSync('document.asice');
84
+ const fileBuffer = readFileSync("document.asice");
64
85
  const container = parseEdoc(fileBuffer);
65
86
 
66
- // Check signatures
87
+ // Check signatures with revocation and timestamp checking
67
88
  for (const signature of container.signatures) {
68
- const result = await verifySignature(signature, container.files);
89
+ const result = await verifySignature(signature, container.files, {
90
+ checkRevocation: true,
91
+ verifyTimestamps: true
92
+ });
69
93
  console.log(`Signature valid: ${result.isValid}`);
70
94
 
95
+ if (result.timestamp?.info) {
96
+ console.log(`Signed at (TSA): ${result.timestamp.info.genTime}`);
97
+ }
98
+
99
+ if (result.certificate.revocation) {
100
+ console.log(`Revocation status: ${result.certificate.revocation.status}`);
101
+ }
102
+
71
103
  if (!result.isValid && result.errors) {
72
104
  console.log(`Errors: ${result.errors.join(', ')}`);
73
105
  }
@@ -88,23 +120,72 @@ async function verifyDocument(url) {
88
120
  console.log("Documents:", container.documentFileList);
89
121
 
90
122
  for (const signature of container.signatures) {
91
- const result = await verifySignature(signature, container.files);
123
+ const result = await verifySignature(signature, container.files, {
124
+ checkRevocation: true,
125
+ revocationOptions: {
126
+ // Use a CORS proxy for OCSP/CRL requests in browser environments
127
+ proxyUrl: 'https://your-cors-proxy.example.com/?url=',
128
+ },
129
+ });
130
+
92
131
  console.log(`Valid: ${result.isValid}`);
132
+
133
+ if (result.timestamp?.info) {
134
+ console.log(`Timestamp: ${result.timestamp.info.genTime}`);
135
+ }
136
+ if (result.certificate.revocation) {
137
+ console.log(`Revocation: ${result.certificate.revocation.status}`);
138
+ }
93
139
  }
94
140
  }
95
141
  ```
96
142
 
143
+ > **Note:** OCSP and CRL endpoints typically don't support CORS, so browser environments need a proxy to perform revocation checks. The `proxyUrl` option routes all revocation requests through the specified proxy, which should accept the original URL as a query parameter.
144
+
145
+ ### Timestamp Utilities
146
+
147
+ For advanced timestamp handling, you can use the timestamp utilities directly:
148
+
149
+ ```typescript
150
+ import { parseTimestamp, verifyTimestamp, getTimestampTime } from 'edockit';
151
+
152
+ // Get timestamp time from a signature (quick utility)
153
+ const timestampTime = getTimestampTime(signature.signatureTimestamp);
154
+ console.log(`Signed at: ${timestampTime}`);
155
+
156
+ // Parse timestamp for detailed info
157
+ const info = parseTimestamp(signature.signatureTimestamp);
158
+ // info = {
159
+ // genTime: Date, // When TSA signed
160
+ // policy: string, // TSA policy OID
161
+ // hashAlgorithm: string, // e.g., 'SHA-256'
162
+ // messageImprint: string, // Hash of timestamped data
163
+ // tsaName?: string, // TSA name
164
+ // tsaCertificate?: string, // TSA cert in PEM format
165
+ // }
166
+
167
+ // Verify timestamp with options
168
+ const result = await verifyTimestamp(signature.signatureTimestamp, {
169
+ signatureValue: signature.signatureValue, // Verify timestamp covers this signature
170
+ verifyTsaCertificate: true, // Check TSA cert validity
171
+ checkTsaRevocation: true, // Check TSA cert revocation
172
+ });
173
+ ```
174
+
97
175
  ## Features
98
176
 
99
177
  - Support for EU standard ASiC-E containers and Latvian eDoc files/containers (same format, different extension)
100
178
  - List files contained in ASiC-E/eDoc container
101
179
  - Extract and display signature information
102
180
  - Verify XML signatures against file checksums
103
- - Validate certificate validity (Note: OCSP validation planned for future releases)
181
+ - Validate certificate validity (time-based)
182
+ - RFC 3161 timestamp verification (when present, certificate is validated at the trusted TSA timestamp time)
183
+ - OCSP/CRL revocation checking for both signer and TSA certificates (soft-fail behavior - network errors don't invalidate signatures)
104
184
 
105
185
  ## Testing Status
106
186
 
107
187
  The library has been tested with a limited set of real Latvian eDoc files (which are ASiC-E containers with a .edoc extension). More testing is needed with:
188
+
108
189
  - ASiC-E containers from different EU countries
109
190
  - Files created with different software implementations
110
191
  - Various signature algorithms and certificate types
@@ -10,6 +10,7 @@ export interface SignatureInfo {
10
10
  signingTime: Date;
11
11
  certificate: string;
12
12
  certificatePEM: string;
13
+ certificateChain?: string[];
13
14
  publicKey?: {
14
15
  algorithm: string;
15
16
  namedCurve?: string;
@@ -36,4 +37,6 @@ export interface SignatureInfo {
36
37
  signedInfoXml?: string;
37
38
  rawXml?: string;
38
39
  canonicalizationMethod?: string;
40
+ /** RFC 3161 timestamp token (base64 encoded) from xades:EncapsulatedTimeStamp */
41
+ signatureTimestamp?: string;
39
42
  }
@@ -0,0 +1,22 @@
1
+ import { X509Certificate } from "@peculiar/x509";
2
+ import { RevocationResult, RevocationCheckOptions } from "./types";
3
+ /**
4
+ * Check certificate revocation status using OCSP (primary) and CRL (fallback)
5
+ *
6
+ * Strategy:
7
+ * 1. Try OCSP first (faster, real-time)
8
+ * 2. If OCSP fails or returns unknown, try CRL as fallback
9
+ * 3. If both fail, return 'unknown' status (soft fail)
10
+ *
11
+ * @param cert Certificate to check (X509Certificate or PEM string)
12
+ * @param options Revocation check options
13
+ * @returns RevocationResult with status and details
14
+ */
15
+ export declare function checkCertificateRevocation(cert: X509Certificate | string, options?: RevocationCheckOptions): Promise<RevocationResult>;
16
+ /**
17
+ * Check multiple certificates' revocation status
18
+ * @param certs Array of certificates (X509Certificate or PEM strings)
19
+ * @param options Revocation check options
20
+ * @returns Array of RevocationResults in same order as input
21
+ */
22
+ export declare function checkCertificatesRevocation(certs: (X509Certificate | string)[], options?: RevocationCheckOptions): Promise<RevocationResult[]>;
@@ -0,0 +1,35 @@
1
+ import { X509Certificate, X509Crl } from "@peculiar/x509";
2
+ import { RevocationResult } from "./types";
3
+ /**
4
+ * Extract CRL distribution point URLs from certificate
5
+ * @param cert X509Certificate to extract CRL URLs from
6
+ * @returns Array of CRL distribution URLs
7
+ */
8
+ export declare function extractCRLUrls(cert: X509Certificate): string[];
9
+ /**
10
+ * Check if a certificate serial number is in the CRL
11
+ * @param crl X509Crl to check
12
+ * @param serialNumber Certificate serial number (hex string)
13
+ * @returns Object with isRevoked status and optional revocation date
14
+ */
15
+ export declare function isSerialInCRL(crl: X509Crl, serialNumber: string): {
16
+ isRevoked: boolean;
17
+ revokedAt?: Date;
18
+ reason?: number;
19
+ };
20
+ /**
21
+ * Parse CRL from DER or PEM data
22
+ * @param data CRL data (DER or PEM)
23
+ * @returns X509Crl or null if parsing fails
24
+ */
25
+ export declare function parseCRL(data: ArrayBuffer): X509Crl | null;
26
+ /**
27
+ * Check certificate revocation via CRL
28
+ * @param cert Certificate to check
29
+ * @param options CRL check options
30
+ * @returns Revocation result
31
+ */
32
+ export declare function checkCRL(cert: X509Certificate, options?: {
33
+ timeout?: number;
34
+ proxyUrl?: string;
35
+ }): Promise<RevocationResult>;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Cross-platform HTTP fetch for OCSP and CRL requests
3
+ * Works in both browser and Node.js environments
4
+ */
5
+ export interface FetchOptions {
6
+ /** Request timeout in milliseconds */
7
+ timeout?: number;
8
+ /** HTTP method (default: GET) */
9
+ method?: "GET" | "POST";
10
+ /** Request body for POST requests */
11
+ body?: ArrayBuffer | Uint8Array;
12
+ /** Content-Type header */
13
+ contentType?: string;
14
+ /** Accept header */
15
+ accept?: string;
16
+ /**
17
+ * CORS proxy URL for browser environments.
18
+ * When set, the original URL will be URL-encoded and appended to this proxy URL.
19
+ * Example: "https://cors-proxy.example.com/?url="
20
+ */
21
+ proxyUrl?: string;
22
+ }
23
+ export interface FetchResult {
24
+ ok: boolean;
25
+ status: number;
26
+ data?: ArrayBuffer;
27
+ error?: string;
28
+ }
29
+ /**
30
+ * Fetch binary data from a URL with timeout support
31
+ * @param url URL to fetch
32
+ * @param options Fetch options
33
+ * @returns FetchResult with binary data or error
34
+ */
35
+ export declare function fetchBinary(url: string, options?: FetchOptions): Promise<FetchResult>;
36
+ /**
37
+ * Fetch OCSP response
38
+ * @param url OCSP responder URL
39
+ * @param request DER-encoded OCSP request
40
+ * @param timeout Timeout in milliseconds
41
+ * @param proxyUrl Optional CORS proxy URL
42
+ * @returns FetchResult with OCSP response data
43
+ */
44
+ export declare function fetchOCSP(url: string, request: ArrayBuffer, timeout?: number, proxyUrl?: string): Promise<FetchResult>;
45
+ /**
46
+ * Fetch CRL from distribution point
47
+ * @param url CRL distribution point URL
48
+ * @param timeout Timeout in milliseconds
49
+ * @param proxyUrl Optional CORS proxy URL
50
+ * @returns FetchResult with CRL data
51
+ */
52
+ export declare function fetchCRL(url: string, timeout?: number, proxyUrl?: string): Promise<FetchResult>;
53
+ /**
54
+ * Fetch issuer certificate from AIA extension
55
+ * @param url CA Issuers URL
56
+ * @param timeout Timeout in milliseconds
57
+ * @param proxyUrl Optional CORS proxy URL
58
+ * @returns FetchResult with certificate data
59
+ */
60
+ export declare function fetchIssuerCertificate(url: string, timeout?: number, proxyUrl?: string): Promise<FetchResult>;
@@ -0,0 +1,4 @@
1
+ export { checkCertificateRevocation, checkCertificatesRevocation } from "./check";
2
+ export { RevocationResult, RevocationCheckOptions, DEFAULT_REVOCATION_OPTIONS, OID } from "./types";
3
+ export { extractOCSPUrls, extractCAIssuersUrls, findIssuerInChain, checkOCSP } from "./ocsp";
4
+ export { extractCRLUrls, checkCRL } from "./crl";
@@ -0,0 +1,54 @@
1
+ import { X509Certificate } from "@peculiar/x509";
2
+ import { RevocationResult } from "./types";
3
+ /**
4
+ * Extract OCSP responder URLs from certificate
5
+ * @param cert X509Certificate to extract OCSP URLs from
6
+ * @returns Array of OCSP responder URLs
7
+ */
8
+ export declare function extractOCSPUrls(cert: X509Certificate): string[];
9
+ /**
10
+ * Extract CA Issuers URLs from certificate (for fetching issuer cert)
11
+ * @param cert X509Certificate to extract URLs from
12
+ * @returns Array of CA Issuers URLs
13
+ */
14
+ export declare function extractCAIssuersUrls(cert: X509Certificate): string[];
15
+ /**
16
+ * Find issuer certificate from certificate chain
17
+ * @param cert Certificate to find issuer for
18
+ * @param chain Array of PEM-formatted certificates
19
+ * @returns Issuer certificate or null if not found
20
+ */
21
+ export declare function findIssuerInChain(cert: X509Certificate, chain: string[]): X509Certificate | null;
22
+ /**
23
+ * Fetch issuer certificate from AIA extension
24
+ * @param cert Certificate to fetch issuer for
25
+ * @param timeout Timeout in ms
26
+ * @param proxyUrl Optional CORS proxy URL
27
+ * @returns Issuer certificate or null
28
+ */
29
+ export declare function fetchIssuerFromAIA(cert: X509Certificate, timeout?: number, proxyUrl?: string): Promise<X509Certificate | null>;
30
+ /**
31
+ * Build OCSP request for a certificate
32
+ * @param cert Certificate to check
33
+ * @param issuerCert Issuer certificate
34
+ * @returns DER-encoded OCSP request
35
+ */
36
+ export declare function buildOCSPRequest(cert: X509Certificate, issuerCert: X509Certificate): Promise<ArrayBuffer>;
37
+ /**
38
+ * Parse OCSP response and extract revocation status
39
+ * @param responseData DER-encoded OCSP response
40
+ * @returns Revocation result
41
+ */
42
+ export declare function parseOCSPResponse(responseData: ArrayBuffer): RevocationResult;
43
+ /**
44
+ * Check certificate revocation via OCSP
45
+ * @param cert Certificate to check
46
+ * @param issuerCert Issuer certificate (optional, will try to find/fetch)
47
+ * @param options OCSP check options
48
+ * @returns Revocation result
49
+ */
50
+ export declare function checkOCSP(cert: X509Certificate, issuerCert: X509Certificate | null, options?: {
51
+ timeout?: number;
52
+ certificateChain?: string[];
53
+ proxyUrl?: string;
54
+ }): Promise<RevocationResult>;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Result of a certificate revocation check
3
+ */
4
+ export interface RevocationResult {
5
+ /** Whether the certificate passed revocation check (not revoked) */
6
+ isValid: boolean;
7
+ /** Revocation status */
8
+ status: "good" | "revoked" | "unknown" | "error";
9
+ /** Method used to check revocation */
10
+ method?: "ocsp" | "crl" | "none";
11
+ /** Human-readable reason for the status */
12
+ reason?: string;
13
+ /** Date when certificate was revoked (if revoked) */
14
+ revokedAt?: Date;
15
+ /** When this revocation check was performed */
16
+ checkedAt: Date;
17
+ }
18
+ /**
19
+ * Options for revocation checking
20
+ */
21
+ export interface RevocationCheckOptions {
22
+ /** Enable OCSP checking (default: true) */
23
+ ocspEnabled?: boolean;
24
+ /** Enable CRL checking as fallback (default: true) */
25
+ crlEnabled?: boolean;
26
+ /** Timeout for OCSP requests in ms (default: 5000) */
27
+ ocspTimeout?: number;
28
+ /** Timeout for CRL requests in ms (default: 10000) */
29
+ crlTimeout?: number;
30
+ /** Certificate chain for finding issuer (PEM strings) */
31
+ certificateChain?: string[];
32
+ /**
33
+ * CORS proxy URL for browser environments.
34
+ * When set, all OCSP/CRL fetch requests will be routed through this proxy.
35
+ * The original URL will be URL-encoded and appended as a query parameter.
36
+ * Example: "https://cors-proxy.example.com/?url="
37
+ */
38
+ proxyUrl?: string;
39
+ }
40
+ /**
41
+ * Default options for revocation checking
42
+ */
43
+ export declare const DEFAULT_REVOCATION_OPTIONS: Required<Omit<RevocationCheckOptions, "certificateChain" | "proxyUrl">>;
44
+ /**
45
+ * OID constants for certificate extensions
46
+ */
47
+ export declare const OID: {
48
+ /** Authority Information Access */
49
+ readonly authorityInfoAccess: "1.3.6.1.5.5.7.1.1";
50
+ /** CRL Distribution Points */
51
+ readonly crlDistributionPoints: "2.5.29.31";
52
+ /** OCSP access method */
53
+ readonly ocsp: "1.3.6.1.5.5.7.48.1";
54
+ /** CA Issuers access method */
55
+ readonly caIssuers: "1.3.6.1.5.5.7.48.2";
56
+ };
@@ -0,0 +1,2 @@
1
+ export { TimestampInfo, TimestampVerificationResult, TimestampVerificationOptions } from "./types";
2
+ export { parseTimestamp, verifyTimestamp, verifyTimestampCoversSignature, getTimestampTime, } from "./verify";
@@ -0,0 +1,48 @@
1
+ import { RevocationResult } from "../revocation/types";
2
+ /**
3
+ * Parsed timestamp information from RFC 3161 TimeStampToken
4
+ */
5
+ export interface TimestampInfo {
6
+ /** The timestamp generation time (when TSA signed) */
7
+ genTime: Date;
8
+ /** TSA policy OID */
9
+ policy: string;
10
+ /** Serial number of the timestamp */
11
+ serialNumber: string;
12
+ /** Hash algorithm used for the message imprint */
13
+ hashAlgorithm: string;
14
+ /** The message imprint (hash of timestamped data) */
15
+ messageImprint: string;
16
+ /** TSA name (if provided) */
17
+ tsaName?: string;
18
+ /** TSA certificate (PEM format) */
19
+ tsaCertificate?: string;
20
+ /** Accuracy of the timestamp (in seconds) */
21
+ accuracy?: number;
22
+ }
23
+ /**
24
+ * Result of timestamp verification
25
+ */
26
+ export interface TimestampVerificationResult {
27
+ /** Whether the timestamp is valid */
28
+ isValid: boolean;
29
+ /** Parsed timestamp info (if parsing succeeded) */
30
+ info?: TimestampInfo;
31
+ /** Error or status message */
32
+ reason?: string;
33
+ /** Whether the timestamp covers the signature value correctly */
34
+ coversSignature?: boolean;
35
+ /** TSA certificate revocation check result (if checkTsaRevocation was enabled) */
36
+ tsaRevocation?: RevocationResult;
37
+ }
38
+ /**
39
+ * Options for timestamp verification
40
+ */
41
+ export interface TimestampVerificationOptions {
42
+ /** The signature value that the timestamp should cover (base64) */
43
+ signatureValue?: string;
44
+ /** Verify the TSA certificate chain */
45
+ verifyTsaCertificate?: boolean;
46
+ /** Check TSA certificate revocation */
47
+ checkTsaRevocation?: boolean;
48
+ }
@@ -0,0 +1,32 @@
1
+ import { TimestampInfo, TimestampVerificationResult, TimestampVerificationOptions } from "./types";
2
+ /**
3
+ * Parse RFC 3161 TimeStampToken from base64
4
+ * @param timestampBase64 Base64-encoded timestamp token
5
+ * @returns Parsed timestamp info or null if parsing fails
6
+ */
7
+ export declare function parseTimestamp(timestampBase64: string): TimestampInfo | null;
8
+ /**
9
+ * Verify that timestamp covers the signature value
10
+ * XAdES timestamps can cover either:
11
+ * 1. The decoded signature value bytes (standard per ETSI EN 319 132-1)
12
+ * 2. The base64-encoded string (some implementations)
13
+ *
14
+ * @param timestampInfo Parsed timestamp info
15
+ * @param signatureValueBase64 Base64-encoded signature value
16
+ * @returns True if the timestamp covers the signature
17
+ */
18
+ export declare function verifyTimestampCoversSignature(timestampInfo: TimestampInfo, signatureValueBase64: string): Promise<boolean>;
19
+ /**
20
+ * Verify an RFC 3161 timestamp token
21
+ * @param timestampBase64 Base64-encoded timestamp token
22
+ * @param options Verification options
23
+ * @returns Timestamp verification result
24
+ */
25
+ export declare function verifyTimestamp(timestampBase64: string, options?: TimestampVerificationOptions): Promise<TimestampVerificationResult>;
26
+ /**
27
+ * Get the trusted timestamp time from a signature
28
+ * This should be used instead of the self-declared signingTime for certificate validation
29
+ * @param timestampBase64 Base64-encoded timestamp token
30
+ * @returns The timestamp generation time, or null if parsing fails
31
+ */
32
+ export declare function getTimestampTime(timestampBase64: string): Date | null;
@@ -1,5 +1,7 @@
1
1
  import { CertificateInfo } from "./certificate";
2
2
  import { SignatureInfo } from "./parser";
3
+ import { RevocationResult, RevocationCheckOptions } from "./revocation/types";
4
+ import { TimestampVerificationResult } from "./timestamp/types";
3
5
  /**
4
6
  * Options for verification process
5
7
  */
@@ -8,6 +10,12 @@ export interface VerificationOptions {
8
10
  verifySignatures?: boolean;
9
11
  verifyChecksums?: boolean;
10
12
  verifyTime?: Date;
13
+ /** Check certificate revocation via OCSP/CRL (default: true) */
14
+ checkRevocation?: boolean;
15
+ /** Options for revocation checking (timeouts, etc.) */
16
+ revocationOptions?: RevocationCheckOptions;
17
+ /** Verify RFC 3161 timestamp if present (default: true) */
18
+ verifyTimestamps?: boolean;
11
19
  }
12
20
  /**
13
21
  * Result of a checksum verification
@@ -42,6 +50,8 @@ export interface CertificateVerificationResult {
42
50
  isValid: boolean;
43
51
  reason?: string;
44
52
  info?: CertificateInfo;
53
+ /** Revocation check result (if checkRevocation was enabled) */
54
+ revocation?: RevocationResult;
45
55
  }
46
56
  /**
47
57
  * Complete verification result
@@ -51,6 +61,8 @@ export interface VerificationResult {
51
61
  certificate: CertificateVerificationResult;
52
62
  checksums: ChecksumVerificationResult;
53
63
  signature?: SignatureVerificationResult;
64
+ /** Timestamp verification result (if timestamp present and verifyTimestamps enabled) */
65
+ timestamp?: TimestampVerificationResult;
54
66
  errors?: string[];
55
67
  }
56
68
  /**