edockit 0.3.0 → 0.4.0-dev.0
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 +17 -0
- package/README.md +81 -198
- package/TRUSTED-LIST.md +308 -0
- package/dist/certificate-c46e14a0.js +560 -0
- package/dist/certificate-c46e14a0.js.map +1 -0
- package/dist/certificate-fc0e06f7.js +571 -0
- package/dist/certificate-fc0e06f7.js.map +1 -0
- package/dist/core/canonicalization/XMLCanonicalizer.d.ts +9 -3
- package/dist/core/trustedlist/build.d.ts +41 -0
- package/dist/core/trustedlist/bundled-provider.d.ts +2 -0
- package/dist/core/trustedlist/contract.d.ts +19 -0
- package/dist/core/trustedlist/dom.d.ts +12 -0
- package/dist/core/trustedlist/extract.d.ts +6 -0
- package/dist/core/trustedlist/http.d.ts +8 -0
- package/dist/core/trustedlist/identity.d.ts +7 -0
- package/dist/core/trustedlist/index.d.ts +18 -0
- package/dist/core/trustedlist/loader.d.ts +5 -0
- package/dist/core/trustedlist/matcher.d.ts +11 -0
- package/dist/core/trustedlist/normalize.d.ts +14 -0
- package/dist/core/trustedlist/reference-provider.d.ts +12 -0
- package/dist/core/trustedlist/types.d.ts +114 -0
- package/dist/core/unzip.d.ts +0 -0
- package/dist/core/verification.d.ts +22 -0
- package/dist/data/trusted-list.d.ts +3 -0
- package/dist/identity-1a3dddc3.js +902 -0
- package/dist/identity-1a3dddc3.js.map +1 -0
- package/dist/identity-b3a70fc1.js +897 -0
- package/dist/identity-b3a70fc1.js.map +1 -0
- package/dist/index.cjs.js +909 -8003
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.esm.js +417 -7510
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +12 -12
- package/dist/index.umd.js.map +1 -1
- package/dist/loader-1ac52e12.js +217 -0
- package/dist/loader-1ac52e12.js.map +1 -0
- package/dist/loader-43d8e17a.js +222 -0
- package/dist/loader-43d8e17a.js.map +1 -0
- package/dist/normalize-60f2d7e6.js +6270 -0
- package/dist/normalize-60f2d7e6.js.map +1 -0
- package/dist/normalize-70da6516.js +6214 -0
- package/dist/normalize-70da6516.js.map +1 -0
- package/dist/reference-provider-1cd85b7b.js +217 -0
- package/dist/reference-provider-1cd85b7b.js.map +1 -0
- package/dist/reference-provider-53240217.js +211 -0
- package/dist/reference-provider-53240217.js.map +1 -0
- package/dist/trusted-list-build.cjs.js +575 -0
- package/dist/trusted-list-build.cjs.js.map +1 -0
- package/dist/trusted-list-build.d.ts +4 -0
- package/dist/trusted-list-build.esm.js +564 -0
- package/dist/trusted-list-build.esm.js.map +1 -0
- package/dist/trusted-list-bundled.cjs.js +30436 -0
- package/dist/trusted-list-bundled.cjs.js.map +1 -0
- package/dist/trusted-list-bundled.d.ts +1 -0
- package/dist/trusted-list-bundled.esm.js +30432 -0
- package/dist/trusted-list-bundled.esm.js.map +1 -0
- package/dist/trusted-list-http.cjs.js +85 -0
- package/dist/trusted-list-http.cjs.js.map +1 -0
- package/dist/trusted-list-http.d.ts +1 -0
- package/dist/trusted-list-http.esm.js +81 -0
- package/dist/trusted-list-http.esm.js.map +1 -0
- package/dist/trusted-list.cjs.js +35 -0
- package/dist/trusted-list.cjs.js.map +1 -0
- package/dist/trusted-list.d.ts +9 -0
- package/dist/trusted-list.esm.js +10 -0
- package/dist/trusted-list.esm.js.map +1 -0
- package/package.json +32 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type TrustListQueryPurpose = "signature_issuer" | "timestamp_tsa";
|
|
2
|
+
export type TrustMatchConfidence = "exact" | "ski_dn" | "dn_only";
|
|
3
|
+
export interface TrustListQuery {
|
|
4
|
+
purpose: TrustListQueryPurpose;
|
|
5
|
+
time: Date;
|
|
6
|
+
spkiSha256Hex?: string | null;
|
|
7
|
+
skiHex?: string | null;
|
|
8
|
+
subjectDn?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export interface TrustListMatch {
|
|
11
|
+
found: boolean;
|
|
12
|
+
trustedAtTime?: boolean;
|
|
13
|
+
confidence?: TrustMatchConfidence;
|
|
14
|
+
country?: string;
|
|
15
|
+
detail?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TrustListProvider {
|
|
18
|
+
match(query: TrustListQuery): Promise<TrustListMatch>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type XmlParent = Document | Element;
|
|
2
|
+
export declare function parseXmlDocument(xml: string): Document;
|
|
3
|
+
export declare function getDocumentElement(document: Document): Element | null;
|
|
4
|
+
export declare function getChildElement(parent: XmlParent | null, localName: string): Element | null;
|
|
5
|
+
export declare function getChildElements(parent: XmlParent | null, localName: string): Element[];
|
|
6
|
+
export declare function getDescendantElement(parent: XmlParent | null, localName: string): Element | null;
|
|
7
|
+
export declare function getDescendantElements(parent: XmlParent | null, localName: string): Element[];
|
|
8
|
+
export declare function getElementText(element: Element | null | undefined): string | undefined;
|
|
9
|
+
export declare function getChildText(parent: XmlParent | null, localName: string): string | undefined;
|
|
10
|
+
export declare function getDescendantText(parent: XmlParent | null, localName: string): string | undefined;
|
|
11
|
+
export declare function getLanguageAttribute(element: Element): string | undefined;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TslPointer, TrustedListSource, TrustedService } from "./types";
|
|
2
|
+
export declare function parseLotlPointers(xml: string, source: TrustedListSource): TslPointer[];
|
|
3
|
+
export declare function parseTrustedList(xml: string, context: {
|
|
4
|
+
source: TrustedListSource;
|
|
5
|
+
territoryHint?: string;
|
|
6
|
+
}): Promise<TrustedService[]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TrustListProvider } from "./contract";
|
|
2
|
+
export interface CreateRemoteTrustListProviderOptions {
|
|
3
|
+
url: string;
|
|
4
|
+
fetch?: typeof fetch;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function createRemoteTrustListProvider(options: CreateRemoteTrustListProviderOptions): TrustListProvider;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CertificateIdentity, IssuerIdentity, TrustedListFetchOptions } from "./types";
|
|
2
|
+
export interface ExtractIssuerIdentityOptions {
|
|
3
|
+
certificateChain?: string[];
|
|
4
|
+
fetchOptions?: TrustedListFetchOptions;
|
|
5
|
+
}
|
|
6
|
+
export declare function extractIssuerIdentityFromCertificate(certificatePem: string, options?: ExtractIssuerIdentityOptions): Promise<IssuerIdentity>;
|
|
7
|
+
export declare function extractCertificateIdentityFromCertificate(certificatePem: string): Promise<CertificateIdentity>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CompactTrustedListBundle, TrustedListData, TrustedListFetchOptions, TrustedListSource } from "./types";
|
|
2
|
+
export * from "./contract";
|
|
3
|
+
export * from "./types";
|
|
4
|
+
export * from "./normalize";
|
|
5
|
+
export * from "./loader";
|
|
6
|
+
export * from "./extract";
|
|
7
|
+
export * from "./identity";
|
|
8
|
+
export * from "./matcher";
|
|
9
|
+
export * from "./reference-provider";
|
|
10
|
+
export declare const DEFAULT_TRUSTED_LIST_SOURCES: TrustedListSource[];
|
|
11
|
+
/**
|
|
12
|
+
* Low-level live fetch helper for LOTL/TSL processing.
|
|
13
|
+
*
|
|
14
|
+
* Primarily intended for Node.js build/update tooling. Browser callers generally
|
|
15
|
+
* need a proxy and should prefer the higher-level trusted-list update flow.
|
|
16
|
+
*/
|
|
17
|
+
export declare function fetchTrustedListBundle(sources?: TrustedListSource[], fetchOptions?: TrustedListFetchOptions): Promise<CompactTrustedListBundle>;
|
|
18
|
+
export declare function updateTrustedList(sources?: TrustedListSource[], fetchOptions?: TrustedListFetchOptions): Promise<TrustedListData>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CompactTrustedListBundle, TrustedListData, TrustedListSource, TrustedService } from "./types";
|
|
2
|
+
export declare function createEmptyTrustedListBundle(): CompactTrustedListBundle;
|
|
3
|
+
export declare function buildTrustedListData(bundle: CompactTrustedListBundle): TrustedListData;
|
|
4
|
+
export declare function buildCompactTrustedListBundle(services: TrustedService[], sources: TrustedListSource[], generatedAt?: string): CompactTrustedListBundle;
|
|
5
|
+
export declare function dedupeTrustedServices(services: TrustedService[]): TrustedService[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TrustListMatch, TrustListQuery } from "./contract";
|
|
2
|
+
import type { IssuerIdentity, MatchCertificateToTrustedListOptions, MatchIssuerOptions, TrustedListData, TrustedListFetchOptions } from "./types";
|
|
3
|
+
export interface MatchCertificateIssuerToTrustedListOptions extends MatchIssuerOptions {
|
|
4
|
+
certificateChain?: string[];
|
|
5
|
+
trustedListData: TrustedListData;
|
|
6
|
+
fetchOptions?: TrustedListFetchOptions;
|
|
7
|
+
}
|
|
8
|
+
export declare function matchTrustListQuery(query: TrustListQuery, trustedListData: TrustedListData): TrustListMatch;
|
|
9
|
+
export declare function matchIssuerIdentityToTrustedList(issuerIdentity: IssuerIdentity, trustedListData: TrustedListData, options: MatchIssuerOptions): TrustListMatch;
|
|
10
|
+
export declare function matchCertificateIssuerToTrustedList(certificatePem: string, options: MatchCertificateIssuerToTrustedListOptions): Promise<TrustListMatch>;
|
|
11
|
+
export declare function matchCertificateToTrustedList(certificatePem: string, options: MatchCertificateToTrustedListOptions): Promise<TrustListMatch>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TrustListQueryPurpose } from "./contract";
|
|
2
|
+
import type { TrustListPurposeMask } from "./types";
|
|
3
|
+
export declare function normalizeHex(input?: string | null): string | null;
|
|
4
|
+
export declare function hexToBase64Url(input?: string | null): string | null;
|
|
5
|
+
export declare function base64UrlToHex(input?: string | null): string | null;
|
|
6
|
+
export declare function normalizeKeyIdentifier(input?: string | ArrayBuffer | ArrayBufferView | null): string | null;
|
|
7
|
+
export declare function normalizeDistinguishedName(dn?: string | null): string;
|
|
8
|
+
export declare function isTrustedServiceStatus(status: string): boolean;
|
|
9
|
+
export declare function getRelevantServiceType(uri?: string | null): string | null;
|
|
10
|
+
export declare function getTrustListPurposeMaskForQueryPurpose(purpose: TrustListQueryPurpose): TrustListPurposeMask;
|
|
11
|
+
export declare function trustListPurposeMatchesMask(purpose: TrustListQueryPurpose, purposeMask: TrustListPurposeMask): boolean;
|
|
12
|
+
export declare function getTrustListPurposeMaskForServiceType(serviceType: string): TrustListPurposeMask | null;
|
|
13
|
+
export declare function getServiceStatusSuffix(uri?: string | null): string | null;
|
|
14
|
+
export declare function isLikelyXmlTslUrl(url: string): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TrustListProvider } from "./contract";
|
|
2
|
+
import type { CompactTrustedListBundle, TrustedListData } from "./types";
|
|
3
|
+
export interface CreateTrustListProviderFromDataOptions {
|
|
4
|
+
data: CompactTrustedListBundle | TrustedListData;
|
|
5
|
+
}
|
|
6
|
+
export interface CreateTrustListProviderFromUrlOptions {
|
|
7
|
+
url: string;
|
|
8
|
+
fetch?: typeof fetch;
|
|
9
|
+
headers?: HeadersInit;
|
|
10
|
+
}
|
|
11
|
+
export type CreateTrustListProviderOptions = CreateTrustListProviderFromDataOptions | CreateTrustListProviderFromUrlOptions;
|
|
12
|
+
export declare function createTrustListProvider(options: CreateTrustListProviderOptions): TrustListProvider;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { TrustListQueryPurpose } from "./contract";
|
|
2
|
+
export type { TrustListMatch, TrustListProvider, TrustListQuery, TrustListQueryPurpose, TrustMatchConfidence, } from "./contract";
|
|
3
|
+
export interface TrustedListSource {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
lotlUrl: string;
|
|
7
|
+
}
|
|
8
|
+
export type TrustListPurposeMask = 1 | 2 | 3;
|
|
9
|
+
export interface TrustedListFetchOptions {
|
|
10
|
+
timeout?: number;
|
|
11
|
+
proxyUrl?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface TrustedStatusPeriod {
|
|
14
|
+
status: string;
|
|
15
|
+
from: string;
|
|
16
|
+
to: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface TrustedService {
|
|
19
|
+
skiHex: string | null;
|
|
20
|
+
spkiSha256Hex: string;
|
|
21
|
+
subjectDn: string;
|
|
22
|
+
country: string;
|
|
23
|
+
tspName: string;
|
|
24
|
+
serviceType: string;
|
|
25
|
+
source: string;
|
|
26
|
+
sourceLabel: string;
|
|
27
|
+
history: TrustedStatusPeriod[];
|
|
28
|
+
}
|
|
29
|
+
export interface TrustedServiceSnapshot {
|
|
30
|
+
skiHex: string | null;
|
|
31
|
+
spkiSha256Hex: string;
|
|
32
|
+
subjectDn: string;
|
|
33
|
+
country: string;
|
|
34
|
+
tspName: string;
|
|
35
|
+
serviceType: string;
|
|
36
|
+
source: string;
|
|
37
|
+
sourceLabel: string;
|
|
38
|
+
status: string;
|
|
39
|
+
startTime: string;
|
|
40
|
+
}
|
|
41
|
+
export interface TrustedTrustInterval {
|
|
42
|
+
fromUnix: number;
|
|
43
|
+
toUnix: number | null;
|
|
44
|
+
}
|
|
45
|
+
export interface TrustedListEntry {
|
|
46
|
+
skiHex: string | null;
|
|
47
|
+
spkiSha256Hex: string | null;
|
|
48
|
+
subjectDn: string;
|
|
49
|
+
country: string;
|
|
50
|
+
purposeMask: TrustListPurposeMask;
|
|
51
|
+
trustIntervals: TrustedTrustInterval[];
|
|
52
|
+
}
|
|
53
|
+
export interface TslPointer {
|
|
54
|
+
url: string;
|
|
55
|
+
territory?: string;
|
|
56
|
+
source: TrustedListSource;
|
|
57
|
+
}
|
|
58
|
+
export interface TrustedListIndexes {
|
|
59
|
+
bySki: Map<string, TrustedListEntry[]>;
|
|
60
|
+
bySpkiSha256: Map<string, TrustedListEntry[]>;
|
|
61
|
+
bySubjectDn: Map<string, TrustedListEntry[]>;
|
|
62
|
+
}
|
|
63
|
+
export interface TrustedListData {
|
|
64
|
+
version: number;
|
|
65
|
+
generatedAt: string;
|
|
66
|
+
sources: TrustedListSource[];
|
|
67
|
+
services: TrustedListEntry[];
|
|
68
|
+
indexes: TrustedListIndexes;
|
|
69
|
+
}
|
|
70
|
+
export interface IssuerIdentity {
|
|
71
|
+
issuerSubjectDn: string;
|
|
72
|
+
authorityKeyIdentifierHex?: string | null;
|
|
73
|
+
issuerCertificate?: {
|
|
74
|
+
subjectDn: string;
|
|
75
|
+
spkiSha256Hex: string;
|
|
76
|
+
} | null;
|
|
77
|
+
}
|
|
78
|
+
export interface CertificateIdentity {
|
|
79
|
+
subjectDn: string;
|
|
80
|
+
subjectKeyIdentifierHex?: string | null;
|
|
81
|
+
spkiSha256Hex?: string | null;
|
|
82
|
+
}
|
|
83
|
+
export interface MatchIssuerOptions {
|
|
84
|
+
time: Date;
|
|
85
|
+
}
|
|
86
|
+
export interface MatchCertificateToTrustedListOptions {
|
|
87
|
+
purpose?: TrustListQueryPurpose;
|
|
88
|
+
time: Date;
|
|
89
|
+
trustedListData: TrustedListData;
|
|
90
|
+
}
|
|
91
|
+
export type CompactTrustedInterval = [fromUnix: number, toUnix: number | null];
|
|
92
|
+
export type CompactTrustedService = [
|
|
93
|
+
spkiSha256Base64Url: string | null,
|
|
94
|
+
skiBase64Url: string | null,
|
|
95
|
+
subjectDnIdx: number,
|
|
96
|
+
country: string,
|
|
97
|
+
purposeMask: TrustListPurposeMask,
|
|
98
|
+
trustIntervals: CompactTrustedInterval[]
|
|
99
|
+
];
|
|
100
|
+
export type CompactTrustedListSource = [id: string, label: string, lotlUrl: string];
|
|
101
|
+
export interface CompactTrustedListBundle {
|
|
102
|
+
v: 2;
|
|
103
|
+
generatedAt: string;
|
|
104
|
+
sources: CompactTrustedListSource[];
|
|
105
|
+
dns: string[];
|
|
106
|
+
services: CompactTrustedService[];
|
|
107
|
+
}
|
|
108
|
+
export interface TrustedListBundleManifest {
|
|
109
|
+
schemaVersion: number;
|
|
110
|
+
bundleId: string;
|
|
111
|
+
generatedAt: string;
|
|
112
|
+
url: string;
|
|
113
|
+
sha256: string;
|
|
114
|
+
}
|
|
File without changes
|
|
@@ -2,6 +2,8 @@ import { CertificateInfo } from "./certificate";
|
|
|
2
2
|
import { SignatureInfo } from "./parser";
|
|
3
3
|
import { RevocationResult, RevocationCheckOptions } from "./revocation/types";
|
|
4
4
|
import { TimestampVerificationResult } from "./timestamp/types";
|
|
5
|
+
import type { TrustListMatch, TrustListProvider } from "./trustedlist/contract";
|
|
6
|
+
import type { TrustedListFetchOptions } from "./trustedlist/types";
|
|
5
7
|
/**
|
|
6
8
|
* Options for verification process
|
|
7
9
|
*/
|
|
@@ -16,6 +18,14 @@ export interface VerificationOptions {
|
|
|
16
18
|
revocationOptions?: RevocationCheckOptions;
|
|
17
19
|
/** Verify RFC 3161 timestamp if present (default: true) */
|
|
18
20
|
verifyTimestamps?: boolean;
|
|
21
|
+
/** Include a structured verification checklist in the result (default: false) */
|
|
22
|
+
includeChecklist?: boolean;
|
|
23
|
+
/** Trusted-list provider used for issuer and timestamp authority trust checks */
|
|
24
|
+
trustListProvider?: TrustListProvider;
|
|
25
|
+
/** Options used when fetching issuer certificates needed for stronger trust-list matching */
|
|
26
|
+
trustedListFetchOptions?: TrustedListFetchOptions;
|
|
27
|
+
/** Allow DN-only trusted-list matches to be treated as positive evidence */
|
|
28
|
+
allowWeakDnOnlyTrustMatch?: boolean;
|
|
19
29
|
}
|
|
20
30
|
/**
|
|
21
31
|
* Result of a checksum verification
|
|
@@ -74,6 +84,15 @@ export interface ValidationLimitation {
|
|
|
74
84
|
/** Platform where this limitation applies (e.g., 'Safari/WebKit') */
|
|
75
85
|
platform?: string;
|
|
76
86
|
}
|
|
87
|
+
export type ChecklistStatus = "pass" | "fail" | "skipped" | "indeterminate";
|
|
88
|
+
export type ChecklistCheck = "document_integrity" | "signature_valid" | "certificate_valid_at_signing_time" | "timestamp_present" | "timestamp_valid" | "timestamp_authority_trusted_at_signing_time" | "certificate_not_revoked_at_signing_time" | "issuer_trusted_at_signing_time";
|
|
89
|
+
export interface ChecklistItem {
|
|
90
|
+
check: ChecklistCheck;
|
|
91
|
+
label: string;
|
|
92
|
+
status: ChecklistStatus;
|
|
93
|
+
detail?: string;
|
|
94
|
+
country?: string;
|
|
95
|
+
}
|
|
77
96
|
/**
|
|
78
97
|
* Complete verification result
|
|
79
98
|
*/
|
|
@@ -91,6 +110,9 @@ export interface VerificationResult {
|
|
|
91
110
|
signature?: SignatureVerificationResult;
|
|
92
111
|
/** Timestamp verification result (if timestamp present and verifyTimestamps enabled) */
|
|
93
112
|
timestamp?: TimestampVerificationResult;
|
|
113
|
+
checklist?: ChecklistItem[];
|
|
114
|
+
trustListMatch?: TrustListMatch;
|
|
115
|
+
timestampTrustListMatch?: TrustListMatch;
|
|
94
116
|
errors?: string[];
|
|
95
117
|
}
|
|
96
118
|
/**
|