@owf/eudi-tl 0.4.0-alpha-20260901082001
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/LICENSE +201 -0
- package/README.md +217 -0
- package/dist/index.cjs +785 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +515 -0
- package/dist/index.d.mts +515 -0
- package/dist/index.mjs +732 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +56 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/constants.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Well-known ETSI TS 119 612 URIs.
|
|
5
|
+
*
|
|
6
|
+
* These are the standard values used by eIDAS national trusted lists. Profiled
|
|
7
|
+
* lists may use their own profile-specific URIs (validated via a caller-supplied
|
|
8
|
+
* {@link ProfileRule}); this library's parser is agnostic to both.
|
|
9
|
+
*/
|
|
10
|
+
/** Standard `TSLType` values (TS 119 612 clause 5.3.3). */
|
|
11
|
+
declare const TSLType: {
|
|
12
|
+
readonly EUgeneric: "http://uri.etsi.org/TrstSvc/TrustedList/TSLType/EUgeneric";
|
|
13
|
+
readonly EUlistofthelists: "http://uri.etsi.org/TrstSvc/TrustedList/TSLType/EUlistofthelists";
|
|
14
|
+
};
|
|
15
|
+
/** Standard `ServiceStatus` values (TS 119 612 clause 5.5.4). */
|
|
16
|
+
declare const ServiceStatus: {
|
|
17
|
+
readonly Granted: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/granted";
|
|
18
|
+
readonly Withdrawn: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/withdrawn";
|
|
19
|
+
readonly UnderSupervision: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/undersupervision";
|
|
20
|
+
readonly SupervisionCeased: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/supervisionceased";
|
|
21
|
+
readonly SupervisionInCessation: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/supervisionincessation";
|
|
22
|
+
readonly Accredited: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/accredited";
|
|
23
|
+
readonly AccreditationCeased: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/accreditationceased";
|
|
24
|
+
readonly AccreditationRevoked: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/accreditationrevoked";
|
|
25
|
+
readonly SetByNationalLaw: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/setbynationallaw";
|
|
26
|
+
readonly RecognisedAtNationalLevel: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/recognisedatnationallevel";
|
|
27
|
+
readonly DeprecatedAtNationalLevel: "http://uri.etsi.org/TrstSvc/TrustedList/Svcstatus/deprecatedatnationallevel";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Service statuses that denote a currently active / trustworthy service under
|
|
31
|
+
* TS 119 612. Use as the `serviceStatus` filter when extracting trust anchors
|
|
32
|
+
* from a standard eIDAS list; withdrawn/ceased services are excluded.
|
|
33
|
+
*/
|
|
34
|
+
declare const ACTIVE_SERVICE_STATUSES: string[];
|
|
35
|
+
/** Common standard `ServiceTypeIdentifier` values (TS 119 612 Annex D). */
|
|
36
|
+
declare const ServiceType: {
|
|
37
|
+
/** Qualified certificate CA. */
|
|
38
|
+
readonly CA_QC: "http://uri.etsi.org/TrstSvc/Svctype/CA/QC";
|
|
39
|
+
/** Public key certificate CA. */
|
|
40
|
+
readonly CA_PKC: "http://uri.etsi.org/TrstSvc/Svctype/CA/PKC";
|
|
41
|
+
/** Qualified timestamping authority. */
|
|
42
|
+
readonly TSA_QTST: "http://uri.etsi.org/TrstSvc/Svctype/TSA/QTST";
|
|
43
|
+
/** Qualified electronic delivery service. */
|
|
44
|
+
readonly EDS_Q: "http://uri.etsi.org/TrstSvc/Svctype/EDS/Q";
|
|
45
|
+
/** Qualified registered electronic mail delivery service. */
|
|
46
|
+
readonly EDS_REM_Q: "http://uri.etsi.org/TrstSvc/Svctype/EDS/REM/Q";
|
|
47
|
+
/** Qualified preservation service for electronic signatures/seals. */
|
|
48
|
+
readonly PSES_Q: "http://uri.etsi.org/TrstSvc/Svctype/PSES/Q";
|
|
49
|
+
/** Qualified validation service for qualified electronic signatures. */
|
|
50
|
+
readonly QESValidation_Q: "http://uri.etsi.org/TrstSvc/Svctype/QESValidation/Q";
|
|
51
|
+
/** OCSP responder for qualified certificates. */
|
|
52
|
+
readonly OCSP_QC: "http://uri.etsi.org/TrstSvc/Svctype/Certstatus/OCSP/QC";
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/types.d.ts
|
|
56
|
+
/**
|
|
57
|
+
* A service's digital identity (TS 119 612 `ServiceDigitalIdentity`): the
|
|
58
|
+
* `DigitalId` children (X509Certificate, X509SubjectName, X509SKI) that describe
|
|
59
|
+
* one entity are merged here. A standard list may identify a service by subject
|
|
60
|
+
* name and/or key identifier without embedding the full certificate.
|
|
61
|
+
*/
|
|
62
|
+
declare const DigitalIdentitySchema: z.ZodObject<{
|
|
63
|
+
certificate: z.ZodOptional<z.ZodString>;
|
|
64
|
+
subjectName: z.ZodOptional<z.ZodString>;
|
|
65
|
+
subjectKeyIdentifier: z.ZodOptional<z.ZodString>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
type DigitalIdentity = z.infer<typeof DigitalIdentitySchema>;
|
|
68
|
+
/** A past status entry for a service (`ServiceHistoryInstance`). */
|
|
69
|
+
declare const ServiceHistoryInstanceSchema: z.ZodObject<{
|
|
70
|
+
serviceTypeIdentifier: z.ZodOptional<z.ZodString>;
|
|
71
|
+
serviceStatus: z.ZodString;
|
|
72
|
+
statusStartingTime: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>;
|
|
74
|
+
type ServiceHistoryInstance = z.infer<typeof ServiceHistoryInstanceSchema>;
|
|
75
|
+
/**
|
|
76
|
+
* A trust service (TSPService) entry: its type, status, digital identities,
|
|
77
|
+
* qualifiers, and status history.
|
|
78
|
+
*/
|
|
79
|
+
declare const TrustedListServiceSchema: z.ZodObject<{
|
|
80
|
+
serviceTypeIdentifier: z.ZodString;
|
|
81
|
+
serviceStatus: z.ZodString;
|
|
82
|
+
serviceName: z.ZodOptional<z.ZodString>;
|
|
83
|
+
digitalIdentities: z.ZodArray<z.ZodObject<{
|
|
84
|
+
certificate: z.ZodOptional<z.ZodString>;
|
|
85
|
+
subjectName: z.ZodOptional<z.ZodString>;
|
|
86
|
+
subjectKeyIdentifier: z.ZodOptional<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>>;
|
|
88
|
+
qualifiers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
+
history: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
90
|
+
serviceTypeIdentifier: z.ZodOptional<z.ZodString>;
|
|
91
|
+
serviceStatus: z.ZodString;
|
|
92
|
+
statusStartingTime: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>>>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
type TrustedListService = z.infer<typeof TrustedListServiceSchema>;
|
|
96
|
+
/** A Trust Service Provider (TSP) and the services it operates. */
|
|
97
|
+
declare const TrustServiceProviderSchema: z.ZodObject<{
|
|
98
|
+
name: z.ZodOptional<z.ZodString>;
|
|
99
|
+
services: z.ZodArray<z.ZodObject<{
|
|
100
|
+
serviceTypeIdentifier: z.ZodString;
|
|
101
|
+
serviceStatus: z.ZodString;
|
|
102
|
+
serviceName: z.ZodOptional<z.ZodString>;
|
|
103
|
+
digitalIdentities: z.ZodArray<z.ZodObject<{
|
|
104
|
+
certificate: z.ZodOptional<z.ZodString>;
|
|
105
|
+
subjectName: z.ZodOptional<z.ZodString>;
|
|
106
|
+
subjectKeyIdentifier: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, z.core.$strip>>;
|
|
108
|
+
qualifiers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
+
history: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
110
|
+
serviceTypeIdentifier: z.ZodOptional<z.ZodString>;
|
|
111
|
+
serviceStatus: z.ZodString;
|
|
112
|
+
statusStartingTime: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$strip>>>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
type TrustServiceProvider = z.infer<typeof TrustServiceProviderSchema>;
|
|
117
|
+
/** A pointer to another trusted list (`OtherTSLPointer`), e.g. the EU LOTL. */
|
|
118
|
+
declare const TrustedListPointerSchema: z.ZodObject<{
|
|
119
|
+
location: z.ZodString;
|
|
120
|
+
tslType: z.ZodOptional<z.ZodString>;
|
|
121
|
+
schemeTerritory: z.ZodOptional<z.ZodString>;
|
|
122
|
+
digitalIdentities: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
123
|
+
certificate: z.ZodOptional<z.ZodString>;
|
|
124
|
+
subjectName: z.ZodOptional<z.ZodString>;
|
|
125
|
+
subjectKeyIdentifier: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.core.$strip>>>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
type TrustedListPointer = z.infer<typeof TrustedListPointerSchema>;
|
|
129
|
+
/** A parsed ETSI TS 119 612 Trusted List (`TrustServiceStatusList`). */
|
|
130
|
+
declare const TrustedListSchema: z.ZodObject<{
|
|
131
|
+
tslType: z.ZodOptional<z.ZodString>;
|
|
132
|
+
schemeOperatorName: z.ZodOptional<z.ZodString>;
|
|
133
|
+
sequenceNumber: z.ZodOptional<z.ZodNumber>;
|
|
134
|
+
listIssueDateTime: z.ZodOptional<z.ZodString>;
|
|
135
|
+
nextUpdate: z.ZodOptional<z.ZodString>;
|
|
136
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
137
|
+
name: z.ZodOptional<z.ZodString>;
|
|
138
|
+
services: z.ZodArray<z.ZodObject<{
|
|
139
|
+
serviceTypeIdentifier: z.ZodString;
|
|
140
|
+
serviceStatus: z.ZodString;
|
|
141
|
+
serviceName: z.ZodOptional<z.ZodString>;
|
|
142
|
+
digitalIdentities: z.ZodArray<z.ZodObject<{
|
|
143
|
+
certificate: z.ZodOptional<z.ZodString>;
|
|
144
|
+
subjectName: z.ZodOptional<z.ZodString>;
|
|
145
|
+
subjectKeyIdentifier: z.ZodOptional<z.ZodString>;
|
|
146
|
+
}, z.core.$strip>>;
|
|
147
|
+
qualifiers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
148
|
+
history: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
149
|
+
serviceTypeIdentifier: z.ZodOptional<z.ZodString>;
|
|
150
|
+
serviceStatus: z.ZodString;
|
|
151
|
+
statusStartingTime: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, z.core.$strip>>>;
|
|
153
|
+
}, z.core.$strip>>;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
pointersToOtherLists: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
156
|
+
location: z.ZodString;
|
|
157
|
+
tslType: z.ZodOptional<z.ZodString>;
|
|
158
|
+
schemeTerritory: z.ZodOptional<z.ZodString>;
|
|
159
|
+
digitalIdentities: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
160
|
+
certificate: z.ZodOptional<z.ZodString>;
|
|
161
|
+
subjectName: z.ZodOptional<z.ZodString>;
|
|
162
|
+
subjectKeyIdentifier: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$strip>>>;
|
|
164
|
+
}, z.core.$strip>>>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
type TrustedList = z.infer<typeof TrustedListSchema>;
|
|
167
|
+
/**
|
|
168
|
+
* A flattened trust anchor: one digital identity with the service context it was
|
|
169
|
+
* published under. The normalized unit both certificate-chain validation and AKI
|
|
170
|
+
* emission consume — the ETSI TS 119 612 counterpart of a `@owf/eudi-lote`
|
|
171
|
+
* TrustedEntity service certificate.
|
|
172
|
+
*/
|
|
173
|
+
declare const TrustAnchorSchema: z.ZodObject<{
|
|
174
|
+
certificate: z.ZodOptional<z.ZodString>;
|
|
175
|
+
subjectName: z.ZodOptional<z.ZodString>;
|
|
176
|
+
subjectKeyIdentifier: z.ZodOptional<z.ZodString>;
|
|
177
|
+
serviceTypeIdentifier: z.ZodString;
|
|
178
|
+
serviceStatus: z.ZodString;
|
|
179
|
+
providerName: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
type TrustAnchor = z.infer<typeof TrustAnchorSchema>;
|
|
182
|
+
//#endregion
|
|
183
|
+
//#region src/verify.d.ts
|
|
184
|
+
/**
|
|
185
|
+
* Install the WebCrypto implementation used to verify trusted list signatures
|
|
186
|
+
* ("bring your own crypto"), for callers that must route verification through a
|
|
187
|
+
* reviewed or policy-constrained engine. Call it once during start-up, before
|
|
188
|
+
* verifying; without it, the global Web Crypto API (`globalThis.crypto`,
|
|
189
|
+
* available in Node >= 20 and browsers) is used.
|
|
190
|
+
*
|
|
191
|
+
* Process-wide by necessity, not by design: xadesjs exposes a single global
|
|
192
|
+
* crypto engine rather than a per-call context
|
|
193
|
+
* (see {@link https://github.com/PeculiarVentures/xmldsigjs/issues/119}).
|
|
194
|
+
* A per-invocation option would look isolated while still swapping that global,
|
|
195
|
+
* so concurrent verifications with different engines would race; it is
|
|
196
|
+
* deliberately not offered. Should upstream gain per-call crypto, accepting it
|
|
197
|
+
* as a verification option is an additive, non-breaking change.
|
|
198
|
+
*/
|
|
199
|
+
declare function setTrustedListCrypto(crypto: Crypto): void;
|
|
200
|
+
interface VerifyTrustedListOptions {
|
|
201
|
+
/**
|
|
202
|
+
* DER-encoded certificates the trusted list's signer certificate must match.
|
|
203
|
+
* When provided, verification fails closed unless the embedded signer
|
|
204
|
+
* certificate equals one of these anchors — establishing that the list was
|
|
205
|
+
* signed by the expected scheme operator, not merely by *some* key.
|
|
206
|
+
*
|
|
207
|
+
* When omitted, only the cryptographic validity of the enveloped signature
|
|
208
|
+
* is checked; that proves integrity, NOT trust. Production callers should
|
|
209
|
+
* always pin the scheme operator certificate(s).
|
|
210
|
+
*/
|
|
211
|
+
trustAnchors?: Uint8Array[];
|
|
212
|
+
}
|
|
213
|
+
interface VerifyTrustedListResult {
|
|
214
|
+
/** base64-encoded DER of the signer certificate from the signature KeyInfo. */
|
|
215
|
+
signerCertificateBase64: string;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Verify the enveloped XAdES/XMLDSig signature of an ETSI TS 119 612 Trusted
|
|
219
|
+
* List. Throws {@link TrustedListSignatureException} when the signature is
|
|
220
|
+
* missing, invalid, or (with `trustAnchors`) not signed by a pinned scheme
|
|
221
|
+
* operator.
|
|
222
|
+
*
|
|
223
|
+
* Verified against a standard eIDAS national trusted list (RSA-SHA512,
|
|
224
|
+
* exclusive C14N, XAdES SignedProperties).
|
|
225
|
+
*
|
|
226
|
+
* Verification runs on the global Web Crypto API unless another implementation
|
|
227
|
+
* was installed with {@link setTrustedListCrypto}.
|
|
228
|
+
*/
|
|
229
|
+
declare function verifyTrustedListSignature(xml: string, options?: VerifyTrustedListOptions): Promise<VerifyTrustedListResult>;
|
|
230
|
+
//#endregion
|
|
231
|
+
//#region src/eu-lotl.d.ts
|
|
232
|
+
/**
|
|
233
|
+
* The LOTL signing certificates shipped with this package, as DER bytes ready
|
|
234
|
+
* to pass as `trustAnchors`.
|
|
235
|
+
*
|
|
236
|
+
* This pinned set is the root of the eIDAS trusted-list hierarchy and cannot be
|
|
237
|
+
* bootstrapped from the LOTL itself — a forged list would carry a forged
|
|
238
|
+
* self-pointer. It is published by the European Commission in the Official
|
|
239
|
+
* Journal; see {@link EU_LOTL_ANCHORS_PROVENANCE} for the exact act, list issue
|
|
240
|
+
* and expiry of the shipped set.
|
|
241
|
+
*
|
|
242
|
+
* Certificates rotate (historically every 6–24 months), so a deployment has
|
|
243
|
+
* three ways to stay current without waiting for a release of this package:
|
|
244
|
+
*
|
|
245
|
+
* 1. pass its own `trustAnchors`, e.g. from configuration;
|
|
246
|
+
* 2. after verifying a LOTL, read the currently published set from its own
|
|
247
|
+
* self-pointer with `getPointerSigningCertificates(lotl, { tslType:
|
|
248
|
+
* TSLType.EUlistofthelists })` and persist it — rotation is announced in a
|
|
249
|
+
* list still signed by the previous generation of keys;
|
|
250
|
+
* 3. follow the pivot LOTLs advertised in the list's `SchemeInformationURI`
|
|
251
|
+
* when the pinned set has fallen behind entirely.
|
|
252
|
+
*/
|
|
253
|
+
declare function getEuLotlTrustAnchors(): Uint8Array[];
|
|
254
|
+
/**
|
|
255
|
+
* Verify the signature of the EU List of Trusted Lists against the shipped
|
|
256
|
+
* signing certificates. Identical to {@link verifyTrustedListSignature} except
|
|
257
|
+
* that `trustAnchors` defaults to {@link getEuLotlTrustAnchors} instead of to
|
|
258
|
+
* "integrity only" — pass your own to override.
|
|
259
|
+
*/
|
|
260
|
+
declare function verifyEuLotlSignature(xml: string, options?: VerifyTrustedListOptions): Promise<VerifyTrustedListResult>;
|
|
261
|
+
/**
|
|
262
|
+
* Verify, parse and profile-check the EU List of Trusted Lists in one step: the
|
|
263
|
+
* safe entry point for the top of the hierarchy. The returned list carries the
|
|
264
|
+
* `PointersToOtherTSL` entries from which national list anchors are derived
|
|
265
|
+
* with `getPointerSigningCertificates`.
|
|
266
|
+
*/
|
|
267
|
+
declare function loadEuLotl(xml: string, options?: VerifyTrustedListOptions): Promise<TrustedList>;
|
|
268
|
+
//#endregion
|
|
269
|
+
//#region src/eu-lotl-anchors.d.ts
|
|
270
|
+
/**
|
|
271
|
+
* EU List of Trusted Lists (LOTL) signing certificates — GENERATED by
|
|
272
|
+
* `scripts/refresh-lotl-anchors.mts`, do not edit by hand.
|
|
273
|
+
*
|
|
274
|
+
* These are the certificates the European Commission publishes as the signers
|
|
275
|
+
* of the LOTL. They are the out-of-band trust anchor of the whole eIDAS trusted
|
|
276
|
+
* list hierarchy: the set cannot be derived from the LOTL alone (a forged list
|
|
277
|
+
* would carry a forged self-pointer), so it is pinned here and cross-checked
|
|
278
|
+
* against the Official Journal publication referenced below.
|
|
279
|
+
*
|
|
280
|
+
* Source list: https://ec.europa.eu/tools/lotl/eu-lotl.xml
|
|
281
|
+
* Official Journal: https://eur-lex.europa.eu/eli/C/2026/1944/oj
|
|
282
|
+
*/
|
|
283
|
+
/** One certificate the European Commission publishes as a LOTL signer. */
|
|
284
|
+
interface EuLotlSigningCertificate {
|
|
285
|
+
/** base64-encoded DER. */
|
|
286
|
+
certificate: string;
|
|
287
|
+
/** Subject distinguished name, for human review of the pinned set. */
|
|
288
|
+
subject: string;
|
|
289
|
+
/** Lowercase-hex SHA-256 of the DER, for out-of-band cross-checking. */
|
|
290
|
+
fingerprintSha256: string;
|
|
291
|
+
/** Certificate expiry (ISO 8601). */
|
|
292
|
+
notAfter: string;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* The signing certificates published by the LOTL identified in
|
|
296
|
+
* {@link EU_LOTL_ANCHORS_PROVENANCE}. Any of them may sign a future issue of the
|
|
297
|
+
* list, so the whole published set is pinned, not just the current signer.
|
|
298
|
+
*/
|
|
299
|
+
declare const EU_LOTL_SIGNING_CERTIFICATES: readonly EuLotlSigningCertificate[];
|
|
300
|
+
/** Where this set came from, so the pin can be audited without re-running the script. */
|
|
301
|
+
declare const EU_LOTL_ANCHORS_PROVENANCE: {
|
|
302
|
+
/** The list the certificates were read from. */
|
|
303
|
+
readonly source: "https://ec.europa.eu/tools/lotl/eu-lotl.xml";
|
|
304
|
+
/** The Official Journal act the LOTL itself references for its signers. */
|
|
305
|
+
readonly officialJournal: "https://eur-lex.europa.eu/eli/C/2026/1944/oj";
|
|
306
|
+
/** `TSLSequenceNumber` of that list. */
|
|
307
|
+
readonly tslSequenceNumber: 390;
|
|
308
|
+
/** `ListIssueDateTime` of that list. */
|
|
309
|
+
readonly listIssueDateTime: "2026-08-03T13:16:38Z";
|
|
310
|
+
/** Earliest expiry in the set: refresh before this date. */
|
|
311
|
+
readonly earliestNotAfter: "2027-04-26T12:49:22.000Z";
|
|
312
|
+
};
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/parse.d.ts
|
|
315
|
+
/**
|
|
316
|
+
* Parse an ETSI TS 119 612 `TrustServiceStatusList` XML into a normalized
|
|
317
|
+
* {@link TrustedList}. This does NOT verify the list signature — call
|
|
318
|
+
* {@link verifyTrustedListSignature} first (or use {@link loadTrustedList}).
|
|
319
|
+
*/
|
|
320
|
+
declare function parseTrustedList(xml: string): TrustedList;
|
|
321
|
+
/** Selects `PointersToOtherTSL` entries in {@link getPointerSigningCertificates}. */
|
|
322
|
+
interface TrustedListPointerFilter {
|
|
323
|
+
/** `SchemeTerritory` of the pointed-to list (e.g. `ES`), case-insensitive. */
|
|
324
|
+
schemeTerritory?: string;
|
|
325
|
+
/** `TSLType` of the pointed-to list, compared scheme-insensitively. */
|
|
326
|
+
tslType?: string;
|
|
327
|
+
/** Exact `TSLLocation` URL of the pointed-to list. */
|
|
328
|
+
location?: string;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* The DER-encoded certificates a list publishes for the lists it points to —
|
|
332
|
+
* i.e. the trust anchors with which those lists are signed, ready to be passed
|
|
333
|
+
* as `trustAnchors` to `verifyTrustedListSignature`.
|
|
334
|
+
*
|
|
335
|
+
* This is the mechanism by which a trusted list distributes trust downwards: a
|
|
336
|
+
* verifier that has established trust in one list (for the EU LOTL, by pinning
|
|
337
|
+
* its signing certificates out of band) obtains the anchors of every list it
|
|
338
|
+
* points to without pinning them individually.
|
|
339
|
+
*
|
|
340
|
+
* ```ts
|
|
341
|
+
* const lotl = await loadTrustedList(lotlXml, { trustAnchors: getEuLotlTrustAnchors() })
|
|
342
|
+
* const esAnchors = getPointerSigningCertificates(lotl, { schemeTerritory: 'ES' })
|
|
343
|
+
* const esList = await loadTrustedList(esXml, { trustAnchors: esAnchors })
|
|
344
|
+
* ```
|
|
345
|
+
*
|
|
346
|
+
* Passing `{ tslType: TSLType.EUlistofthelists }` returns the LOTL's own
|
|
347
|
+
* currently published signing certificates (from its self-pointer), which is
|
|
348
|
+
* how a deployment refreshes its pinned set as the scheme operator rotates keys.
|
|
349
|
+
*/
|
|
350
|
+
declare function getPointerSigningCertificates(trustedList: TrustedList, filter?: TrustedListPointerFilter): Uint8Array[];
|
|
351
|
+
interface TrustAnchorFilter {
|
|
352
|
+
/**
|
|
353
|
+
* When set, only include services whose `serviceStatus` is in this list
|
|
354
|
+
* (e.g. `ACTIVE_SERVICE_STATUSES`). Withdrawn/deprecated services are
|
|
355
|
+
* excluded.
|
|
356
|
+
*/
|
|
357
|
+
serviceStatus?: string[];
|
|
358
|
+
/** When set, only include services whose `serviceTypeIdentifier` matches. */
|
|
359
|
+
serviceTypeIdentifier?: string[];
|
|
360
|
+
/**
|
|
361
|
+
* When true, only include anchors that embed an X.509 certificate (i.e. the
|
|
362
|
+
* ones usable for certificate-chain validation). Defaults to false, which
|
|
363
|
+
* also returns SubjectName/SKI-only identities (useful for AKI queries).
|
|
364
|
+
*/
|
|
365
|
+
requireCertificate?: boolean;
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Flatten a {@link TrustedList} into individual {@link TrustAnchor} entries —
|
|
369
|
+
* the normalized unit consumed by certificate-chain validation and AKI
|
|
370
|
+
* emission.
|
|
371
|
+
*/
|
|
372
|
+
declare function getTrustAnchors(trustedList: TrustedList, filter?: TrustAnchorFilter): TrustAnchor[];
|
|
373
|
+
//#endregion
|
|
374
|
+
//#region src/profiles.d.ts
|
|
375
|
+
/**
|
|
376
|
+
* Ready-made {@link ProfileRule}s for common ETSI ecosystems, so callers don't
|
|
377
|
+
* have to hand-write the URIs. The engine ({@link validateTrustedListProfile})
|
|
378
|
+
* stays profile-agnostic; these are just convenience constants you pass into it.
|
|
379
|
+
*
|
|
380
|
+
* A profile is an allowlist: the structural schema is checked first, then the
|
|
381
|
+
* list's `TSLType` must match and every service's type/status must be permitted.
|
|
382
|
+
* That fits homogeneous, curated lists well (e.g. Age Verification). For a full
|
|
383
|
+
* eIDAS national list — which legitimately carries withdrawn/ceased services and
|
|
384
|
+
* a broad mix of qualified service types — {@link euGeneric} therefore permits
|
|
385
|
+
* all standard ETSI statuses and qualified service types: it asserts "this is a
|
|
386
|
+
* well-formed EU generic list using standard ETSI URIs", not "only currently
|
|
387
|
+
* active CAs". Narrow further with your own {@link ProfileRule} when you need to.
|
|
388
|
+
*/
|
|
389
|
+
declare const TrustedListProfiles: {
|
|
390
|
+
/**
|
|
391
|
+
* EU List of Trusted Lists (LOTL). Its `TSLType` is `EUlistofthelists` and it
|
|
392
|
+
* carries pointers to national lists rather than trust-service providers, so
|
|
393
|
+
* no service type/status is permitted (a conforming LOTL has no TSP services).
|
|
394
|
+
*/
|
|
395
|
+
euLotl: {
|
|
396
|
+
name: string;
|
|
397
|
+
tslType: "http://uri.etsi.org/TrstSvc/TrustedList/TSLType/EUlistofthelists";
|
|
398
|
+
serviceTypes: never[];
|
|
399
|
+
serviceStatuses: never[];
|
|
400
|
+
};
|
|
401
|
+
/**
|
|
402
|
+
* A generic EU (eIDAS national) trusted list: `TSLType` `EUgeneric`, any
|
|
403
|
+
* standard qualified service type, any standard service status (including
|
|
404
|
+
* withdrawn/ceased entries that national lists retain for history).
|
|
405
|
+
*/
|
|
406
|
+
euGeneric: {
|
|
407
|
+
name: string;
|
|
408
|
+
tslType: "http://uri.etsi.org/TrstSvc/TrustedList/TSLType/EUgeneric";
|
|
409
|
+
serviceTypes: string[];
|
|
410
|
+
serviceStatuses: string[];
|
|
411
|
+
};
|
|
412
|
+
/**
|
|
413
|
+
* EU Age Verification trusted list, per the European Commission's "AV Trusted
|
|
414
|
+
* List Specifications" (DIGIT.B.3). The `TSLType` (clause 5.3.3), the single
|
|
415
|
+
* Proof of Age Attestation service type (`paa`, clause 5.5.1) and the two
|
|
416
|
+
* permitted service statuses (clause 5.5.4) are fixed by that specification —
|
|
417
|
+
* which states the statuses "may be used to the exclusion of any other", so
|
|
418
|
+
* the allowlist model captures the AV profile exactly. Deployed lists have
|
|
419
|
+
* used `https` for the `TSLType`; the profile compares scheme-insensitively.
|
|
420
|
+
*/
|
|
421
|
+
ageVerification: {
|
|
422
|
+
name: string;
|
|
423
|
+
tslType: string;
|
|
424
|
+
serviceTypes: string[];
|
|
425
|
+
serviceStatuses: string[];
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
//#endregion
|
|
429
|
+
//#region src/trusted-list-exception.d.ts
|
|
430
|
+
/**
|
|
431
|
+
* Base exception for all trusted-list processing failures.
|
|
432
|
+
*/
|
|
433
|
+
declare class TrustedListException extends Error {
|
|
434
|
+
readonly cause?: unknown;
|
|
435
|
+
constructor(message: string, options?: {
|
|
436
|
+
cause?: unknown;
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* The XML could not be parsed as an ETSI TS 119 612 `TrustServiceStatusList`.
|
|
441
|
+
*/
|
|
442
|
+
declare class TrustedListParseException extends TrustedListException {
|
|
443
|
+
constructor(message: string, options?: {
|
|
444
|
+
cause?: unknown;
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* The trusted list's own XAdES/XMLDSig signature is missing, invalid, or does
|
|
449
|
+
* not match a configured trust anchor. Callers MUST treat this as fail-closed:
|
|
450
|
+
* a trusted list whose authenticity cannot be established must not be used to
|
|
451
|
+
* trust credentials.
|
|
452
|
+
*/
|
|
453
|
+
declare class TrustedListSignatureException extends TrustedListException {
|
|
454
|
+
constructor(message: string, options?: {
|
|
455
|
+
cause?: unknown;
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/validate.d.ts
|
|
460
|
+
/** A single validation problem, mirroring `@owf/eudi-lote`'s ValidationError. */
|
|
461
|
+
interface ValidationError {
|
|
462
|
+
path: string;
|
|
463
|
+
message: string;
|
|
464
|
+
}
|
|
465
|
+
/** Result of a validation, mirroring `@owf/eudi-lote`'s ValidationResult. */
|
|
466
|
+
interface ValidationResult {
|
|
467
|
+
valid: boolean;
|
|
468
|
+
errors: ValidationError[];
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* Structurally validate an object against the ETSI TS 119 612 trusted-list
|
|
472
|
+
* schema (the same zod-based approach `@owf/eudi-lote` uses for TS 119 602).
|
|
473
|
+
* For XML input, parse it first with `parseTrustedList` (XML → object), then
|
|
474
|
+
* validate the object here.
|
|
475
|
+
*/
|
|
476
|
+
declare function validateTrustedList(value: unknown): ValidationResult;
|
|
477
|
+
/**
|
|
478
|
+
* Structurally validate and return the typed trusted list, throwing
|
|
479
|
+
* {@link TrustedListParseException} when it does not conform to the schema.
|
|
480
|
+
*/
|
|
481
|
+
declare function assertValidTrustedList(value: unknown): TrustedList;
|
|
482
|
+
/**
|
|
483
|
+
* A profile constraint set for a trusted list: the expected `TSLType` and the
|
|
484
|
+
* service type / status URIs the profile permits. The zod-based structural
|
|
485
|
+
* schema ({@link validateTrustedList}) is checked first; a profile then narrows
|
|
486
|
+
* a conforming list to a specific ecosystem. Rules are supplied by the caller,
|
|
487
|
+
* so the library stays profile-agnostic (mirrors `@owf/eudi-lote`'s approach).
|
|
488
|
+
*/
|
|
489
|
+
interface ProfileRule {
|
|
490
|
+
/** Optional label used in error messages. */
|
|
491
|
+
name?: string;
|
|
492
|
+
/** Expected `TSLType` (compared scheme-insensitively). */
|
|
493
|
+
tslType: string;
|
|
494
|
+
/** Service type URIs the profile permits (scheme-insensitive). */
|
|
495
|
+
serviceTypes: string[];
|
|
496
|
+
/** Service status URIs the profile permits (scheme-insensitive). */
|
|
497
|
+
serviceStatuses: string[];
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Validate that a trusted list conforms to one (or any, given several) of the
|
|
501
|
+
* supplied profile rules — structural schema first, then profile-specific
|
|
502
|
+
* constraints. Mirrors `@owf/eudi-lote`'s profile validation.
|
|
503
|
+
*/
|
|
504
|
+
declare function validateTrustedListProfile(value: unknown, rule: ProfileRule | ProfileRule[]): ValidationResult;
|
|
505
|
+
//#endregion
|
|
506
|
+
//#region src/index.d.ts
|
|
507
|
+
/**
|
|
508
|
+
* Verify the trusted list signature and, only if it is valid, parse it. This is
|
|
509
|
+
* the safe entry point: it never returns a {@link TrustedList} whose
|
|
510
|
+
* authenticity has not been established.
|
|
511
|
+
*/
|
|
512
|
+
declare function loadTrustedList(xml: string, options?: VerifyTrustedListOptions): Promise<TrustedList>;
|
|
513
|
+
//#endregion
|
|
514
|
+
export { ACTIVE_SERVICE_STATUSES, type DigitalIdentity, DigitalIdentitySchema, EU_LOTL_ANCHORS_PROVENANCE, EU_LOTL_SIGNING_CERTIFICATES, type EuLotlSigningCertificate, type ProfileRule, type ServiceHistoryInstance, ServiceHistoryInstanceSchema, ServiceStatus, ServiceType, TSLType, type TrustAnchor, type TrustAnchorFilter, TrustAnchorSchema, type TrustServiceProvider, TrustServiceProviderSchema, type TrustedList, TrustedListException, TrustedListParseException, type TrustedListPointer, type TrustedListPointerFilter, TrustedListPointerSchema, TrustedListProfiles, TrustedListSchema, type TrustedListService, TrustedListServiceSchema, TrustedListSignatureException, type ValidationError, type ValidationResult, type VerifyTrustedListOptions, type VerifyTrustedListResult, assertValidTrustedList, getEuLotlTrustAnchors, getPointerSigningCertificates, getTrustAnchors, loadEuLotl, loadTrustedList, parseTrustedList, setTrustedListCrypto, validateTrustedList, validateTrustedListProfile, verifyEuLotlSignature, verifyTrustedListSignature };
|
|
515
|
+
//# sourceMappingURL=index.d.cts.map
|