@owf/eudi-registration-certificate 0.0.0-stage → 0.4.2

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.
@@ -0,0 +1,825 @@
1
+ import { Signer } from "@owf/crypto";
2
+ import { z } from "zod";
3
+ import { IdentityException } from "@owf/identity-common";
4
+ //#region src/entitlements.d.ts
5
+ /**
6
+ * All standard WRP entitlements defined in ETSI TS 119 475
7
+ */
8
+ export declare const WRP_ENTITLEMENTS: {
9
+ readonly SERVICE_PROVIDER: "https://uri.etsi.org/19475/Entitlement/Service_Provider";
10
+ readonly QEAA_PROVIDER: "https://uri.etsi.org/19475/Entitlement/QEAA_Provider";
11
+ readonly NON_Q_EAA_PROVIDER: "https://uri.etsi.org/19475/Entitlement/Non_Q_EAA_Provider";
12
+ readonly PUB_EAA_PROVIDER: "https://uri.etsi.org/19475/Entitlement/PUB_EAA_Provider";
13
+ readonly PID_PROVIDER: "https://uri.etsi.org/19475/Entitlement/PID_Provider";
14
+ readonly QCERT_FOR_ESEAL_PROVIDER: "https://uri.etsi.org/19475/Entitlement/QCert_for_ESeal_Provider";
15
+ readonly QCERT_FOR_ESIG_PROVIDER: "https://uri.etsi.org/19475/Entitlement/QCert_for_ESig_Provider";
16
+ readonly RQSEALCDS_PROVIDER: "https://uri.etsi.org/19475/Entitlement/rQSealCDs_Provider";
17
+ readonly RQSIGCDS_PROVIDER: "https://uri.etsi.org/19475/Entitlement/rQSigCDs_Provider";
18
+ readonly ESIG_ESEAL_CREATION_PROVIDER: "https://uri.etsi.org/19475/Entitlement/ESig_ESeal_Creation_Provider";
19
+ };
20
+ /**
21
+ * Payment Service Provider Sub-entitlements (A.3.1)
22
+ * As defined in ETSI TS 119 495
23
+ */
24
+ export declare const PSP_SUB_ENTITLEMENTS: {
25
+ /** Account Servicing Payment Service Provider */
26
+ readonly ACCOUNT_SERVICING: 'https://uri.etsi.org/19475/SubEntitlement/psp/psp-as';
27
+ /** Payment Initiation Service Provider */
28
+ readonly PAYMENT_INITIATION: 'https://uri.etsi.org/19475/SubEntitlement/psp/psp-pi';
29
+ /** Account Information Service Provider */
30
+ readonly ACCOUNT_INFORMATION: 'https://uri.etsi.org/19475/SubEntitlement/psp/psp-ai';
31
+ /** Payment Service Provider issuing card-based payment instruments */
32
+ readonly CARD_BASED: 'https://uri.etsi.org/19475/SubEntitlement/psp/psp-ic';
33
+ /** Unspecified Payment Service Provider */
34
+ readonly UNSPECIFIED: 'https://uri.etsi.org/19475/SubEntitlement/psp/unspecified';
35
+ };
36
+ /**
37
+ * Identifier type URIs for legal person semantic identifiers
38
+ */
39
+ export declare const IDENTIFIER_TYPES: {
40
+ /** Economic Operator Registration and Identification Number (EORI-No) */
41
+ readonly EORI: 'http://data.europa.eu/eudi/id/EORI-No';
42
+ /** Legal Entity Identifier (LEI) */
43
+ readonly LEI: 'http://data.europa.eu/eudi/id/LEI';
44
+ /** European Unique Identifier (EUID) */
45
+ readonly EUID: 'http://data.europa.eu/eudi/id/EUID';
46
+ /** Value Added Tax Identification Number (VATIN) */
47
+ readonly VATIN: 'http://data.europa.eu/eudi/id/VATIN';
48
+ /** Taxpayer Identification Number (TIN) */
49
+ readonly TIN: 'http://data.europa.eu/eudi/id/TIN';
50
+ /** Excise Number */
51
+ readonly EXCISE: 'http://data.europa.eu/eudi/id/Excise';
52
+ };
53
+ /**
54
+ * Mapping from identifier type URIs to semantic identifier initial characters
55
+ * for legal persons (Table 2, ETSI EN 319 412-1 clause 5.1.4).
56
+ *
57
+ * Note that the TIN type maps to the `VAT` initial characters for legal persons.
58
+ */
59
+ export declare const LEGAL_PERSON_IDENTIFIER_PREFIXES: Record<string, string>;
60
+ /**
61
+ * Mapping from identifier type URIs to semantic identifier initial characters
62
+ * for natural persons (Table 4, ETSI EN 319 412-1 clause 5.1.3).
63
+ */
64
+ export declare const NATURAL_PERSON_IDENTIFIER_PREFIXES: Record<string, string>;
65
+ /**
66
+ * Check if a given URI is a valid WRP entitlement
67
+ */
68
+ export declare function isValidEntitlement(uri: string): boolean;
69
+ /**
70
+ * Check if a given URI is a PSP sub-entitlement
71
+ */
72
+ export declare function isPSPSubEntitlement(uri: string): boolean;
73
+ /**
74
+ * Check if entitlements include an attestation provider role
75
+ */
76
+ export declare function hasAttestationProviderEntitlement(entitlements: string[]): boolean;
77
+ /**
78
+ * Get the semantic identifier initial characters for a given identifier type URI
79
+ *
80
+ * @param subjectType - Which mapping to use: Table 2 for legal persons, Table 4 for natural persons
81
+ */
82
+ export declare function getIdentifierPrefix(typeUri: string, subjectType?: 'legal' | 'natural'): string | undefined;
83
+ //#endregion
84
+ //#region src/dialect.d.ts
85
+ /**
86
+ * Wire dialects understood by this package.
87
+ */
88
+ export declare const WRPRC_DIALECTS: {
89
+ /** ETSI TS 119 475 v1.2.1 as published. The default for everything this package emits. */
90
+ readonly CURRENT: 'ts119475-1.2.1';
91
+ /**
92
+ * Anticipated corrections: `claims` instead of `claim`, `intermediary.name` instead of
93
+ * `intermediary.sname`.
94
+ *
95
+ * Unstable. No published edition defines this yet, so a certificate emitted in this
96
+ * dialect may match neither the current specification nor its eventual correction.
97
+ */
98
+ readonly DRAFT: 'draft';
99
+ };
100
+ /** A wire dialect understood by this package */
101
+ type WRPRCDialect = (typeof WRPRC_DIALECTS)[keyof typeof WRPRC_DIALECTS];
102
+ /**
103
+ * Accept the anticipated `claims` and `intermediary.name` spellings when parsing, so a
104
+ * certificate from an SDK that already applies the corrections still validates.
105
+ */
106
+ export declare function normalizeWRPRCPayload(payload: unknown): unknown;
107
+ /**
108
+ * Serialize a canonical payload in the requested dialect.
109
+ */
110
+ export declare function toWRPRCDialect(payload: WRPRCPayload, dialect: WRPRCDialect): unknown;
111
+ //#endregion
112
+ //#region src/schemas.d.ts
113
+ /**
114
+ * Multilingual string schema (B.2.6 Class MultiLangString)
115
+ */
116
+ export declare const MultiLangStringSchema: z.ZodObject<{
117
+ lang: z.ZodString;
118
+ value: z.ZodString;
119
+ }, z.core.$strip>;
120
+ /**
121
+ * Supervisory Authority schema for Data Protection Authority
122
+ */
123
+ export declare const SupervisoryAuthoritySchema: z.ZodObject<{
124
+ email: z.ZodOptional<z.ZodEmail>;
125
+ phone: z.ZodOptional<z.ZodString>;
126
+ uri: z.ZodOptional<z.ZodURL>;
127
+ }, z.core.$strip>;
128
+ /**
129
+ * Claim schema for credential attribute specification (B.2.10 Class Claim).
130
+ *
131
+ * `path` follows the DCQL claims path pointer: string for an object key, integer for an
132
+ * array index, null to select every element of an array.
133
+ */
134
+ export declare const ClaimSchema: z.ZodObject<{
135
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
136
+ values: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
137
+ }, z.core.$strip>;
138
+ /**
139
+ * Credential schema for attestations (B.2.9 Class Credential).
140
+ *
141
+ * The subfield is named `claim` (singular) even though it holds an array. This follows
142
+ * ETSI TS 119 475 v1.2.1 Tables 8 and 9 and Annex C verbatim; see the package README.
143
+ */
144
+ export declare const CredentialSchema: z.ZodObject<{
145
+ format: z.ZodString;
146
+ meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
147
+ claim: z.ZodOptional<z.ZodArray<z.ZodObject<{
148
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
149
+ values: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
150
+ }, z.core.$strip>>>;
151
+ }, z.core.$strip>;
152
+ /** Credential issued by the WRP for `provides_attestations` (Table 8) */
153
+ export declare const ProvidedAttestationSchema: z.ZodObject<{
154
+ format: z.ZodString;
155
+ meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
156
+ }, z.core.$strict>;
157
+ /**
158
+ * Status schema for WRPRC validity
159
+ */
160
+ export declare const StatusSchema: z.ZodObject<{
161
+ status_list: z.ZodObject<{
162
+ idx: z.ZodNumber;
163
+ uri: z.ZodURL;
164
+ }, z.core.$strip>;
165
+ }, z.core.$strip>;
166
+ /**
167
+ * Intermediary information when WRP acts through an intermediary (Table 10).
168
+ * The intermediary's semantic identifier comes from its own WRPAC.
169
+ *
170
+ * The common name subfield is `sname` per the normative Table 10. The informative
171
+ * Annex C example spells it `name`; see the package README.
172
+ */
173
+ export declare const IntermediarySchema: z.ZodObject<{
174
+ sub: z.ZodString;
175
+ sname: z.ZodString;
176
+ }, z.core.$strip>;
177
+ /**
178
+ * WRPRC Payload schema according to ETSI TS 119 475 clause 5.2.4
179
+ */
180
+ export declare const WRPRCPayloadSchema: z.ZodObject<{
181
+ name: z.ZodString;
182
+ sub_ln: z.ZodOptional<z.ZodString>;
183
+ sub_gn: z.ZodOptional<z.ZodString>;
184
+ sub_fn: z.ZodOptional<z.ZodString>;
185
+ sub: z.ZodString;
186
+ country: z.ZodString;
187
+ registry_uri: z.ZodURL;
188
+ srv_description: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
189
+ lang: z.ZodString;
190
+ value: z.ZodString;
191
+ }, z.core.$strip>>>>;
192
+ entitlements: z.ZodArray<z.ZodString>;
193
+ privacy_policy: z.ZodOptional<z.ZodURL>;
194
+ info_uri: z.ZodOptional<z.ZodURL>;
195
+ support_uri: z.ZodOptional<z.ZodUnion<[z.ZodURL, z.ZodEmail]>>;
196
+ supervisory_authority: z.ZodOptional<z.ZodObject<{
197
+ email: z.ZodOptional<z.ZodEmail>;
198
+ phone: z.ZodOptional<z.ZodString>;
199
+ uri: z.ZodOptional<z.ZodURL>;
200
+ }, z.core.$strip>>;
201
+ policy_id: z.ZodOptional<z.ZodArray<z.ZodString>>;
202
+ certificate_policy: z.ZodOptional<z.ZodURL>;
203
+ jti: z.ZodOptional<z.ZodString>;
204
+ iat: z.ZodNumber;
205
+ status: z.ZodOptional<z.ZodObject<{
206
+ status_list: z.ZodObject<{
207
+ idx: z.ZodNumber;
208
+ uri: z.ZodURL;
209
+ }, z.core.$strip>;
210
+ }, z.core.$strip>>;
211
+ purpose: z.ZodOptional<z.ZodArray<z.ZodObject<{
212
+ lang: z.ZodString;
213
+ value: z.ZodString;
214
+ }, z.core.$strip>>>;
215
+ credentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
216
+ format: z.ZodString;
217
+ meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
218
+ claim: z.ZodOptional<z.ZodArray<z.ZodObject<{
219
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
220
+ values: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
221
+ }, z.core.$strip>>>;
222
+ }, z.core.$strip>>>;
223
+ provides_attestations: z.ZodOptional<z.ZodArray<z.ZodObject<{
224
+ format: z.ZodString;
225
+ meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
226
+ }, z.core.$strict>>>;
227
+ intermediary: z.ZodOptional<z.ZodObject<{
228
+ sub: z.ZodString;
229
+ sname: z.ZodString;
230
+ }, z.core.$strip>>;
231
+ public_body: z.ZodOptional<z.ZodBoolean>;
232
+ exp: z.ZodOptional<z.ZodNumber>;
233
+ intended_use_id: z.ZodOptional<z.ZodString>;
234
+ }, z.core.$strip>;
235
+ /**
236
+ * Signature algorithms permitted for JAdES B-B signatures (ETSI TS 119 182-1 clause 5.1.2),
237
+ * referenced by GEN-5.2.1-04.
238
+ */
239
+ export declare const WRPRC_JWS_ALGORITHMS: readonly ['ES256', 'ES384', 'ES512', 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'EdDSA'];
240
+ /**
241
+ * JWT Header schema according to ETSI TS 119 475 clause 5.2.2 (Table 5).
242
+ *
243
+ * Table 5 lists `typ`, `alg` and `x5c` as the minimum set. GEN-5.2.1-04 additionally
244
+ * requires a JAdES B-B signature, whose protected header carries `iat` as the claimed
245
+ * signing time (ETSI TS 119 182-1 clause 5.1.9). The informative Annex C header omits it.
246
+ */
247
+ export declare const WRPRCJWTHeaderSchema: z.ZodObject<{
248
+ typ: z.ZodLiteral<"rc-wrp+jwt">;
249
+ alg: z.ZodEnum<{
250
+ ES256: "ES256";
251
+ ES384: "ES384";
252
+ ES512: "ES512";
253
+ EdDSA: "EdDSA";
254
+ PS256: "PS256";
255
+ PS384: "PS384";
256
+ PS512: "PS512";
257
+ RS256: "RS256";
258
+ RS384: "RS384";
259
+ RS512: "RS512";
260
+ }>;
261
+ x5c: z.ZodArray<z.ZodString>;
262
+ kid: z.ZodOptional<z.ZodString>;
263
+ iat: z.ZodNumber;
264
+ }, z.core.$strip>;
265
+ /**
266
+ * CWT Header schema according to ETSI TS 119 475 clause 5.2.3 (Table 6).
267
+ *
268
+ * GEN-5.2.1-05 requires an advanced electronic signature per RFC 9052 and RFC 9360
269
+ * rather than a JAdES profile, so no claimed signing time is imposed here.
270
+ */
271
+ export declare const WRPRCCWTHeaderSchema: z.ZodObject<{
272
+ typ: z.ZodLiteral<"rc-wrp+cwt">;
273
+ alg: z.ZodNumber;
274
+ x5chain: z.ZodArray<z.ZodInstanceOf<Uint8Array<ArrayBuffer>>>;
275
+ iat: z.ZodOptional<z.ZodNumber>;
276
+ }, z.core.$strip>;
277
+ /**
278
+ * Schema for legal person WRPRC subject
279
+ */
280
+ export declare const LegalPersonSubjectSchema: z.ZodObject<{
281
+ name: z.ZodString;
282
+ sub: z.ZodString;
283
+ country: z.ZodString;
284
+ registry_uri: z.ZodURL;
285
+ srv_description: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
286
+ lang: z.ZodString;
287
+ value: z.ZodString;
288
+ }, z.core.$strip>>>>;
289
+ entitlements: z.ZodArray<z.ZodString>;
290
+ privacy_policy: z.ZodOptional<z.ZodURL>;
291
+ info_uri: z.ZodOptional<z.ZodURL>;
292
+ support_uri: z.ZodOptional<z.ZodUnion<[z.ZodURL, z.ZodEmail]>>;
293
+ supervisory_authority: z.ZodOptional<z.ZodObject<{
294
+ email: z.ZodOptional<z.ZodEmail>;
295
+ phone: z.ZodOptional<z.ZodString>;
296
+ uri: z.ZodOptional<z.ZodURL>;
297
+ }, z.core.$strip>>;
298
+ policy_id: z.ZodOptional<z.ZodArray<z.ZodString>>;
299
+ certificate_policy: z.ZodOptional<z.ZodURL>;
300
+ jti: z.ZodOptional<z.ZodString>;
301
+ iat: z.ZodNumber;
302
+ status: z.ZodOptional<z.ZodObject<{
303
+ status_list: z.ZodObject<{
304
+ idx: z.ZodNumber;
305
+ uri: z.ZodURL;
306
+ }, z.core.$strip>;
307
+ }, z.core.$strip>>;
308
+ purpose: z.ZodOptional<z.ZodArray<z.ZodObject<{
309
+ lang: z.ZodString;
310
+ value: z.ZodString;
311
+ }, z.core.$strip>>>;
312
+ credentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
313
+ format: z.ZodString;
314
+ meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
315
+ claim: z.ZodOptional<z.ZodArray<z.ZodObject<{
316
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
317
+ values: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
318
+ }, z.core.$strip>>>;
319
+ }, z.core.$strip>>>;
320
+ provides_attestations: z.ZodOptional<z.ZodArray<z.ZodObject<{
321
+ format: z.ZodString;
322
+ meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
323
+ }, z.core.$strict>>>;
324
+ intermediary: z.ZodOptional<z.ZodObject<{
325
+ sub: z.ZodString;
326
+ sname: z.ZodString;
327
+ }, z.core.$strip>>;
328
+ public_body: z.ZodOptional<z.ZodBoolean>;
329
+ exp: z.ZodOptional<z.ZodNumber>;
330
+ intended_use_id: z.ZodOptional<z.ZodString>;
331
+ sub_ln: z.ZodString;
332
+ }, z.core.$strip>;
333
+ /**
334
+ * Schema for natural person WRPRC subject
335
+ */
336
+ export declare const NaturalPersonSubjectSchema: z.ZodObject<{
337
+ name: z.ZodString;
338
+ sub: z.ZodString;
339
+ country: z.ZodString;
340
+ registry_uri: z.ZodURL;
341
+ srv_description: z.ZodOptional<z.ZodArray<z.ZodArray<z.ZodObject<{
342
+ lang: z.ZodString;
343
+ value: z.ZodString;
344
+ }, z.core.$strip>>>>;
345
+ entitlements: z.ZodArray<z.ZodString>;
346
+ privacy_policy: z.ZodOptional<z.ZodURL>;
347
+ info_uri: z.ZodOptional<z.ZodURL>;
348
+ support_uri: z.ZodOptional<z.ZodUnion<[z.ZodURL, z.ZodEmail]>>;
349
+ supervisory_authority: z.ZodOptional<z.ZodObject<{
350
+ email: z.ZodOptional<z.ZodEmail>;
351
+ phone: z.ZodOptional<z.ZodString>;
352
+ uri: z.ZodOptional<z.ZodURL>;
353
+ }, z.core.$strip>>;
354
+ policy_id: z.ZodOptional<z.ZodArray<z.ZodString>>;
355
+ certificate_policy: z.ZodOptional<z.ZodURL>;
356
+ jti: z.ZodOptional<z.ZodString>;
357
+ iat: z.ZodNumber;
358
+ status: z.ZodOptional<z.ZodObject<{
359
+ status_list: z.ZodObject<{
360
+ idx: z.ZodNumber;
361
+ uri: z.ZodURL;
362
+ }, z.core.$strip>;
363
+ }, z.core.$strip>>;
364
+ purpose: z.ZodOptional<z.ZodArray<z.ZodObject<{
365
+ lang: z.ZodString;
366
+ value: z.ZodString;
367
+ }, z.core.$strip>>>;
368
+ credentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
369
+ format: z.ZodString;
370
+ meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
371
+ claim: z.ZodOptional<z.ZodArray<z.ZodObject<{
372
+ path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
373
+ values: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
374
+ }, z.core.$strip>>>;
375
+ }, z.core.$strip>>>;
376
+ provides_attestations: z.ZodOptional<z.ZodArray<z.ZodObject<{
377
+ format: z.ZodString;
378
+ meta: z.ZodRecord<z.ZodString, z.ZodUnknown>;
379
+ }, z.core.$strict>>>;
380
+ intermediary: z.ZodOptional<z.ZodObject<{
381
+ sub: z.ZodString;
382
+ sname: z.ZodString;
383
+ }, z.core.$strip>>;
384
+ public_body: z.ZodOptional<z.ZodBoolean>;
385
+ exp: z.ZodOptional<z.ZodNumber>;
386
+ intended_use_id: z.ZodOptional<z.ZodString>;
387
+ sub_gn: z.ZodString;
388
+ sub_fn: z.ZodString;
389
+ }, z.core.$strip>;
390
+ //#endregion
391
+ //#region src/types.d.ts
392
+ /** Multilingual string with language tag (B.2.6 Class MultiLangString) */
393
+ type MultiLangString = z.infer<typeof MultiLangStringSchema>;
394
+ /** Supervisory Authority (Data Protection Authority) */
395
+ type SupervisoryAuthority = z.infer<typeof SupervisoryAuthoritySchema>;
396
+ /** Claim specification for credential attributes (B.2.10 Class Claim) */
397
+ type Claim = z.infer<typeof ClaimSchema>;
398
+ /** Credential specification for attestations (B.2.9 Class Credential) */
399
+ type Credential = z.infer<typeof CredentialSchema>;
400
+ /** Credential issued by the WRP for `provides_attestations` (Table 8) */
401
+ type ProvidedAttestation = z.infer<typeof ProvidedAttestationSchema>;
402
+ /** Status reference for WRPRC validity */
403
+ type Status = z.infer<typeof StatusSchema>;
404
+ /** Intermediary information */
405
+ type Intermediary = z.infer<typeof IntermediarySchema>;
406
+ /** WRPRC Payload */
407
+ type WRPRCPayload = z.infer<typeof WRPRCPayloadSchema>;
408
+ /** Legal person subject payload */
409
+ type LegalPersonSubject = z.infer<typeof LegalPersonSubjectSchema>;
410
+ /** Natural person subject payload */
411
+ type NaturalPersonSubject = z.infer<typeof NaturalPersonSubjectSchema>;
412
+ /** JWT Header for WRPRC */
413
+ type WRPRCJWTHeader = z.infer<typeof WRPRCJWTHeaderSchema>;
414
+ /** CWT Header for WRPRC */
415
+ type WRPRCCWTHeader = z.infer<typeof WRPRCCWTHeaderSchema>;
416
+ /** Signed JWT WRPRC (compact JWS format) */
417
+ interface SignedWRPRC {
418
+ /** The compact JWS string */
419
+ jws: string;
420
+ /** Decoded header */
421
+ header: WRPRCJWTHeader;
422
+ /** Decoded payload */
423
+ payload: WRPRCPayload;
424
+ }
425
+ /** Options for signing a WRPRC */
426
+ interface SignOptions {
427
+ /** The WRPRC payload to sign */
428
+ payload: WRPRCPayload;
429
+ /** Required subject of the access certificate the WRPRC is intended to authorize */
430
+ accessCertificateSub: string;
431
+ /** Algorithm (default: ES256) */
432
+ algorithm?: WRPRCJWTHeader['alg'];
433
+ /** PEM-encoded certificates for x5c header (each element is a single PEM certificate) */
434
+ certificates: string[];
435
+ /** Key ID (optional) */
436
+ keyId?: string;
437
+ /** JAdES claimed signing time; defaults to now */
438
+ signingTime?: number | string | Date;
439
+ /** Wire dialect to emit; defaults to ETSI TS 119 475 v1.2.1 as published */
440
+ dialect?: WRPRCDialect;
441
+ /** Signer function for signing the JWS */
442
+ signer: Signer;
443
+ }
444
+ /** Input for creating a legal person WRPRC */
445
+ interface LegalPersonWRPRCInput {
446
+ /** Trade name (for display) */
447
+ name: string;
448
+ /** Legal name of the organization */
449
+ legalName: string;
450
+ /** Semantic identifier (e.g., "LEIXG-529900T8BM49AURSDO55") */
451
+ identifier: string;
452
+ /** Country code (ISO 3166-1 Alpha-2) */
453
+ country: string;
454
+ /** URL to the national registry API endpoint */
455
+ registryUri: string;
456
+ /** List of entitlement URIs */
457
+ entitlements: string[];
458
+ }
459
+ /** Input for creating a natural person WRPRC */
460
+ interface NaturalPersonWRPRCInput {
461
+ /** Trade name (for display) */
462
+ name: string;
463
+ /** Given name(s) */
464
+ givenName: string;
465
+ /** Family name */
466
+ familyName: string;
467
+ /** Semantic identifier (e.g., "TINIT-RSSMRA85T10A562S") */
468
+ identifier: string;
469
+ /** Country code (ISO 3166-1 Alpha-2) */
470
+ country: string;
471
+ /** URL to the national registry API endpoint */
472
+ registryUri: string;
473
+ /** List of entitlement URIs */
474
+ entitlements: string[];
475
+ }
476
+ //#endregion
477
+ //#region src/builders.d.ts
478
+ /**
479
+ * Builder for creating WRPRC payloads with a fluent API
480
+ */
481
+ export declare class WRPRCBuilder {
482
+ private payload;
483
+ /**
484
+ * Set the trade name (display name) of the WRP
485
+ */
486
+ name(value: string): this;
487
+ /**
488
+ * Set the legal name for a legal person WRP
489
+ */
490
+ legalName(value: string): this;
491
+ /**
492
+ * Set the given name for a natural person WRP
493
+ */
494
+ givenName(value: string): this;
495
+ /**
496
+ * Set the family name for a natural person WRP
497
+ */
498
+ familyName(value: string): this;
499
+ /**
500
+ * Set the WRP identifier (semantic identifier)
501
+ *
502
+ * @param identifier - The semantic identifier following ETSI EN 319 412-1
503
+ * Format: PREFIX (3 chars) + COUNTRY (2 chars) + "-" + ID
504
+ * Examples: "LEIXG-529900T8BM49AURSDO55", "TINIT-RSSMRA85T10A562S"
505
+ */
506
+ identifier(identifier: string): this;
507
+ /**
508
+ * Set the country code (ISO 3166-1 Alpha-2)
509
+ */
510
+ country(code: string): this;
511
+ /**
512
+ * Set the URL to the national registry API endpoint
513
+ */
514
+ registryUri(uri: string): this;
515
+ /**
516
+ * Add a service description in a specific language.
517
+ *
518
+ * `srv_description` is an array of services, each localized into one or more languages
519
+ * (B.2.1). Consecutive calls localize the same service; repeating a language starts the
520
+ * next one.
521
+ */
522
+ serviceDescription(description: string, lang?: string): this;
523
+ /**
524
+ * Add multiple service descriptions (one array per service, with multiple languages)
525
+ */
526
+ addServiceDescriptions(descriptions: MultiLangString[]): this;
527
+ /**
528
+ * Add an entitlement
529
+ *
530
+ * @param entitlement - The entitlement URI or key from WRP_ENTITLEMENTS
531
+ */
532
+ addEntitlement(entitlement: string | (typeof WRP_ENTITLEMENTS)[keyof typeof WRP_ENTITLEMENTS]): this;
533
+ /**
534
+ * Set all entitlements (replaces existing)
535
+ */
536
+ entitlements(entitlements: string[]): this;
537
+ /**
538
+ * Set the privacy policy URL
539
+ */
540
+ privacyPolicy(uri: string): this;
541
+ /**
542
+ * Set the info URI (general-purpose web address)
543
+ */
544
+ infoUri(uri: string): this;
545
+ /**
546
+ * Set the support URI for data requests
547
+ */
548
+ supportUri(uri: string): this;
549
+ /**
550
+ * Set the supervisory authority (Data Protection Authority)
551
+ */
552
+ supervisoryAuthority(authority: SupervisoryAuthority): this;
553
+ /**
554
+ * Set the policy ID(s)
555
+ */
556
+ policyId(ids: string[]): this;
557
+ /**
558
+ * Set the certificate policy URL
559
+ */
560
+ certificatePolicy(uri: string): this;
561
+ /**
562
+ * Set the unique identifier of the certificate (`jti`)
563
+ * If not set, the payload carries no identifier
564
+ *
565
+ * @param id - Identifier from the issuing registry's own scheme.
566
+ */
567
+ certificateId(id: string): this;
568
+ /**
569
+ * Set the issued-at timestamp (Unix timestamp)
570
+ * If not set, will default to current time when building
571
+ */
572
+ issuedAt(timestamp: number | Date): this;
573
+ /**
574
+ * Set the status reference for certificate validity
575
+ */
576
+ status(status: Status): this;
577
+ /**
578
+ * Add a purpose description
579
+ */
580
+ addPurpose(description: string, lang?: string): this;
581
+ /**
582
+ * Set all purposes (replaces existing)
583
+ */
584
+ purposes(purposes: MultiLangString[]): this;
585
+ /**
586
+ * Add a credential that the WRP intends to request
587
+ */
588
+ addCredential(credential: Credential): this;
589
+ /**
590
+ * Add a credential issued by the WRP (Table 8, `provides_attestations`).
591
+ */
592
+ addProvidedAttestation(attestation: ProvidedAttestation): this;
593
+ /**
594
+ * Set intermediary information
595
+ */
596
+ intermediary(intermediary: Intermediary): this;
597
+ /**
598
+ * Mark the WRP as a public sector body (Table 10)
599
+ */
600
+ publicBody(value: boolean): this;
601
+ /**
602
+ * Set the expiry timestamp (Table 10); must be at most 12 months after iat
603
+ */
604
+ expiresAt(timestamp: number | Date): this;
605
+ /**
606
+ * Set the intended-use identifier, used to fetch the intended use from the registry (Table 9)
607
+ */
608
+ intendedUseId(id: string): this;
609
+ /**
610
+ * Build the WRPRC payload
611
+ *
612
+ * @throws WRPRCException if the payload is invalid
613
+ */
614
+ build(): WRPRCPayload;
615
+ }
616
+ /**
617
+ * Builder for creating Credential objects
618
+ */
619
+ export declare class CredentialBuilder {
620
+ private credential;
621
+ /**
622
+ * Set the credential format
623
+ *
624
+ * @param format - The format identifier (e.g., "dc+sd-jwt", "mso_mdoc")
625
+ */
626
+ format(format: string): this;
627
+ /**
628
+ * Set the credential metadata
629
+ *
630
+ * @param meta - Metadata object per credential format specification
631
+ */
632
+ meta(meta: Record<string, unknown>): this;
633
+ /**
634
+ * Set SD-JWT credential metadata (vct_values)
635
+ */
636
+ sdJwtMeta(vctValues: string[]): this;
637
+ /**
638
+ * Set mDL/mDoc credential metadata (doctype_value)
639
+ */
640
+ mdocMeta(doctypeValue: string): this;
641
+ /**
642
+ * Add a claim to request
643
+ */
644
+ addClaim(claim: Claim): this;
645
+ /**
646
+ * Add a simple path claim. Use an integer for an array index and null to select
647
+ * every element of an array, per the DCQL claims path pointer.
648
+ */
649
+ addPathClaim(...path: (string | number | null)[]): this;
650
+ /**
651
+ * Build the Credential object
652
+ */
653
+ build(): Credential;
654
+ }
655
+ /**
656
+ * Create a new WRPRCBuilder
657
+ */
658
+ export declare function wrprc(): WRPRCBuilder;
659
+ /**
660
+ * Create a new CredentialBuilder
661
+ */
662
+ export declare function credential(): CredentialBuilder;
663
+ /**
664
+ * Create a WRPRC payload for a legal person
665
+ */
666
+ export declare function createLegalPersonWRPRC(input: LegalPersonWRPRCInput): WRPRCPayload;
667
+ /**
668
+ * Create a WRPRC payload for a natural person
669
+ */
670
+ export declare function createNaturalPersonWRPRC(input: NaturalPersonWRPRCInput): WRPRCPayload;
671
+ /**
672
+ * Create a simple service provider WRPRC
673
+ */
674
+ export declare function createServiceProviderWRPRC(name: string, legalName: string, identifier: string, country: string, registryUri: string): WRPRCPayload;
675
+ //#endregion
676
+ //#region src/signer.d.ts
677
+ /**
678
+ * Sign a WRPRC payload into a JAdES B-B signed JWT
679
+ *
680
+ * @param options - Signing options including payload, algorithm, certificates, and signer
681
+ * @returns Signed WRPRC with JWS string and decoded parts
682
+ */
683
+ export declare function signWRPRC(options: SignOptions): Promise<SignedWRPRC>;
684
+ /**
685
+ * Decode a signed WRPRC JWT (without cryptographic verification)
686
+ *
687
+ * @param jws - The compact JWS string
688
+ * @returns Decoded WRPRC with header and payload
689
+ */
690
+ export declare function decodeWRPRC(jws: string, accessCertificateSub: string): SignedWRPRC;
691
+ /**
692
+ * Parse a WRPRC JWT without validation (for inspection purposes)
693
+ *
694
+ * @param jws - The compact JWS string
695
+ * @returns Decoded parts without validation
696
+ */
697
+ export declare function parseWRPRC(jws: string): {
698
+ header: unknown;
699
+ payload: unknown;
700
+ signature: string;
701
+ };
702
+ /**
703
+ * Create a WRPRC with automatic timestamp
704
+ *
705
+ * @param payload - Partial payload (iat will be set automatically if not provided)
706
+ * @returns Complete payload with timestamp
707
+ */
708
+ export declare function createWRPRCPayload(payload: WRPRCPayload, accessCertificateSub: string): WRPRCPayload;
709
+ //#endregion
710
+ //#region src/validator.d.ts
711
+ /**
712
+ * Codes for the semantic checks this validator performs, beyond schema parsing.
713
+ *
714
+ * Exposed so a calling application can branch on a specific failure rather than
715
+ * matching on message text. Requirement identifiers from ETSI TS 119 475 v1.2.1
716
+ * are given where a code maps to one.
717
+ */
718
+ export declare const WRPRC_VALIDATION_CODES: {
719
+ /** No entitlement present (GEN-5.2.4-03) */
720
+ readonly MISSING_ENTITLEMENT: 'missing_entitlement';
721
+ /** Sub-entitlement present without its base entitlement (GEN-5.2.4-04) */
722
+ readonly MISSING_BASE_ENTITLEMENT: 'missing_base_entitlement';
723
+ /** Entitlement outside Annex A, which may be a national or EU extension */
724
+ readonly UNKNOWN_ENTITLEMENT: 'unknown_entitlement';
725
+ /** Attestation provider without provides_attestations (GEN-5.2.4-05) */
726
+ readonly MISSING_PROVIDES_ATTESTATIONS: 'missing_provides_attestations';
727
+ /** Service provider without credentials (GEN-5.2.4-06, Table 9) */
728
+ readonly MISSING_CREDENTIALS: 'missing_credentials';
729
+ /** Service provider without purpose (GEN-5.2.4-06, Table 9) */
730
+ readonly MISSING_PURPOSE: 'missing_purpose';
731
+ /** sub does not follow the semantic identifier format of clause 5.1 */
732
+ readonly INVALID_SEMANTIC_IDENTIFIER: 'invalid_semantic_identifier';
733
+ /** sub uses initial characters outside Tables 2 and 4, which may be a national scheme */
734
+ readonly UNKNOWN_IDENTIFIER_PREFIX: 'unknown_identifier_prefix';
735
+ /** sub parses but deviates from the expected identifier shape */
736
+ readonly IDENTIFIER_FORMAT_WARNING: 'identifier_format_warning';
737
+ /** exp more than 12 months after iat (GEN-5.2.4-08) */
738
+ readonly EXP_TOO_LATE: 'exp_too_late';
739
+ /** exp at or before iat */
740
+ readonly EXP_BEFORE_IAT: 'exp_before_iat';
741
+ /** Selected WRPRC identity does not match the access certificate subject */
742
+ readonly ACCESS_CERTIFICATE_IDENTITY_MISMATCH: 'access_certificate_identity_mismatch';
743
+ };
744
+ /** A semantic validation code emitted by this validator */
745
+ type WRPRCValidationCode = (typeof WRPRC_VALIDATION_CODES)[keyof typeof WRPRC_VALIDATION_CODES];
746
+ /**
747
+ * A single validation error
748
+ */
749
+ interface ValidationError {
750
+ /** Path to the invalid field */
751
+ path: string[];
752
+ /** Error message */
753
+ message: string;
754
+ /**
755
+ * Error code. Either a `WRPRCValidationCode` from the semantic checks, or a zod issue
756
+ * code forwarded from schema parsing, so the string stays open for the latter.
757
+ */
758
+ code: WRPRCValidationCode | (string & {});
759
+ }
760
+ /**
761
+ * Result of WRPRC validation
762
+ */
763
+ interface ValidationResult {
764
+ /** Whether the WRPRC is valid */
765
+ valid: boolean;
766
+ /** List of validation errors (empty if valid) */
767
+ errors: ValidationError[];
768
+ /** Warnings that don't invalidate the certificate but should be noted */
769
+ warnings: ValidationError[];
770
+ }
771
+ /**
772
+ * Validate a WRPRC payload against the schema and semantic rules.
773
+ *
774
+ * @param accessCertificateSub Required subject from the presented access certificate.
775
+ */
776
+ export declare function validateWRPRCPayload(payload: unknown, accessCertificateSub: string): ValidationResult;
777
+ /**
778
+ * Validate a JWT header for WRPRC
779
+ */
780
+ export declare function validateWRPRCJWTHeader(header: unknown): ValidationResult;
781
+ /**
782
+ * Validate a complete WRPRC (header + payload)
783
+ */
784
+ export declare function validateWRPRC(header: unknown, payload: unknown, accessCertificateSub: string): ValidationResult;
785
+ /**
786
+ * Check if payload represents a legal person
787
+ */
788
+ export declare function isLegalPersonWRPRC(payload: WRPRCPayload): boolean;
789
+ /**
790
+ * Check if payload represents a natural person
791
+ */
792
+ export declare function isNaturalPersonWRPRC(payload: WRPRCPayload): boolean;
793
+ /**
794
+ * Validate as legal person WRPRC
795
+ */
796
+ export declare function validateLegalPersonWRPRC(payload: unknown): ValidationResult;
797
+ /**
798
+ * Validate as natural person WRPRC
799
+ */
800
+ export declare function validateNaturalPersonWRPRC(payload: unknown): ValidationResult;
801
+ /**
802
+ * Assert that a WRPRC payload is valid, throws WRPRCException if not
803
+ */
804
+ export declare function assertValidWRPRCPayload(payload: unknown, accessCertificateSub: string): asserts payload is WRPRCPayload;
805
+ /**
806
+ * Parse a WRPRC payload into its canonical form, accepting either dialect spelling.
807
+ *
808
+ * @throws WRPRCException if the payload is invalid
809
+ */
810
+ export declare function parseWRPRCPayload(payload: unknown, accessCertificateSub: string): WRPRCPayload;
811
+ /**
812
+ * Assert that a WRPRC is valid (header + payload), throws WRPRCException if not
813
+ */
814
+ export declare function assertValidWRPRC(header: unknown, payload: unknown, accessCertificateSub: string): void;
815
+ //#endregion
816
+ //#region src/wrprc-exception.d.ts
817
+ /**
818
+ * WRPRCException is a custom error class for WRPRC-related exceptions.
819
+ */
820
+ export declare class WRPRCException extends IdentityException {
821
+ constructor(message: string, details?: unknown);
822
+ }
823
+ //#endregion
824
+ export type { Claim, Credential, Intermediary, LegalPersonSubject, LegalPersonWRPRCInput, MultiLangString, NaturalPersonSubject, NaturalPersonWRPRCInput, ProvidedAttestation, SignOptions, SignedWRPRC, Status, SupervisoryAuthority, ValidationError, ValidationResult, WRPRCCWTHeader, WRPRCDialect, WRPRCJWTHeader, WRPRCPayload, WRPRCValidationCode };
825
+ //# sourceMappingURL=index.d.cts.map