@sphereon/ssi-types 0.33.1-next.2 → 0.33.1-next.68

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 (122) hide show
  1. package/dist/index.cjs +1773 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +1589 -0
  4. package/dist/index.d.ts +1589 -6
  5. package/dist/index.js +1741 -24
  6. package/dist/index.js.map +1 -1
  7. package/package.json +23 -14
  8. package/src/index.ts +3 -2
  9. package/src/logging/index.ts +6 -4
  10. package/src/mapper/credential-constraints.ts +14 -1
  11. package/src/mapper/credential-mapper.ts +61 -23
  12. package/src/mapper/index.ts +1 -0
  13. package/src/types/cose.ts +5 -51
  14. package/src/types/did.ts +0 -90
  15. package/src/types/index.ts +13 -13
  16. package/src/types/jose.ts +18 -65
  17. package/src/types/mso_mdoc.ts +10 -138
  18. package/src/types/sd-jwt-vc.ts +4 -178
  19. package/src/types/status-list.ts +1 -8
  20. package/src/types/vc.ts +7 -29
  21. package/src/types/w3c-vc.ts +3 -26
  22. package/src/utils/cose.ts +46 -0
  23. package/src/utils/did.ts +91 -0
  24. package/src/utils/hasher.ts +5 -2
  25. package/src/utils/index.ts +6 -0
  26. package/src/utils/jose.ts +47 -0
  27. package/src/utils/mdoc.ts +144 -0
  28. package/src/utils/sd-jwt.ts +179 -0
  29. package/src/utils/vc.ts +54 -0
  30. package/dist/events/index.d.ts +0 -116
  31. package/dist/events/index.d.ts.map +0 -1
  32. package/dist/events/index.js +0 -165
  33. package/dist/events/index.js.map +0 -1
  34. package/dist/index.d.ts.map +0 -1
  35. package/dist/logging/index.d.ts +0 -73
  36. package/dist/logging/index.d.ts.map +0 -1
  37. package/dist/logging/index.js +0 -186
  38. package/dist/logging/index.js.map +0 -1
  39. package/dist/mapper/credential-constraints.d.ts +0 -16
  40. package/dist/mapper/credential-constraints.d.ts.map +0 -1
  41. package/dist/mapper/credential-constraints.js +0 -3
  42. package/dist/mapper/credential-constraints.js.map +0 -1
  43. package/dist/mapper/credential-mapper.d.ts +0 -124
  44. package/dist/mapper/credential-mapper.d.ts.map +0 -1
  45. package/dist/mapper/credential-mapper.js +0 -774
  46. package/dist/mapper/credential-mapper.js.map +0 -1
  47. package/dist/mapper/index.d.ts +0 -3
  48. package/dist/mapper/index.d.ts.map +0 -1
  49. package/dist/mapper/index.js +0 -19
  50. package/dist/mapper/index.js.map +0 -1
  51. package/dist/mapper/jsonld-language-values.d.ts +0 -18
  52. package/dist/mapper/jsonld-language-values.d.ts.map +0 -1
  53. package/dist/mapper/jsonld-language-values.js +0 -79
  54. package/dist/mapper/jsonld-language-values.js.map +0 -1
  55. package/dist/types/cose.d.ts +0 -77
  56. package/dist/types/cose.d.ts.map +0 -1
  57. package/dist/types/cose.js +0 -51
  58. package/dist/types/cose.js.map +0 -1
  59. package/dist/types/dcql.d.ts +0 -33
  60. package/dist/types/dcql.d.ts.map +0 -1
  61. package/dist/types/dcql.js +0 -4
  62. package/dist/types/dcql.js.map +0 -1
  63. package/dist/types/did.d.ts +0 -186
  64. package/dist/types/did.d.ts.map +0 -1
  65. package/dist/types/did.js +0 -78
  66. package/dist/types/did.js.map +0 -1
  67. package/dist/types/generic.d.ts +0 -44
  68. package/dist/types/generic.d.ts.map +0 -1
  69. package/dist/types/generic.js +0 -3
  70. package/dist/types/generic.js.map +0 -1
  71. package/dist/types/index.d.ts +0 -14
  72. package/dist/types/index.d.ts.map +0 -1
  73. package/dist/types/index.js +0 -30
  74. package/dist/types/index.js.map +0 -1
  75. package/dist/types/jose.d.ts +0 -89
  76. package/dist/types/jose.d.ts.map +0 -1
  77. package/dist/types/jose.js +0 -55
  78. package/dist/types/jose.js.map +0 -1
  79. package/dist/types/metadata-types.d.ts +0 -5
  80. package/dist/types/metadata-types.d.ts.map +0 -1
  81. package/dist/types/metadata-types.js +0 -3
  82. package/dist/types/metadata-types.js.map +0 -1
  83. package/dist/types/mso_mdoc.d.ts +0 -94
  84. package/dist/types/mso_mdoc.d.ts.map +0 -1
  85. package/dist/types/mso_mdoc.js +0 -121
  86. package/dist/types/mso_mdoc.js.map +0 -1
  87. package/dist/types/pex.d.ts +0 -36
  88. package/dist/types/pex.d.ts.map +0 -1
  89. package/dist/types/pex.js +0 -3
  90. package/dist/types/pex.js.map +0 -1
  91. package/dist/types/sd-jwt-type-metadata.d.ts +0 -191
  92. package/dist/types/sd-jwt-type-metadata.d.ts.map +0 -1
  93. package/dist/types/sd-jwt-type-metadata.js +0 -3
  94. package/dist/types/sd-jwt-type-metadata.js.map +0 -1
  95. package/dist/types/sd-jwt-vc.d.ts +0 -196
  96. package/dist/types/sd-jwt-vc.d.ts.map +0 -1
  97. package/dist/types/sd-jwt-vc.js +0 -142
  98. package/dist/types/sd-jwt-vc.js.map +0 -1
  99. package/dist/types/status-list.d.ts +0 -10
  100. package/dist/types/status-list.d.ts.map +0 -1
  101. package/dist/types/status-list.js +0 -9
  102. package/dist/types/status-list.js.map +0 -1
  103. package/dist/types/vc.d.ts +0 -28
  104. package/dist/types/vc.d.ts.map +0 -1
  105. package/dist/types/vc.js +0 -28
  106. package/dist/types/vc.js.map +0 -1
  107. package/dist/types/w3c-vc.d.ts +0 -243
  108. package/dist/types/w3c-vc.d.ts.map +0 -1
  109. package/dist/types/w3c-vc.js +0 -26
  110. package/dist/types/w3c-vc.js.map +0 -1
  111. package/dist/utils/hasher.d.ts +0 -4
  112. package/dist/utils/hasher.d.ts.map +0 -1
  113. package/dist/utils/hasher.js +0 -40
  114. package/dist/utils/hasher.js.map +0 -1
  115. package/dist/utils/index.d.ts +0 -3
  116. package/dist/utils/index.d.ts.map +0 -1
  117. package/dist/utils/index.js +0 -19
  118. package/dist/utils/index.js.map +0 -1
  119. package/dist/utils/object.d.ts +0 -8
  120. package/dist/utils/object.d.ts.map +0 -1
  121. package/dist/utils/object.js +0 -28
  122. package/dist/utils/object.js.map +0 -1
package/dist/types/did.js DELETED
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseDid = exports.IProofType = exports.IProofPurpose = void 0;
4
- var IProofPurpose;
5
- (function (IProofPurpose) {
6
- IProofPurpose["verificationMethod"] = "verificationMethod";
7
- IProofPurpose["assertionMethod"] = "assertionMethod";
8
- IProofPurpose["authentication"] = "authentication";
9
- IProofPurpose["keyAgreement"] = "keyAgreement";
10
- IProofPurpose["contractAgreement"] = "contactAgreement";
11
- IProofPurpose["capabilityInvocation"] = "capabilityInvocation";
12
- IProofPurpose["capabilityDelegation"] = "capabilityDelegation";
13
- })(IProofPurpose || (exports.IProofPurpose = IProofPurpose = {}));
14
- var IProofType;
15
- (function (IProofType) {
16
- IProofType["Ed25519Signature2018"] = "Ed25519Signature2018";
17
- IProofType["Ed25519Signature2020"] = "Ed25519Signature2020";
18
- IProofType["EcdsaSecp256k1Signature2019"] = "EcdsaSecp256k1Signature2019";
19
- IProofType["EcdsaSecp256k1RecoverySignature2020"] = "EcdsaSecp256k1RecoverySignature2020";
20
- IProofType["JsonWebSignature2020"] = "JsonWebSignature2020";
21
- IProofType["RsaSignature2018"] = "RsaSignature2018";
22
- IProofType["GpgSignature2020"] = "GpgSignature2020";
23
- IProofType["JcsEd25519Signature2020"] = "JcsEd25519Signature2020";
24
- IProofType["BbsBlsSignatureProof2020"] = "BbsBlsSignatureProof2020";
25
- IProofType["BbsBlsBoundSignatureProof2020"] = "BbsBlsBoundSignatureProof2020";
26
- IProofType["JwtProof2020"] = "JwtProof2020";
27
- IProofType["SdJwtProof2024"] = "SdJwtProof2024";
28
- IProofType["MdocProof2024"] = "MsoMdocProof2024";
29
- })(IProofType || (exports.IProofType = IProofType = {}));
30
- const parseDid = (did) => {
31
- const parsedDid = parse(did);
32
- if (parsedDid === null) {
33
- throw new Error('invalid did');
34
- }
35
- return parsedDid;
36
- };
37
- exports.parseDid = parseDid;
38
- const parse = (didUrl) => {
39
- const PCT_ENCODED = '(?:%[0-9a-fA-F]{2})';
40
- const ID_CHAR = `(?:[a-zA-Z0-9._-]|${PCT_ENCODED})`;
41
- const METHOD = '([a-z0-9]+)';
42
- const METHOD_ID = `((?:${ID_CHAR}*:)*(${ID_CHAR}+))`;
43
- const PARAM_CHAR = '[a-zA-Z0-9_.:%-]';
44
- const PARAM = `;${PARAM_CHAR}+=${PARAM_CHAR}*`;
45
- const PARAMS = `((${PARAM})*)`;
46
- const PATH = `(/[^#?]*)?`;
47
- const QUERY = `([?][^#]*)?`;
48
- const FRAGMENT = `(#.*)?`;
49
- const DID_MATCHER = new RegExp(`^did:${METHOD}:${METHOD_ID}${PARAMS}${PATH}${QUERY}${FRAGMENT}$`);
50
- if (didUrl === '' || !didUrl)
51
- return null;
52
- const sections = didUrl.match(DID_MATCHER);
53
- if (sections) {
54
- const parts = {
55
- did: `did:${sections[1]}:${sections[2]}`,
56
- method: sections[1],
57
- id: sections[2],
58
- didUrl,
59
- };
60
- if (sections[4]) {
61
- const params = sections[4].slice(1).split(';');
62
- parts.params = {};
63
- for (const p of params) {
64
- const kv = p.split('=');
65
- parts.params[kv[0]] = kv[1];
66
- }
67
- }
68
- if (sections[6])
69
- parts.path = sections[6];
70
- if (sections[7])
71
- parts.query = sections[7].slice(1);
72
- if (sections[8])
73
- parts.fragment = sections[8].slice(1);
74
- return parts;
75
- }
76
- return null;
77
- };
78
- //# sourceMappingURL=did.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"did.js","sourceRoot":"","sources":["../../src/types/did.ts"],"names":[],"mappings":";;;AAAA,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,0DAAyC,CAAA;IACzC,oDAAmC,CAAA;IACnC,kDAAiC,CAAA;IACjC,8CAA6B,CAAA;IAC7B,uDAAsC,CAAA;IACtC,8DAA6C,CAAA;IAC7C,8DAA6C,CAAA;AAC/C,CAAC,EARW,aAAa,6BAAb,aAAa,QAQxB;AAED,IAAY,UAcX;AAdD,WAAY,UAAU;IACpB,2DAA6C,CAAA;IAC7C,2DAA6C,CAAA;IAC7C,yEAA2D,C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* Accept a Type or a Promise of that Type.
3
- *
4
- * @internal
5
- */
6
- export type OrPromise<T> = T | Promise<T>;
7
- export type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
8
- export type RequireOneOf<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
9
- [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;
10
- }[Keys];
11
- export type BearerTokenArg = (() => Promise<string>) | string;
12
- /**
13
- * Generic structure used for validations. For instance for X509 and JWs signature checks. Allows us to create multilevel structures for complex validations
14
- */
15
- export type IValidationResult = {
16
- /**
17
- * The name of the validation or its subsystem. Mainly used for information purposes. Not assumed to be unique
18
- */
19
- name: string;
20
- /**
21
- * Whether the validation was successful or not
22
- */
23
- error: boolean;
24
- /**
25
- * Whether an error can be ignored or not (up to processing logic)
26
- */
27
- critical: boolean;
28
- /**
29
- * Any status/info message about the validation
30
- */
31
- message: string;
32
- /**
33
- * The date and time of the validation
34
- */
35
- verificationTime: Date;
36
- };
37
- export type IValidationResults = {
38
- /**
39
- * Global derived error state for easy access
40
- */
41
- error: boolean;
42
- verifications: Array<IValidationResult>;
43
- };
44
- //# sourceMappingURL=generic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../src/types/generic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AACzC,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAE7E,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC,GAC3F;KACG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;CACzE,CAAC,IAAI,CAAC,CAAA;AAET,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAA;AAE7D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,KAAK,EAAE,OAAO,CAAA;IAEd;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAA;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAA;IAEf;;OAEG;IACH,gBAAgB,EAAE,IAAI,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAA;IAEd,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAA;CACxC,CAAA"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=generic.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generic.js","sourceRoot":"","sources":["../../src/types/generic.ts"],"names":[],"mappings":""}
@@ -1,14 +0,0 @@
1
- export * from './did';
2
- export * from './pex';
3
- export * from './vc';
4
- export * from './generic';
5
- export * from './sd-jwt-vc';
6
- export * from './sd-jwt-type-metadata';
7
- export * from './w3c-vc';
8
- export * from './jose';
9
- export * from './cose';
10
- export * from './mso_mdoc';
11
- export * from './metadata-types';
12
- export * from './status-list';
13
- export * from './dcql';
14
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,OAAO,CAAA;AACrB,cAAc,MAAM,CAAA;AACpB,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,QAAQ,CAAA"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./did"), exports);
18
- __exportStar(require("./pex"), exports);
19
- __exportStar(require("./vc"), exports);
20
- __exportStar(require("./generic"), exports);
21
- __exportStar(require("./sd-jwt-vc"), exports);
22
- __exportStar(require("./sd-jwt-type-metadata"), exports);
23
- __exportStar(require("./w3c-vc"), exports);
24
- __exportStar(require("./jose"), exports);
25
- __exportStar(require("./cose"), exports);
26
- __exportStar(require("./mso_mdoc"), exports);
27
- __exportStar(require("./metadata-types"), exports);
28
- __exportStar(require("./status-list"), exports);
29
- __exportStar(require("./dcql"), exports);
30
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,wCAAqB;AACrB,uCAAoB;AACpB,4CAAyB;AACzB,8CAA2B;AAC3B,yDAAsC;AACtC,2CAAwB;AACxB,yCAAsB;AACtB,yCAAsB;AACtB,6CAA0B;AAC1B,mDAAgC;AAChC,gDAA6B;AAC7B,yCAAsB"}
@@ -1,89 +0,0 @@
1
- /**
2
- * Conversion functions to Cose available for TS in our @sphereon/ssi-sdk-ext.key-utils package
3
- */
4
- export interface BaseJWK {
5
- kty: JwkKeyType | JwkKeyTypeString;
6
- crv?: JoseCurve | JoseCurveString;
7
- alg?: JoseSignatureAlgorithm | JoseSignatureAlgorithmString;
8
- x?: string;
9
- y?: string;
10
- e?: string;
11
- n?: string;
12
- }
13
- export interface JWK extends BaseJWK {
14
- d?: string;
15
- dp?: string;
16
- dq?: string;
17
- ext?: boolean;
18
- k?: string;
19
- key_ops?: (JoseKeyOperation | JoseKeyOperationString)[];
20
- kid?: string;
21
- oth?: Array<{
22
- d?: string;
23
- r?: string;
24
- t?: string;
25
- }>;
26
- p?: string;
27
- q?: string;
28
- qi?: string;
29
- use?: string;
30
- /** JWK "x5c" (X.509 Certificate Chain) Parameter. */
31
- x5c?: string[];
32
- /** JWK "x5t" (X.509 Certificate SHA-1 Thumbprint) Parameter. */
33
- x5t?: string;
34
- /** "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Parameter. */
35
- 'x5t#S256'?: string;
36
- /** JWK "x5u" (X.509 URL) Parameter. */
37
- x5u?: string;
38
- iv?: string;
39
- [propName: string]: unknown;
40
- }
41
- export declare enum JwkKeyType {
42
- EC = "EC",
43
- RSA = "RSA",
44
- oct = "oct",
45
- OKP = "OKP"
46
- }
47
- export type JwkKeyTypeString = 'EC' | 'RSA' | 'oct' | 'OKP';
48
- export declare enum JoseSignatureAlgorithm {
49
- RS256 = "RS256",
50
- RS384 = "RS384",
51
- RS512 = "RS512",
52
- ES256 = "ES256",
53
- ES256K = "ES256K",
54
- ES384 = "ES384",
55
- ES512 = "ES512",
56
- EdDSA = "EdDSA",
57
- HS256 = "HS256",
58
- HS384 = "HS384",
59
- HS512 = "HS512",
60
- PS256 = "PS256",
61
- PS384 = "PS384",
62
- PS512 = "PS512",
63
- none = "none"
64
- }
65
- export type JoseSignatureAlgorithmString = 'RS256' | 'RS384' | 'RS512' | 'ES256' | 'ES256K' | 'ES384' | 'ES512' | 'EdDSA' | 'HS256' | 'HS384' | 'HS512' | 'PS256' | 'PS384' | 'PS512' | 'none';
66
- export declare enum JoseKeyOperation {
67
- SIGN = "sign",
68
- VERIFY = "verify",
69
- ENCRYPT = "encrypt",
70
- DECRYPT = "decrypt",
71
- WRAP_KEY = "wrapKey",
72
- UNWRAP_KEY = "unwrapKey",
73
- DERIVE_KEY = "deriveKey",
74
- DERIVE_BITS = "deriveBits"
75
- }
76
- export type JoseKeyOperationString = 'sign' | 'verify' | 'encrypt' | 'decrypt' | 'wrapKey' | 'unwrapKey' | 'deriveKey' | 'deriveBits';
77
- export declare enum JoseCurve {
78
- P_256 = "P-256",
79
- P_384 = "P-384",
80
- P_521 = "P-521",
81
- X25519 = "X25519",
82
- X448 = "X448",
83
- EdDSA = "EdDSA",
84
- Ed25519 = "Ed25519",
85
- Ed448 = "Ed448",
86
- secp256k1 = "secp256k1"
87
- }
88
- export type JoseCurveString = 'P-256' | 'P-384' | 'P-521' | 'X25519' | 'X448' | 'EdDSA' | 'Ed25519' | 'Ed448' | 'secp256k1';
89
- //# sourceMappingURL=jose.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jose.d.ts","sourceRoot":"","sources":["../../src/types/jose.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,UAAU,GAAG,gBAAgB,CAAA;IAClC,GAAG,CAAC,EAAE,SAAS,GAAG,eAAe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sphereon/ssi-sdk-ext.key-utils package
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.JoseCurve = exports.JoseKeyOperation = exports.JoseSignatureAlgorithm = exports.JwkKeyType = void 0;
7
- var JwkKeyType;
8
- (function (JwkKeyType) {
9
- JwkKeyType["EC"] = "EC";
10
- JwkKeyType["RSA"] = "RSA";
11
- JwkKeyType["oct"] = "oct";
12
- JwkKeyType["OKP"] = "OKP";
13
- })(JwkKeyType || (exports.JwkKeyType = JwkKeyType = {}));
14
- var JoseSignatureAlgorithm;
15
- (function (JoseSignatureAlgorithm) {
16
- JoseSignatureAlgorithm["RS256"] = "RS256";
17
- JoseSignatureAlgorithm["RS384"] = "RS384";
18
- JoseSignatureAlgorithm["RS512"] = "RS512";
19
- JoseSignatureAlgorithm["ES256"] = "ES256";
20
- JoseSignatureAlgorithm["ES256K"] = "ES256K";
21
- JoseSignatureAlgorithm["ES384"] = "ES384";
22
- JoseSignatureAlgorithm["ES512"] = "ES512";
23
- JoseSignatureAlgorithm["EdDSA"] = "EdDSA";
24
- JoseSignatureAlgorithm["HS256"] = "HS256";
25
- JoseSignatureAlgorithm["HS384"] = "HS384";
26
- JoseSignatureAlgorithm["HS512"] = "HS512";
27
- JoseSignatureAlgorithm["PS256"] = "PS256";
28
- JoseSignatureAlgorithm["PS384"] = "PS384";
29
- JoseSignatureAlgorithm["PS512"] = "PS512";
30
- JoseSignatureAlgorithm["none"] = "none";
31
- })(JoseSignatureAlgorithm || (exports.JoseSignatureAlgorithm = JoseSignatureAlgorithm = {}));
32
- var JoseKeyOperation;
33
- (function (JoseKeyOperation) {
34
- JoseKeyOperation["SIGN"] = "sign";
35
- JoseKeyOperation["VERIFY"] = "verify";
36
- JoseKeyOperation["ENCRYPT"] = "encrypt";
37
- JoseKeyOperation["DECRYPT"] = "decrypt";
38
- JoseKeyOperation["WRAP_KEY"] = "wrapKey";
39
- JoseKeyOperation["UNWRAP_KEY"] = "unwrapKey";
40
- JoseKeyOperation["DERIVE_KEY"] = "deriveKey";
41
- JoseKeyOperation["DERIVE_BITS"] = "deriveBits";
42
- })(JoseKeyOperation || (exports.JoseKeyOperation = JoseKeyOperation = {}));
43
- var JoseCurve;
44
- (function (JoseCurve) {
45
- JoseCurve["P_256"] = "P-256";
46
- JoseCurve["P_384"] = "P-384";
47
- JoseCurve["P_521"] = "P-521";
48
- JoseCurve["X25519"] = "X25519";
49
- JoseCurve["X448"] = "X448";
50
- JoseCurve["EdDSA"] = "EdDSA";
51
- JoseCurve["Ed25519"] = "Ed25519";
52
- JoseCurve["Ed448"] = "Ed448";
53
- JoseCurve["secp256k1"] = "secp256k1";
54
- })(JoseCurve || (exports.JoseCurve = JoseCurve = {}));
55
- //# sourceMappingURL=jose.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jose.js","sourceRoot":"","sources":["../../src/types/jose.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA2CH,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,uBAAS,CAAA;IACT,yBAAW,CAAA;IACX,yBAAW,CAAA;IACX,yBAAW,CAAA;AACb,CAAC,EALW,UAAU,0BAAV,UAAU,QAKrB;AAID,IAAY,sBAgBX;AAhBD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,2CAAiB,CAAA;IACjB,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,yCAAe,CAAA;IACf,uCAAa,CAAA;AACf,CAAC,EAhBW,sBAAsB,sCAAtB,sBAAsB,QAgBjC;AAmBD,IAAY,gBASX;AATD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,wCAAoB,CAAA;IACpB,4CAAwB,CAAA;IACxB,4CAAwB,CAAA;IACxB,8CAA0B,CAAA;AAC5B,CAAC,EATW,gBAAgB,gCAAhB,gBAAgB,QAS3B;AAID,IAAY,SAUX;AAVD,WAAY,SAAS;IACnB,4BAAe,CAAA;IACf,4BAAe,CAAA;IACf,4BAAe,CAAA;IACf,8BAAiB,CAAA;IACjB,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,gCAAmB,CAAA;IACnB,4BAAe,CAAA;IACf,oCAAuB,CAAA;AACzB,CAAC,EAVW,SAAS,yBAAT,SAAS,QAUpB"}
@@ -1,5 +0,0 @@
1
- export type MetadataType = 'issuer' | 'authorizationServer' | 'openidFederation';
2
- export interface IMetadataImportArgs {
3
- metadataType: MetadataType;
4
- }
5
- //# sourceMappingURL=metadata-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metadata-types.d.ts","sourceRoot":"","sources":["../../src/types/metadata-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,qBAAqB,GAAG,kBAAkB,CAAA;AAEhF,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,YAAY,CAAA;CAC3B"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=metadata-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"metadata-types.js","sourceRoot":"","sources":["../../src/types/metadata-types.ts"],"names":[],"mappings":""}
@@ -1,94 +0,0 @@
1
- /**
2
- * Create some interface below to do a the mapping of the KMP library.
3
- * For now we are using the library directly, and thus do not need them,
4
- * but it would be nice if we can remove the imports and just have some interfaces here we can then use, like done
5
- * for sd-jwts
6
- */
7
- import { com } from '@sphereon/kmp-mdoc-core';
8
- import { OriginalType, WrappedVerifiableCredential, WrappedVerifiablePresentation } from './vc';
9
- import { IVerifiableCredential } from './w3c-vc';
10
- /**
11
- * Represents a selective disclosure JWT vc in compact form.
12
- */
13
- export type MdocOid4vpIssuerSigned = string;
14
- export type MdocOid4vpMdocVpToken = string;
15
- export type MdocIssuerSigned = com.sphereon.mdoc.data.device.IssuerSignedCbor;
16
- export type MdocDocument = com.sphereon.mdoc.data.device.DocumentCbor;
17
- export type MdocDocumentJson = com.sphereon.mdoc.data.device.DocumentJson;
18
- export type IssuerSignedJson = com.sphereon.mdoc.data.device.IssuerSignedJson;
19
- export type DeviceSignedJson = com.sphereon.mdoc.data.device.DeviceSignedJson;
20
- export type MdocDeviceResponse = com.sphereon.mdoc.data.device.DeviceResponseCbor;
21
- export interface WrappedMdocCredential {
22
- /**
23
- * Original IssuerSigned to Mdoc that we've received. Can be either the encoded or decoded variant.
24
- */
25
- original: MdocDocument | MdocOid4vpIssuerSigned;
26
- /**
27
- * Record where keys are the namespaces and the values are objects again with the namespace values
28
- * @todo which types can be there? (it doesn't matter for matching as mdoc only matches on path)
29
- */
30
- decoded: MdocDecodedPayload;
31
- /**
32
- * Type of this credential.
33
- */
34
- type: OriginalType.MSO_MDOC_DECODED | OriginalType.MSO_MDOC_ENCODED;
35
- /**
36
- * The claim format, typically used during exchange transport protocols
37
- */
38
- format: 'mso_mdoc';
39
- /**
40
- * Internal stable representation of a Credential
41
- */
42
- credential: MdocDocument;
43
- }
44
- export interface WrappedMdocPresentation {
45
- /**
46
- * Original VP that we've received. Can be either the encoded or decoded variant.
47
- */
48
- original: MdocDeviceResponse | MdocOid4vpMdocVpToken;
49
- /**
50
- * Decoded version of the SD-JWT payload. This is the decoded payload, rather than the whole SD-JWT.
51
- */
52
- decoded: MdocDeviceResponse;
53
- /**
54
- * Type of this Presentation.
55
- */
56
- type: OriginalType.MSO_MDOC_ENCODED | OriginalType.MSO_MDOC_DECODED;
57
- /**
58
- * The claim format, typically used during exchange transport protocols
59
- */
60
- format: 'mso_mdoc';
61
- /**
62
- * Internal stable representation of a Presentation
63
- */
64
- presentation: MdocDeviceResponse;
65
- /**
66
- * Wrapped Mdocs belonging to the Presentation. There can be multiple
67
- * documents in a single device response
68
- */
69
- vcs: WrappedMdocCredential[];
70
- }
71
- export declare function isWrappedMdocCredential(vc: WrappedVerifiableCredential): vc is WrappedMdocCredential;
72
- export declare function isWrappedMdocPresentation(vp: WrappedVerifiablePresentation): vp is WrappedMdocPresentation;
73
- /**
74
- * Record where keys are the namespaces and the values are objects again with the namespace values
75
- */
76
- export type MdocDecodedPayload = Record<string, Record<string, string | number | boolean>>;
77
- export declare function getMdocDecodedPayload(mdoc: MdocDocument): MdocDecodedPayload;
78
- /**
79
- * Decode an Mdoc from its issuerSigned OID4VP Base64URL (string) to an object containing the disclosures,
80
- * signed payload, decoded payload
81
- *
82
- */
83
- export declare function decodeMdocIssuerSigned(oid4vpIssuerSigned: MdocOid4vpIssuerSigned): MdocDocument;
84
- export declare function encodeMdocIssuerSigned(issuerSigned: MdocIssuerSigned, encoding?: 'base64url'): string;
85
- /**
86
- * Decode an Mdoc from its vp_token OID4VP Base64URL (string) to an object containing the disclosures,
87
- * signed payload, decoded payload
88
- *
89
- */
90
- export declare function decodeMdocDeviceResponse(vpToken: MdocOid4vpMdocVpToken): MdocDeviceResponse;
91
- export declare const mdocDecodedCredentialToUniformCredential: (decoded: MdocDocument, opts?: {
92
- maxTimeSkewInMS?: number;
93
- }) => IVerifiableCredential;
94
- //# sourceMappingURL=mso_mdoc.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mso_mdoc.d.ts","sourceRoot":"","sources":["../../src/types/mso_mdoc.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAE7C,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,6BAA6B,EAAE,MAAM,MAAM,CAAA;AAC/F,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAShD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAA;AAC3C,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAA;AAC1C,MAAM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AkB,CAAA;IAChC;;;OAGG;IACH,GAAG,EAAE,qBAAqB,EAAE,CAAA;CAC7B;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,2BAA2B,GAAG,EAAE,IAAI,qBAAqB,CAEpG;AAED,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,6BAA6B,GAAG,EAAE,IAAI,uBAAuB,CAE1G;AACD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAA;AAC1F,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,YAAY,GAAG,kBAAkB,CAqB5E;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,kBAAkB,EAAE,sBAAsB,GAAG,YAAY,CAM/F;AAED,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,gBAAgB,EAAE,QAAQ,GAAE,WAAyB,UAEzG;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,qBAAqB,GAAG,kBAAkB,CAG3F;AAGD,eAAO,MAAM,wCAAwC,YAC1C,YAAY,SAEd;IAAE,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,KAClC,qBA0DF,CAAA"}
@@ -1,121 +0,0 @@
1
- "use strict";
2
- /**
3
- * Create some interface below to do a the mapping of the KMP library.
4
- * For now we are using the library directly, and thus do not need them,
5
- * but it would be nice if we can remove the imports and just have some interfaces here we can then use, like done
6
- * for sd-jwts
7
- */
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.mdocDecodedCredentialToUniformCredential = void 0;
10
- exports.isWrappedMdocCredential = isWrappedMdocCredential;
11
- exports.isWrappedMdocPresentation = isWrappedMdocPresentation;
12
- exports.getMdocDecodedPayload = getMdocDecodedPayload;
13
- exports.decodeMdocIssuerSigned = decodeMdocIssuerSigned;
14
- exports.encodeMdocIssuerSigned = encodeMdocIssuerSigned;
15
- exports.decodeMdocDeviceResponse = decodeMdocDeviceResponse;
16
- const kmp_mdoc_core_1 = require("@sphereon/kmp-mdoc-core");
17
- const did_1 = require("./did");
18
- var decodeFrom = kmp_mdoc_core_1.com.sphereon.kmp.decodeFrom;
19
- var encodeTo = kmp_mdoc_core_1.com.sphereon.kmp.encodeTo;
20
- var Encoding = kmp_mdoc_core_1.com.sphereon.kmp.Encoding;
21
- var DeviceResponseCbor = kmp_mdoc_core_1.com.sphereon.mdoc.data.device.DeviceResponseCbor;
22
- var IssuerSignedCbor = kmp_mdoc_core_1.com.sphereon.mdoc.data.device.IssuerSignedCbor;
23
- function isWrappedMdocCredential(vc) {
24
- return vc.format === 'mso_mdoc';
25
- }
26
- function isWrappedMdocPresentation(vp) {
27
- return vp.format === 'mso_mdoc';
28
- }
29
- function getMdocDecodedPayload(mdoc) {
30
- const mdocJson = mdoc.toJson();
31
- if (!mdocJson.issuerSigned.nameSpaces) {
32
- throw Error(`Cannot access Issuer Signed items from the Mdoc`);
33
- }
34
- const issuerSignedJson = mdoc.issuerSigned.toJsonDTO();
35
- const namespaces = issuerSignedJson.nameSpaces;
36
- const decodedPayload = {};
37
- for (const [namespace, items] of Object.entries(namespaces)) {
38
- decodedPayload[namespace] = items.reduce((acc, item) => (Object.assign(Object.assign({}, acc), { [item.key]: item.value.value })), {});
39
- }
40
- return decodedPayload;
41
- }
42
- /**
43
- * Decode an Mdoc from its issuerSigned OID4VP Base64URL (string) to an object containing the disclosures,
44
- * signed payload, decoded payload
45
- *
46
- */
47
- function decodeMdocIssuerSigned(oid4vpIssuerSigned) {
48
- // Issuer signed according to 18013-7 in base64url
49
- const issuerSigned = IssuerSignedCbor.Static.cborDecode(decodeFrom(oid4vpIssuerSigned, Encoding.BASE64URL));
50
- // Create an mdoc from it. // Validations need to be performed by the caller after this!
51
- const holderMdoc = issuerSigned.toDocument();
52
- return holderMdoc;
53
- }
54
- function encodeMdocIssuerSigned(issuerSigned, encoding = 'base64url') {
55
- return encodeTo(issuerSigned.cborEncode(), Encoding.BASE64URL);
56
- }
57
- /**
58
- * Decode an Mdoc from its vp_token OID4VP Base64URL (string) to an object containing the disclosures,
59
- * signed payload, decoded payload
60
- *
61
- */
62
- function decodeMdocDeviceResponse(vpToken) {
63
- const deviceResponse = DeviceResponseCbor.Static.cborDecode(decodeFrom(vpToken, Encoding.BASE64URL));
64
- return deviceResponse;
65
- }
66
- // TODO naive implementation of mapping a mdoc onto a IVerifiableCredential. Needs some fixes and further implementation and needs to be moved out of ssi-types
67
- const mdocDecodedCredentialToUniformCredential = (decoded,
68
- // @ts-ignore
69
- opts) => {
70
- var _a;
71
- const mdoc = decoded.toJson();
72
- const json = mdoc.toJsonDTO();
73
- const type = 'Personal Identification Data';
74
- const MSO = mdoc.MSO;
75
- if (!MSO || !((_a = json.issuerSigned) === null || _a === void 0 ? void 0 : _a.nameSpaces)) {
76
- throw Error(`Cannot access Mobile Security Object or Issuer Signed items from the Mdoc`);
77
- }
78
- const nameSpaces = json.issuerSigned.nameSpaces;
79
- if (!('eu.europa.ec.eudi.pid.1' in nameSpaces)) {
80
- throw Error(`Only PID supported at present`);
81
- }
82
- const items = nameSpaces['eu.europa.ec.eudi.pid.1'];
83
- if (!items || items.length === 0) {
84
- throw Error(`No issuer signed items were found`);
85
- }
86
- const credentialSubject = items.reduce((acc, item) => {
87
- if (Array.isArray(item.value)) {
88
- acc[item.key] = item.value.map((val) => val.value).join(', ');
89
- }
90
- else {
91
- acc[item.key] = item.value.value;
92
- }
93
- return acc;
94
- }, {});
95
- const validFrom = MSO.validityInfo.validFrom;
96
- const validUntil = MSO.validityInfo.validUntil;
97
- const docType = MSO.docType;
98
- const expirationDate = validUntil;
99
- let issuanceDateStr = validFrom;
100
- const issuanceDate = issuanceDateStr;
101
- if (!issuanceDate) {
102
- throw Error(`JWT issuance date is required but was not present`);
103
- }
104
- const credential = {
105
- type: [docType], // Mdoc not a W3C VC, so no VerifiableCredential
106
- '@context': [], // Mdoc has no JSON-LD by default. Certainly not the VC DM1 default context for JSON-LD
107
- credentialSubject: Object.assign({ type }, credentialSubject),
108
- issuanceDate,
109
- expirationDate,
110
- proof: {
111
- type: did_1.IProofType.MdocProof2024,
112
- created: issuanceDate,
113
- proofPurpose: did_1.IProofPurpose.authentication,
114
- verificationMethod: json.issuerSigned.issuerAuth.payload,
115
- mso_mdoc: encodeTo(decoded.cborEncode(), Encoding.BASE64URL),
116
- },
117
- };
118
- return credential;
119
- };
120
- exports.mdocDecodedCredentialToUniformCredential = mdocDecodedCredentialToUniformCredential;
121
- //# sourceMappingURL=mso_mdoc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mso_mdoc.js","sourceRoot":"","sources":["../../src/types/mso_mdoc.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA8EH,0DAEC;AAED,8DAEC;AAKD,sDAqBC;AAOD,wDAMC;AAED,wDAEC;AAOD,4DAGC;AAvID,2DAA6C;AAC7C,+BAAiD;AAGjD,IAAO,UAAU,GAAG,mBAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAA;AAC/C,IAAO,QAAQ,GAAG,mBAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAA;AAC3C,IAAO,QAAQ,GAAG,mBAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAA;AAC3C,IAAO,kBAAkB,GAAG,mBAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAA;AAE5E,IAAO,gBAAgB,GAAG,mBAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAA;AAmExE,SAAgB,uBAAuB,CAAC,EAA+B;IACrE,OAAO,EAAE,CAAC,MAAM,KAAK,UAAU,CAAA;AACjC,CAAC;AAED,SAAgB,yBAAyB,CAAC,EAAiC;IACzE,OAAO,EAAE,CAAC,MAAM,KAAK,UAAU,CAAA;AACjC,CAAC;AAKD,SAA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
- export interface PresentationSubmission {
5
- /**
6
- * A UUID or some other unique ID to identify this Presentation Submission
7
- */
8
- id: string;
9
- /**
10
- * A UUID or some other unique ID to identify this Presentation Definition
11
- */
12
- definition_id: string;
13
- /**
14
- * List of descriptors of how the claims are being mapped to presentation definition
15
- */
16
- descriptor_map: Array<Descriptor>;
17
- }
18
- /**
19
- * descriptor map laying out the structure of the presentation submission.
20
- */
21
- export interface Descriptor {
22
- /**
23
- * ID to identify the descriptor from Presentation Definition Input Descriptor it coresponds to.
24
- */
25
- id: string;
26
- /**
27
- * The path where the verifiable credential is located in the presentation submission json
28
- */
29
- path: string;
30
- path_nested?: Descriptor;
31
- /**
32
- * The Proof or JWT algorith that the proof is in
33
- */
34
- format: string;
35
- }
36
- //# sourceMappingURL=pex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pex.d.ts","sourceRoot":"","sources":["../../src/types/pex.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,cAAc,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,UAAU,CAAA;IACxB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;CACf"}
package/dist/types/pex.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=pex.js.map