@pagopa/io-react-native-wallet 0.11.1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. package/lib/commonjs/client/generated/wallet-provider.js +126 -0
  2. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -0
  3. package/lib/commonjs/client/index.js +40 -0
  4. package/lib/commonjs/client/index.js.map +1 -0
  5. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +2 -1
  6. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/03-start-credential-issuance.js +287 -0
  8. package/lib/commonjs/credential/issuance/03-start-credential-issuance.js.map +1 -0
  9. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +56 -83
  10. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +88 -0
  12. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  13. package/lib/commonjs/credential/issuance/05-authorize-access.js +56 -33
  14. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  15. package/lib/commonjs/credential/issuance/06-obtain-credential.js +51 -78
  16. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  17. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +21 -44
  18. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  19. package/lib/commonjs/credential/issuance/index.js +7 -0
  20. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/types.js +28 -0
  22. package/lib/commonjs/credential/issuance/types.js.map +1 -0
  23. package/lib/commonjs/index.js +10 -1
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/pid/sd-jwt/converters.js +5 -9
  26. package/lib/commonjs/pid/sd-jwt/converters.js.map +1 -1
  27. package/lib/commonjs/pid/sd-jwt/types.js +3 -3
  28. package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
  29. package/lib/commonjs/sd-jwt/__test__/converters.test.js +1 -1
  30. package/lib/commonjs/sd-jwt/__test__/converters.test.js.map +1 -1
  31. package/lib/commonjs/sd-jwt/__test__/index.test.js +30 -43
  32. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  33. package/lib/commonjs/sd-jwt/__test__/types.test.js +16 -24
  34. package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
  35. package/lib/commonjs/sd-jwt/index.js +3 -9
  36. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  37. package/lib/commonjs/sd-jwt/types.js +11 -16
  38. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  39. package/lib/commonjs/trust/types.js +70 -29
  40. package/lib/commonjs/trust/types.js.map +1 -1
  41. package/lib/commonjs/utils/auth.js +44 -0
  42. package/lib/commonjs/utils/auth.js.map +1 -0
  43. package/lib/commonjs/utils/errors.js +104 -1
  44. package/lib/commonjs/utils/errors.js.map +1 -1
  45. package/lib/commonjs/utils/integrity.js +2 -0
  46. package/lib/commonjs/utils/integrity.js.map +1 -0
  47. package/lib/commonjs/utils/misc.js +34 -1
  48. package/lib/commonjs/utils/misc.js.map +1 -1
  49. package/lib/commonjs/utils/par.js +23 -15
  50. package/lib/commonjs/utils/par.js.map +1 -1
  51. package/lib/commonjs/utils/pop.js +33 -0
  52. package/lib/commonjs/utils/pop.js.map +1 -0
  53. package/lib/commonjs/wallet-instance/index.js +29 -0
  54. package/lib/commonjs/wallet-instance/index.js.map +1 -0
  55. package/lib/commonjs/wallet-instance-attestation/issuing.js +62 -65
  56. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  57. package/lib/commonjs/wallet-instance-attestation/types.js +8 -8
  58. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  59. package/lib/module/client/generated/wallet-provider.js +102 -0
  60. package/lib/module/client/generated/wallet-provider.js.map +1 -0
  61. package/lib/module/client/index.js +33 -0
  62. package/lib/module/client/index.js.map +1 -0
  63. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +2 -1
  64. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
  65. package/lib/module/credential/issuance/03-start-credential-issuance.js +276 -0
  66. package/lib/module/credential/issuance/03-start-credential-issuance.js.map +1 -0
  67. package/lib/module/credential/issuance/03-start-user-authorization.js +56 -80
  68. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  69. package/lib/module/credential/issuance/04-complete-user-authorization.js +85 -1
  70. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  71. package/lib/module/credential/issuance/05-authorize-access.js +54 -33
  72. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  73. package/lib/module/credential/issuance/06-obtain-credential.js +50 -75
  74. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  75. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +21 -44
  76. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
  77. package/lib/module/credential/issuance/index.js +2 -1
  78. package/lib/module/credential/issuance/index.js.map +1 -1
  79. package/lib/module/credential/issuance/types.js +18 -0
  80. package/lib/module/credential/issuance/types.js.map +1 -0
  81. package/lib/module/index.js +3 -1
  82. package/lib/module/index.js.map +1 -1
  83. package/lib/module/pid/sd-jwt/converters.js +5 -9
  84. package/lib/module/pid/sd-jwt/converters.js.map +1 -1
  85. package/lib/module/pid/sd-jwt/types.js +3 -3
  86. package/lib/module/pid/sd-jwt/types.js.map +1 -1
  87. package/lib/module/sd-jwt/__test__/converters.test.js +1 -1
  88. package/lib/module/sd-jwt/__test__/converters.test.js.map +1 -1
  89. package/lib/module/sd-jwt/__test__/index.test.js +30 -43
  90. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  91. package/lib/module/sd-jwt/__test__/types.test.js +16 -24
  92. package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
  93. package/lib/module/sd-jwt/index.js +3 -9
  94. package/lib/module/sd-jwt/index.js.map +1 -1
  95. package/lib/module/sd-jwt/types.js +11 -16
  96. package/lib/module/sd-jwt/types.js.map +1 -1
  97. package/lib/module/trust/types.js +70 -29
  98. package/lib/module/trust/types.js.map +1 -1
  99. package/lib/module/utils/auth.js +35 -0
  100. package/lib/module/utils/auth.js.map +1 -0
  101. package/lib/module/utils/errors.js +98 -0
  102. package/lib/module/utils/errors.js.map +1 -1
  103. package/lib/module/utils/integrity.js +2 -0
  104. package/lib/module/utils/integrity.js.map +1 -0
  105. package/lib/module/utils/misc.js +31 -0
  106. package/lib/module/utils/misc.js.map +1 -1
  107. package/lib/module/utils/par.js +24 -16
  108. package/lib/module/utils/par.js.map +1 -1
  109. package/lib/module/utils/pop.js +24 -0
  110. package/lib/module/utils/pop.js.map +1 -0
  111. package/lib/module/wallet-instance/index.js +23 -0
  112. package/lib/module/wallet-instance/index.js.map +1 -0
  113. package/lib/module/wallet-instance-attestation/issuing.js +63 -67
  114. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  115. package/lib/module/wallet-instance-attestation/types.js +8 -8
  116. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  117. package/lib/typescript/client/generated/wallet-provider.d.ts +264 -0
  118. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -0
  119. package/lib/typescript/client/index.d.ts +7 -0
  120. package/lib/typescript/client/index.d.ts.map +1 -0
  121. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -0
  122. package/lib/typescript/credential/issuance/01-start-flow.d.ts.map +1 -1
  123. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +2 -1
  124. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -1
  125. package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts +41 -0
  126. package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts.map +1 -0
  127. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +23 -18
  128. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  129. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +24 -12
  130. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  131. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +22 -16
  132. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  133. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +19 -26
  134. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  135. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +10 -15
  136. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
  137. package/lib/typescript/credential/issuance/index.d.ts +3 -4
  138. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  139. package/lib/typescript/credential/issuance/types.d.ts +63 -0
  140. package/lib/typescript/credential/issuance/types.d.ts.map +1 -0
  141. package/lib/typescript/credential/presentation/types.d.ts +6 -6
  142. package/lib/typescript/index.d.ts +6 -1
  143. package/lib/typescript/index.d.ts.map +1 -1
  144. package/lib/typescript/pid/sd-jwt/converters.d.ts.map +1 -1
  145. package/lib/typescript/pid/sd-jwt/types.d.ts +36 -36
  146. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
  147. package/lib/typescript/sd-jwt/index.d.ts +40 -68
  148. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  149. package/lib/typescript/sd-jwt/types.d.ts +64 -121
  150. package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
  151. package/lib/typescript/trust/index.d.ts +150 -48
  152. package/lib/typescript/trust/index.d.ts.map +1 -1
  153. package/lib/typescript/trust/types.d.ts +2838 -1740
  154. package/lib/typescript/trust/types.d.ts.map +1 -1
  155. package/lib/typescript/utils/auth.d.ts +52 -0
  156. package/lib/typescript/utils/auth.d.ts.map +1 -0
  157. package/lib/typescript/utils/errors.d.ts +48 -0
  158. package/lib/typescript/utils/errors.d.ts.map +1 -1
  159. package/lib/typescript/utils/integrity.d.ts +21 -0
  160. package/lib/typescript/utils/integrity.d.ts.map +1 -0
  161. package/lib/typescript/utils/misc.d.ts +18 -0
  162. package/lib/typescript/utils/misc.d.ts.map +1 -1
  163. package/lib/typescript/utils/par.d.ts +8 -31
  164. package/lib/typescript/utils/par.d.ts.map +1 -1
  165. package/lib/typescript/utils/pop.d.ts +26 -0
  166. package/lib/typescript/utils/pop.d.ts.map +1 -0
  167. package/lib/typescript/wallet-instance/index.d.ts +7 -0
  168. package/lib/typescript/wallet-instance/index.d.ts.map +1 -0
  169. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +17 -4
  170. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  171. package/lib/typescript/wallet-instance-attestation/types.d.ts +64 -64
  172. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  173. package/package.json +9 -5
  174. package/src/client/generated/wallet-provider.ts +173 -0
  175. package/src/client/index.ts +53 -0
  176. package/src/credential/issuance/01-start-flow.ts +1 -0
  177. package/src/credential/issuance/02-evaluate-issuer-trust.ts +2 -1
  178. package/src/credential/issuance/03-start-credential-issuance.ts +407 -0
  179. package/src/credential/issuance/03-start-user-authorization.ts +91 -92
  180. package/src/credential/issuance/04-complete-user-authorization.ts +114 -13
  181. package/src/credential/issuance/05-authorize-access.ts +74 -49
  182. package/src/credential/issuance/06-obtain-credential.ts +77 -111
  183. package/src/credential/issuance/07-verify-and-parse-credential.ts +30 -67
  184. package/src/credential/issuance/index.ts +6 -4
  185. package/src/credential/issuance/types.ts +25 -0
  186. package/src/index.ts +8 -0
  187. package/src/pid/sd-jwt/converters.ts +5 -11
  188. package/src/pid/sd-jwt/types.ts +8 -6
  189. package/src/sd-jwt/__test__/converters.test.ts +1 -1
  190. package/src/sd-jwt/__test__/index.test.ts +45 -74
  191. package/src/sd-jwt/__test__/types.test.ts +21 -33
  192. package/src/sd-jwt/index.ts +3 -12
  193. package/src/sd-jwt/types.ts +17 -22
  194. package/src/trust/types.ts +64 -32
  195. package/src/utils/auth.ts +37 -0
  196. package/src/utils/errors.ts +112 -0
  197. package/src/utils/integrity.ts +23 -0
  198. package/src/utils/misc.ts +43 -0
  199. package/src/utils/par.ts +29 -17
  200. package/src/utils/pop.ts +34 -0
  201. package/src/wallet-instance/index.ts +29 -0
  202. package/src/wallet-instance-attestation/issuing.ts +101 -97
  203. package/src/wallet-instance-attestation/types.ts +12 -8
  204. package/lib/commonjs/credential/issuance/07-confirm-credential.js +0 -6
  205. package/lib/commonjs/credential/issuance/07-confirm-credential.js.map +0 -1
  206. package/lib/commonjs/credential/issuance/08-confirm-credential.js +0 -6
  207. package/lib/commonjs/credential/issuance/08-confirm-credential.js.map +0 -1
  208. package/lib/module/credential/issuance/07-confirm-credential.js +0 -2
  209. package/lib/module/credential/issuance/07-confirm-credential.js.map +0 -1
  210. package/lib/module/credential/issuance/08-confirm-credential.js +0 -2
  211. package/lib/module/credential/issuance/08-confirm-credential.js.map +0 -1
  212. package/lib/typescript/credential/issuance/07-confirm-credential.d.ts +0 -11
  213. package/lib/typescript/credential/issuance/07-confirm-credential.d.ts.map +0 -1
  214. package/lib/typescript/credential/issuance/08-confirm-credential.d.ts +0 -11
  215. package/lib/typescript/credential/issuance/08-confirm-credential.d.ts.map +0 -1
  216. package/src/credential/issuance/07-confirm-credential.ts +0 -14
  217. package/src/credential/issuance/08-confirm-credential.ts +0 -14
@@ -6,33 +6,26 @@ import { verify as verifySdJwt } from "../../sd-jwt";
6
6
 
7
7
  // handy alias
8
8
 
9
- const parseCredentialSdJwt = function (credentials_supported, _ref) {
10
- var _credentials_supporte;
9
+ const parseCredentialSdJwt = (credentials_supported, _ref) => {
11
10
  let {
12
11
  sdJwt,
13
12
  disclosures
14
13
  } = _ref;
15
- let ignoreMissingAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
16
- // find the definition that matches the received credential's type
17
- // warning: if more then a defintion is found, the first is retrieved
18
- const credentialSubject = (_credentials_supporte = credentials_supported.find(c => c.format === "vc+sd-jwt" && c.credential_definition.type.includes(sdJwt.payload.type))) === null || _credentials_supporte === void 0 ? void 0 : _credentials_supporte.credential_definition.credentialSubject;
19
-
20
- // the received credential matches no supported credential, throw an exception
14
+ const credentialSubject = credentials_supported[sdJwt.payload.vct];
21
15
  if (!credentialSubject) {
22
- const expected = credentials_supported.flatMap(_ => _.credential_definition.type).join(", ");
23
- throw new IoWalletError(`Received credential is of an unknwown type. Expected one of [${expected}], received '${sdJwt.payload.type}', `);
16
+ throw new IoWalletError("Credential type not supported by the issuer");
17
+ }
18
+ if (credentialSubject.format !== sdJwt.header.typ) {
19
+ throw new IoWalletError(`Received credential is of an unknwown type. Expected one of [${credentialSubject.format}], received '${sdJwt.header.typ}', `);
24
20
  }
25
21
 
26
22
  // transfrom a record { key: value } in an iterable of pairs [key, value]
27
- const attrDefinitions = Object.entries(credentialSubject);
23
+ const attrDefinitions = Object.entries(credentialSubject.claims);
28
24
 
29
- // every mandatory attribute must be present in the credential's disclosures
30
25
  // the key of the attribute defintion must match the disclosure's name
31
26
  const attrsNotInDisclosures = attrDefinitions.filter(_ref2 => {
32
- let [attrKey, {
33
- mandatory
34
- }] = _ref2;
35
- return mandatory && !disclosures.some(_ref3 => {
27
+ let [attrKey] = _ref2;
28
+ return !disclosures.some(_ref3 => {
36
29
  let [, name] = _ref3;
37
30
  return name === attrKey;
38
31
  });
@@ -40,12 +33,7 @@ const parseCredentialSdJwt = function (credentials_supported, _ref) {
40
33
  if (attrsNotInDisclosures.length > 0) {
41
34
  const missing = attrsNotInDisclosures.map(_ => _[0 /* key */]).join(", ");
42
35
  const received = disclosures.map(_ => _[1 /* name */]).join(", ");
43
- // the rationale of this condition is that we may want to be permissive
44
- // on incomplete credentials in the test phase of the project.
45
- // we might want to be strict once in production, hence remove this condition
46
- if (!ignoreMissingAttributes) {
47
- throw new IoWalletError(`Some attributes are missing in the credential. Missing: [${missing}], received: [${received}]`);
48
- }
36
+ throw new IoWalletError(`Some attributes are missing in the credential. Missing: [${missing}], received: [${received}]`);
49
37
  }
50
38
 
51
39
  // attributes that are defined in the issuer configuration
@@ -88,7 +76,6 @@ const parseCredentialSdJwt = function (credentials_supported, _ref) {
88
76
  let [, key, value] = _ref7;
89
77
  return [key, {
90
78
  value,
91
- mandatory: false,
92
79
  name: key
93
80
  }];
94
81
  }));
@@ -130,40 +117,30 @@ async function verifyCredentialSdJwt(rawCredential, issuerKeys, holderBindingCon
130
117
 
131
118
  const verifyAndParseCredentialSdJwt = async (issuerConf, credential, _, _ref8) => {
132
119
  let {
133
- credentialCryptoContext,
134
- ignoreMissingAttributes
120
+ credentialCryptoContext
135
121
  } = _ref8;
136
122
  const decoded = await verifyCredentialSdJwt(credential, issuerConf.openid_credential_issuer.jwks.keys, credentialCryptoContext);
137
- const parsedCredential = parseCredentialSdJwt(issuerConf.openid_credential_issuer.credentials_supported, decoded, ignoreMissingAttributes);
123
+ const parsedCredential = parseCredentialSdJwt(issuerConf.openid_credential_issuer.credential_configurations_supported, decoded);
138
124
  return {
139
125
  parsedCredential
140
126
  };
141
127
  };
142
- const verifyAndParseCredentialMdoc = async (_issuerConf, _credential, _, _ctx) => {
143
- // TODO: [SIW-686] decode MDOC credentials
144
- throw new Error("verifyAndParseCredentialMdoc not implemented yet");
145
- };
146
128
 
147
129
  /**
148
- * Verify and parse an encoded credential
149
- *
150
- * @param issuerConf The Issuer configuration
151
- * @param credential The encoded credential
152
- * @param format The format of the credentual
153
- * @param context.credentialCryptoContext The context to access the key the Credential will be bound to
154
- * @param context.ignoreMissingAttributes (optional) Whether to fail if a defined attribute is note present in the credentual. Default: false
130
+ * Verify and parse an encoded credential.
131
+ * @param issuerConf The Issuer configuration returned by {@link evaluateIssuerTrust}
132
+ * @param credential The encoded credential returned by {@link obtainCredential}
133
+ * @param format The format of the credentual returned by {@link obtainCredential}
134
+ * @param context.credentialCryptoContext The crypto context used to obtain the credential in {@link obtainCredential}
155
135
  * @returns A parsed credential with attributes in plain value
156
- * @throws If the credential signature is not verified with the Issuer key set
157
- * @throws If the credential is not bound to the provided user key
158
- * @throws If the credential data fail to parse
136
+ * @throws {IoWalletError} If the credential signature is not verified with the Issuer key set
137
+ * @throws {IoWalletError} If the credential is not bound to the provided user key
138
+ * @throws {IoWalletError} If the credential data fail to parse
159
139
  */
160
140
  export const verifyAndParseCredential = async (issuerConf, credential, format, context) => {
161
141
  if (format === "vc+sd-jwt") {
162
142
  return verifyAndParseCredentialSdJwt(issuerConf, credential, format, context);
163
- } else if (format === "vc+mdoc-cbor") {
164
- return verifyAndParseCredentialMdoc(issuerConf, credential, format, context);
165
143
  }
166
- const _ = format;
167
- throw new IoWalletError(`Unsupported credential format: ${_}`);
144
+ throw new IoWalletError(`Unsupported credential format: ${format}`);
168
145
  };
169
146
  //# sourceMappingURL=07-verify-and-parse-credential.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IoWalletError","SdJwt4VC","verify","verifySdJwt","parseCredentialSdJwt","credentials_supported","_ref","_credentials_supporte","sdJwt","disclosures","ignoreMissingAttributes","arguments","length","undefined","credentialSubject","find","c","format","credential_definition","type","includes","payload","expected","flatMap","_","join","attrDefinitions","Object","entries","attrsNotInDisclosures","filter","_ref2","attrKey","mandatory","some","_ref3","name","missing","map","received","definedValues","fromEntries","_ref4","_disclosures$find","definition","value","_ref5","display","reduce","names","_ref6","locale","undefinedValues","keys","_ref7","key","verifyCredentialSdJwt","rawCredential","issuerKeys","holderBindingContext","decodedCredential","holderBindingKey","Promise","all","getPublicKey","cnf","jwk","kid","verifyAndParseCredentialSdJwt","issuerConf","credential","_ref8","credentialCryptoContext","decoded","openid_credential_issuer","jwks","parsedCredential","verifyAndParseCredentialMdoc","_issuerConf","_credential","_ctx","Error","verifyAndParseCredential","context"],"sourceRoot":"../../../../src","sources":["credential/issuance/07-verify-and-parse-credential.ts"],"mappings":"AAGA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,MAAM,IAAIC,WAAW,QAAQ,cAAc;;AAcpD;;AAmBA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ySdJwt","parseCredentialSdJwt","credentials_supported","_ref","sdJwt","disclosures","credentialSubject","payload","vct","format","header","typ","attrDefinitions","Object","entries","claims","attrsNotInDisclosures","filter","_ref2","attrKey","some","_ref3","name","length","missing","map","_","join","received","definedValues","fromEntries","_ref4","_disclosures$find","definition","value","find","_ref5","display","reduce","names","_ref6","locale","undefinedValues","keys","includes","_ref7","key","verifyCredentialSdJwt","rawCredential","issuerKeys","holderBindingContext","decodedCredential","holderBindingKey","Promise","all","getPublicKey","cnf","jwk","kid","verifyAndParseCredentialSdJwt","issuerConf","credential","_ref8","credentialCryptoContext","decoded","openid_credential_issuer","jwks","parsedCredential","credential_configurations_supported","verifyAndParseCredential","context"],"sourceRoot":"../../../../src","sources":["credential/issuance/07-verify-and-parse-credential.ts"],"mappings":"AAEA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,MAAM,IAAIC,WAAW,QAAQ,cAAc;;AAcpD;;AAkBA;;AAKA,MAAMC,oBAAoB,GAAGA,CAE3BC,qBAAgI,EAAAC,IAAA,KAE3G;EAAA,IADrB;IAAEC,KAAK;IAAEC;EAAoC,CAAC,GAAAF,IAAA;EAE9C,MAAMG,iBAAiB,GAAGJ,qBAAqB,CAACE,KAAK,CAACG,OAAO,CAACC,GAAG,CAAC;EAElE,IAAI,CAACF,iBAAiB,EAAE;IACtB,MAAM,IAAIT,aAAa,CAAC,6CAA6C,CAAC;EACxE;EAEA,IAAIS,iBAAiB,CAACG,MAAM,KAAKL,KAAK,CAACM,MAAM,CAACC,GAAG,EAAE;IACjD,MAAM,IAAId,aAAa,CACpB,gEAA+DS,iBAAiB,CAACG,MAAO,gBAAeL,KAAK,CAACM,MAAM,CAACC,GAAI,KAC3H,CAAC;EACH;;EAEA;EACA,MAAMC,eAAe,GAAGC,MAAM,CAACC,OAAO,CAACR,iBAAiB,CAACS,MAAM,CAAC;;EAEhE;EACA,MAAMC,qBAAqB,GAAGJ,eAA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C,GAAG,KAAKN,gBAAgB,CAACM,GAAG,EAAE;IACxD,MAAM,IAAI7D,aAAa,CACpB,kDAAiDuD,gBAAgB,CAACM,GAAI,UAASP,iBAAiB,CAAC/C,KAAK,CAACG,OAAO,CAACiD,GAAG,CAACC,GAAG,CAACC,GAAI,EAC9H,CAAC;EACH;EAEA,OAAOP,iBAAiB;AAC1B;;AAEA;;AAQA,MAAMQ,6BAAsD,GAAG,MAAAA,CAC7DC,UAAU,EACVC,UAAU,EACVnC,CAAC,EAAAoC,KAAA,KAEE;EAAA,IADH;IAAEC;EAAwB,CAAC,GAAAD,KAAA;EAE3B,MAAME,OAAO,GAAG,MAAMjB,qBAAqB,CACzCc,UAAU,EACVD,UAAU,CAACK,wBAAwB,CAACC,IAAI,CAACvB,IAAI,EAC7CoB,uBACF,CAAC;EAED,MAAMI,gBAAgB,GAAGlE,oBAAoB,CAC3C2D,UAAU,CAACK,wBAAwB,CAACG,mCAAmC,EACvEJ,OACF,CAAC;EAED,OAAO;IAAEG;EAAiB,CAAC;AAC7B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,wBAAkD,GAAG,MAAAA,CAChET,UAAU,EACVC,UAAU,EACVpD,MAAM,EACN6D,OAAO,KACJ;EACH,IAAI7D,MAAM,KAAK,WAAW,EAAE;IAC1B,OAAOkD,6BAA6B,CAClCC,UAAU,EACVC,UAAU,EACVpD,MAAM,EACN6D,OACF,CAAC;EACH;EAEA,MAAM,IAAIzE,aAAa,CAAE,kCAAiCY,MAAO,EAAC,CAAC;AACrE,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { evaluateIssuerTrust } from "./02-evaluate-issuer-trust";
2
2
  import { startUserAuthorization } from "./03-start-user-authorization";
3
+ import { completeUserAuthorizationWithQueryMode } from "./04-complete-user-authorization";
3
4
  import { authorizeAccess } from "./05-authorize-access";
4
5
  import { obtainCredential } from "./06-obtain-credential";
5
6
  import { verifyAndParseCredential } from "./07-verify-and-parse-credential";
6
- export { evaluateIssuerTrust, startUserAuthorization, authorizeAccess, obtainCredential, verifyAndParseCredential };
7
+ export { evaluateIssuerTrust, startUserAuthorization, completeUserAuthorizationWithQueryMode, authorizeAccess, obtainCredential, verifyAndParseCredential };
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["evaluateIssuerTrust","startUserAuthorization","authorizeAccess","obtainCredential","verifyAndParseCredential"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":"AACA,SACEA,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,+BAA+B;AAEtC,SAASC,eAAe,QAA8B,uBAAuB;AAC7E,SACEC,gBAAgB,QAEX,wBAAwB;AAC/B,SACEC,wBAAwB,QAEnB,kCAAkC;AAGzC,SACEJ,mBAAmB,EACnBC,sBAAsB,EACtBC,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB"}
1
+ {"version":3,"names":["evaluateIssuerTrust","startUserAuthorization","completeUserAuthorizationWithQueryMode","authorizeAccess","obtainCredential","verifyAndParseCredential"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":"AACA,SACEA,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,+BAA+B;AACtC,SACEC,sCAAsC,QAEjC,kCAAkC;AACzC,SAASC,eAAe,QAA8B,uBAAuB;AAC7E,SACEC,gBAAgB,QAEX,wBAAwB;AAC/B,SACEC,wBAAwB,QAEnB,kCAAkC;AAEzC,SACEL,mBAAmB,EACnBC,sBAAsB,EACtBC,sCAAsC,EACtCC,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB"}
@@ -0,0 +1,18 @@
1
+ import { AuthorizationDetail } from "../../utils/par";
2
+ import * as z from "zod";
3
+ import { SupportedCredentialFormat } from "./const";
4
+ export const TokenResponse = z.object({
5
+ access_token: z.string(),
6
+ authorization_details: z.array(AuthorizationDetail),
7
+ c_nonce: z.string(),
8
+ c_nonce_expires_in: z.number(),
9
+ expires_in: z.number(),
10
+ token_type: z.string()
11
+ });
12
+ export const CredentialResponse = z.object({
13
+ c_nonce: z.string(),
14
+ c_nonce_expires_in: z.number(),
15
+ credential: z.string(),
16
+ format: SupportedCredentialFormat
17
+ });
18
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AuthorizationDetail","z","SupportedCredentialFormat","TokenResponse","object","access_token","string","authorization_details","array","c_nonce","c_nonce_expires_in","number","expires_in","token_type","CredentialResponse","credential","format"],"sourceRoot":"../../../../src","sources":["credential/issuance/types.ts"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,iBAAiB;AACrD,OAAO,KAAKC,CAAC,MAAM,KAAK;AACxB,SAASC,yBAAyB,QAAQ,SAAS;AAInD,OAAO,MAAMC,aAAa,GAAGF,CAAC,CAACG,MAAM,CAAC;EACpCC,YAAY,EAAEJ,CAAC,CAACK,MAAM,CAAC,CAAC;EACxBC,qBAAqB,EAAEN,CAAC,CAACO,KAAK,CAACR,mBAAmB,CAAC;EACnDS,OAAO,EAAER,CAAC,CAACK,MAAM,CAAC,CAAC;EACnBI,kBAAkB,EAAET,CAAC,CAACU,MAAM,CAAC,CAAC;EAC9BC,UAAU,EAAEX,CAAC,CAACU,MAAM,CAAC,CAAC;EACtBE,UAAU,EAAEZ,CAAC,CAACK,MAAM,CAAC;AACvB,CAAC,CAAC;AAIF,OAAO,MAAMQ,kBAAkB,GAAGb,CAAC,CAACG,MAAM,CAAC;EACzCK,OAAO,EAAER,CAAC,CAACK,MAAM,CAAC,CAAC;EACnBI,kBAAkB,EAAET,CAAC,CAACU,MAAM,CAAC,CAAC;EAC9BI,UAAU,EAAEd,CAAC,CAACK,MAAM,CAAC,CAAC;EACtBU,MAAM,EAAEd;AACV,CAAC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { fixBase64EncodingOnKey } from "./utils/jwk";
1
2
  // polyfill due to known bugs on URL implementation for react native
2
3
  // https://github.com/facebook/react-native/issues/24428
3
4
  import "react-native-url-polyfill/auto";
@@ -7,7 +8,8 @@ import * as SdJwt from "./sd-jwt";
7
8
  import * as Errors from "./utils/errors";
8
9
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
9
10
  import * as Trust from "./trust";
11
+ import * as WalletInstance from "./wallet-instance";
10
12
  import { AuthorizationDetail, AuthorizationDetails } from "./utils/par";
11
13
  import { createCryptoContextFor } from "./utils/crypto";
12
- export { SdJwt, PID, Credential, WalletInstanceAttestation, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails };
14
+ export { SdJwt, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey };
13
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Credential","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","AuthorizationDetail","AuthorizationDetails","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKA,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,aAAa;AACvE,SAASC,sBAAsB,QAAQ,gBAAgB;AAEvD,SACEN,KAAK,EACLD,GAAG,EACHD,UAAU,EACVI,yBAAyB,EACzBD,MAAM,EACNE,KAAK,EACLG,sBAAsB,EACtBF,mBAAmB,EACnBC,oBAAoB"}
1
+ {"version":3,"names":["fixBase64EncodingOnKey","Credential","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","AuthorizationDetail","AuthorizationDetails","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,aAAa;AACpD;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,aAAa;AACvE,SAASC,sBAAsB,QAAQ,gBAAgB;AAGvD,SACEP,KAAK,EACLD,GAAG,EACHD,UAAU,EACVI,yBAAyB,EACzBE,cAAc,EACdH,MAAM,EACNE,KAAK,EACLI,sBAAsB,EACtBF,mBAAmB,EACnBC,oBAAoB,EACpBT,sBAAsB"}
@@ -1,22 +1,18 @@
1
1
  import { getValueFromDisclosures } from "../../sd-jwt/converters";
2
2
  import { PID } from "./types";
3
3
  export function pidFromToken(sdJwt, disclosures) {
4
+ const placeOfBirth = getValueFromDisclosures(disclosures, "place_of_birth");
4
5
  return PID.parse({
5
6
  issuer: sdJwt.payload.iss,
6
- issuedAt: new Date(sdJwt.payload.iat * 1000),
7
+ issuedAt: new Date(getValueFromDisclosures(disclosures, "iat") * 1000),
7
8
  expiration: new Date(sdJwt.payload.exp * 1000),
8
- verification: {
9
- trustFramework: sdJwt.payload.verified_claims.verification.trust_framework,
10
- assuranceLevel: sdJwt.payload.verified_claims.verification.assurance_level,
11
- evidence: getValueFromDisclosures(disclosures, "evidence")
12
- },
13
9
  claims: {
14
10
  uniqueId: getValueFromDisclosures(disclosures, "unique_id"),
15
11
  givenName: getValueFromDisclosures(disclosures, "given_name"),
16
12
  familyName: getValueFromDisclosures(disclosures, "family_name"),
17
- birthdate: getValueFromDisclosures(disclosures, "birthdate"),
18
- placeOfBirth: getValueFromDisclosures(disclosures, "place_of_birth"),
19
- taxIdCode: getValueFromDisclosures(disclosures, "tax_id_number")
13
+ birthDate: getValueFromDisclosures(disclosures, "birth_date"),
14
+ ...(placeOfBirth && placeOfBirth),
15
+ taxIdCode: getValueFromDisclosures(disclosures, "tax_id_code")
20
16
  }
21
17
  });
22
18
  }
@@ -1 +1 @@
1
- {"version":3,"names":["getValueFromDisclosures","PID","pidFromToken","sdJwt","disclosures","parse","issuer","payload","iss","issuedAt","Date","iat","expiration","exp","verification","trustFramework","verified_claims","trust_framework","assuranceLevel","assurance_level","evidence","claims","uniqueId","givenName","familyName","birthdate","placeOfBirth","taxIdCode"],"sourceRoot":"../../../../src","sources":["pid/sd-jwt/converters.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,yBAAyB;AAEjE,SAASC,GAAG,QAAQ,SAAS;AAE7B,OAAO,SAASC,YAAYA,CAACC,KAAe,EAAEC,WAAyB,EAAO;EAC5E,OAAOH,GAAG,CAACI,KAAK,CAAC;IACfC,MAAM,EAAEH,KAAK,CAACI,OAAO,CAACC,GAAG;IACzBC,QAAQ,EAAE,IAAIC,IAAI,CAACP,KAAK,CAACI,OAAO,CAACI,GAAG,GAAG,IAAI,CAAC;IAC5CC,UAAU,EAAE,IAAIF,IAAI,CAACP,KAAK,CAACI,OAAO,CAACM,GAAG,GAAG,IAAI,CAAC;IAC9CC,YAAY,EAAE;MACZC,cAAc,EACZZ,KAAK,CAACI,OAAO,CAACS,eAAe,CAACF,YAAY,CAACG,eAAe;MAC5DC,cAAc,EACZf,KAAK,CAACI,OAAO,CAACS,eAAe,CAACF,YAAY,CAACK,eAAe;MAC5DC,QAAQ,EAAEpB,uBAAuB,CAACI,WAAW,EAAE,UAAU;IAC3D,CAAC;IACDiB,MAAM,EAAE;MACNC,QAAQ,EAAEtB,uBAAuB,CAACI,WAAW,EAAE,WAAW,CAAC;MAC3DmB,SAAS,EAAEvB,uBAAuB,CAACI,WAAW,EAAE,YAAY,CAAC;MAC7DoB,UAAU,EAAExB,uBAAuB,CAACI,WAAW,EAAE,aAAa,CAAC;MAC/DqB,SAAS,EAAEzB,uBAAuB,CAACI,WAAW,EAAE,WAAW,CAAC;MAC5DsB,YAAY,EAAE1B,uBAAuB,CAACI,WAAW,EAAE,gBAAgB,CAAC;MACpEuB,SAAS,EAAE3B,uBAAuB,CAACI,WAAW,EAAE,eAAe;IACjE;EACF,CAAC,CAAC;AACJ"}
1
+ {"version":3,"names":["getValueFromDisclosures","PID","pidFromToken","sdJwt","disclosures","placeOfBirth","parse","issuer","payload","iss","issuedAt","Date","expiration","exp","claims","uniqueId","givenName","familyName","birthDate","taxIdCode"],"sourceRoot":"../../../../src","sources":["pid/sd-jwt/converters.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,yBAAyB;AAEjE,SAASC,GAAG,QAAQ,SAAS;AAE7B,OAAO,SAASC,YAAYA,CAACC,KAAe,EAAEC,WAAyB,EAAO;EAC5E,MAAMC,YAAY,GAAGL,uBAAuB,CAACI,WAAW,EAAE,gBAAgB,CAAC;EAC3E,OAAOH,GAAG,CAACK,KAAK,CAAC;IACfC,MAAM,EAAEJ,KAAK,CAACK,OAAO,CAACC,GAAG;IACzBC,QAAQ,EAAE,IAAIC,IAAI,CAACX,uBAAuB,CAACI,WAAW,EAAE,KAAK,CAAC,GAAG,IAAI,CAAC;IACtEQ,UAAU,EAAE,IAAID,IAAI,CAACR,KAAK,CAACK,OAAO,CAACK,GAAG,GAAG,IAAI,CAAC;IAC9CC,MAAM,EAAE;MACNC,QAAQ,EAAEf,uBAAuB,CAACI,WAAW,EAAE,WAAW,CAAC;MAC3DY,SAAS,EAAEhB,uBAAuB,CAACI,WAAW,EAAE,YAAY,CAAC;MAC7Da,UAAU,EAAEjB,uBAAuB,CAACI,WAAW,EAAE,aAAa,CAAC;MAC/Dc,SAAS,EAAElB,uBAAuB,CAACI,WAAW,EAAE,YAAY,CAAC;MAC7D,IAAIC,YAAY,IAAIA,YAAY,CAAC;MACjCc,SAAS,EAAEnB,uBAAuB,CAACI,WAAW,EAAE,aAAa;IAC/D;EACF,CAAC,CAAC;AACJ"}
@@ -27,16 +27,16 @@ export const PID = z.object({
27
27
  issuer: z.string(),
28
28
  issuedAt: z.date(),
29
29
  expiration: z.date(),
30
- verification: Verification,
30
+ verification: Verification.optional(),
31
31
  claims: z.object({
32
32
  uniqueId: z.string(),
33
33
  givenName: z.string(),
34
34
  familyName: z.string(),
35
- birthdate: z.string(),
35
+ birthDate: z.string(),
36
36
  placeOfBirth: z.object({
37
37
  country: z.string(),
38
38
  locality: z.string()
39
- }),
39
+ }).optional(),
40
40
  taxIdCode: z.string()
41
41
  })
42
42
  });
@@ -1 +1 @@
1
- {"version":3,"names":["z","VerificationEvidence","object","type","string","record","source","organization_name","organization_id","country_code","Verification","trustFramework","literal","assuranceLevel","evidence","array","PID","issuer","issuedAt","date","expiration","verification","claims","uniqueId","givenName","familyName","birthdate","placeOfBirth","country","locality","taxIdCode"],"sourceRoot":"../../../../src","sources":["pid/sd-jwt/types.ts"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,MAAMC,oBAAoB,GAAGD,CAAC,CAACE,MAAM,CAAC;EACpCC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;EAChBC,MAAM,EAAEL,CAAC,CAACE,MAAM,CAAC;IACfC,IAAI,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC;IAChBE,MAAM,EAAEN,CAAC,CAACE,MAAM,CAAC;MACfK,iBAAiB,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC;MAC7BI,eAAe,EAAER,CAAC,CAACI,MAAM,CAAC,CAAC;MAC3BK,YAAY,EAAET,CAAC,CAACI,MAAM,CAAC;IACzB,CAAC;EACH,CAAC;AACH,CAAC,CAAC;AAEF,MAAMM,YAAY,GAAGV,CAAC,CAACE,MAAM,CAAC;EAC5BS,cAAc,EAAEX,CAAC,CAACY,OAAO,CAAC,OAAO,CAAC;EAClCC,cAAc,EAAEb,CAAC,CAACI,MAAM,CAAC,CAAC;EAC1BU,QAAQ,EAAEd,CAAC,CAACe,KAAK,CAACd,oBAAoB;AACxC,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMe,GAAG,GAAGhB,CAAC,CAACE,MAAM,CAAC;EAC1Be,MAAM,EAAEjB,CAAC,CAACI,MAAM,CAAC,CAAC;EAClBc,QAAQ,EAAElB,CAAC,CAACmB,IAAI,CAAC,CAAC;EAClBC,UAAU,EAAEpB,CAAC,CAACmB,IAAI,CAAC,CAAC;EACpBE,YAAY,EAAEX,YAAY;EAC1BY,MAAM,EAAEtB,CAAC,CAACE,MAAM,CAAC;IACfqB,QAAQ,EAAEvB,CAAC,CAACI,MAAM,CAAC,CAAC;IACpBoB,SAAS,EAAExB,CAAC,CAACI,MAAM,CAAC,CAAC;IACrBqB,UAAU,EAAEzB,CAAC,CAACI,MAAM,CAAC,CAAC;IACtBsB,SAAS,EAAE1B,CAAC,CAACI,MAAM,CAAC,CAAC;IACrBuB,YAAY,EAAE3B,CAAC,CAACE,MAAM,CAAC;MACrB0B,OAAO,EAAE5B,CAAC,CAACI,MAAM,CAAC,CAAC;MACnByB,QAAQ,EAAE7B,CAAC,CAACI,MAAM,CAAC;IACrB,CAAC,CAAC;IACF0B,SAAS,EAAE9B,CAAC,CAACI,MAAM,CAAC;EACtB,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"names":["z","VerificationEvidence","object","type","string","record","source","organization_name","organization_id","country_code","Verification","trustFramework","literal","assuranceLevel","evidence","array","PID","issuer","issuedAt","date","expiration","verification","optional","claims","uniqueId","givenName","familyName","birthDate","placeOfBirth","country","locality","taxIdCode"],"sourceRoot":"../../../../src","sources":["pid/sd-jwt/types.ts"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAEvB,MAAMC,oBAAoB,GAAGD,CAAC,CAACE,MAA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,EAAE7B,CAAC,CAACI,MAAM,CAAC,CAAC;MACnB0B,QAAQ,EAAE9B,CAAC,CAACI,MAAM,CAAC;IACrB,CAAC,CAAC,CACDkB,QAAQ,CAAC,CAAC;IACbS,SAAS,EAAE/B,CAAC,CAACI,MAAM,CAAC;EACtB,CAAC;AACH,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { getValueFromDisclosures } from "../converters";
2
- const disclosures = [["6w1_soRXFgaHKfpYn3cvfQ", "given_name", "Mario"], ["fuNp97Hf3wV6y48y-QZhIg", "birthdate", "1980-10-01"], ["p-9LzyWHZBVDvhXDWkN2xA", "place_of_birth", {
2
+ const disclosures = [["6w1_soRXFgaHKfpYn3cvfQ", "given_name", "Mario"], ["fuNp97Hf3wV6y48y-QZhIg", "birth_date", "1980-10-01"], ["p-9LzyWHZBVDvhXDWkN2xA", "place_of_birth", {
3
3
  country: "IT",
4
4
  locality: "Rome"
5
5
  }]];
@@ -1 +1 @@
1
- {"version":3,"names":["getValueFromDisclosures","disclosures","country","locality","describe","it","success","expect","toBe","toEqual","toBeUndefined"],"sourceRoot":"../../../../src","sources":["sd-jwt/__test__/converters.test.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,eAAe;AAGvD,MAAMC,WAAyB,GAAG,CAChC,CAAC,wBAAwB,EAAE,YAAY,EAAE,OAAO,CAAC,EACjD,CAAC,wBAAwB,EAAE,WAAW,EAAE,YAAY,CAAC,EACrD,CACE,wBAAwB,EACxB,gBAAgB,EAChB;EAAEC,OAAO,EAAE,IAAI;EAAEC,QAAQ,EAAE;AAAO,CAAC,CACpC,CACF;AAEDC,QAAQ,CAAC,yBAAyB,EAAE,MAAM;EACxCC,EAAE,CAAC,4CAA4C,EAAE,MAAM;IACrD,MAAMC,OAAO,GAAGN,uBAAuB,CAACC,WAAW,EAAE,YAAY,CAAC;IAClEM,MAAM,CAACD,OAAO,CAAC,CAACE,IAAI,CAAC,OAAO,CAAC;EAC/B,CAAC,CAAC;EACFH,EAAE,CAAC,gDAAgD,EAAE,MAAM;IACzD,MAAMC,OAAO,GAAGN,uBAAuB,CAACC,WAAW,EAAE,gBAAgB,CAAC;IACtEM,MAAM,CAACD,OAAO,CAAC,CAACG,OAAO,CAAC;MAAEP,OAAO,EAAE,IAAI;MAAEC,QAAQ,EAAE;IAAO,CAAC,CAAC;EAC9D,CAAC,CAAC;EACFE,EAAE,CAAC,aAAa,EAAE,MAAM;IACtB,MAAMC,OAAO,GAAGN,uBAAuB,CAACC,WAAW,EAAE,eAAe,CAAC;IACrEM,MAAM,CAACD,OAAO,CAAC,CAACI,aAAa,CAAC,CAAC;EACjC,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["getValueFromDisclosures","disclosures","country","locality","describe","it","success","expect","toBe","toEqual","toBeUndefined"],"sourceRoot":"../../../../src","sources":["sd-jwt/__test__/converters.test.ts"],"mappings":"AAAA,SAASA,uBAAuB,QAAQ,eAAe;AAGvD,MAAMC,WAAyB,GAAG,CAChC,CAAC,wBAAwB,EAAE,YAAY,EAAE,OAAO,CAAC,EACjD,CAAC,wBAAwB,EAAE,YAAY,EAAE,YAAY,CAAC,EACtD,CACE,wBAAwB,EACxB,gBAAgB,EAChB;EAAEC,OAAO,EAAE,IAAI;EAAEC,QAAQ,EAAE;AAAO,CAAC,CACpC,CACF;AAEDC,QAAQ,CAAC,yBAAyB,EAAE,MAAM;EACxCC,EAAE,CAAC,4CAA4C,EAAE,MAAM;IACrD,MAAMC,OAAO,GAAGN,uBAAuB,CAACC,WAAW,EAAE,YAAY,CAAC;IAClEM,MAAM,CAACD,OAAO,CAAC,CAACE,IAAI,CAAC,OAAO,CAAC;EAC/B,CAAC,CAAC;EACFH,EAAE,CAAC,gDAAgD,EAAE,MAAM;IACzD,MAAMC,OAAO,GAAGN,uBAAuB,CAACC,WAAW,EAAE,gBAAgB,CAAC;IACtEM,MAAM,CAACD,OAAO,CAAC,CAACG,OAAO,CAAC;MAAEP,OAAO,EAAE,IAAI;MAAEC,QAAQ,EAAE;IAAO,CAAC,CAAC;EAC9D,CAAC,CAAC;EACFE,EAAE,CAAC,aAAa,EAAE,MAAM;IACtB,MAAMC,OAAO,GAAGN,uBAAuB,CAACC,WAAW,EAAE,eAAe,CAAC;IACrEM,MAAM,CAACD,OAAO,CAAC,CAACI,aAAa,CAAC,CAAC;EACjC,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -11,56 +11,43 @@ import { SdJwt4VC } from "../types";
11
11
  // - payload is taken from the italian specification, but _sd are compiled with:
12
12
  // - "address" is used as verification._sd
13
13
  // - all others disclosures are in claims._sd
14
- const token = "eyJ0eXAiOiJ2YytzZC1qd3QiLCJhbGciOiJFUzI1NiIsImtpZCI6ImIxODZlYTBjMTkyNTc5MzA5N2JmMDFiOGEyODlhNDVmIiwidHJ1c3RfY2hhaW4iOlsiTkVoUmRFUnBZbmxIWTNNNVdsZFdUV1oyYVVobSAuLi4iLCJleUpoYkdjaU9pSlNVekkxTmlJc0ltdHBaQ0k2IC4uLiIsIklrSllkbVp5Ykc1b1FVMTFTRkl3TjJGcVZXMUIgLi4uIl19.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tL2lzc3VlciIsInN1YiI6Ik56YkxzWGg4dURDY2Q3bm9XWEZaQWZIa3hac1JHQzlYcy4uLiIsImp0aSI6InVybjp1dWlkOjZjNWMwYTQ5LWI1ODktNDMxZC1iYWU3LTIxOTEyMmE5ZWMyYyIsImlhdCI6MTU0MTQ5MzcyNCwiZXhwIjoxNTQxNDkzNzI0LCJzdGF0dXMiOiJodHRwczovL2V4YW1wbGUuY29tL3N0YXR1cyIsImNuZiI6eyJqd2siOnsia3R5IjoiUlNBIiwidXNlIjoic2lnIiwibiI6IjFUYS1zRSIsImUiOiJBUUFCIiwia2lkIjoiWWhORlMzWW5DOXRqaUNhaXZoV0xWVUozQXh3R0d6Xzk4dVJGYXFNRUVzIn19LCJ0eXBlIjoiUGVyc29uSWRlbnRpZmljYXRpb25EYXRh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jU2IiwidmN0IjoiUGVyc29uSWRlbnRpZmljYXRpb25EYXRhIiwiaXNzIjoiaHR0cHM6Ly9wcmUuZWlkLndhbGxldC5pcHpzLml0IiwiY25mIjp7Imp3ayI6eyJrdHkiOiJFQyIsImNydiI6IlAtMjU2Iiwia2lkIjoiUnYzVy1FaUtwdkJUeWs1eVp4dnJldi03TURCNlNselVDQm9fQ1FqamRkVSIsIngiOiIwV294N1F0eVBxQnlnMzVNSF9YeUNjbmQ1TGUtSm0wQVhIbFVnREJBMDNZIiwieSI6ImVFaFZ2ZzFKUHFOZDNEVFNhNG1HREdCbHdZNk5QLUVaYkxiTkZYU1h3SWcifX0sImV4cCI6MTc1MTU0NjU3Niwic3RhdHVzIjp7InN0YXR1c19hdHRlc3RhdGlvbiI6eyJjcmVkZW50aWFsX2hhc2hfYWxnIjoic2hhLTI1NiJ9fX0";
16
+ const signature = "qXHA2oqr8trX4fGxpxpUft2GX380TM3pzfo1MYAsDjUC8HsODA-4rdRWAvDe2zYP57x4tJU7eiABkd1Kmln9yQ";
17
17
  const signed = `${unsigned}.${signature}`;
18
- const tokenizedDisclosures = ["WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwgImdpdmVuX25hbWUiLCAiSm9obiJd", "WyJlbHVWNU9nM2dTTklJOEVZbnN4QV9BIiwgImZhbWlseV9uYW1lIiwgIkRvZSJd", "WyI2SWo3dE0tYTVpVlBHYm9TNXRtdlZBIiwgImVtYWlsIiwgImpvaG5kb2VAZXhhbXBsZS5jb20iXQ", "WyJlSThaV205UW5LUHBOUGVOZW5IZGhRIiwgInBob25lX251bWJlciIsICIrMS0yMDItNTU1LTAxMDEiXQ", "WyJBSngtMDk1VlBycFR0TjRRTU9xUk9BIiwgImJpcnRoZGF0ZSIsICIxOTQwLTAxLTAxIl0", "WyJQYzMzSk0yTGNoY1VfbEhnZ3ZfdWZRIiwgImlzX292ZXJfMTgiLCB0cnVlXQ", "WyJHMDJOU3JRZmpGWFE3SW8wOXN5YWpBIiwgImlzX292ZXJfMjEiLCB0cnVlXQ", "WyJsa2x4RjVqTVlsR1RQVW92TU5JdkNBIiwgImlzX292ZXJfNjUiLCB0cnVlXQ", "WyJRZ19PNjR6cUF4ZTQxMmExMDhpcm9BIiwgImFkZHJlc3MiLCB7InN0cmVldF9hZGRyZXNzIjogIjEyMyBNYWluIFN0IiwgImxvY2FsaXR5IjogIkFueXRvd24iLCAicmVnaW9uIjogIkFueXN0YXRlIiwgImNvdW50cnkiOiAiVVMifV0"];
18
+ const tokenizedDisclosures = ["WyJrSkRFUDhFYU5URU1CRE9aelp6VDR3IiwidW5pcXVlX2lkIiwiVElOSVQtTFZMREFBODVUNTBHNzAyQiJd", "WyJ6SUF5VUZ2UGZJcEUxekJxeEk1aGFRIiwiYmlydGhfZGF0ZSIsIjE5ODUtMTItMTAiXQ", "WyJHcjNSM3MyOTBPa1FVbS1ORlR1OTZBIiwidGF4X2lkX2NvZGUiLCJUSU5JVC1MVkxEQUE4NVQ1MEc3MDJCIl0", "WyJHeE9SYWxNQWVsZlowZWRGSmpqWVV3IiwiZ2l2ZW5fbmFtZSIsIkFkYSJd", "WyJfdlY1UklrbDBJT0VYS290czlrdDF3IiwiZmFtaWx5X25hbWUiLCJMb3ZlbGFjZSJd", "WyJDajV0Y2NSNzJKd3J6ZTJUVzRhLXdnIiwiaWF0IiwxNzIwMDEwNTc1XQ"];
19
19
  const sdJwt = {
20
20
  header: {
21
+ kid: "-F_6Uga8n3VegjY2U7YUHK1zLoaD-NPTc63RMISnLaw",
21
22
  typ: "vc+sd-jwt",
22
- alg: "ES256",
23
- kid: "b186ea0c1925793097bf01b8a289a45f",
24
- trust_chain: ["NEhRdERpYnlHY3M5WldWTWZ2aUhm ...", "eyJhbGciOiJSUzI1NiIsImtpZCI6 ...", "IkJYdmZybG5oQU11SFIwN2FqVW1B ..."]
23
+ alg: "ES256"
25
24
  },
26
25
  payload: {
27
- iss: "https://example.com/issuer",
28
- sub: "NzbLsXh8uDCcd7noWXFZAfHkxZsRGC9Xs...",
29
- jti: "urn:uuid:6c5c0a49-b589-431d-bae7-219122a9ec2c",
30
- iat: 1541493724,
31
- exp: 1541493724,
32
- status: "https://example.com/status",
26
+ _sd: ["0q1D5Jmav6pQaEh_J_Fcv_uNNMQIgCyhQOxqlY4l3qU", "KCJ-AVNv88d-xj6sUIAOJxFnbUh3rHXDKkIH1lFqbRs", "M9lo9YxDNIXrAq2qWeiCA40zpJ_zYfFdR_4AEALcRtU", "czgjUk0nqRCswShChCjdS6A1-v47d_qTCSFIvIHhMoI", "nGnQr7clm3tfTp8yjL_uHrDSOtzR2PVb8S7GeLdAqBQ", "xNIVwlpSsaZ8CJSf0gz5x_75VRWWc6V1mlpejdCrqUs"],
27
+ sub: "216f8946-9ecb-4819-9309-c076f34a7e11",
28
+ _sd_alg: "sha-256",
29
+ vct: "PersonIdentificationData",
30
+ iss: "https://pre.eid.wallet.ipzs.it",
33
31
  cnf: {
34
32
  jwk: {
35
- kty: "RSA",
36
- use: "sig",
37
- n: "1Ta-sE",
38
- e: "AQAB",
39
- kid: "YhNFS3YnC9tjiCaivhWLVUJ3AxwGGz_98uRFaqMEEs"
33
+ kty: "EC",
34
+ crv: "P-256",
35
+ kid: "Rv3W-EiKpvBTyk5yZxvrev-7MDB6SlzUCBo_CQjjddU",
36
+ x: "0Wox7QtyPqByg35MH_XyCcnd5Le-Jm0AXHlUgDBA03Y",
37
+ y: "eEhVvg1JPqNd3DTSa4mGDGBlwY6NP-EZbLbNFXSXwIg"
40
38
  }
41
39
  },
42
- type: "PersonIdentificationData",
43
- verified_claims: {
44
- verification: {
45
- _sd: ["JzYjH4svliH0R3PyEMfeZu6Jt69u5qehZo7F7EPYlSE"],
46
- trust_framework: "eidas",
47
- assurance_level: "high"
48
- },
49
- claims: {
50
- _sd: ["09vKrJMOlyTWM0sjpu_pdOBVBQ2M1y3KhpH515nXkpY", "2rsjGbaC0ky8mT0pJrPioWTq0_daw1sX76poUlgCwbI", "EkO8dhW0dHEJbvUHlE_VCeuC9uRELOieLZhh7XbUTtA", "IlDzIKeiZdDwpqpK6ZfbyphFvz5FgnWa-sN6wqQXCiw", "PorFbpKuVu6xymJagvkFsFXAbRoc2JGlAUA2BA4o7cI", "TGf4oLbgwd5JQaHyKVQZU9UdGE0w5rtDsrZzfUaomLo", "jdrTE8YcbY4EifugihiAe_BPekxJQZICeiUQwY9QqxI", "jsu9yVulwQQlhFlM_3JlzMaSFzglhQG0DpfayQwLUK4"]
40
+ exp: 1751546576,
41
+ status: {
42
+ status_attestation: {
43
+ credential_hash_alg: "sha-256"
51
44
  }
52
- },
53
- _sd_alg: "sha-256"
45
+ }
54
46
  }
55
47
  };
56
48
 
57
49
  // In the very same order than tokenizedDisclosures
58
- const disclosures = [["2GLC42sKQveCfGfryNRN9w", "given_name", "John"], ["eluV5Og3gSNII8EYnsxA_A", "family_name", "Doe"], ["6Ij7tM-a5iVPGboS5tmvVA", "email", "johndoe@example.com"], ["eI8ZWm9QnKPpNPeNenHdhQ", "phone_number", "+1-202-555-0101"], ["AJx-095VPrpTtN4QMOqROA", "birthdate", "1940-01-01"], ["Pc33JM2LchcU_lHggv_ufQ", "is_over_18", true], ["G02NSrQfjFXQ7Io09syajA", "is_over_21", true], ["lklxF5jMYlGTPUovMNIvCA", "is_over_65", true], ["Qg_O64zqAxe412a108iroA", "address", {
59
- street_address: "123 Main St",
60
- locality: "Anytown",
61
- region: "Anystate",
62
- country: "US"
63
- }]];
50
+ const disclosures = [["kJDEP8EaNTEMBDOZzZzT4w", "unique_id", "TINIT-LVLDAA85T50G702B"], ["zIAyUFvPfIpE1zBqxI5haQ", "birth_date", "1985-12-10"], ["Gr3R3s290OkQUm-NFTu96A", "tax_id_code", "TINIT-LVLDAA85T50G702B"], ["GxORalMAelfZ0edFJjjYUw", "given_name", "Ada"], ["_vV5RIkl0IOEXKots9kt1w", "family_name", "Lovelace"], ["Cj5tccR72Jwrze2TW4a-wg", "iat", 1720010575]];
64
51
  it("Ensures example data correctness", () => {
65
52
  expect(JSON.parse(decodeBase64(encodeBase64(JSON.stringify(sdJwt.header))))).toEqual(sdJwt.header);
66
53
  expect([signed, ...tokenizedDisclosures].join("~")).toBe(token);
@@ -112,10 +99,10 @@ describe("disclose", () => {
112
99
  it("should encode a valid sdjwt (one claim)", async () => {
113
100
  const result = await disclose(token, ["given_name"]);
114
101
  const expected = {
115
- token: `${signed}~WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwgImdpdmVuX25hbWUiLCAiSm9obiJd`,
102
+ token: `${signed}~WyJHeE9SYWxNQWVsZlowZWRGSmpqWVV3IiwiZ2l2ZW5fbmFtZSIsIkFkYSJd`,
116
103
  paths: [{
117
104
  claim: "given_name",
118
- path: "verified_claims.claims._sd[7]"
105
+ path: "verified_claims.claims._sd[3]"
119
106
  }]
120
107
  };
121
108
  expect(result).toEqual(expected);
@@ -129,15 +116,15 @@ describe("disclose", () => {
129
116
  expect(result).toEqual(expected);
130
117
  });
131
118
  it("should encode a valid sdjwt (multiple claims)", async () => {
132
- const result = await disclose(token, ["given_name", "email"]);
119
+ const result = await disclose(token, ["iat", "family_name"]);
133
120
  const expected = {
134
- token: `${signed}~WyIyR0xDNDJzS1F2ZUNmR2ZyeU5STjl3IiwgImdpdmVuX25hbWUiLCAiSm9obiJd~WyI2SWo3dE0tYTVpVlBHYm9TNXRtdlZBIiwgImVtYWlsIiwgImpvaG5kb2VAZXhhbXBsZS5jb20iXQ`,
121
+ token: `${signed}~WyJfdlY1UklrbDBJT0VYS290czlrdDF3IiwiZmFtaWx5X25hbWUiLCJMb3ZlbGFjZSJd~WyJDajV0Y2NSNzJKd3J6ZTJUVzRhLXdnIiwiaWF0IiwxNzIwMDEwNTc1XQ`,
135
122
  paths: [{
136
- claim: "given_name",
137
- path: "verified_claims.claims._sd[7]"
123
+ claim: "iat",
124
+ path: "verified_claims.claims._sd[4]"
138
125
  }, {
139
- claim: "email",
140
- path: "verified_claims.verification._sd[0]"
126
+ claim: "family_name",
127
+ path: "verified_claims.claims._sd[0]"
141
128
  }]
142
129
  };
143
130
  expect(result).toEqual(expected);
@@ -1 +1 @@
1
- {"version":3,"names":["z","decode","disclose","encodeBase64","decodeBase64","SdJwt4VC","token","unsigned","signature","signed","tokenizedDisclosures","sdJwt","header","typ","alg","kid","trust_chain","payload","iss","sub","jti","iat","exp","status","cnf","jwk","kty","use","n","e","type","verified_claims","verification","_sd","trust_framework","assurance_level","claims","_sd_alg","disclosures","street_address","locality","region","country","it","expect","JSON","parse","stringify","toEqual","join","toBe","describe","result","map","decoded","i","encoded","validDecoder","and","object","customField","string","invalidDecoder","error","expected","paths","claim","path","fn","rejects","any","Error"],"sourceRoot":"../../../../src","sources":["sd-jwt/__test__/index.test.ts"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,MAAM,EAAEC,QAAQ,QAAQ,UAAU;AAE3C,SAASC,YAAY,EAAEC,YAAY,QAAQ,6BAA6B;AACxE,SAASC,QAAQ,QAAQ,UAAU;;AAEnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,KAAK,GACT,kvEAAkvE;AAEpvE,MAAMC,QAAQ,GACZ,87CAA87C;AAEh8C,MAAMC,SAAS,GACb,wFAAwF;AAE1F,MAAMC,MAAM,GAAI,GAAEF,QAAS,IAAGC,SAAU,EAAC;AAEzC,MAAME,oBAAoB,GAAG,CAC3B,kEAAkE,EAClE,kEAAkE,EAClE,gFAAgF,EAChF,oFAAoF,EACpF,yEAAyE,EACzE,gEAAgE,EAChE,gEAAgE,EAChE,gEAAgE,EAChE,qLAAqL,CACtL;AAED,MAAMC,KAAK,GAAG;EACZC,MAAM,EAAE;IACNC,GAAG,EAAE,WAAW;IAChBC,GAAG,EAAE,OAAO;IACZC,GAAG,EAAE,kCAAkC;IACvCC,WAAW,EAAE,CACX,kCAAkC,EAClC,kCAAkC,EAClC,kCAAkC;EAEtC,CAAC;EACDC,OAAO,EAAE;IACPC,GAAG,EAAE,4BAA4B;I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AM,CAAC,CAACJ,OAAO,CAACgB,QAAQ,CAAC;EAClC,CAAC,CAAC;EAEFrB,EAAE,CAAC,+CAA+C,EAAE,YAAY;IAC9D,MAAMS,MAAM,GAAG,MAAMlD,QAAQ,CAACI,KAAK,EAAE,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC7D,MAAM0D,QAAQ,GAAG;MACf1D,KAAK,EAAG,GAAEG,MAAO,kJAAiJ;MAClKwD,KAAK,EAAE,CACL;QACEC,KAAK,EAAE,YAAY;QACnBC,IAAI,EAAE;MACR,CAAC,EACD;QACED,KAAK,EAAE,OAAO;QACdC,IAAI,EAAE;MACR,CAAC;IAEL,CAAC;IAEDvB,MAAM,CAACQ,MAAM,CAAC,CAACJ,OAAO,CAACgB,QAAQ,CAAC;EAClC,CAAC,CAAC;EAEFrB,EAAE,CAAC,8BAA8B,EAAE,YAAY;IAC7C,MAAMyB,EAAE,GAAG,MAAAA,CAAA,KAAYlE,QAAQ,CAACI,KAAK,EAAE,CAAC,SAAS,CAAC,CAAC;IAEnD,MAAMsC,MAAM,CAACwB,EAAE,CAAC,CAAC,CAAC,CAACC,OAAO,CAACrB,OAAO,CAACJ,MAAM,CAAC0B,GAAG,CAACC,KAAK,CAAC,CAAC;EACvD,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["z","decode","disclose","encodeBase64","decodeBase64","SdJwt4VC","token","unsigned","signature","signed","tokenizedDisclosures","sdJwt","header","kid","typ","alg","payload","_sd","sub","_sd_alg","vct","iss","cnf","jwk","kty","crv","x","y","exp","status","status_attestation","credential_hash_alg","disclosures","it","expect","JSON","parse","stringify","toEqual","join","toBe","describe","result","map","decoded","i","encoded","validDecoder","and","object","customField","string","invalidDecoder","error","expected","paths","claim","path","fn","rejects","any","Error"],"sourceRoot":"../../../../src","sources":["sd-jwt/__test__/index.test.ts"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AACvB,SAASC,MAAM,EAAEC,QAAQ,QAAQ,U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 kid: "dB67gL7ck3TFiIAf7N6_7SHvqk0MDYMEQcoGGlkUAAw"
11
10
  },
12
11
  payload: {
13
- iss: "https://pidprovider.example.org",
14
- sub: "NzbLsXh8uDCcd7noWXFZAfHkxZsRGC9Xs...",
15
- jti: "urn:uuid:6c5c0a49-b589-431d-bae7-219122a9ec2c",
16
- iat: 1541493724,
17
- exp: 1541493724,
18
- status: "https://pidprovider.example.org/status",
12
+ _sd: ["0q1D5Jmav6pQaEh_J_Fcv_uNNMQIgCyhQOxqlY4l3qU", "KCJ-AVNv88d-xj6sUIAOJxFnbUh3rHXDKkIH1lFqbRs", "M9lo9YxDNIXrAq2qWeiCA40zpJ_zYfFdR_4AEALcRtU", "czgjUk0nqRCswShChCjdS6A1-v47d_qTCSFIvIHhMoI", "nGnQr7clm3tfTp8yjL_uHrDSOtzR2PVb8S7GeLdAqBQ", "xNIVwlpSsaZ8CJSf0gz5x_75VRWWc6V1mlpejdCrqUs"],
13
+ sub: "216f8946-9ecb-4819-9309-c076f34a7e11",
14
+ _sd_alg: "sha-256",
15
+ vct: "PersonIdentificationData",
16
+ iss: "https://pidprovider.example.com",
19
17
  cnf: {
20
18
  jwk: {
21
- kty: "RSA",
22
- use: "sig",
23
- n: "1Ta-sE …",
24
- e: "AQAB",
25
- kid: "YhNFS3YnC9tjiCaivhWLVUJ3AxwGGz_98uRFaqMEEs"
19
+ kty: "EC",
20
+ crv: "P-256",
21
+ kid: "zEv_qGSL5r0_F67j2dwEgUJmBgbMNSEJ5K_iH1PYc7A",
22
+ x: "0Pj7v_afNp9ETJx11JbYgkI7yQpd0rtiYuo5feuAN2o",
23
+ y: "XB62Um02vHqedkOzSfJ5hdtjPz-zmV9jmWh4sKgdD9o"
26
24
  }
27
25
  },
28
- type: "PersonIdentificationData",
29
- verified_claims: {
30
- verification: {
31
- _sd: ["OGm7ryXgt5Xzlevp-Hu-UTk0a-TxAaPAobqv1pIWMfw"],
32
- trust_framework: "eidas",
33
- assurance_level: "high"
34
- },
35
- claims: {
36
- _sd: ["8JjozBfovMNvQ3HflmPWy4O19Gpxs61FWHjZebU589E", "BoMGktW1rbikntw8Fzx_BeL4YbAndr6AHsdgpatFCig", "CFLGzentGNRFngnLVVQVcoAFi05r6RJUX-rdbLdEfew", "JU_sTaHCngS32X-0ajHrd1-HCLCkpT5YqgcfQme168w", "VQI-S1mT1Kxfq2o8J9io7xMMX2MIxaG9M9PeJVqrMcA", "zVdghcmClMVWlUgGsGpSkCPkEHZ4u9oWj1SlIBlCc1o"]
26
+ exp: 1751107255,
27
+ status: {
28
+ status_attestation: {
29
+ credential_hash_alg: "sha-256"
37
30
  }
38
- },
39
- _sd_alg: "sha-256"
31
+ }
40
32
  }
41
33
  };
42
34
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["Disclosure","SdJwt4VC","describe","it","token","header","typ","alg","kid","trust_chain","payload","iss","sub","jti","iat","exp","status","cnf","jwk","kty","use","n","e","type","verified_claims","verification","_sd","trust_framework","assurance_level","claims","_sd_alg","success","safeParse","expect","toBe","value","record","source","organization_name","organization_id","country_code"],"sourceRoot":"../../../../src","sources":["sd-jwt/__test__/types.test.ts"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,UAAU;AAE/CC,QAAQ,CAAC,UAAU,EAAE,MAAM;EACzBC,EAAE,CAAC,6BAA6B,EAAE,MAAM;IACtC;IACA,MAAMC,KAAK,GAAG;MACZC,MAAM,EAAE;QACNC,GAAG,EAAE,WAAW;QAChBC,GAAG,EAAE,OAAO;QACZC,GAAG,EAAE,6CAA6C;QAClDC,WAAW,EAAE,CACX,kCAAkC,EAClC,kCAAkC,EAClC,kCAAkC;MAEtC,CAAC;MACDC,OAAO,EAAE;QACPC,GAAG,EAAE,iCAAiC;QACtCC,GAAG,EAAE,sCAAsC;QAC3CC,GAAG,EAAE,+CAA+C;QACpDC,GAAG,EAAE,UAAU;QACfC,GAAG,EAAE,UAAU;QACfC,MAAM,EAAE,wCAAwC;QAChDC,GAAG,EAAE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it","token","header","typ","alg","kid","payload","_sd","sub","_sd_alg","vct","iss","cnf","jwk","kty","crv","x","y","exp","status","status_attestation","credential_hash_alg","success","safeParse","expect","toBe","value","type","record","source","organization_name","organization_id","country_code"],"sourceRoot":"../../../../src","sources":["sd-jwt/__test__/types.test.ts"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,UAAU;AAE/CC,QAAQ,CAAC,UAAU,EAAE,MAAM;EACzBC,EAAE,CAAC,6BAA6B,EAAE,MAAM;IACtC;IACA,MAAMC,KAAK,GAAG;MACZC,MAAM,EAAE;QACNC,GAAG,EAAE,WAAW;QAChBC,GAAG,EAAE,OAAO;QACZC,GAAG,EAAE;MACP,CAAC;MACDC,OAAO,EAAE;QACPC,GAAG,EAAE,CACH,6CAA6C,EAC7C,6CAA6C,EAC7C,6CAA6C,EAC7C,6CAA6C,EAC7C,6CAA6C,EAC7C,6CAA6C,CAC9C;QACDC,GAAG,EAAE,sCAAsC;QAC3CC,OAAO,EAAE,SAAS;QAClBC,GAAG,EAAE,0BAA0B;QAC/BC,GAAG,EAAE,iCAAiC;QACtCC,GAAG,EAAE;UACHC,GAAG,EAAE;YACHC,GAAG,EAAE,IAAI;YACTC,GAAG,EAAE,OAAO;YACZV,GAAG,EAAE,6CAA6C;YAClDW,CAAC,EAAE,6CAA6C;YAChDC,CAAC,EAAE;UACL;QACF,CAAC;QACDC,GAAG,EAAE,UAAU;QACfC,MAAM,EAAE;UACNC,kBAAkB,EAAE;YAClBC,mBAAmB,EAAE;UACvB;QACF;MACF;IACF,CAAC;IAED,MAAM;MAAEC;IAAQ,CAAC,GAAGxB,QAAQ,CAACyB,SAAS,CAACtB,KAAK,CAAC;IAE7CuB,MAAM,CAACF,OAAO,CAAC,CAACG,IAAI,CAAC,IAAI,CAAC;EAC5B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF1B,QAAQ,CAAC,YAAY,EAAE,MAAM;EAC3BC,EAAE,CAAC,kCAAkC,EAAE,MAAM;IAC3C;IACA,MAAM0B,KAAK,GAAG,CACZ,wBAAwB,EACxB,UAAU,EACV,CACE;MACEC,IAAI,EAAE,mBAAmB;MACzBC,MAAM,EAAE;QACND,IAAI,EAAE,cAAc;QACpBE,MAAM,EAAE;UACNC,iBAAiB,EAAE,wBAAwB;UAC3CC,eAAe,EAAE,MAAM;UACvBC,YAAY,EAAE;QAChB;MACF;IACF,CAAC,CACF,CACF;IAED,MAAM;MAAEV;IAAQ,CAAC,GAAGzB,UAAU,CAAC0B,SAAS,CAACG,KAAK,CAAC;IAC/CF,MAAM,CAACF,OAAO,CAAC,CAACG,IAAI,CAAC,IAAI,CAAC;EAC5B,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -92,18 +92,12 @@ export const disclose = async (token, claims) => {
92
92
 
93
93
  // _sd is defined in verified_claims.claims and verified_claims.verification
94
94
  // we must look into both
95
- if (sdJwt.payload.verified_claims.claims._sd.includes(hash)) {
96
- const index = sdJwt.payload.verified_claims.claims._sd.indexOf(hash);
95
+ if (sdJwt.payload._sd.includes(hash)) {
96
+ const index = sdJwt.payload._sd.indexOf(hash);
97
97
  return {
98
98
  claim,
99
99
  path: `verified_claims.claims._sd[${index}]`
100
100
  };
101
- } else if (sdJwt.payload.verified_claims.verification._sd.includes(hash)) {
102
- const index = sdJwt.payload.verified_claims.verification._sd.indexOf(hash);
103
- return {
104
- claim,
105
- path: `verified_claims.verification._sd[${index}]`
106
- };
107
101
  }
108
102
  throw new ClaimsNotFoundInToken(claim);
109
103
  }));
@@ -147,7 +141,7 @@ export const verify = async (token, publicKey, customSchema) => {
147
141
  await verifyJwt(rawSdJwt, publicKey);
148
142
 
149
143
  //Check disclosures in sd-jwt
150
- const claims = [...decoded.sdJwt.payload.verified_claims.verification._sd, ...decoded.sdJwt.payload.verified_claims.claims._sd];
144
+ const claims = [...decoded.sdJwt.payload._sd];
151
145
  await Promise.all(decoded.disclosures.map(async disclosure => await verifyDisclosure(disclosure, claims)));
152
146
  return {
153
147
  sdJwt: decoded.sdJwt,