@idos-network/credentials 1.5.0 → 2.2.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.
Files changed (82) hide show
  1. package/README.md +289 -85
  2. package/assets/idos-credential-subject-edd-v1.json +10 -0
  3. package/assets/idos-credential-subject-v1.json +1 -1
  4. package/assets/idos-credential-subject-v2.json +1 -1
  5. package/assets/idos-credential-subject-v3.json +83 -0
  6. package/assets/idos-credentials-v1.json +2 -2
  7. package/assets/idos-credentials-v2.json +10 -0
  8. package/dist/index-0NqXMjNk.d.mts +395 -0
  9. package/dist/index-0NqXMjNk.d.mts.map +1 -0
  10. package/dist/index-WW372Tf5.d.mts +57 -0
  11. package/dist/index-WW372Tf5.d.mts.map +1 -0
  12. package/dist/index.mjs +1 -1
  13. package/dist/loader-Cg6hs1-P.mjs +2 -0
  14. package/dist/loader-Cg6hs1-P.mjs.map +1 -0
  15. package/dist/parser/index.d.mts +19 -0
  16. package/dist/parser/index.d.mts.map +1 -0
  17. package/dist/parser/index.mjs +2 -0
  18. package/dist/parser/index.mjs.map +1 -0
  19. package/dist/schemas/index.d.mts +2 -0
  20. package/dist/schemas/index.mjs +1 -0
  21. package/dist/schemas-BVGuUlPe.mjs +2 -0
  22. package/dist/schemas-BVGuUlPe.mjs.map +1 -0
  23. package/dist/types/index.d.mts +2 -134
  24. package/dist/types/index.mjs +1 -63
  25. package/dist/utils/index.d.mts +37 -15
  26. package/dist/utils/index.d.mts.map +1 -1
  27. package/dist/utils/index.mjs +1 -116
  28. package/dist/utils/index.mjs.map +1 -1
  29. package/dist/verifier/index.d.mts +8 -0
  30. package/dist/verifier/index.d.mts.map +1 -0
  31. package/dist/verifier/index.mjs +2 -0
  32. package/dist/verifier/index.mjs.map +1 -0
  33. package/package.json +23 -10
  34. package/src/parser/index.test.ts +266 -0
  35. package/src/parser/index.ts +69 -0
  36. package/src/schemas/EddV1/index.test.ts +40 -0
  37. package/src/schemas/EddV1/index.ts +53 -0
  38. package/src/schemas/Envelope.ts +37 -0
  39. package/src/schemas/FaceIdV1/index.test.ts +26 -0
  40. package/src/schemas/FaceIdV1/index.ts +33 -0
  41. package/src/schemas/KycV1/IdDocument.ts +41 -0
  42. package/src/schemas/KycV1/ResidentialAddress.ts +56 -0
  43. package/src/schemas/KycV1/Subject.ts +86 -0
  44. package/src/schemas/KycV1/index.test.ts +156 -0
  45. package/src/schemas/KycV1/index.ts +40 -0
  46. package/src/schemas/KycV2/Subject.ts +67 -0
  47. package/src/schemas/KycV2/index.test.ts +162 -0
  48. package/src/schemas/KycV2/index.ts +45 -0
  49. package/src/schemas/KycV3/Biometric.ts +14 -0
  50. package/src/schemas/KycV3/Contact.ts +13 -0
  51. package/src/schemas/KycV3/EDD.ts +32 -0
  52. package/src/schemas/KycV3/IdDocument.ts +92 -0
  53. package/src/schemas/KycV3/Onboarding.ts +36 -0
  54. package/src/schemas/KycV3/Person.ts +105 -0
  55. package/src/schemas/KycV3/ResidentialAddress.ts +73 -0
  56. package/src/schemas/KycV3/Screening.ts +27 -0
  57. package/src/schemas/KycV3/SourceOfWealth.ts +44 -0
  58. package/src/schemas/KycV3/Subject.ts +54 -0
  59. package/src/schemas/KycV3/index.test.ts +682 -0
  60. package/src/schemas/KycV3/index.ts +108 -0
  61. package/src/schemas/VerifiableCredential.ts +232 -0
  62. package/src/schemas/enums.ts +126 -0
  63. package/src/schemas/index.ts +14 -0
  64. package/src/schemas/integration.test.ts +251 -0
  65. package/src/schemas/types.ts +11 -0
  66. package/src/schemas/utils.ts +274 -0
  67. package/src/types/credentials.ts +18 -249
  68. package/src/utils/{utils.test.ts → index.test.ts} +59 -67
  69. package/src/utils/index.ts +129 -134
  70. package/src/utils/issuer.ts +42 -0
  71. package/src/{builder → utils}/loader.ts +22 -17
  72. package/src/verifier/index.test.ts +149 -0
  73. package/src/{builder/verifier.ts → verifier/index.ts} +4 -8
  74. package/types/internals.d.ts +11 -6
  75. package/dist/builder/index.d.mts +0 -19
  76. package/dist/builder/index.d.mts.map +0 -1
  77. package/dist/builder/index.mjs +0 -619
  78. package/dist/builder/index.mjs.map +0 -1
  79. package/dist/types/index.d.mts.map +0 -1
  80. package/dist/types/index.mjs.map +0 -1
  81. package/src/builder/builder.test.ts +0 -407
  82. package/src/builder/index.ts +0 -122
@@ -0,0 +1,395 @@
1
+ import { i as VerifiableCredential, t as AvailableIssuerType } from "./index-WW372Tf5.mjs";
2
+ //#region src/schemas/enums.d.ts
3
+ declare const IntendedUses: readonly ["INVESTING", "PAYMENT_TO_FRIENDS_FAMILY_OR_OTHERS", "PURCHASE_DIGITAL_ASSETS", "ONLINE_PURCHASES_OF_GOODS_OR_SERVICES", "TRADING"];
4
+ type IntendedUse = (typeof IntendedUses)[number];
5
+ declare const IDDocumentTypes: readonly ["PASSPORT", "DRIVERS", "ID_CARD", "VOTING_CARD", "PAN_CARD", "INTERNAL_PASSPORT", "RESIDENCE_PERMIT"];
6
+ type IDDocumentType = (typeof IDDocumentTypes)[number];
7
+ declare const ResidentialAddressSources: readonly ["MANUAL", "GPS", "EXTERNAL_DB", "PROOF_OF_ADDRESS", "PROOF_OF_IDENTITY", "AUTO_COMPLETE"];
8
+ type ResidentialAddressSource = (typeof ResidentialAddressSources)[number];
9
+ declare const ScreeningResults: readonly ["CLEAR", "NOT_CHECKED"];
10
+ type ScreeningResult = (typeof ScreeningResults)[number];
11
+ declare const Genders: readonly ["M", "F", "OTHER"];
12
+ type Gender = (typeof Genders)[number];
13
+ declare const EmploymentStatuses: readonly ["EMPLOYED", "SELF_EMPLOYED", "UNEMPLOYED", "RETIRED", "STUDENT"];
14
+ type EmploymentStatus = (typeof EmploymentStatuses)[number];
15
+ declare const ExpectedMonthlyTransactionCounts: readonly ["LESS_THAN_5", "BETWEEN_5_AND_10", "MORE_THAN_10"];
16
+ type ExpectedMonthlyTransactionCount = (typeof ExpectedMonthlyTransactionCounts)[number];
17
+ declare const ExpectedMonthlyTransactionVolumes: readonly ["LESS_THAN_500", "MORE_THAN_500_LESS_THAN_2000", "MORE_THAN_2000"];
18
+ type ExpectedMonthlyTransactionVolume = (typeof ExpectedMonthlyTransactionVolumes)[number];
19
+ declare const SourceOfWealthTypes: readonly ["SALARY", "SAVINGS", "INVESTMENTS", "CRYPTO_TRADING", "OTHER"];
20
+ type SourceOfWealthType = (typeof SourceOfWealthTypes)[number];
21
+ declare const YearlyGrossIncomes: readonly ["LESS_THAN_20000", "FROM_20001_TO_30000", "FROM_30001_TO_40000", "FROM_40001_TO_50000", "FROM_50001_TO_60000", "FROM_60001_TO_70000", "FROM_70001_TO_80000", "FROM_80001_TO_90000", "FROM_90001_TO_100000", "FROM_100001_TO_110000", "FROM_110001_TO_120000", "FROM_120001_TO_130000", "FROM_130001_TO_140000", "FROM_140001_TO_150000", "FROM_150001_TO_200000", "FROM_200001_TO_500000", "MORE_THAN_500000"];
22
+ type YearlyGrossIncome = (typeof YearlyGrossIncomes)[number];
23
+ declare const ApproximateNetWorths: readonly ["UP_TO_25000", "BETWEEN_25001_AND_50000", "BETWEEN_50001_AND_100000", "BETWEEN_100001_AND_300000", "BETWEEN_300001_AND_500000", "BETWEEN_500001_AND_1000000", "OVER_1000001"];
24
+ type ApproximateNetWorth = (typeof ApproximateNetWorths)[number];
25
+ declare const Occupations: readonly ["AGRICULTURE", "ARTS_AND_ENTERTAINMENT", "CONSTRUCTION", "EDUCATION", "FINANCIAL_SERVICES", "INFORMATION_AND_TECHNOLOGY", "RETAIL", "REAL_ESTATE", "OTHER", "BUSINESS_OWNER", "HEALTHCARE", "INDUSTRIAL", "LEGAL_SERVICES", "PUBLIC_SECTOR", "SENIOR_MANAGEMENT"];
26
+ type Occupation = (typeof Occupations)[number];
27
+ declare const Currencies: readonly ["EUR", "USD", "GBP", "OTHER"];
28
+ type Currency = (typeof Currencies)[number];
29
+ //#endregion
30
+ //#region src/schemas/types.d.ts
31
+ /**
32
+ * A value a credential may publish in its unencrypted public notes.
33
+ *
34
+ * A `Date` is accepted here, but public notes travel as JSON: once stored, a `Date` is an
35
+ * ISO string, and every consumer reads it as one.
36
+ */
37
+ type PublicNotesAllowedValues = number | string | Date | undefined;
38
+ type PublicNotes = Record<string, PublicNotesAllowedValues | Record<string, PublicNotesAllowedValues> | undefined>;
39
+ //#endregion
40
+ //#region src/schemas/VerifiableCredential.d.ts
41
+ type Ctor<T> = new () => T;
42
+ /** The sections of a subject class, with their optionality dropped. */
43
+ type Sections<TSubject> = { [K in keyof TSubject]-?: NonNullable<TSubject[K]>; };
44
+ /**
45
+ * The fields of a class that are not sections: a subject's `id`, an envelope's own fields.
46
+ * Sections are the properties holding another class; everything a credential carries as a
47
+ * value is one of the types below.
48
+ */
49
+ type OwnFields<T> = Partial<Pick<T, { [K in keyof T]-?: NonNullable<T[K]> extends string | number | boolean | Date | Buffer ? K : never; }[keyof T]>>;
50
+ /**
51
+ * A credential under construction: an envelope and a subject built up section by section,
52
+ * validated as a whole, then flattened for issuance.
53
+ *
54
+ * Both halves stay partial until `checkValidity()` runs — proving them complete is the
55
+ * point of that call.
56
+ */
57
+ declare abstract class VerifiableCredentialBase<TEnvelope extends object, TSubject extends object> {
58
+ private readonly envelopeClass;
59
+ private readonly subjectClass;
60
+ static readonly envelopeContext: string;
61
+ static readonly subjectContext: string;
62
+ readonly envelope: Partial<TEnvelope>;
63
+ readonly subject: Partial<TSubject>;
64
+ protected constructor(envelopeClass: Ctor<TEnvelope>, subjectClass: Ctor<TSubject>);
65
+ /**
66
+ * Adds one section of the subject. Fields the section does not declare are rejected: they
67
+ * would silently vanish on serialization, and a caller who misspells one deserves to hear
68
+ * about it rather than issue a credential missing the field.
69
+ *
70
+ * Pass `validate: false` to defer value checks to `checkValidity()`; the extra-field check
71
+ * always runs.
72
+ */
73
+ addSection<K extends keyof TSubject>(section: K, fields: Sections<TSubject>[K], validate?: boolean): this;
74
+ /**
75
+ * Sets the subject's own fields — the ones that are not a section, such as `id`. Unknown
76
+ * fields are rejected for the same reason `addSection` rejects them.
77
+ *
78
+ * Values are checked by `checkValidity()`, since a field left out here may still be filled
79
+ * in by `setMissingFields()` later.
80
+ */
81
+ setSubject(fields: OwnFields<TSubject>): this;
82
+ /** `setSubject`, for the envelope: `id`, `issued`, `approvedAt`, `expirationDate`. */
83
+ setEnvelope(fields: OwnFields<TEnvelope>): this;
84
+ /**
85
+ * Fills in the fields this credential derives from its own contents, then validates both
86
+ * halves. Throws `CredentialValidationError` if either is incomplete or invalid.
87
+ */
88
+ checkValidity(): void;
89
+ /** The flat credential subject, with its `@context`. */
90
+ serializeSubject(): Record<string, unknown>;
91
+ /** The flat envelope fields. */
92
+ serializeEnvelope(): Record<string, unknown>;
93
+ /** Signs the credential with `issuer`, producing a verifiable credential. */
94
+ issue(issuer: AvailableIssuerType): Promise<VerifiableCredential<unknown>>;
95
+ /**
96
+ * Rebuilds envelope and subject from a serialized credential.
97
+ *
98
+ * A subject key the class does not declare is an error: the subject context defines the
99
+ * subject exhaustively, so an unknown key means the credential does not match the
100
+ * `@context` it claims, and reading it anyway would silently discard what it carried.
101
+ *
102
+ * The envelope is the lenient half — a credential carries W3C fields of its own there
103
+ * (`proof`, `issuanceDate`, `type`, `issuer`), which are dropped rather than rejected.
104
+ *
105
+ * SECURITY: this does not verify the signature. See `verifyCredential()`.
106
+ */
107
+ deserialize(credential: VerifiableCredential<unknown>): Promise<void>;
108
+ /** The credential's level, derived from its contents. */
109
+ abstract level(): string;
110
+ /** The credential's public notes, stored unencrypted alongside it. */
111
+ abstract publicNotes(): PublicNotes;
112
+ /**
113
+ * The class's own fields, transformed onto an instance. Fields the class does not declare, or
114
+ * declares as a section rather than a value, are rejected as they are by `add`.
115
+ */
116
+ private ownFields;
117
+ /** The subclass's static contexts, reached through the instance. */
118
+ private get contexts();
119
+ /** Fills in derived envelope fields left unset by the caller. */
120
+ protected setMissingFields(): void;
121
+ }
122
+ //#endregion
123
+ //#region src/schemas/Envelope.d.ts
124
+ /** The envelope: the credential's own fields, alongside `credentialSubject`. */
125
+ declare class EnvelopeV1 {
126
+ id: string;
127
+ level: string;
128
+ approvedAt?: Date;
129
+ }
130
+ /** `EnvelopeV1` plus a numeric KYC level and the issuance/expiry dates. */
131
+ declare class EnvelopeV2 extends EnvelopeV1 {
132
+ kycLevel?: number;
133
+ issued?: Date;
134
+ expirationDate?: Date;
135
+ }
136
+ //#endregion
137
+ //#region src/schemas/EddV1/index.d.ts
138
+ /** The same fields as KycV3's `edd` section, here as a credential of its own. */
139
+ declare class EDD$1 {
140
+ occupation?: Occupation;
141
+ sourceOfFundsCategory?: string;
142
+ sourceOfFundsProofFile?: Buffer;
143
+ }
144
+ declare class Subject$4 {
145
+ id: string;
146
+ edd: EDD$1;
147
+ }
148
+ declare class EddV1 extends VerifiableCredentialBase<EnvelopeV1, Subject$4> {
149
+ static readonly envelopeContext: string;
150
+ static readonly subjectContext: string;
151
+ constructor();
152
+ override level(): string;
153
+ override publicNotes(): PublicNotes;
154
+ }
155
+ //#endregion
156
+ //#region src/schemas/FaceIdV1/index.d.ts
157
+ declare class Subject$3 {
158
+ faceSignUserId: string;
159
+ }
160
+ declare class FaceIdV1 extends VerifiableCredentialBase<EnvelopeV1, Subject$3> {
161
+ static readonly envelopeContext: string;
162
+ static readonly subjectContext: string;
163
+ constructor();
164
+ override level(): string;
165
+ override publicNotes(): PublicNotes;
166
+ }
167
+ //#endregion
168
+ //#region src/schemas/KycV1/IdDocument.d.ts
169
+ /** The identity document, as v1 and v2 describe it: every field optional and untyped. */
170
+ declare class IdDocument$1 {
171
+ country?: string;
172
+ number?: string;
173
+ type?: string;
174
+ dateOfIssue?: Date;
175
+ dateOfExpiry?: Date;
176
+ frontFile?: Buffer;
177
+ backFile?: Buffer;
178
+ }
179
+ //#endregion
180
+ //#region src/schemas/KycV1/ResidentialAddress.d.ts
181
+ /** The residential address, as v1 and v2 describe it: every field optional, no `verified` flag. */
182
+ declare class ResidentialAddress$1 {
183
+ street?: string;
184
+ houseNumber?: string;
185
+ additionalAddressInfo?: string;
186
+ region?: string;
187
+ city?: string;
188
+ postalCode?: string;
189
+ country?: string;
190
+ proofCategory?: string;
191
+ proofDateOfIssue?: Date;
192
+ proofFile?: Buffer;
193
+ }
194
+ //#endregion
195
+ //#region src/schemas/KycV1/Subject.d.ts
196
+ declare class Subject$2 {
197
+ id: string;
198
+ applicantId?: string;
199
+ inquiryId?: string;
200
+ firstName?: string;
201
+ middleName?: string;
202
+ nationality?: string;
203
+ familyName?: string;
204
+ maidenName?: string;
205
+ gender?: string;
206
+ governmentId?: string;
207
+ governmentIdType?: string;
208
+ email?: string;
209
+ ssn?: string;
210
+ phoneNumber?: string;
211
+ dateOfBirth?: Date;
212
+ placeOfBirth?: string;
213
+ selfieFile?: Buffer;
214
+ idDocument?: IdDocument$1;
215
+ residentialAddress?: ResidentialAddress$1;
216
+ }
217
+ //#endregion
218
+ //#region src/schemas/KycV1/index.d.ts
219
+ declare class KycV1 extends VerifiableCredentialBase<EnvelopeV1, Subject$2> {
220
+ static readonly envelopeContext: string;
221
+ static readonly subjectContext: string;
222
+ constructor();
223
+ override level(): string;
224
+ override publicNotes(): PublicNotes;
225
+ }
226
+ //#endregion
227
+ //#region src/schemas/KycV2/Subject.d.ts
228
+ /** v1's subject, minus the applicant/inquiry and government-id fields v2 dropped. */
229
+ declare class Subject$1 {
230
+ id: string;
231
+ firstName?: string;
232
+ middleName?: string;
233
+ nationality?: string;
234
+ familyName?: string;
235
+ maidenName?: string;
236
+ gender?: string;
237
+ email?: string;
238
+ phoneNumber?: string;
239
+ ssn?: string;
240
+ dateOfBirth?: Date;
241
+ placeOfBirth?: string;
242
+ selfieFile?: Buffer;
243
+ idDocument?: IdDocument$1;
244
+ residentialAddress?: ResidentialAddress$1;
245
+ }
246
+ //#endregion
247
+ //#region src/schemas/KycV2/index.d.ts
248
+ declare class KycV2 extends VerifiableCredentialBase<EnvelopeV2, Subject$1> {
249
+ static readonly envelopeContext: string;
250
+ static readonly subjectContext: string;
251
+ constructor();
252
+ override level(): string;
253
+ override publicNotes(): PublicNotes;
254
+ }
255
+ //#endregion
256
+ //#region src/schemas/KycV3/Biometric.d.ts
257
+ declare class Biometric {
258
+ selfieFile: Buffer;
259
+ selfieMatch?: number;
260
+ }
261
+ //#endregion
262
+ //#region src/schemas/KycV3/Contact.d.ts
263
+ declare class Contact {
264
+ email?: string;
265
+ phoneNumber?: string;
266
+ }
267
+ //#endregion
268
+ //#region src/schemas/KycV3/EDD.d.ts
269
+ declare class EDD {
270
+ occupation?: Occupation;
271
+ sourceOfFundsCategory?: string;
272
+ sourceOfFundsProofFile?: Buffer;
273
+ sourceOfFundsProofFileType?: string;
274
+ sourceOfFundsProofFileName?: string;
275
+ }
276
+ //#endregion
277
+ //#region src/schemas/KycV3/IdDocument.d.ts
278
+ declare class IdDocument {
279
+ type: IDDocumentType;
280
+ number: string;
281
+ country: string;
282
+ dateOfExpiry?: Date;
283
+ dateOfIssue?: Date;
284
+ issuingAuthority?: string;
285
+ frontFile: Buffer;
286
+ frontFileType: string;
287
+ frontFileName: string;
288
+ backFile?: Buffer;
289
+ backFileType?: string;
290
+ backFileName?: string;
291
+ mrzLine1?: string;
292
+ title?: string;
293
+ extendedValidUntil?: Date;
294
+ additionalNumber?: string;
295
+ ethnicity?: string;
296
+ issuingSubdivision?: string;
297
+ }
298
+ //#endregion
299
+ //#region src/schemas/KycV3/Onboarding.d.ts
300
+ declare class Onboarding {
301
+ intendedUse: IntendedUse;
302
+ employmentStatus: EmploymentStatus;
303
+ expectedMonthlyTransactionCount: ExpectedMonthlyTransactionCount;
304
+ expectedMonthlyTransactionVolume: ExpectedMonthlyTransactionVolume;
305
+ expectedMonthlyTransactionVolumeCurrency: Currency;
306
+ }
307
+ //#endregion
308
+ //#region src/schemas/KycV3/Person.d.ts
309
+ declare class Person {
310
+ firstName?: string;
311
+ familyName?: string;
312
+ middleName?: string;
313
+ fatherName?: string;
314
+ maidenName?: string;
315
+ motherName?: string;
316
+ gender?: Gender;
317
+ nationality?: string;
318
+ secondNationality?: string;
319
+ dateOfBirth: Date;
320
+ placeOfBirth?: string;
321
+ regionOfBirth?: string;
322
+ stateless?: boolean;
323
+ refugeeStatus?: boolean;
324
+ subsidiaryProtectionStatus?: boolean;
325
+ nationalIdNumber?: string;
326
+ taxIdNumber?: string;
327
+ taxIdIssuingCountry?: string;
328
+ taxResidenceCountry?: string;
329
+ ssn?: string;
330
+ }
331
+ //#endregion
332
+ //#region src/schemas/KycV3/ResidentialAddress.d.ts
333
+ declare class ResidentialAddress {
334
+ source: ResidentialAddressSource;
335
+ street: string;
336
+ houseNumber?: string;
337
+ additionalAddressInfo?: string;
338
+ region?: string;
339
+ city: string;
340
+ postalCode?: string;
341
+ country: string;
342
+ proofCategory?: string;
343
+ proofDateOfIssue?: Date;
344
+ proofFile?: Buffer;
345
+ proofFileType?: string;
346
+ proofFileName?: string;
347
+ ipCountry?: string;
348
+ }
349
+ //#endregion
350
+ //#region src/schemas/KycV3/Screening.d.ts
351
+ declare class Screening {
352
+ sanctionsCheckResult: ScreeningResult;
353
+ sanctionsConfidenceScore?: number;
354
+ pepCheckResult: ScreeningResult;
355
+ pepConfidenceScore?: number;
356
+ }
357
+ //#endregion
358
+ //#region src/schemas/KycV3/SourceOfWealth.d.ts
359
+ declare class SourceOfWealth {
360
+ type: SourceOfWealthType;
361
+ yearlyGrossIncome?: YearlyGrossIncome;
362
+ yearlyGrossIncomeCurrency?: Currency;
363
+ approximateNetWorth?: ApproximateNetWorth;
364
+ approximateNetWorthCurrency?: Currency;
365
+ sourceOfWealthProofFile?: Buffer;
366
+ }
367
+ //#endregion
368
+ //#region src/schemas/KycV3/Subject.d.ts
369
+ /** The credential subject: the sections that get flattened onto the wire. */
370
+ declare class Subject {
371
+ id: string;
372
+ person: Person;
373
+ idDocument?: IdDocument;
374
+ contact?: Contact;
375
+ biometric?: Biometric;
376
+ residentialAddress?: ResidentialAddress;
377
+ screening?: Screening;
378
+ edd?: EDD;
379
+ sourceOfWealth?: SourceOfWealth;
380
+ onboarding?: Onboarding;
381
+ }
382
+ //#endregion
383
+ //#region src/schemas/KycV3/index.d.ts
384
+ declare class KycV3 extends VerifiableCredentialBase<EnvelopeV2, Subject> {
385
+ static readonly envelopeContext: string;
386
+ static readonly subjectContext: string;
387
+ constructor();
388
+ override level(): string;
389
+ kycLevel(): number;
390
+ override publicNotes(): PublicNotes;
391
+ protected override setMissingFields(): void;
392
+ }
393
+ //#endregion
394
+ export { Occupations as A, Gender as C, IntendedUse as D, IDDocumentTypes as E, SourceOfWealthType as F, SourceOfWealthTypes as I, YearlyGrossIncome as L, ResidentialAddressSources as M, ScreeningResult as N, IntendedUses as O, ScreeningResults as P, YearlyGrossIncomes as R, ExpectedMonthlyTransactionVolumes as S, IDDocumentType as T, EmploymentStatus as _, FaceIdV1 as a, ExpectedMonthlyTransactionCounts as b, EnvelopeV2 as c, VerifiableCredentialBase as d, PublicNotes as f, Currency as g, Currencies as h, KycV1 as i, ResidentialAddressSource as j, Occupation as k, OwnFields as l, ApproximateNetWorths as m, Subject as n, EddV1 as o, ApproximateNetWorth as p, KycV2 as r, EnvelopeV1 as s, KycV3 as t, Sections as u, EmploymentStatuses as v, Genders as w, ExpectedMonthlyTransactionVolume as x, ExpectedMonthlyTransactionCount as y };
395
+ //# sourceMappingURL=index-0NqXMjNk.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-0NqXMjNk.d.mts","names":[],"sources":["../src/schemas/enums.ts","../src/schemas/types.ts","../src/schemas/VerifiableCredential.ts","../src/schemas/Envelope.ts","../src/schemas/EddV1/index.ts","../src/schemas/FaceIdV1/index.ts","../src/schemas/KycV1/IdDocument.ts","../src/schemas/KycV1/ResidentialAddress.ts","../src/schemas/KycV1/Subject.ts","../src/schemas/KycV1/index.ts","../src/schemas/KycV2/Subject.ts","../src/schemas/KycV2/index.ts","../src/schemas/KycV3/Biometric.ts","../src/schemas/KycV3/Contact.ts","../src/schemas/KycV3/EDD.ts","../src/schemas/KycV3/IdDocument.ts","../src/schemas/KycV3/Onboarding.ts","../src/schemas/KycV3/Person.ts","../src/schemas/KycV3/ResidentialAddress.ts","../src/schemas/KycV3/Screening.ts","../src/schemas/KycV3/SourceOfWealth.ts","../src/schemas/KycV3/Subject.ts","../src/schemas/KycV3/index.ts"],"mappings":";;cAKa;KAOD,sBAAsB;cAErB;KASD,yBAAyB;cAExB;KAQD,mCAAmC;cAElC;KACD,0BAA0B;cAEzB;KACD,iBAAiB;cAEhB;KAOD,2BAA2B;cAE1B;KAKD,0CAA0C;cAEzC;KAKD,2CAA2C;cAE1C;KAOD,6BAA6B;cAE5B;KAmBD,4BAA4B;cAE3B;KASD,8BAA8B;cAE7B;KAiBD,qBAAqB;cAEpB;KACD,mBAAmB;;;;;;;;;KCvHnB,6CAA6C;KAC7C,cAAc,eAExB,2BAA2B,eAAe;;;KCcvC,KAAK,eAAe;;KAGb,SAAS,eAClB,WAAW,aAAa,YAAY,SAAS;;;;;;KAQpC,UAAU,KAAK,QACzB,KACE,MAEG,WAAW,MAAM,YAAY,EAAE,wCAAwC,OAAO,SAC3E,mBAEE;;;;;;;;uBAWU,yBAAyB,0BAA0B;mBAarE;mBACA;kBARsB;kBACA;WAEf,UAAU,QAAQ;WAClB,SAAS,QAAQ;YAEhB,YACR,eAAgC,KAAK,YACrC,cAA+B,KAAK;;;;;;;;;EAWtC,WAAW,gBAAgB,UACzB,SAAS,GACT,QAAQ,SAAS,UAAU,IAC3B;;;;;;;;EAkCF,WAAW,QAAQ,UAAU;;EAO7B,YAAY,QAAQ,UAAU;;;;;EAU9B;;EAQA,oBAAoB;;EAUpB,qBAAqB;;EAOrB,MAAY,QAAQ,sBAAsB,QAAQ;;;;;;;;;;;;;EA8BlD,YAAkB,YAAY,gCAAgC;;WAiBrD;;WAGA,eAAe;;;;;UAMhB;;cAUI;;YAKF;;;;;cC/NC;EACX;EAIA;EAIA,aAEa;;;cAIF,mBAAmB;EAE9B;EAMA,SAES;EAGT,iBAEiB;;;;;cCxBN;EAEX,aAEa;EAGb;EAKA,yBAEyB;;cAGd;EACX;EAGA,KAEK;;cAGM,cAAc,yBAAyB,YAAY;kBAC9C;kBACA;EAEhB;WAIS;WAIA,eAAe;;;;cCrCb;EACX;;cAIW,iBAAiB,yBAAyB,YAAY;kBACjD;kBACA;EAEhB;WAIS;WAIA,eAAe;;;;;cCxBb;EAEX;EAKA;EAKA;EAKA,cAEc;EAGd,eAEe;EAGf,YAEY;EAGZ,WAEW;;;;;cClCA;EAEX;EAKA;EAKA;EAKA;EAKA;EAKA;EAKA;EAKA;EAKA,mBAEmB;EAGnB,YAEY;;;;cC5CD;EACX;EAGA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA,cAEc;EAEd;EAIA,aAEa;EAEb,aAEa;EAEb,qBAEqB;;;;cC7EV,cAAc,yBAAyB,YAAY;kBAC9C;kBACA;EAEhB;WAIS;WAqBA,eAAe;;;;;cC7Bb;EACX;EAGA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA;EAIA,cAEc;EAEd;EAIA,aAEa;EAEb,aAEa;EAEb,qBAEqB;;;;cCrDV,cAAc,yBAAyB,YAAY;kBAC9C;kBACA;EAEhB;WAIS;WAqBA,eAAe;;;;cCrCb;EAEX,YACY;EAGZ;;;;cCRW;EAEX;EAKA;;;;cCJW;EAEX,aAEa;EAGb;EAKA,yBAEyB;EAGzB;EAMA;;;;cCvBW;EAEX,MACM;EAGN;EAIA;EAIA,eAEe;EAGf,cAEc;EAGd;EAKA,WACW;EAGX;EAKA;EAIA,WAEW;EAGX;EAMA;EAKA;EAKA;EAKA,qBAEqB;EAGrB;EAKA;EAKA;;;;cCzEW;EAEX,aACa;EAGb,kBACkB;EAGlB,iCACiC;EAGjC,kCACkC;EAGlC,0CAC0C;;;;cC7B/B;EAEX;EAKA;EAKA;EAKA;EAKA;EAKA;EAKA,SAES;EAGT;EAKA;EAKA,aACa;EAGb;EAKA;EAKA;EAKA;EAKA;EAKA;EAKA;EAKA;EAKA;EAKA;;;;cChGW;EAEX,QACQ;EAGR;EAIA;EAKA;EAKA;EAKA;EAIA;EAKA;EAIA;EAKA,mBAEmB;EAGnB,YAEY;EAGZ;EAMA;EAKA;;;;cCjEW;EAEX,sBACsB;EAGtB;EAOA,gBACgB;EAGhB;;;;cCPW;EAEX,MACM;EAGN,oBAEoB;EAGpB,4BAE4B;EAG5B,sBAEsB;EAGtB,8BAE8B;EAG9B,0BAE0B;;;;;cC5Bf;EACX;EAGA,QAEQ;EAER,aAEa;EAEb,UAEU;EAEV,YAEY;EAEZ,qBAEqB;EAErB,YAEY;EAEZ,MAEM;EAEN,iBAEiB;EAEjB,aAEa;;;;cC7CF,cAAc,yBAAyB,YAAY;kBAC9C;kBACA;EAEhB;WAIS;EA8CT;WA4BS,eAAe;qBAQL"}
@@ -0,0 +1,57 @@
1
+ import { Ed25519VerificationKey2020, Ed25519VerificationKey2020Options } from "@digitalbazaar/ed25519-verification-key-2020";
2
+ //#region src/types/credentials.d.ts
3
+ type idOSCredential = {
4
+ id: string;
5
+ user_id: string;
6
+ public_notes: string;
7
+ content_uri: string;
8
+ content_size: number;
9
+ encryptor_public_key: string;
10
+ issuer_auth_public_key: string;
11
+ original_id?: string | null;
12
+ inserter_type?: string | null;
13
+ inserter_id?: string | null;
14
+ };
15
+ type idOSCredentialRecord = Omit<idOSCredential, "content_uri" | "content_size"> & {
16
+ content: string | null;
17
+ content_uri?: string | null;
18
+ content_size?: number | null;
19
+ };
20
+ type SignedCredentialContentReference = {
21
+ public_notes: string;
22
+ public_notes_signature: string;
23
+ broader_signature: string;
24
+ issuer_auth_public_key: string;
25
+ };
26
+ interface VerifiableCredentialProof {
27
+ type: string;
28
+ created: string;
29
+ verificationMethod: string;
30
+ proofValue: string;
31
+ proofPurpose: string;
32
+ }
33
+ interface VerifiableCredential<K> {
34
+ "@context": string[];
35
+ type: string[];
36
+ issuer: string;
37
+ id: string;
38
+ level: string;
39
+ kycLevel?: number;
40
+ issued: string;
41
+ approvedAt: string;
42
+ expirationDate?: string;
43
+ credentialSubject: K;
44
+ issuanceDate: string;
45
+ proof: VerifiableCredentialProof;
46
+ }
47
+ //#endregion
48
+ //#region src/types/issuers.d.ts
49
+ interface CustomIssuerType {
50
+ issuer: string;
51
+ publicKeyMultibase: string;
52
+ privateKeyMultibase?: string;
53
+ }
54
+ type AvailableIssuerType = Omit<Ed25519VerificationKey2020Options, "type"> | Ed25519VerificationKey2020 | CustomIssuerType;
55
+ //#endregion
56
+ export { VerifiableCredentialProof as a, VerifiableCredential as i, CustomIssuerType as n, idOSCredential as o, SignedCredentialContentReference as r, idOSCredentialRecord as s, AvailableIssuerType as t };
57
+ //# sourceMappingURL=index-WW372Tf5.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-WW372Tf5.d.mts","names":[],"sources":["../src/types/credentials.ts","../src/types/issuers.ts"],"mappings":";;KAAY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU,uBAAuB,KAAK;EACtC;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;;UAMe;EACf;EACA;EACA;EACA;EACA;;UAGe,qBAAqB;EACpC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,mBAAmB;EACnB;EACA,OAAO;;;;UC5CQ;EACf;EAGA;EAGA;;KAKU,sBACR,KAAK,6CACL,6BACA"}
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export {};
1
+ export{};
@@ -0,0 +1,2 @@
1
+ import{JsonLdDocumentLoader as e}from"jsonld-document-loader";var t={"@context":{id:`@id`,type:`@type`,"@protected":!0,proof:{"@id":`https://w3id.org/security#proof`,"@type":`@id`,"@container":`@graph`},Ed25519VerificationKey2020:{"@id":`https://w3id.org/security#Ed25519VerificationKey2020`,"@context":{"@protected":!0,id:`@id`,type:`@type`,controller:{"@id":`https://w3id.org/security#controller`,"@type":`@id`},revoked:{"@id":`https://w3id.org/security#revoked`,"@type":`http://www.w3.org/2001/XMLSchema#dateTime`},publicKeyMultibase:{"@id":`https://w3id.org/security#publicKeyMultibase`,"@type":`https://w3id.org/security#multibase`}}},Ed25519Signature2020:{"@id":`https://w3id.org/security#Ed25519Signature2020`,"@context":{"@protected":!0,id:`@id`,type:`@type`,challenge:`https://w3id.org/security#challenge`,created:{"@id":`http://purl.org/dc/terms/created`,"@type":`http://www.w3.org/2001/XMLSchema#dateTime`},domain:`https://w3id.org/security#domain`,expires:{"@id":`https://w3id.org/security#expiration`,"@type":`http://www.w3.org/2001/XMLSchema#dateTime`},nonce:`https://w3id.org/security#nonce`,proofPurpose:{"@id":`https://w3id.org/security#proofPurpose`,"@type":`@vocab`,"@context":{"@protected":!0,id:`@id`,type:`@type`,assertionMethod:{"@id":`https://w3id.org/security#assertionMethod`,"@type":`@id`,"@container":`@set`},authentication:{"@id":`https://w3id.org/security#authenticationMethod`,"@type":`@id`,"@container":`@set`},capabilityInvocation:{"@id":`https://w3id.org/security#capabilityInvocationMethod`,"@type":`@id`,"@container":`@set`},capabilityDelegation:{"@id":`https://w3id.org/security#capabilityDelegationMethod`,"@type":`@id`,"@container":`@set`},keyAgreement:{"@id":`https://w3id.org/security#keyAgreementMethod`,"@type":`@id`,"@container":`@set`}}},proofValue:{"@id":`https://w3id.org/security#proofValue`,"@type":`https://w3id.org/security#multibase`},verificationMethod:{"@id":`https://w3id.org/security#verificationMethod`,"@type":`@id`}}}}},n={"@context":{"@version":1.1,"@protected":!0,xsd:`http://www.w3.org/2001/XMLSchema#`,eddOccupation:`xsd:string`,eddSourceOfFundsCategory:`xsd:string`,eddSourceOfFundsProofFile:`xsd:string`}},r={"@context":{"@version":1.1,"@protected":!0,xsd:`http://www.w3.org/2001/XMLSchema#`,faceSignUserId:`xsd:string`}},i={"@context":{"@version":1.1,"@protected":!0,xsd:`http://www.w3.org/2001/XMLSchema#`,aux:`https://raw.githubusercontent.com/idos-network/idos-sdk-js/168f449a799620123bc7b01fc224423739500f94/packages/issuer-sdk-js/assets/country-codes.xml`,applicantId:`xsd:string`,inquiryId:`xsd:string`,firstName:`xsd:string`,middleName:`xsd:string`,nationality:`aux:ISO_3166-1_alpha-2`,familyName:`xsd:string`,maidenName:`xsd:string`,gender:`xsd:string`,governmentId:`xsd:string`,governmentIdType:`xsd:string`,email:`xsd:string`,ssn:`xsd:string`,phoneNumber:`xsd:string`,dateOfBirth:`aux:date`,placeOfBirth:`xsd:string`,selfieFile:`xsd:string`,idDocumentCountry:`xsd:string`,idDocumentNumber:`xsd:string`,idDocumentType:`xsd:string`,idDocumentDateOfIssue:`aux:date`,idDocumentDateOfExpiry:`aux:date`,idDocumentFrontFile:`xsd:string`,idDocumentBackFile:`xsd:string`,residentialAddressStreet:`xsd:string`,residentialAddressHouseNumber:`xsd:string`,residentialAddressAdditionalAddressInfo:`xsd:string`,residentialAddressRegion:`xsd:string`,residentialAddressCity:`xsd:string`,residentialAddressPostalCode:`xsd:string`,residentialAddressCountry:`aux:ISO_3166-1_alpha-2`,residentialAddressProofCategory:`xsd:string`,residentialAddressProofDateOfIssue:`xsd:date`,residentialAddressProofFile:`xsd:string`}},a={"@context":{"@version":1.1,"@protected":!0,xsd:`http://www.w3.org/2001/XMLSchema#`,aux:`https://raw.githubusercontent.com/idos-network/idos-sdk-js/168f449a799620123bc7b01fc224423739500f94/packages/issuer-sdk-js/assets/country-codes.xml`,firstName:`xsd:string`,middleName:`xsd:string`,nationality:`aux:ISO_3166-1_alpha-2`,familyName:`xsd:string`,maidenName:`xsd:string`,gender:`xsd:string`,email:`xsd:string`,phoneNumber:`xsd:string`,ssn:`xsd:string`,dateOfBirth:`aux:date`,placeOfBirth:`xsd:string`,selfieFile:`xsd:string`,idDocumentCountry:`xsd:string`,idDocumentNumber:`xsd:string`,idDocumentType:`xsd:string`,idDocumentDateOfIssue:`aux:date`,idDocumentDateOfExpiry:`aux:date`,idDocumentFrontFile:`xsd:string`,idDocumentBackFile:`xsd:string`,residentialAddressStreet:`xsd:string`,residentialAddressHouseNumber:`xsd:string`,residentialAddressAdditionalAddressInfo:`xsd:string`,residentialAddressRegion:`xsd:string`,residentialAddressCity:`xsd:string`,residentialAddressPostalCode:`xsd:string`,residentialAddressCountry:`aux:ISO_3166-1_alpha-2`,residentialAddressProofCategory:`xsd:string`,residentialAddressProofDateOfIssue:`xsd:date`,residentialAddressProofFile:`xsd:string`}},o={"@context":{"@version":1.1,"@protected":!0,xsd:`http://www.w3.org/2001/XMLSchema#`,personFirstName:`xsd:string`,personFamilyName:`xsd:string`,personMiddleName:`xsd:string`,personFatherName:`xsd:string`,personMaidenName:`xsd:string`,personMotherName:`xsd:string`,personGender:`xsd:string`,personNationality:`xsd:string`,personSecondNationality:`xsd:string`,personDateOfBirth:`xsd:date`,personPlaceOfBirth:`xsd:string`,personRegionOfBirth:`xsd:string`,personStateless:`xsd:boolean`,personRefugeeStatus:`xsd:boolean`,personSubsidiaryProtectionStatus:`xsd:boolean`,personNationalIdNumber:`xsd:string`,personTaxIdNumber:`xsd:string`,personTaxIdIssuingCountry:`xsd:string`,personTaxResidenceCountry:`xsd:string`,personSsn:`xsd:string`,idDocumentType:`xsd:string`,idDocumentNumber:`xsd:string`,idDocumentCountry:`xsd:string`,idDocumentDateOfExpiry:`xsd:date`,idDocumentDateOfIssue:`xsd:date`,idDocumentIssuingAuthority:`xsd:string`,idDocumentFrontFile:`xsd:string`,idDocumentFrontFileType:`xsd:string`,idDocumentFrontFileName:`xsd:string`,idDocumentBackFile:`xsd:string`,idDocumentBackFileType:`xsd:string`,idDocumentBackFileName:`xsd:string`,idDocumentMrzLine1:`xsd:string`,idDocumentTitle:`xsd:string`,idDocumentExtendedValidUntil:`xsd:date`,idDocumentAdditionalNumber:`xsd:string`,idDocumentEthnicity:`xsd:string`,idDocumentIssuingSubdivision:`xsd:string`,contactEmail:`xsd:string`,contactPhoneNumber:`xsd:string`,biometricSelfieFile:`xsd:string`,biometricSelfieMatch:`xsd:double`,residentialAddressSource:`xsd:string`,residentialAddressStreet:`xsd:string`,residentialAddressHouseNumber:`xsd:string`,residentialAddressAdditionalAddressInfo:`xsd:string`,residentialAddressRegion:`xsd:string`,residentialAddressCity:`xsd:string`,residentialAddressPostalCode:`xsd:string`,residentialAddressCountry:`xsd:string`,residentialAddressProofCategory:`xsd:string`,residentialAddressProofDateOfIssue:`xsd:date`,residentialAddressProofFile:`xsd:string`,residentialAddressProofFileType:`xsd:string`,residentialAddressProofFileName:`xsd:string`,residentialAddressIpCountry:`xsd:string`,screeningSanctionsCheckResult:`xsd:string`,screeningSanctionsConfidenceScore:`xsd:double`,screeningPepCheckResult:`xsd:string`,screeningPepConfidenceScore:`xsd:double`,eddOccupation:`xsd:string`,eddSourceOfFundsCategory:`xsd:string`,eddSourceOfFundsProofFile:`xsd:string`,eddSourceOfFundsProofFileType:`xsd:string`,eddSourceOfFundsProofFileName:`xsd:string`,sourceOfWealthType:`xsd:string`,sourceOfWealthYearlyGrossIncome:`xsd:string`,sourceOfWealthYearlyGrossIncomeCurrency:`xsd:string`,sourceOfWealthApproximateNetWorth:`xsd:string`,sourceOfWealthApproximateNetWorthCurrency:`xsd:string`,sourceOfWealthSourceOfWealthProofFile:`xsd:string`,onboardingIntendedUse:`xsd:string`,onboardingEmploymentStatus:`xsd:string`,onboardingExpectedMonthlyTransactionCount:`xsd:string`,onboardingExpectedMonthlyTransactionVolume:`xsd:string`,onboardingExpectedMonthlyTransactionVolumeCurrency:`xsd:string`}},s={"@context":{"@version":1.1,"@protected":!0,xsd:`http://www.w3.org/2001/XMLSchema#`,level:`xsd:string`,approvedAt:`xsd:date`}},c={"@context":{"@version":1.1,"@protected":!0,xsd:`http://www.w3.org/2001/XMLSchema#`,level:`xsd:string`,approvedAt:`xsd:dateTime`,kycLevel:`xsd:integer`}},l={"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,VerifiableCredential:{"@id":`https://www.w3.org/2018/credentials#VerifiableCredential`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,cred:`https://www.w3.org/2018/credentials#`,sec:`https://w3id.org/security#`,xsd:`http://www.w3.org/2001/XMLSchema#`,credentialSchema:{"@id":`cred:credentialSchema`,"@type":`@id`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,cred:`https://www.w3.org/2018/credentials#`,JsonSchemaValidator2018:`cred:JsonSchemaValidator2018`}},credentialStatus:{"@id":`cred:credentialStatus`,"@type":`@id`},credentialSubject:{"@id":`cred:credentialSubject`,"@type":`@id`},evidence:{"@id":`cred:evidence`,"@type":`@id`},expirationDate:{"@id":`cred:expirationDate`,"@type":`xsd:dateTime`},holder:{"@id":`cred:holder`,"@type":`@id`},issued:{"@id":`cred:issued`,"@type":`xsd:dateTime`},issuer:{"@id":`cred:issuer`,"@type":`@id`},issuanceDate:{"@id":`cred:issuanceDate`,"@type":`xsd:dateTime`},proof:{"@id":`sec:proof`,"@type":`@id`,"@container":`@graph`},refreshService:{"@id":`cred:refreshService`,"@type":`@id`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,cred:`https://www.w3.org/2018/credentials#`,ManualRefreshService2018:`cred:ManualRefreshService2018`}},termsOfUse:{"@id":`cred:termsOfUse`,"@type":`@id`},validFrom:{"@id":`cred:validFrom`,"@type":`xsd:dateTime`},validUntil:{"@id":`cred:validUntil`,"@type":`xsd:dateTime`}}},VerifiablePresentation:{"@id":`https://www.w3.org/2018/credentials#VerifiablePresentation`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,cred:`https://www.w3.org/2018/credentials#`,sec:`https://w3id.org/security#`,holder:{"@id":`cred:holder`,"@type":`@id`},proof:{"@id":`sec:proof`,"@type":`@id`,"@container":`@graph`},verifiableCredential:{"@id":`cred:verifiableCredential`,"@type":`@id`,"@container":`@graph`}}},EcdsaSecp256k1Signature2019:{"@id":`https://w3id.org/security#EcdsaSecp256k1Signature2019`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,sec:`https://w3id.org/security#`,xsd:`http://www.w3.org/2001/XMLSchema#`,challenge:`sec:challenge`,created:{"@id":`http://purl.org/dc/terms/created`,"@type":`xsd:dateTime`},domain:`sec:domain`,expires:{"@id":`sec:expiration`,"@type":`xsd:dateTime`},jws:`sec:jws`,nonce:`sec:nonce`,proofPurpose:{"@id":`sec:proofPurpose`,"@type":`@vocab`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,sec:`https://w3id.org/security#`,assertionMethod:{"@id":`sec:assertionMethod`,"@type":`@id`,"@container":`@set`},authentication:{"@id":`sec:authenticationMethod`,"@type":`@id`,"@container":`@set`}}},proofValue:`sec:proofValue`,verificationMethod:{"@id":`sec:verificationMethod`,"@type":`@id`}}},EcdsaSecp256r1Signature2019:{"@id":`https://w3id.org/security#EcdsaSecp256r1Signature2019`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,sec:`https://w3id.org/security#`,xsd:`http://www.w3.org/2001/XMLSchema#`,challenge:`sec:challenge`,created:{"@id":`http://purl.org/dc/terms/created`,"@type":`xsd:dateTime`},domain:`sec:domain`,expires:{"@id":`sec:expiration`,"@type":`xsd:dateTime`},jws:`sec:jws`,nonce:`sec:nonce`,proofPurpose:{"@id":`sec:proofPurpose`,"@type":`@vocab`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,sec:`https://w3id.org/security#`,assertionMethod:{"@id":`sec:assertionMethod`,"@type":`@id`,"@container":`@set`},authentication:{"@id":`sec:authenticationMethod`,"@type":`@id`,"@container":`@set`}}},proofValue:`sec:proofValue`,verificationMethod:{"@id":`sec:verificationMethod`,"@type":`@id`}}},Ed25519Signature2018:{"@id":`https://w3id.org/security#Ed25519Signature2018`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,sec:`https://w3id.org/security#`,xsd:`http://www.w3.org/2001/XMLSchema#`,challenge:`sec:challenge`,created:{"@id":`http://purl.org/dc/terms/created`,"@type":`xsd:dateTime`},domain:`sec:domain`,expires:{"@id":`sec:expiration`,"@type":`xsd:dateTime`},jws:`sec:jws`,nonce:`sec:nonce`,proofPurpose:{"@id":`sec:proofPurpose`,"@type":`@vocab`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,sec:`https://w3id.org/security#`,assertionMethod:{"@id":`sec:assertionMethod`,"@type":`@id`,"@container":`@set`},authentication:{"@id":`sec:authenticationMethod`,"@type":`@id`,"@container":`@set`}}},proofValue:`sec:proofValue`,verificationMethod:{"@id":`sec:verificationMethod`,"@type":`@id`}}},RsaSignature2018:{"@id":`https://w3id.org/security#RsaSignature2018`,"@context":{"@version":1.1,"@protected":!0,challenge:`sec:challenge`,created:{"@id":`http://purl.org/dc/terms/created`,"@type":`xsd:dateTime`},domain:`sec:domain`,expires:{"@id":`sec:expiration`,"@type":`xsd:dateTime`},jws:`sec:jws`,nonce:`sec:nonce`,proofPurpose:{"@id":`sec:proofPurpose`,"@type":`@vocab`,"@context":{"@version":1.1,"@protected":!0,id:`@id`,type:`@type`,sec:`https://w3id.org/security#`,assertionMethod:{"@id":`sec:assertionMethod`,"@type":`@id`,"@container":`@set`},authentication:{"@id":`sec:authenticationMethod`,"@type":`@id`,"@container":`@set`}}},proofValue:`sec:proofValue`,verificationMethod:{"@id":`sec:verificationMethod`,"@type":`@id`}}},proof:{"@id":`https://w3id.org/security#proof`,"@type":`@id`,"@container":`@graph`}}};const u=`https://www.w3.org/2018/credentials/v1`,d=`https://w3id.org/security/suites/ed25519-2020/v1`,f=`https://idos-network.github.io/idos-sdk-js/credentials/`,p=`${f}idos-credentials-v1.json`,m=`${f}idos-credentials-v2.json`,h=`${f}idos-credential-subject-v1.json`,g=`${f}idos-credential-subject-v2.json`,_=`${f}idos-credential-subject-v3.json`,v=`${f}idos-credential-subject-face-id-v1.json`,y=`${f}idos-credential-subject-edd-v1.json`;function b(){let f=new e;return f.addStatic(u,l),f.addStatic(d,t),f.addStatic(p,s),f.addStatic(m,c),f.addStatic(h,i),f.addStatic(g,a),f.addStatic(_,o),f.addStatic(v,r),f.addStatic(y,n),[`1356fea6672d22deb07fedc5fa427478b2e1654c`,`346f14468348e4f3dd00039c89ce9bb49d88777c`,`1e8421744e037dfd7b0289cb39261c73ab6d643c`,`0049d2e93f8913c42398372e2bb65d92bed38ac0`].forEach(e=>{f.addStatic(`https://raw.githubusercontent.com/idos-network/idos-sdk-js/${e}/packages/%40credentials/assets/idos-credentials-v1.json`,s),f.addStatic(`https://raw.githubusercontent.com/idos-network/idos-sdk-js/${e}/packages/%40credentials/assets/idos-credential-subject-v1.json`,i)}),[`1bc3503f5302a7e42777076445d5b05fec8db429`].forEach(e=>{f.addStatic(`https://raw.githubusercontent.com/idos-network/idos-sdk-js/${e}/packages/issuer-sdk-js/assets/idos-credentials-v1.json`,s),f.addStatic(`https://raw.githubusercontent.com/idos-network/idos-sdk-js/${e}/packages/issuer-sdk-js/assets/idos-credential-subject-v1.json`,i)}),f.build()}const x=b();export{h as a,_ as c,v as i,u as l,p as n,m as o,y as r,g as s,d as t,x as u};
2
+ //# sourceMappingURL=loader-Cg6hs1-P.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader-Cg6hs1-P.mjs","names":["v1","ed25519Signature2020V1","idosCredentialsV1","idosCredentialsV2","idosCredentialSubjectV1","idosCredentialSubjectV2","idosCredentialSubjectV3","idosCredentialSubjectFaceIdV1","idosCredentialSubjectEddV1"],"sources":["../assets/ed25519-signature-2020-v1.json","../assets/idos-credential-subject-edd-v1.json","../assets/idos-credential-subject-face-id-v1.json","../assets/idos-credential-subject-v1.json","../assets/idos-credential-subject-v2.json","../assets/idos-credential-subject-v3.json","../assets/idos-credentials-v1.json","../assets/idos-credentials-v2.json","../assets/v1.json","../src/utils/loader.ts"],"sourcesContent":["","","","","","","","","","import { type JsonLDDocumentLoaderInstance, JsonLdDocumentLoader } from \"jsonld-document-loader\";\n\nimport ed25519Signature2020V1 from \"../../assets/ed25519-signature-2020-v1.json\";\nimport idosCredentialSubjectEddV1 from \"../../assets/idos-credential-subject-edd-v1.json\";\n// Maybe we can generate those imports alongside the JSON-LD\nimport idosCredentialSubjectFaceIdV1 from \"../../assets/idos-credential-subject-face-id-v1.json\";\nimport idosCredentialSubjectV1 from \"../../assets/idos-credential-subject-v1.json\";\nimport idosCredentialSubjectV2 from \"../../assets/idos-credential-subject-v2.json\";\nimport idosCredentialSubjectV3 from \"../../assets/idos-credential-subject-v3.json\";\nimport idosCredentialsV1 from \"../../assets/idos-credentials-v1.json\";\nimport idosCredentialsV2 from \"../../assets/idos-credentials-v2.json\";\nimport v1 from \"../../assets/v1.json\";\n\nexport const CONTEXT_V1 = \"https://www.w3.org/2018/credentials/v1\";\nexport const CONTEXT_ED25519_SIGNATURE_2020_V1 = \"https://w3id.org/security/suites/ed25519-2020/v1\";\n\nexport const BASE_PUBLIC_URL = \"https://idos-network.github.io/idos-sdk-js/credentials/\";\n\n// Check .github/workflow/pages.yml how those are deployed\nexport const CONTEXT_IDOS_CREDENTIAL_V1: string = `${BASE_PUBLIC_URL}idos-credentials-v1.json`;\nexport const CONTEXT_IDOS_CREDENTIAL_V2: string = `${BASE_PUBLIC_URL}idos-credentials-v2.json`;\nexport const CONTEXT_IDOS_CREDENTIAL_V1_SUBJECT: string = `${BASE_PUBLIC_URL}idos-credential-subject-v1.json`;\nexport const CONTEXT_IDOS_CREDENTIAL_V2_SUBJECT: string = `${BASE_PUBLIC_URL}idos-credential-subject-v2.json`;\nexport const CONTEXT_IDOS_CREDENTIAL_V3_SUBJECT: string = `${BASE_PUBLIC_URL}idos-credential-subject-v3.json`;\nexport const CONTEXT_IDOS_CREDENTIAL_V1_FACE_ID: string = `${BASE_PUBLIC_URL}idos-credential-subject-face-id-v1.json`;\nexport const CONTEXT_IDOS_CREDENTIAL_V1_EDD: string = `${BASE_PUBLIC_URL}idos-credential-subject-edd-v1.json`;\n\nexport function buildDocumentLoader(): JsonLDDocumentLoaderInstance {\n const loader = new JsonLdDocumentLoader();\n\n loader.addStatic(CONTEXT_V1, v1);\n loader.addStatic(CONTEXT_ED25519_SIGNATURE_2020_V1, ed25519Signature2020V1);\n\n // Envelopes\n loader.addStatic(CONTEXT_IDOS_CREDENTIAL_V1, idosCredentialsV1);\n loader.addStatic(CONTEXT_IDOS_CREDENTIAL_V2, idosCredentialsV2);\n\n // KYC\n loader.addStatic(CONTEXT_IDOS_CREDENTIAL_V1_SUBJECT, idosCredentialSubjectV1);\n loader.addStatic(CONTEXT_IDOS_CREDENTIAL_V2_SUBJECT, idosCredentialSubjectV2);\n loader.addStatic(CONTEXT_IDOS_CREDENTIAL_V3_SUBJECT, idosCredentialSubjectV3);\n\n // PoP\n loader.addStatic(CONTEXT_IDOS_CREDENTIAL_V1_FACE_ID, idosCredentialSubjectFaceIdV1);\n\n // EDD\n loader.addStatic(CONTEXT_IDOS_CREDENTIAL_V1_EDD, idosCredentialSubjectEddV1);\n\n // DEPRECATED: Those should be removed\n [\n \"1356fea6672d22deb07fedc5fa427478b2e1654c\",\n \"346f14468348e4f3dd00039c89ce9bb49d88777c\",\n \"1e8421744e037dfd7b0289cb39261c73ab6d643c\",\n \"0049d2e93f8913c42398372e2bb65d92bed38ac0\",\n ].forEach((hash) => {\n loader.addStatic(\n `https://raw.githubusercontent.com/idos-network/idos-sdk-js/${hash}/packages/%40credentials/assets/idos-credentials-v1.json`,\n idosCredentialsV1,\n );\n loader.addStatic(\n `https://raw.githubusercontent.com/idos-network/idos-sdk-js/${hash}/packages/%40credentials/assets/idos-credential-subject-v1.json`,\n idosCredentialSubjectV1,\n );\n });\n\n // DEPRECATED: Those should be removed\n [\"1bc3503f5302a7e42777076445d5b05fec8db429\"].forEach((hash) => {\n loader.addStatic(\n `https://raw.githubusercontent.com/idos-network/idos-sdk-js/${hash}/packages/issuer-sdk-js/assets/idos-credentials-v1.json`,\n idosCredentialsV1,\n );\n loader.addStatic(\n `https://raw.githubusercontent.com/idos-network/idos-sdk-js/${hash}/packages/issuer-sdk-js/assets/idos-credential-subject-v1.json`,\n idosCredentialSubjectV1,\n );\n });\n\n return loader.build();\n}\n\nexport const defaultDocumentLoader: JsonLDDocumentLoaderInstance = buildDocumentLoader();\n"],"mappings":"w9ZSaA,MAAa,EAAa,yCACb,EAAoC,mDAEpC,EAAkB,0DAGlB,EAAqC,GAAG,EAAgB,0BACxD,EAAqC,GAAG,EAAgB,0BACxD,EAA6C,GAAG,EAAgB,iCAChE,EAA6C,GAAG,EAAgB,iCAChE,EAA6C,GAAG,EAAgB,iCAChE,EAA6C,GAAG,EAAgB,yCAChE,EAAyC,GAAG,EAAgB,qCAEzE,SAAgB,GAAoD,CAClE,IAAM,EAAS,IAAI,EAiDnB,OA/CA,EAAO,UAAU,EAAYA,CAAE,EAC/B,EAAO,UAAU,EAAmCC,CAAsB,EAG1E,EAAO,UAAU,EAA4BC,CAAiB,EAC9D,EAAO,UAAU,EAA4BC,CAAiB,EAG9D,EAAO,UAAU,EAAoCC,CAAuB,EAC5E,EAAO,UAAU,EAAoCC,CAAuB,EAC5E,EAAO,UAAU,EAAoCC,CAAuB,EAG5E,EAAO,UAAU,EAAoCC,CAA6B,EAGlF,EAAO,UAAU,EAAgCC,CAA0B,EAG3E,CACE,2CACA,2CACA,2CACA,0CACF,CAAC,CAAC,QAAS,GAAS,CAClB,EAAO,UACL,8DAA8D,EAAK,0DACnEN,CACF,EACA,EAAO,UACL,8DAA8D,EAAK,iEACnEE,CACF,CACF,CAAC,EAGD,CAAC,0CAA0C,CAAC,CAAC,QAAS,GAAS,CAC7D,EAAO,UACL,8DAA8D,EAAK,yDACnEF,CACF,EACA,EAAO,UACL,8DAA8D,EAAK,gEACnEE,CACF,CACF,CAAC,EAEM,EAAO,MAAM,CACtB,CAEA,MAAa,EAAsD,EAAoB"}
@@ -0,0 +1,19 @@
1
+ import { i as VerifiableCredential } from "../index-WW372Tf5.mjs";
2
+ import { a as FaceIdV1, i as KycV1, o as EddV1, r as KycV2, t as KycV3 } from "../index-0NqXMjNk.mjs";
3
+ //#region src/parser/index.d.ts
4
+ type CredentialWithContext = VerifiableCredential<unknown>;
5
+ /** Every version `parseCredential` can return. */
6
+ export type ParsedCredential = EddV1 | FaceIdV1 | KycV1 | KycV2 | KycV3;
7
+ /**
8
+ * Deserializes a credential into its typed version by matching the subject `@context`, then
9
+ * validates it. A credential that does not match the context it claims is rejected here rather
10
+ * than at the first property access: a subject field the context does not define throws, and one
11
+ * it promises but the credential omits fails with `CredentialValidationError`.
12
+ *
13
+ * SECURITY: this does NOT verify the credential's signature. The returned version reflects
14
+ * whatever was in `input`, signed or forged. For untrusted input, call `verifyCredential()`
15
+ * (from `@idos-network/credentials/verifier`) first and only parse once it reports verified.
16
+ */
17
+ export declare function parseCredential(input: CredentialWithContext): Promise<ParsedCredential>;
18
+ //#endregion
19
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/parser/index.ts"],"mappings":";;;KAUK,wBAAwB;;YAGjB,mBACR,QACA,WACA,QACA,QACA;;;;;;;;;;;wBAqCkB,gBAAgB,OAAO,wBAAwB,QAAQ"}
@@ -0,0 +1,2 @@
1
+ import{a as e,i as t,o as n,r,t as i}from"../schemas-BVGuUlPe.mjs";const a=[n,e,t,r,i];function o(e,t){if(typeof e.credentialSubject!=`object`||e.credentialSubject===null||Array.isArray(e.credentialSubject))return!1;let n=e.credentialSubject[`@context`];return Array.isArray(n)?n.includes(t):n===t}async function s(e){for(let t of a){if(!o(e,t.subjectContext))continue;let n=new t;return await n.deserialize(e),n.checkValidity(),n}throw Error(`Unknown credential`)}export{s as parseCredential};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["VerifiableCredentialEddV1","VerifiableCredentialFaceIdV1","VerifiableCredentialKycV1","VerifiableCredentialKycV2","VerifiableCredentialKycV3"],"sources":["../../src/parser/index.ts"],"sourcesContent":["import type { VerifiableCredential } from \"../types\";\n\nimport {\n VerifiableCredentialEddV1,\n VerifiableCredentialFaceIdV1,\n VerifiableCredentialKycV1,\n VerifiableCredentialKycV2,\n VerifiableCredentialKycV3,\n} from \"../schemas\";\n\ntype CredentialWithContext = VerifiableCredential<unknown>;\n\n/** Every version `parseCredential` can return. */\nexport type ParsedCredential =\n | VerifiableCredentialEddV1\n | VerifiableCredentialFaceIdV1\n | VerifiableCredentialKycV1\n | VerifiableCredentialKycV2\n | VerifiableCredentialKycV3;\n\n/*\n * Matched on the subject `@context`, which is unique per version — several versions share an\n * envelope context, so that one cannot tell them apart.\n */\nconst VERSIONS: { readonly subjectContext: string; new (): ParsedCredential }[] = [\n VerifiableCredentialEddV1,\n VerifiableCredentialFaceIdV1,\n VerifiableCredentialKycV1,\n VerifiableCredentialKycV2,\n VerifiableCredentialKycV3,\n];\n\nfunction hasContext(input: CredentialWithContext, context: string): boolean {\n if (\n typeof input.credentialSubject !== \"object\" ||\n input.credentialSubject === null ||\n Array.isArray(input.credentialSubject)\n ) {\n return false;\n }\n\n const value = (input.credentialSubject as Record<string, unknown>)[\"@context\"];\n return Array.isArray(value) ? value.includes(context) : value === context;\n}\n\n/**\n * Deserializes a credential into its typed version by matching the subject `@context`, then\n * validates it. A credential that does not match the context it claims is rejected here rather\n * than at the first property access: a subject field the context does not define throws, and one\n * it promises but the credential omits fails with `CredentialValidationError`.\n *\n * SECURITY: this does NOT verify the credential's signature. The returned version reflects\n * whatever was in `input`, signed or forged. For untrusted input, call `verifyCredential()`\n * (from `@idos-network/credentials/verifier`) first and only parse once it reports verified.\n */\nexport async function parseCredential(input: CredentialWithContext): Promise<ParsedCredential> {\n for (const Version of VERSIONS) {\n if (!hasContext(input, Version.subjectContext)) continue;\n\n const credential = new Version();\n\n await credential.deserialize(input);\n credential.checkValidity();\n\n return credential;\n }\n\n throw new Error(\"Unknown credential\");\n}\n"],"mappings":"mEAwBA,MAAM,EAA4E,CAChFA,EACAC,EACAC,EACAC,EACAC,CACF,EAEA,SAAS,EAAW,EAA8B,EAA0B,CAC1E,GACE,OAAO,EAAM,mBAAsB,UACnC,EAAM,oBAAsB,MAC5B,MAAM,QAAQ,EAAM,iBAAiB,EAErC,MAAO,GAGT,IAAM,EAAS,EAAM,kBAA8C,YACnE,OAAO,MAAM,QAAQ,CAAK,EAAI,EAAM,SAAS,CAAO,EAAI,IAAU,CACpE,CAYA,eAAsB,EAAgB,EAAyD,CAC7F,IAAK,IAAM,KAAW,EAAU,CAC9B,GAAI,CAAC,EAAW,EAAO,EAAQ,cAAc,EAAG,SAEhD,IAAM,EAAa,IAAI,EAKvB,OAHA,MAAM,EAAW,YAAY,CAAK,EAClC,EAAW,cAAc,EAElB,CACT,CAEA,MAAU,MAAM,oBAAoB,CACtC"}
@@ -0,0 +1,2 @@
1
+ import { A as Occupations, C as Gender, D as IntendedUse, E as IDDocumentTypes, F as SourceOfWealthType, I as SourceOfWealthTypes, L as YearlyGrossIncome, M as ResidentialAddressSources, N as ScreeningResult, O as IntendedUses, P as ScreeningResults, R as YearlyGrossIncomes, S as ExpectedMonthlyTransactionVolumes, T as IDDocumentType, _ as EmploymentStatus, a as FaceIdV1, b as ExpectedMonthlyTransactionCounts, c as EnvelopeV2, d as VerifiableCredentialBase, f as PublicNotes, g as Currency, h as Currencies, i as KycV1, j as ResidentialAddressSource, k as Occupation, l as OwnFields, m as ApproximateNetWorths, n as Subject, o as EddV1, p as ApproximateNetWorth, r as KycV2, s as EnvelopeV1, t as KycV3, u as Sections, v as EmploymentStatuses, w as Genders, x as ExpectedMonthlyTransactionVolume, y as ExpectedMonthlyTransactionCount } from "../index-0NqXMjNk.mjs";
2
+ export { ApproximateNetWorth, ApproximateNetWorths, Currencies, Currency, EmploymentStatus, EmploymentStatuses, EnvelopeV1, EnvelopeV2, ExpectedMonthlyTransactionCount, ExpectedMonthlyTransactionCounts, ExpectedMonthlyTransactionVolume, ExpectedMonthlyTransactionVolumes, Gender, Genders, IDDocumentType, IDDocumentTypes, IntendedUse, IntendedUses, Occupation, Occupations, type OwnFields, type PublicNotes, ResidentialAddressSource, ResidentialAddressSources, ScreeningResult, ScreeningResults, type Sections, SourceOfWealthType, SourceOfWealthTypes, VerifiableCredentialBase, EddV1 as VerifiableCredentialEddV1, FaceIdV1 as VerifiableCredentialFaceIdV1, KycV1 as VerifiableCredentialKycV1, KycV2 as VerifiableCredentialKycV2, KycV3 as VerifiableCredentialKycV3, Subject as VerifiableCredentialKycV3Subject, YearlyGrossIncome, YearlyGrossIncomes };
@@ -0,0 +1 @@
1
+ import{S as e,_ as t,a as n,b as r,c as i,d as a,f as o,g as s,h as c,i as l,l as u,m as d,n as f,o as p,p as m,r as h,s as g,t as _,u as v,v as y,x as b,y as x}from"../schemas-BVGuUlPe.mjs";export{v as ApproximateNetWorths,a as Currencies,o as EmploymentStatuses,g as EnvelopeV1,i as EnvelopeV2,m as ExpectedMonthlyTransactionCounts,d as ExpectedMonthlyTransactionVolumes,c as Genders,s as IDDocumentTypes,t as IntendedUses,y as Occupations,x as ResidentialAddressSources,r as ScreeningResults,b as SourceOfWealthTypes,u as VerifiableCredentialBase,p as VerifiableCredentialEddV1,n as VerifiableCredentialFaceIdV1,l as VerifiableCredentialKycV1,h as VerifiableCredentialKycV2,_ as VerifiableCredentialKycV3,f as VerifiableCredentialKycV3Subject,e as YearlyGrossIncomes};
@@ -0,0 +1,2 @@
1
+ import{assertNoExtraFields as e,issuerToKey as t}from"./utils/index.mjs";import{a as n,c as r,i,l as a,n as o,o as s,r as c,s as l,t as ee,u as te}from"./loader-Cg6hs1-P.mjs";import{base85ToFile as ne,fileToBase85 as re}from"@idos-network/utils/codecs";import{Ed25519Signature2020 as ie}from"@digitalbazaar/ed25519-signature-2020";import*as ae from"@digitalbazaar/vc";import"reflect-metadata";import{Transform as u,Type as oe,instanceToPlain as se,plainToInstance as ce}from"class-transformer";import{IsBoolean as d,IsDate as le,IsDefined as ue,IsEmail as f,IsEnum as de,IsISO31661Alpha2 as p,IsIn as m,IsInstance as fe,IsInt as pe,IsMimeType as h,IsNumber as g,IsOptional as _,IsPositive as me,IsString as v,Length as y,Max as he,Min as ge,ValidateIf as _e,ValidateNested as ve,getMetadataStorage as ye,validateSync as be}from"class-validator";const xe=[`INVESTING`,`PAYMENT_TO_FRIENDS_FAMILY_OR_OTHERS`,`PURCHASE_DIGITAL_ASSETS`,`ONLINE_PURCHASES_OF_GOODS_OR_SERVICES`,`TRADING`],b=[`PASSPORT`,`DRIVERS`,`ID_CARD`,`VOTING_CARD`,`PAN_CARD`,`INTERNAL_PASSPORT`,`RESIDENCE_PERMIT`],Se=[`MANUAL`,`GPS`,`EXTERNAL_DB`,`PROOF_OF_ADDRESS`,`PROOF_OF_IDENTITY`,`AUTO_COMPLETE`],x=[`CLEAR`,`NOT_CHECKED`],Ce=[`M`,`F`,`OTHER`],S=[`EMPLOYED`,`SELF_EMPLOYED`,`UNEMPLOYED`,`RETIRED`,`STUDENT`],we=[`LESS_THAN_5`,`BETWEEN_5_AND_10`,`MORE_THAN_10`],Te=[`LESS_THAN_500`,`MORE_THAN_500_LESS_THAN_2000`,`MORE_THAN_2000`],Ee=[`SALARY`,`SAVINGS`,`INVESTMENTS`,`CRYPTO_TRADING`,`OTHER`],De=[`LESS_THAN_20000`,`FROM_20001_TO_30000`,`FROM_30001_TO_40000`,`FROM_40001_TO_50000`,`FROM_50001_TO_60000`,`FROM_60001_TO_70000`,`FROM_70001_TO_80000`,`FROM_80001_TO_90000`,`FROM_90001_TO_100000`,`FROM_100001_TO_110000`,`FROM_110001_TO_120000`,`FROM_120001_TO_130000`,`FROM_130001_TO_140000`,`FROM_140001_TO_150000`,`FROM_150001_TO_200000`,`FROM_200001_TO_500000`,`MORE_THAN_500000`],Oe=[`UP_TO_25000`,`BETWEEN_25001_AND_50000`,`BETWEEN_50001_AND_100000`,`BETWEEN_100001_AND_300000`,`BETWEEN_300001_AND_500000`,`BETWEEN_500001_AND_1000000`,`OVER_1000001`],C=[`AGRICULTURE`,`ARTS_AND_ENTERTAINMENT`,`CONSTRUCTION`,`EDUCATION`,`FINANCIAL_SERVICES`,`INFORMATION_AND_TECHNOLOGY`,`RETAIL`,`REAL_ESTATE`,`OTHER`,`BUSINESS_OWNER`,`HEALTHCARE`,`INDUSTRIAL`,`LEGAL_SERVICES`,`PUBLIC_SECTOR`,`SENIOR_MANAGEMENT`],w=[`EUR`,`USD`,`GBP`,`OTHER`],T=Symbol(`idos:sections`);function E(e,t){return e?`${e}${t.charAt(0).toUpperCase()}${t.slice(1)}`:t}function D(e,t){return(n,r)=>{let i=String(r),a=Reflect.getOwnMetadata(T,n.constructor)??[...Reflect.getMetadata(T,n.constructor)??[]];a.push({property:i,prefix:t??i,type:e}),Reflect.defineMetadata(T,a,n.constructor),oe(e)(n,r),ve()(n,r)}}function O(e){return Reflect.getMetadata(T,e)??[]}function k(e){let t=ye().getTargetValidationMetadatas(e,e.name,!0,!1);return[...new Set(t.map(e=>e.propertyName))]}function ke(e){let t=se(e),n=new Map(O(e.constructor).map(({property:e,prefix:t})=>[e,t])),r={};for(let[e,i]of Object.entries(t)){if(!n.has(e)){i!==void 0&&(r[e]=i);continue}if(!i)continue;let t=n.get(e);for(let[e,n]of Object.entries(i))n!==void 0&&(r[E(t,e)]=n)}return r}function Ae(e){let t=O(e),n=new Set(t.map(({property:e})=>e)),r=k(e).filter(e=>!n.has(e));for(let{prefix:e,type:n}of t)for(let t of k(n()))r.push(E(e,t));return new Set(r)}function je(e,t){let n=O(e),r=new Set(n.map(({property:e})=>e)),i={};for(let n of k(e))!r.has(n)&&Object.hasOwn(t,n)&&(i[n]=t[n]);for(let{property:e,prefix:r,type:a}of n){let n={};for(let e of k(a())){let i=E(r,e);Object.hasOwn(t,i)&&(n[e]=t[i])}Object.keys(n).length>0&&(i[e]=n)}return ce(e,i)}function Me(e,t){let n=ce(e,t);return Object.fromEntries(Object.keys(t).map(e=>[e,n[e]]))}function Ne(e,t=``){return e.flatMap(e=>{let n=t?`${t}.${e.property}`:e.property;return[...Object.values(e.constraints??{}).map(e=>`${n}: ${e}`),...Ne(e.children??[],n)]})}var Pe=class extends Error{errors;name=`CredentialValidationError`;constructor(e,t){super(`Invalid ${e}: ${Ne(t).join(`; `)}`),this.errors=t}};function A(e,t){let n=be(t);if(n.length>0)throw new Pe(e,n)}function j(e){return(t,n)=>_e(t=>e(t)||t[String(n)]!==void 0)(t,n)}function Fe(e){return j(t=>t[e]!==void 0)}function Ie(...e){return(t,n)=>{for(let r of e)r(t,n)}}function M(){return Ie(u(({value:e})=>e instanceof Date?e.toISOString():e,{toPlainOnly:!0}),u(({value:e})=>typeof e==`string`?new Date(e):e,{toClassOnly:!0}),le())}const Le=/^<~[\s\S]*~>$/;function N(){return Ie(u(({value:e})=>Buffer.isBuffer(e)?re(e):e,{toPlainOnly:!0}),u(({value:e})=>typeof e!=`string`||!Le.test(e)?e:ne(e)||e,{toClassOnly:!0}),fe(Buffer,{message:({property:e})=>`${e} must be a file encoded as delimited ascii85`}))}var P=class{envelopeClass;subjectClass;envelope={};subject={};constructor(e,t){this.envelopeClass=e,this.subjectClass=t}addSection(e,t,n=!0){let r=O(this.subjectClass).find(({property:t})=>t===e);if(!r)throw Error(`Unknown section: ${String(e)}`);let i=r.type(),a=new Set(k(i)),o=Object.keys(t).filter(e=>!a.has(e));if(o.length>0)throw Error(`Unexpected ${String(e)} fields: ${o.join(`, `)}`);let s=Object.assign(new i,t);return n&&A(String(e),s),this.subject[e]=s,this}setSubject(e){return Object.assign(this.subject,this.ownFields(`subject`,this.subjectClass,e)),this}setEnvelope(e){return Object.assign(this.envelope,this.ownFields(`envelope`,this.envelopeClass,e)),this}checkValidity(){this.setMissingFields(),A(`envelope`,Object.assign(new this.envelopeClass,this.envelope)),A(`subject`,Object.assign(new this.subjectClass,this.subject))}serializeSubject(){return this.checkValidity(),{"@context":[this.contexts.subjectContext],...ke(Object.assign(new this.subjectClass,this.subject))}}serializeEnvelope(){return this.checkValidity(),ke(Object.assign(new this.envelopeClass,this.envelope))}async issue(e){let n=await t(e),r={"@context":[a,this.contexts.envelopeContext,ee],type:[`VerifiableCredential`],issuer:n.controller,...this.serializeEnvelope(),credentialSubject:this.serializeSubject()};return ae.issue({credential:r,suite:new ie({key:n}),documentLoader:te})}async deserialize(t){let{credentialSubject:n,...r}=t,{"@context":i,...a}=n;e(`subject`,Ae(this.subjectClass),a),Object.assign(this.envelope,je(this.envelopeClass,r)),Object.assign(this.subject,je(this.subjectClass,n))}ownFields(t,n,r){let i=new Set(O(n).map(({property:e})=>e)),a=k(n).filter(e=>!i.has(e));return e(t,new Set(a),r),Me(n,r)}get contexts(){return this.constructor}setMissingFields(){this.envelope.level??=this.level()}};function F(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var I=class{id;level;approvedAt};F([v()],I.prototype,`id`,void 0),F([v()],I.prototype,`level`,void 0),F([_(),M()],I.prototype,`approvedAt`,void 0);var L=class extends I{kycLevel;issued;expirationDate};F([_(),pe(),me()],L.prototype,`kycLevel`,void 0),F([_(),M()],L.prototype,`issued`,void 0),F([_(),M()],L.prototype,`expirationDate`,void 0);var R=class{occupation;sourceOfFundsCategory;sourceOfFundsProofFile};F([_(),m(C)],R.prototype,`occupation`,void 0),F([_(),v()],R.prototype,`sourceOfFundsCategory`,void 0),F([_(),N()],R.prototype,`sourceOfFundsProofFile`,void 0);var z=class{id;edd};F([v()],z.prototype,`id`,void 0),F([D(()=>R),ue()],z.prototype,`edd`,void 0);var Re=class extends P{static envelopeContext=o;static subjectContext=c;constructor(){super(I,z)}level(){return`edd`}publicNotes(){return{type:`edd`,level:this.level()}}},ze=class{faceSignUserId};F([v()],ze.prototype,`faceSignUserId`,void 0);var Be=class extends P{static envelopeContext=o;static subjectContext=i;constructor(){super(I,ze)}level(){return`human`}publicNotes(){return{type:`pop`,level:this.level()}}},B=class{country;number;type;dateOfIssue;dateOfExpiry;frontFile;backFile};F([_(),p()],B.prototype,`country`,void 0),F([_(),v()],B.prototype,`number`,void 0),F([_(),v()],B.prototype,`type`,void 0),F([_(),M()],B.prototype,`dateOfIssue`,void 0),F([_(),M()],B.prototype,`dateOfExpiry`,void 0),F([_(),N()],B.prototype,`frontFile`,void 0),F([_(),N()],B.prototype,`backFile`,void 0);var V=class{street;houseNumber;additionalAddressInfo;region;city;postalCode;country;proofCategory;proofDateOfIssue;proofFile};F([_(),v()],V.prototype,`street`,void 0),F([_(),v()],V.prototype,`houseNumber`,void 0),F([_(),v()],V.prototype,`additionalAddressInfo`,void 0),F([_(),v()],V.prototype,`region`,void 0),F([_(),v()],V.prototype,`city`,void 0),F([_(),v()],V.prototype,`postalCode`,void 0),F([_(),p()],V.prototype,`country`,void 0),F([_(),v()],V.prototype,`proofCategory`,void 0),F([_(),M()],V.prototype,`proofDateOfIssue`,void 0),F([_(),N()],V.prototype,`proofFile`,void 0);var H=class{id;applicantId;inquiryId;firstName;middleName;nationality;familyName;maidenName;gender;governmentId;governmentIdType;email;ssn;phoneNumber;dateOfBirth;placeOfBirth;selfieFile;idDocument;residentialAddress};F([v()],H.prototype,`id`,void 0),F([_(),v()],H.prototype,`applicantId`,void 0),F([_(),v()],H.prototype,`inquiryId`,void 0),F([_(),v()],H.prototype,`firstName`,void 0),F([_(),v()],H.prototype,`middleName`,void 0),F([_(),p()],H.prototype,`nationality`,void 0),F([_(),v()],H.prototype,`familyName`,void 0),F([_(),v()],H.prototype,`maidenName`,void 0),F([_(),v()],H.prototype,`gender`,void 0),F([_(),v()],H.prototype,`governmentId`,void 0),F([_(),v()],H.prototype,`governmentIdType`,void 0),F([_(),f()],H.prototype,`email`,void 0),F([_(),v()],H.prototype,`ssn`,void 0),F([_(),v()],H.prototype,`phoneNumber`,void 0),F([_(),M()],H.prototype,`dateOfBirth`,void 0),F([_(),v()],H.prototype,`placeOfBirth`,void 0),F([_(),N()],H.prototype,`selfieFile`,void 0),F([D(()=>B),_()],H.prototype,`idDocument`,void 0),F([D(()=>V),_()],H.prototype,`residentialAddress`,void 0);var Ve=class extends P{static envelopeContext=o;static subjectContext=n;constructor(){super(I,H)}level(){let{residentialAddress:e,selfieFile:t,email:n,phoneNumber:r}=this.subject;return[e?.proofFile&&e.city&&e.proofCategory&&e.country?`plus`:`basic`,...[t&&`liveness`,n&&`email`,r&&`phoneNumber`].filter(Boolean)].join(`+`)}publicNotes(){return{type:`kyc`,level:this.level()}}},U=class{id;firstName;middleName;nationality;familyName;maidenName;gender;email;phoneNumber;ssn;dateOfBirth;placeOfBirth;selfieFile;idDocument;residentialAddress};F([v()],U.prototype,`id`,void 0),F([_(),v()],U.prototype,`firstName`,void 0),F([_(),v()],U.prototype,`middleName`,void 0),F([_(),p()],U.prototype,`nationality`,void 0),F([_(),v()],U.prototype,`familyName`,void 0),F([_(),v()],U.prototype,`maidenName`,void 0),F([_(),v()],U.prototype,`gender`,void 0),F([_(),f()],U.prototype,`email`,void 0),F([_(),v()],U.prototype,`phoneNumber`,void 0),F([_(),v()],U.prototype,`ssn`,void 0),F([_(),M()],U.prototype,`dateOfBirth`,void 0),F([_(),v()],U.prototype,`placeOfBirth`,void 0),F([_(),N()],U.prototype,`selfieFile`,void 0),F([D(()=>B),_()],U.prototype,`idDocument`,void 0),F([D(()=>V),_()],U.prototype,`residentialAddress`,void 0);var He=class extends P{static envelopeContext=s;static subjectContext=l;constructor(){super(L,U)}level(){let{residentialAddress:e,selfieFile:t,email:n,phoneNumber:r}=this.subject;return[e?.proofFile&&e.city&&e.proofCategory&&e.country?`plus`:`basic`,...[t&&`liveness`,n&&`email`,r&&`phoneNumber`].filter(Boolean)].join(`+`)}publicNotes(){return{type:`kyc`,level:this.level()}}},W=class{selfieFile;selfieMatch};F([N()],W.prototype,`selfieFile`,void 0),F([_(),g()],W.prototype,`selfieMatch`,void 0);var G=class{email;phoneNumber};F([_(),f()],G.prototype,`email`,void 0),F([_(),v()],G.prototype,`phoneNumber`,void 0);var K=class{occupation;sourceOfFundsCategory;sourceOfFundsProofFile;sourceOfFundsProofFileType;sourceOfFundsProofFileName};F([_(),m(C)],K.prototype,`occupation`,void 0),F([_(),v()],K.prototype,`sourceOfFundsCategory`,void 0),F([_(),N()],K.prototype,`sourceOfFundsProofFile`,void 0),F([j(e=>!!e.sourceOfFundsProofFile),v(),h()],K.prototype,`sourceOfFundsProofFileType`,void 0),F([j(e=>!!e.sourceOfFundsProofFile),v()],K.prototype,`sourceOfFundsProofFileName`,void 0);var q=class{type;number;country;dateOfExpiry;dateOfIssue;issuingAuthority;frontFile;frontFileType;frontFileName;backFile;backFileType;backFileName;mrzLine1;title;extendedValidUntil;additionalNumber;ethnicity;issuingSubdivision};F([m(b)],q.prototype,`type`,void 0),F([y(1,255)],q.prototype,`number`,void 0),F([p()],q.prototype,`country`,void 0),F([_(),M()],q.prototype,`dateOfExpiry`,void 0),F([_(),M()],q.prototype,`dateOfIssue`,void 0),F([_(),y(1,255)],q.prototype,`issuingAuthority`,void 0),F([N()],q.prototype,`frontFile`,void 0),F([v(),h()],q.prototype,`frontFileType`,void 0),F([v()],q.prototype,`frontFileName`,void 0),F([_(),N()],q.prototype,`backFile`,void 0),F([j(e=>!!e.backFile),v(),h()],q.prototype,`backFileType`,void 0),F([j(e=>!!e.backFile),v()],q.prototype,`backFileName`,void 0),F([_(),y(1,255)],q.prototype,`mrzLine1`,void 0),F([_(),y(1,255)],q.prototype,`title`,void 0),F([_(),M()],q.prototype,`extendedValidUntil`,void 0),F([_(),y(1,255)],q.prototype,`additionalNumber`,void 0),F([_(),y(1,255)],q.prototype,`ethnicity`,void 0),F([_(),y(1,255)],q.prototype,`issuingSubdivision`,void 0);var J=class{intendedUse;employmentStatus;expectedMonthlyTransactionCount;expectedMonthlyTransactionVolume;expectedMonthlyTransactionVolumeCurrency};F([m(xe)],J.prototype,`intendedUse`,void 0),F([m(S)],J.prototype,`employmentStatus`,void 0),F([m(we)],J.prototype,`expectedMonthlyTransactionCount`,void 0),F([m(Te)],J.prototype,`expectedMonthlyTransactionVolume`,void 0),F([m(w)],J.prototype,`expectedMonthlyTransactionVolumeCurrency`,void 0);var Y=class{firstName;familyName;middleName;fatherName;maidenName;motherName;gender;nationality;secondNationality;dateOfBirth;placeOfBirth;regionOfBirth;stateless;refugeeStatus;subsidiaryProtectionStatus;nationalIdNumber;taxIdNumber;taxIdIssuingCountry;taxResidenceCountry;ssn};F([j(e=>!e.familyName),v()],Y.prototype,`firstName`,void 0),F([_(),v()],Y.prototype,`familyName`,void 0),F([_(),v()],Y.prototype,`middleName`,void 0),F([_(),v()],Y.prototype,`fatherName`,void 0),F([_(),v()],Y.prototype,`maidenName`,void 0),F([_(),v()],Y.prototype,`motherName`,void 0),F([_(),m(Ce)],Y.prototype,`gender`,void 0),F([j(e=>!e.stateless&&!e.secondNationality),p()],Y.prototype,`nationality`,void 0),F([_(),p()],Y.prototype,`secondNationality`,void 0),F([M()],Y.prototype,`dateOfBirth`,void 0),F([_(),v()],Y.prototype,`placeOfBirth`,void 0),F([_(),v()],Y.prototype,`regionOfBirth`,void 0),F([_(),d()],Y.prototype,`stateless`,void 0),F([_(),d()],Y.prototype,`refugeeStatus`,void 0),F([_(),d()],Y.prototype,`subsidiaryProtectionStatus`,void 0),F([_(),v()],Y.prototype,`nationalIdNumber`,void 0),F([_(),v()],Y.prototype,`taxIdNumber`,void 0),F([_(),p()],Y.prototype,`taxIdIssuingCountry`,void 0),F([_(),p()],Y.prototype,`taxResidenceCountry`,void 0),F([_(),v()],Y.prototype,`ssn`,void 0);var X=class{source;street;houseNumber;additionalAddressInfo;region;city;postalCode;country;proofCategory;proofDateOfIssue;proofFile;proofFileType;proofFileName;ipCountry};F([de(Se)],X.prototype,`source`,void 0),F([v()],X.prototype,`street`,void 0),F([_(),v()],X.prototype,`houseNumber`,void 0),F([_(),v()],X.prototype,`additionalAddressInfo`,void 0),F([_(),v()],X.prototype,`region`,void 0),F([v()],X.prototype,`city`,void 0),F([_(),v()],X.prototype,`postalCode`,void 0),F([p()],X.prototype,`country`,void 0),F([j(e=>e.source===`PROOF_OF_ADDRESS`),v()],X.prototype,`proofCategory`,void 0),F([_(),M()],X.prototype,`proofDateOfIssue`,void 0),F([j(e=>e.source===`PROOF_OF_ADDRESS`),N()],X.prototype,`proofFile`,void 0),F([j(e=>e.source===`PROOF_OF_ADDRESS`),v(),h()],X.prototype,`proofFileType`,void 0),F([j(e=>e.source===`PROOF_OF_ADDRESS`),v()],X.prototype,`proofFileName`,void 0),F([_(),p()],X.prototype,`ipCountry`,void 0);var Z=class{sanctionsCheckResult;sanctionsConfidenceScore;pepCheckResult;pepConfidenceScore};F([m(x)],Z.prototype,`sanctionsCheckResult`,void 0),F([_(),g(),ge(0),he(100)],Z.prototype,`sanctionsConfidenceScore`,void 0),F([m(x)],Z.prototype,`pepCheckResult`,void 0),F([_(),g(),ge(0),he(100)],Z.prototype,`pepConfidenceScore`,void 0);var Q=class{type;yearlyGrossIncome;yearlyGrossIncomeCurrency;approximateNetWorth;approximateNetWorthCurrency;sourceOfWealthProofFile};F([m(Ee)],Q.prototype,`type`,void 0),F([_(),m(De)],Q.prototype,`yearlyGrossIncome`,void 0),F([Fe(`yearlyGrossIncome`),m(w)],Q.prototype,`yearlyGrossIncomeCurrency`,void 0),F([_(),m(Oe)],Q.prototype,`approximateNetWorth`,void 0),F([Fe(`approximateNetWorth`),m(w)],Q.prototype,`approximateNetWorthCurrency`,void 0),F([_(),N()],Q.prototype,`sourceOfWealthProofFile`,void 0);var $=class{id;person;idDocument;contact;biometric;residentialAddress;screening;edd;sourceOfWealth;onboarding};F([v()],$.prototype,`id`,void 0),F([D(()=>Y),ue()],$.prototype,`person`,void 0),F([D(()=>q),_()],$.prototype,`idDocument`,void 0),F([D(()=>G),_()],$.prototype,`contact`,void 0),F([D(()=>W),_()],$.prototype,`biometric`,void 0),F([D(()=>X),_()],$.prototype,`residentialAddress`,void 0),F([D(()=>Z),_()],$.prototype,`screening`,void 0),F([D(()=>K),_()],$.prototype,`edd`,void 0),F([D(()=>Q),_()],$.prototype,`sourceOfWealth`,void 0),F([D(()=>J),_()],$.prototype,`onboarding`,void 0);var Ue=class extends P{static envelopeContext=s;static subjectContext=r;constructor(){super(L,$)}level(){let{residentialAddress:e,biometric:t,contact:n,edd:r,sourceOfWealth:i,screening:a,onboarding:o,person:s,idDocument:c}=this.subject,l=`unverified`;s&&c&&(l=`basic`),l===`basic`&&e?.proofFile&&e.city&&e.proofCategory&&e.source===`PROOF_OF_ADDRESS`&&e.country&&(l=`plus`);let ee=[t?.selfieFile&&`liveness`,n?.email&&`email`,n?.phoneNumber&&`phoneNumber`,r&&`edd`,i&&`sow`,a&&`screening`,o&&`onboarding`].filter(Boolean);return[l,...ee].join(`+`)}kycLevel(){let{person:e,idDocument:t,biometric:n,residentialAddress:r,sourceOfWealth:i,onboarding:a}=this.subject,o=0;return n?.selfieFile&&e&&t&&(o=1),o>=1&&r?.proofFile&&r.source===`PROOF_OF_ADDRESS`&&(o=2),o>=2&&i&&a&&(o=3),o}publicNotes(){return{type:`kyc`,level:this.level(),kycLevel:this.kycLevel()}}setMissingFields(){super.setMissingFields(),this.envelope.kycLevel===void 0&&this.kycLevel()>0&&(this.envelope.kycLevel=this.kycLevel()),this.envelope.expirationDate??=this.subject.idDocument?.dateOfExpiry}};export{De as S,xe as _,Be as a,x as b,L as c,w as d,S as f,b as g,Ce as h,Ve as i,P as l,Te as m,$ as n,Re as o,we as p,He as r,I as s,Ue as t,Oe as u,C as v,Ee as x,Se as y};
2
+ //# sourceMappingURL=schemas-BVGuUlPe.mjs.map