@pagopa/io-react-native-wallet 0.2.8 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/lib/commonjs/rp/__test__/index.test.js +145 -0
  2. package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
  3. package/lib/commonjs/rp/index.js +33 -41
  4. package/lib/commonjs/rp/index.js.map +1 -1
  5. package/lib/commonjs/rp/types.js +11 -9
  6. package/lib/commonjs/rp/types.js.map +1 -1
  7. package/lib/commonjs/utils/jwk.js +35 -0
  8. package/lib/commonjs/utils/jwk.js.map +1 -1
  9. package/lib/commonjs/wallet-instance-attestation/issuing.js +1 -1
  10. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  11. package/lib/commonjs/wallet-instance-attestation/types.js +6 -2
  12. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  13. package/lib/module/rp/__test__/index.test.js +145 -0
  14. package/lib/module/rp/__test__/index.test.js.map +1 -1
  15. package/lib/module/rp/index.js +33 -41
  16. package/lib/module/rp/index.js.map +1 -1
  17. package/lib/module/rp/types.js +11 -9
  18. package/lib/module/rp/types.js.map +1 -1
  19. package/lib/module/utils/jwk.js +34 -0
  20. package/lib/module/utils/jwk.js.map +1 -1
  21. package/lib/module/wallet-instance-attestation/issuing.js +2 -2
  22. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  23. package/lib/module/wallet-instance-attestation/types.js +6 -2
  24. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  25. package/lib/typescript/rp/index.d.ts +8 -8
  26. package/lib/typescript/rp/index.d.ts.map +1 -1
  27. package/lib/typescript/rp/types.d.ts +260 -389
  28. package/lib/typescript/rp/types.d.ts.map +1 -1
  29. package/lib/typescript/utils/jwk.d.ts +9 -0
  30. package/lib/typescript/utils/jwk.d.ts.map +1 -1
  31. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  32. package/lib/typescript/wallet-instance-attestation/types.d.ts +40 -4
  33. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  34. package/package.json +2 -2
  35. package/src/rp/__test__/index.test.ts +222 -0
  36. package/src/rp/index.ts +44 -54
  37. package/src/rp/types.ts +8 -7
  38. package/src/utils/jwk.ts +21 -0
  39. package/src/wallet-instance-attestation/issuing.ts +3 -2
  40. package/src/wallet-instance-attestation/types.ts +6 -2
@@ -1,5 +1,6 @@
1
1
  import { RelyingPartySolution } from "..";
2
2
  import { AuthRequestDecodeError } from "../../utils/errors";
3
+ import { RpEntityConfiguration } from "../types";
3
4
  describe("decodeAuthRequestQR", () => {
4
5
  it("should return authentication request URL", async () => {
5
6
  const qrcode = "ZXVkaXc6Ly9hdXRob3JpemU/Y2xpZW50X2lkPWh0dHBzOi8vdmVyaWZpZXIuZXhhbXBsZS5vcmcmcmVxdWVzdF91cmk9aHR0cHM6Ly92ZXJpZmllci5leGFtcGxlLm9yZy9yZXF1ZXN0X3VyaQ==";
@@ -11,4 +12,148 @@ describe("decodeAuthRequestQR", () => {
11
12
  expect(() => RelyingPartySolution.decodeAuthRequestQR(qrcode)).toThrowError(AuthRequestDecodeError);
12
13
  });
13
14
  });
15
+ describe("RpEntityConfiguration", () => {
16
+ it("should parse a valid confdsfashdhasd", async () => {
17
+ const pp = {
18
+ header: {
19
+ alg: "RS256",
20
+ kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
21
+ typ: "entity-statement+jwt"
22
+ },
23
+ payload: {
24
+ exp: 1692625747,
25
+ iat: 1692625387,
26
+ iss: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
27
+ sub: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
28
+ jwks: {
29
+ keys: [{
30
+ kty: "RSA",
31
+ kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
32
+ e: "AQAB",
33
+ n: "utqtxbs-jnK0cPsV7aRkkZKA9t4S-WSZa3nCZtYIKDpgLnR_qcpeF0diJZvKOqXmj2cXaKFUE-8uHKAHo7BL7T-Rj2x3vGESh7SG1pE0thDGlXj4yNsg0qNvCXtk703L2H3i1UXwx6nq1uFxD2EcOE4a6qDYBI16Zl71TUZktJwmOejoHl16CPWqDLGo9GUSk_MmHOV20m4wXWkB4qbvpWVY8H6b2a0rB1B1YPOs5ZLYarSYZgjDEg6DMtZ4NgiwZ-4N1aaLwyO-GLwt9Vf-NBKwoxeRyD3zWE2FXRFBbhKGksMrCGnFDsNl5JTlPjaM3kYyImE941ggcuc495m-Fw"
34
+ }]
35
+ },
36
+ metadata: {
37
+ wallet_relying_party: {
38
+ application_type: "web",
39
+ authorization_encrypted_response_alg: ["RSA-OAEP", "RSA-OAEP-256", "ECDH-ES", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"],
40
+ authorization_encrypted_response_enc: ["A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512", "A128GCM", "A192GCM", "A256GCM"],
41
+ authorization_signed_response_alg: ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512"],
42
+ client_id: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
43
+ client_name: "Name of an example organization",
44
+ contacts: ["ops@verifier.example.org"],
45
+ default_acr_values: ["https://www.spid.gov.it/SpidL2", "https://www.spid.gov.it/SpidL3"],
46
+ default_max_age: 1111,
47
+ id_token_encrypted_response_alg: ["RSA-OAEP", "RSA-OAEP-256", "ECDH-ES", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"],
48
+ id_token_encrypted_response_enc: ["A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512", "A128GCM", "A192GCM", "A256GCM"],
49
+ id_token_signed_response_alg: ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512"],
50
+ presentation_definitions: [{
51
+ id: "pid-sd-jwt:unique_id+given_name+family_name",
52
+ input_descriptors: [{
53
+ id: "pid-sd-jwt:unique_id+given_name+family_name",
54
+ format: {
55
+ constraints: {
56
+ fields: [{
57
+ filter: {
58
+ const: "PersonIdentificationData",
59
+ type: "string"
60
+ },
61
+ path: ["$.sd-jwt.type"]
62
+ }, {
63
+ filter: {
64
+ type: "object"
65
+ },
66
+ path: ["$.sd-jwt.cnf"]
67
+ }, {
68
+ intent_to_retain: "true",
69
+ path: ["$.sd-jwt.family_name"]
70
+ }, {
71
+ intent_to_retain: "true",
72
+ path: ["$.sd-jwt.given_name"]
73
+ }, {
74
+ intent_to_retain: "true",
75
+ path: ["$.sd-jwt.unique_id"]
76
+ }],
77
+ limit_disclosure: "required"
78
+ },
79
+ jwt: {
80
+ alg: ["EdDSA", "ES256"]
81
+ }
82
+ }
83
+ }]
84
+ }, {
85
+ id: "mDL-sample-req",
86
+ input_descriptors: [{
87
+ format: {
88
+ constraints: {
89
+ fields: [{
90
+ filter: {
91
+ const: "org.iso.18013.5.1.mDL",
92
+ type: "string"
93
+ },
94
+ path: ["$.mdoc.doctype"]
95
+ }, {
96
+ filter: {
97
+ const: "org.iso.18013.5.1",
98
+ type: "string"
99
+ },
100
+ path: ["$.mdoc.namespace"]
101
+ }, {
102
+ intent_to_retain: "false",
103
+ path: ["$.mdoc.family_name"]
104
+ }, {
105
+ intent_to_retain: "false",
106
+ path: ["$.mdoc.portrait"]
107
+ }, {
108
+ intent_to_retain: "false",
109
+ path: ["$.mdoc.driving_privileges"]
110
+ }],
111
+ limit_disclosure: "required"
112
+ },
113
+ mso_mdoc: {
114
+ alg: ["EdDSA", "ES256"]
115
+ }
116
+ },
117
+ id: "mDL"
118
+ }]
119
+ }],
120
+ redirect_uris: ["https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP/redirect-uri"],
121
+ request_uris: ["https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP/request-uri"],
122
+ require_auth_time: true,
123
+ subject_type: "pairwise",
124
+ vp_formats: {
125
+ jwt_vp_json: {
126
+ alg: ["EdDSA", "ES256K"]
127
+ }
128
+ },
129
+ jwks: [{
130
+ crv: "P-256",
131
+ d: "KzQBowMMoPmSZe7G8QsdEWc1IvR2nsgE8qTOYmMcLtc",
132
+ kid: "dDwPWXz5sCtczj7CJbqgPGJ2qQ83gZ9Sfs-tJyULi6s",
133
+ use: "sig",
134
+ kty: "EC",
135
+ x: "TSO-KOqdnUj5SUuasdlRB2VVFSqtJOxuR5GftUTuBdk",
136
+ y: "ByWgQt1wGBSnF56jQqLdoO1xKUynMY-BHIDB3eXlR7"
137
+ }, {
138
+ kty: "RSA",
139
+ d: "QUZsh1NqvpueootsdSjFQz-BUvxwd3Qnzm5qNb-WeOsvt3rWMEv0Q8CZrla2tndHTJhwioo1U4NuQey7znijhZ177bUwPPxSW1r68dEnL2U74nKwwoYeeMdEXnUfZSPxzs7nY6b7vtyCoA-AjiVYFOlgKNAItspv1HxeyGCLhLYhKvS_YoTdAeLuegETU5D6K1xGQIuw0nS13Icjz79Y8jC10TX4FdZwdX-NmuIEDP5-s95V9DMENtVqJAVE3L-wO-NdDilyjyOmAbntgsCzYVGH9U3W_djh4t3qVFCv3r0S-DA2FD3THvlrFi655L0QHR3gu_Fbj3b9Ybtajpue_Q",
140
+ e: "AQAB",
141
+ use: "enc",
142
+ kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
143
+ n: "utqtxbs-jnK0cPsV7aRkkZKA9t4S-WSZa3nCZtYIKDpgLnR_qcpeF0diJZvKOqXmj2cXaKFUE-8uHKAHo7BL7T-Rj2x3vGESh7SG1pE0thDGlXj4yNsg0qNvCXtk703L2H3i1UXwx6nq1uFxD2EcOE4a6qDYBI16Zl71TUZktJwmOejoHl16CPWqDLGo9GUSk_MmHOV20m4wXWkB4qbvpWVY8H6b2a0rB1B1YPOs5ZLYarSYZgjDEg6DMtZ4NgiwZ-4N1aaLwyO-GLwt9Vf-NBKwoxeRyD3zWE2FXRFBbhKGksMrCGnFDsNl5JTlPjaM3kYyImE941ggcuc495m-Fw",
144
+ p: "2zmGXIMCEHPphw778YjVTar1eycih6fFSJ4I4bl1iq167GqO0PjlOx6CZ1-OdBTVU7HfrYRiUK_BnGRdPDn-DQghwwkB79ZdHWL14wXnpB5y-boHz_LxvjsEqXtuQYcIkidOGaMG68XNT1nM4F9a8UKFr5hHYT5_UIQSwsxlRQ0",
145
+ q: "2jMFt2iFrdaYabdXuB4QMboVjPvbLA-IVb6_0hSG_-EueGBvgcBxdFGIZaG6kqHqlB7qMsSzdptU0vn6IgmCZnX-Hlt6c5X7JB_q91PZMLTO01pbZ2Bk58GloalCHnw_mjPh0YPviH5jGoWM5RHyl_HDDMI-UeLkzP7ImxGizrM"
146
+ }]
147
+ }
148
+ },
149
+ authority_hints: ["https://demo.federation.eudi.wallet.developers.italia.it"]
150
+ }
151
+ };
152
+ const result = RpEntityConfiguration.safeParse(pp);
153
+ if (result.success === false) {
154
+ throw result.error;
155
+ }
156
+ expect(result.success).toBe(true);
157
+ });
158
+ });
14
159
  //# sourceMappingURL=index.test.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["RelyingPartySolution","AuthRequestDecodeError","describe","it","qrcode","result","decodeAuthRequestQR","expect","requestURI","toEqual","toThrowError"],"sourceRoot":"../../../../src","sources":["rp/__test__/index.test.ts"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,IAAI;AACzC,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3DC,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCC,EAAE,CAAC,0CAA0C,EAAE,YAAY;IACzD,MAAMC,MAAM,GACV,sJAAsJ;IACxJ,MAAMC,MAAM,GAAGL,oBAAoB,CAACM,mBAAmB,CAACF,MAAM,CAAC;IAC/DG,MAAM,CAACF,MAAM,CAACG,UAAU,CAAC,CAACC,OAAO,CAC/B,0CACF,CAAC;EACH,CAAC,CAAC;EACFN,EAAE,CAAC,wCAAwC,EAAE,YAAY;IACvD,MAAMC,MAAM,GAAG,0BAA0B;IACzCG,MAAM,CAAC,MAAMP,oBAAoB,CAACM,mBAAmB,CAACF,MAAM,CAAC,CAAC,CAACM,YAAY,CACzET,sBACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"names":["RelyingPartySolution","AuthRequestDecodeError","RpEntityConfiguration","describe","it","qrcode","result","decodeAuthRequestQR","expect","requestURI","toEqual","toThrowError","pp","header","alg","kid","typ","payload","exp","iat","iss","sub","jwks","keys","kty","e","n","metadata","wallet_relying_party","application_type","authorization_encrypted_response_alg","authorization_encrypted_response_enc","authorization_signed_response_alg","client_id","client_name","contacts","default_acr_values","default_max_age","id_token_encrypted_response_alg","id_token_encrypted_response_enc","id_token_signed_response_alg","presentation_definitions","id","input_descriptors","format","constraints","fields","filter","const","type","path","intent_to_retain","limit_disclosure","jwt","mso_mdoc","redirect_uris","request_uris","require_auth_time","subject_type","vp_formats","jwt_vp_json","crv","d","use","x","y","p","q","authority_hints","safeParse","success","error","toBe"],"sourceRoot":"../../../../src","sources":["rp/__test__/index.test.ts"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ,IAAI;AACzC,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,SAASC,qBAAqB,QAAQ,UAAU;AAEhDC,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCC,EAAE,CAAC,0CAA0C,EAAE,YAAY;IACzD,MAAMC,MAAM,GACV,sJAAsJ;IACxJ,MAAMC,MAAM,GAAGN,oBAAoB,CAACO,mBAAmB,CAACF,MAAM,CAAC;IAC/DG,MAAM,CAACF,MAAM,CAACG,UAAU,CAAC,CAACC,OAAO,CAC/B,0CACF,CAAC;EACH,CAAC,CAAC;EACFN,EAAE,CAAC,wCAAwC,EAAE,YAAY;IACvD,MAAMC,MAAM,GAAG,0BAA0B;IACzCG,MAAM,CAAC,MAAMR,oBAAoB,CAACO,mBAAmB,CAACF,MAAM,CAAC,CAAC,CAACM,YAAY,CACzEV,sBACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEFE,QAAQ,CAAC,uBAAuB,EAAE,MAAM;EACtCC,EAAE,CAA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hE,MAAM,CAACiE,KAAK;IACpB;IACA/D,MAAM,CAACF,MAAM,CAACgE,OAAO,CAAC,CAACE,IAAI,CAAC,IAAI,CAAC;EACnC,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -72,9 +72,7 @@ export class RelyingPartySolution {
72
72
  * @throws {NoSuitableKeysFoundInEntityConfiguration} When the Request Object is signed with a key not listed in RP's entity configuration
73
73
  *
74
74
  */
75
- async getRequestObject(signedWalletInstanceDPoP, entity) {
76
- const decodedJwtDPop = await decodeJwt(signedWalletInstanceDPoP);
77
- const requestUri = decodedJwtDPop.payload.htu;
75
+ async getRequestObject(signedWalletInstanceDPoP, requestUri, entity) {
78
76
  const response = await this.appFetch(requestUri, {
79
77
  method: "GET",
80
78
  headers: {
@@ -83,13 +81,14 @@ export class RelyingPartySolution {
83
81
  }
84
82
  });
85
83
  if (response.status === 200) {
86
- const responseText = await response.text();
87
- const responseJwt = decodeJwt(responseText);
84
+ const responseJson = await response.json();
85
+ const responseEncodedJwt = responseJson.response;
86
+ const responseJwt = decodeJwt(responseEncodedJwt);
88
87
 
89
88
  // verify token signature according to RP's entity configuration
90
89
  // to ensure the request object is authentic
91
90
  {
92
- const pubKey = entity.payload.jwks.keys.find(_ref => {
91
+ const pubKey = entity.payload.metadata.wallet_relying_party.jwks.find(_ref => {
93
92
  let {
94
93
  kid
95
94
  } = _ref;
@@ -98,7 +97,7 @@ export class RelyingPartySolution {
98
97
  if (!pubKey) {
99
98
  throw new NoSuitableKeysFoundInEntityConfiguration("Request Object signature verification");
100
99
  }
101
- await verify(responseText, pubKey);
100
+ await verify(responseEncodedJwt, pubKey);
102
101
  }
103
102
 
104
103
  // parse request object it has the expected shape by specification
@@ -121,12 +120,16 @@ export class RelyingPartySolution {
121
120
  * @todo accept more than a Verified Credential
122
121
  *
123
122
  * @param requestObj The incoming request object, which the requirements for the requested authorization
123
+ * @param walletInstanceIdentifier The identifies of the wallt instance that is presenting
124
124
  * @param presentation The Verified Credential containing user data along with the list of claims to be disclosed.
125
+ * @param signKeyId The kid of the key that will be used to sign
125
126
  * @returns The unsigned Verified Presentation token
126
127
  * @throws {ClaimsNotFoundBetweenDislosures} If the Verified Credential does not contain one or more requested claims.
127
128
  *
128
129
  */
129
- async prepareVpToken(requestObj, _ref2) {
130
+ async prepareVpToken(requestObj, walletInstanceIdentifier, _ref2,
131
+ // TODO: [SIW-353] support multiple presentations,
132
+ signKeyId) {
130
133
  let [vc, claims] = _ref2;
131
134
  // this throws if vc cannot satisfy all the requested claims
132
135
  const {
@@ -137,14 +140,18 @@ export class RelyingPartySolution {
137
140
  // TODO: [SIW-359] check all requeste claims of the requestedObj are satisfied
138
141
 
139
142
  const vp_token = new SignJWT({
140
- vp
141
- }).setAudience(requestObj.payload.response_uri).setExpirationTime("1h").setProtectedHeader({
143
+ vp: vp,
144
+ jti: `${uuid.v4()}`,
145
+ iss: walletInstanceIdentifier,
146
+ nonce: requestObj.payload.nonce
147
+ }).setAudience(requestObj.payload.response_uri).setIssuedAt().setExpirationTime("1h").setProtectedHeader({
142
148
  typ: "JWT",
143
- alg: "ES256"
149
+ alg: "ES256",
150
+ kid: signKeyId
144
151
  }).toSign();
145
- const [definition_id, vc_scope] = requestObj.payload.scope;
152
+ const vc_scope = requestObj.payload.scope;
146
153
  const presentation_submission = {
147
- definition_id,
154
+ definition_id: `${uuid.v4()}`,
148
155
  id: `${uuid.v4()}`,
149
156
  descriptor_map: paths.map(p => ({
150
157
  id: vc_scope,
@@ -175,72 +182,57 @@ export class RelyingPartySolution {
175
182
  async sendAuthorizationResponse(requestObj, vp_token, presentation_submission, entity) {
176
183
  // the request is an unsigned jws without iss, aud, exp
177
184
  // https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-signed-and-encrypted-respon
178
- const jwk = this.choosePublicKeyToEncrypt(entity);
179
- const enc = this.getEncryptionAlgByJwk(jwk);
185
+ const jwk = this.chooseRSAPublicKeyToEncrypt(entity);
180
186
  const authzResponsePayload = JSON.stringify({
181
187
  state: requestObj.payload.state,
182
188
  presentation_submission,
189
+ nonce: requestObj.payload.nonce,
183
190
  vp_token
184
191
  });
185
192
  const encrypted = await new EncryptJwe(authzResponsePayload, {
186
- alg: jwk.alg,
187
- enc
193
+ alg: "RSA-OAEP-256",
194
+ enc: "A256CBC-HS512",
195
+ kid: jwk.kid
188
196
  }).encrypt(jwk);
189
197
  const formBody = new URLSearchParams({
190
198
  response: encrypted
191
199
  });
200
+ const body = formBody.toString();
192
201
  const response = await this.appFetch(requestObj.payload.response_uri, {
193
202
  method: "POST",
194
203
  headers: {
195
204
  "Content-Type": "application/x-www-form-urlencoded"
196
205
  },
197
- body: formBody.toString()
206
+ body
198
207
  });
199
208
  if (response.status === 200) {
200
- return response.text();
209
+ return await response.text();
201
210
  }
202
- throw new IoWalletError(`Unable to send Authorization Response. Response code: ${response.status}`);
211
+ throw new IoWalletError(`Unable to send Authorization Response. Response: ${await response.text()} with code: ${response.status}`);
203
212
  }
204
213
 
205
214
  /**
206
- * Select a public key from those provided by the RP.
207
- * Keys with algorithm "RSA-OAEP-256" or "RSA-OAEP" are expected, the firsts to be preferred.
215
+ * Select a RSA public key from those provided by the RP to encrypt.
208
216
  *
209
217
  * @param entity The RP entity configuration
210
218
  * @returns A suitable public key with its compatible encryption algorithm
211
219
  * @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key suitable for encrypting
212
220
  */
213
- choosePublicKeyToEncrypt(entity) {
214
- // Look for keys using "RSA-OAEP-256", and pick a random one
215
- const [usingRsa256] = entity.payload.jwks.keys.filter(k => typeof k.alg === "string" && k.alg === "RSA-OAEP-256");
221
+ chooseRSAPublicKeyToEncrypt(entity) {
222
+ const [usingRsa256] = entity.payload.metadata.wallet_relying_party.jwks.filter(jwk => jwk.use === "enc" && jwk.kty === "RSA");
216
223
  if (usingRsa256) {
217
224
  return usingRsa256;
218
225
  }
219
226
 
220
- // Look for keys using "RSA-OAEP", and pick a random one
221
- const [usingRsa] = entity.payload.jwks.keys.filter(k => typeof k.alg === "string" && k.alg === "RSA-OAEP");
222
- if (usingRsa) {
223
- return usingRsa;
224
- }
225
-
226
227
  // No suitable key has been found
227
228
  throw new NoSuitableKeysFoundInEntityConfiguration("Encrypt with RP public key");
228
229
  }
229
- getEncryptionAlgByJwk(_ref3) {
230
- let {
231
- alg
232
- } = _ref3;
233
- if (alg === "RSA-OAEP-256") return "A256CBC-HS512";
234
- if (alg === "RSA-OAEP") return "A128CBC-HS256";
235
- const _ = alg;
236
- throw new Error(`Invalid jwk algorithm: ${_}`);
237
- }
238
230
 
239
231
  /**
240
232
  * Obtain the relying party entity configuration.
241
233
  */
242
234
  async getEntityConfiguration() {
243
- const wellKnownUrl = new URL("/.well-known/openid-federation", this.relyingPartyBaseUrl).href;
235
+ const wellKnownUrl = this.relyingPartyBaseUrl + "/.well-known/openid-federation";
244
236
  const response = await this.appFetch(wellKnownUrl, {
245
237
  method: "GET"
246
238
  });
@@ -1 +1 @@
1
- {"version":3,"names":["AuthRequestDecodeError","IoWalletError","NoSuitableKeysFoundInEntityConfiguration","decode","decodeJwt","decodeBase64","sha256ToBase64","SignJWT","EncryptJwe","verify","QRCodePayload","RequestObject","RpEntityConfiguration","uuid","disclose","RelyingPartySolution","constructor","relyingPartyBaseUrl","walletInstanceAttestation","appFetch","arguments","length","undefined","fetch","decodeAuthRequestQR","qrcode","decoded","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","safeParse","success","data","error","message","getUnsignedWalletInstanceDPoP","walletInstanceAttestationJwk","authRequestUrl","jti","v4","htm","htu","ath","setProtectedHeader","alg","jwk","typ","setIssuedAt","setExpirationTime","toSign","getRequestObject","signedWalletInstanceDPoP","entity","decodedJwtDPop","requestUri","payload","response","method","headers","Authorization","DPoP","status","responseText","text","responseJwt","pubKey","jwks","keys","find","_ref","kid","protectedHeader","requestObj","parse","header","prepareVpToken","_ref2","vc","claims","token","vp","paths","vp_token","setAudience","response_uri","definition_id","vc_scope","scope","presentation_submission","id","descriptor_map","map","p","path","format","sendAuthorizationResponse","choosePublicKeyToEncrypt","enc","getEncryptionAlgByJwk","authzResponsePayload","JSON","stringify","state","encrypted","encrypt","formBody","URLSearchParams","body","toString","usingRsa256","filter","k","usingRsa","_ref3","_","Error","getEntityConfiguration","wellKnownUrl","href"],"sourceRoot":"../../../src","sources":["rp/index.ts"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,aAAa,EACbC,wCAAwC,QACnC,iBAAiB;AACxB,SACEC,MAAM,IAAIC,SAAS,EACnBC,YAAY,EACZC,cAAc,EACdC,OAAO,EACPC,UAAU,EACVC,MAAM,QACD,6BAA6B;AACpC,SACEC,aAAa,EACbC,aAAa,EACbC,qBAAqB,QAEhB,SAAS;AAEhB,OAAOC,IAAI,MAAM,mBAAmB;AAEpC,SAASC,QAAQ,QAAQ,WAAW;AAEpC,OAAO,MAAMC,oBAAoB,CAAC;EAKhCC,WAAWA,CACTC,mBAA2B,EAC3BC,yBAAiC,EAEjC;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACN,mBAAmB,GAAGA,mBAAmB;IAC9C,IAAI,CAACC,yBAAyB,GAAGA,yBAAyB;IAC1D,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOK,mBAAmBA,CAACC,MAAc,EAAiB;IACxD,MAAMC,OAAO,GAAGrB,YAAY,CAACoB,MAAM,CAAC;IACpC,MAAME,UAAU,GAAG,IAAIC,GAAG,CAACF,OAAO,CAAC;IACnC,MAAMG,QAAQ,GAAGF,UAAU,CAACE,QAAQ;IACpC,MAAMC,QAAQ,GAAGH,UAAU,CAACI,QAAQ;IACpC,MAAMC,UAAU,GAAGL,UAAU,CAACM,YAAY,CAACC,GAAG,CAAC,aAAa,CAAC;IAC7D,MAAMC,QAAQ,GAAGR,UAAU,C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;EACH;EAEQuG,qBAAqBA,CAAAe,KAAA,EAIT;IAAA,IAJU;MAC5BrE;IAC6D,CAAC,GAAAqE,KAAA;IAG9D,IAAIrE,GAAG,KAAK,cAAc,EAAE,OAAO,eAAe;IAClD,IAAIA,GAAG,KAAK,UAAU,EAAE,OAAO,eAAe;IAE9C,MAAMsE,CAAQ,GAAGtE,GAAG;IACpB,MAAM,IAAIuE,KAAK,CAAE,0BAAyBD,CAAE,EAAC,CAAC;EAChD;;EAEA;AACF;AACA;EACE,MAAME,sBAAsBA,CAAA,EAAmC;IAC7D,MAAMC,YAAY,GAAG,IAAIhG,GAAG,CAC1B,gCAAgC,EAChC,IAAI,CAACX,mBACP,CAAC,CAAC4G,IAAI;IAEN,MAAM9D,QAAQ,GAAG,MAAM,IAAI,CAAC5C,QAAQ,CAACyG,YAAY,EAAE;MACjD5D,MAAM,EAAE;IACV,CAAC,CAAC;IAEF,IAAID,QAAQ,CAACK,MAAM,KAAK,GAAG,EAAE;MAC3B,MAAMC,YAAY,GAAG,MAAMN,QAAQ,CAACO,IAAI,CAAC,CAAC;MAC1C,MAAMC,WAAW,GAAG,MAAMnE,SAAS,CAACiE,YAAY,CAAC;MACjD,OAAOzD,qBAAqB,CAACoE,KAAK,CAAC;QACjCC,MAAM,EAAEV,WAAW,CAACO,eAAe;QACnChB,OAAO,EAAES,WAAW,CAACT;MACvB,CAAC,CAAC;IACJ;IAEA,MAAM,IAAI7D,aAAa,CACpB,4DAA2D8D,QAAQ,CAACK,MAAO,EAC9E,CAAC;EACH;AACF"}
1
+ {"version":3,"names":["AuthRequestDecodeError","IoWalletError","NoSuitableKeysFoundInEntityConfiguration","decode","decodeJwt","decodeBase64","sha256ToBase64","SignJWT","EncryptJwe","verify","QRCodePayload","RequestObject","RpEntityConfiguration","uuid","disclose","RelyingPartySolution","constructor","relyingPartyBaseUrl","walletInstanceAttestation","appFetch","arguments","length","undefined","fetch","decodeAuthRequestQR","qrcode","decoded","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","safeParse","success","data","error","message","getUnsignedWalletInstanceDPoP","walletInstanceAttestationJwk","authRequestUrl","jti","v4","htm","htu","ath","setProtectedHeader","alg","jwk","typ","setIssuedAt","setExpirationTime","toSign","getRequestObject","signedWalletInstanceDPoP","requestUri","entity","response","method","headers","Authorization","DPoP","status","responseJson","json","responseEncodedJwt","responseJwt","pubKey","payload","metadata","wallet_relying_party","jwks","find","_ref","kid","protectedHeader","requestObj","parse","header","prepareVpToken","walletInstanceIdentifier","_ref2","signKeyId","vc","claims","token","vp","paths","vp_token","iss","nonce","setAudience","response_uri","vc_scope","scope","presentation_submission","definition_id","id","descriptor_map","map","p","path","format","sendAuthorizationResponse","chooseRSAPublicKeyToEncrypt","authzResponsePayload","JSON","stringify","state","encrypted","enc","encrypt","formBody","URLSearchParams","body","toString","text","usingRsa256","filter","use","kty","getEntityConfiguration","wellKnownUrl","responseText"],"sourceRoot":"../../../src","sources":["rp/index.ts"],"mappings":"AAAA,SACEA,sBAAsB,EACtBC,aAAa,EACbC,wCAAwC,QACnC,iBAAiB;AACxB,SACEC,MAAM,IAAIC,SAAS,EACnBC,YAAY,EACZC,cAAc,EACdC,OAAO,EACPC,UAAU,EACVC,MAAM,QACD,6BAA6B;AACpC,SACEC,aAAa,EACbC,aAAa,EACbC,qBAAqB,QAEhB,SAAS;AAEhB,OAAOC,IAAI,MAAM,mBAAmB;AAEpC,SAASC,QAAQ,QAAQ,WAAW;AAEpC,OAAO,MAAMC,oBAAoB,CAAC;EAKhCC,WAAWA,CACTC,mBAA2B,EAC3BC,yBAAiC,EAEjC;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACN,mBAAmB,GAAGA,mBAAmB;IAC9C,IAAI,CAACC,yBAAyB,GAAGA,yBAAyB;IAC1D,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;;E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,CACpB,oDAAmD,MAAM4D,QAAQ,CAAC2D,IAAI,CAAC,CAAE,eACxE3D,QAAQ,CAACK,MACV,EACH,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACU0C,2BAA2BA,CAAChD,MAA6B,EAAO;IACtE,MAAM,CAAC6D,WAAW,CAAC,GACjB7D,MAAM,CAACY,OAAO,CAACC,QAAQ,CAACC,oBAAoB,CAACC,IAAI,CAAC+C,MAAM,CACrDtE,GAAG,IAAKA,GAAG,CAACuE,GAAG,KAAK,KAAK,IAAIvE,GAAG,CAACwE,GAAG,KAAK,KAC5C,CAAC;IAEH,IAAIH,WAAW,EAAE;MACf,OAAOA,WAAW;IACpB;;IAEA;IACA,MAAM,IAAIvH,wCAAwC,CAChD,4BACF,CAAC;EACH;;EAEA;AACF;AACA;EACE,MAAM2H,sBAAsBA,CAAA,EAAmC;IAC7D,MAAMC,YAAY,GAChB,IAAI,CAAC7G,mBAAmB,GAAG,gCAAgC;IAE7D,MAAM4C,QAAQ,GAAG,MAAM,IAAI,CAAC1C,QAAQ,CAAC2G,YAAY,EAAE;MACjDhE,MAAM,EAAE;IACV,CAAC,CAAC;IAEF,IAAID,QAAQ,CAACK,MAAM,KAAK,GAAG,EAAE;MAC3B,MAAM6D,YAAY,GAAG,MAAMlE,QAAQ,CAAC2D,IAAI,CAAC,CAAC;MAC1C,MAAMlD,WAAW,GAAG,MAAMlE,SAAS,CAAC2H,YAAY,CAAC;MACjD,OAAOnH,qBAAqB,CAACqE,KAAK,CAAC;QACjCC,MAAM,EAAEZ,WAAW,CAACS,eAAe;QACnCP,OAAO,EAAEF,WAAW,CAACE;MACvB,CAAC,CAAC;IACJ;IAEA,MAAM,IAAIvE,aAAa,CACpB,4DAA2D4D,QAAQ,CAACK,MAAO,EAC9E,CAAC;EACH;AACF"}
@@ -3,7 +3,8 @@ import { UnixTime } from "../sd-jwt/types";
3
3
  import * as z from "zod";
4
4
  export const RequestObject = z.object({
5
5
  header: z.object({
6
- typ: z.literal("JWT"),
6
+ // FIXME: SIW-421 type field must be either required or omitted, optional isn't useful
7
+ typ: z.literal("JWT").optional(),
7
8
  alg: z.string(),
8
9
  kid: z.string(),
9
10
  trust_chain: z.array(z.string())
@@ -44,24 +45,25 @@ export const RpEntityConfiguration = z.object({
44
45
  application_type: z.string(),
45
46
  client_id: z.string(),
46
47
  client_name: z.string(),
47
- jwks: z.object({
48
- keys: z.array(JWK)
49
- }),
48
+ jwks: z.array(JWK),
50
49
  contacts: z.array(z.string())
51
- }),
52
- federation_entity: z.object({
50
+ })
51
+ // FIXME: SIW-422 require federation_metadata field
52
+ // Actual RP implementation does not comply with the spec
53
+ /* federation_entity: z.object({
53
54
  organization_name: z.string(),
54
55
  homepage_uri: z.string(),
55
56
  policy_uri: z.string(),
56
57
  logo_uri: z.string(),
57
- contacts: z.array(z.string())
58
- })
58
+ contacts: z.array(z.string()),
59
+ }), */
59
60
  }),
61
+
60
62
  authority_hints: z.array(z.string())
61
63
  })
62
64
  });
63
65
  export const QRCodePayload = z.object({
64
- protocol: z.literal("eudiw:"),
66
+ protocol: z.string(),
65
67
  resource: z.string(),
66
68
  // TODO: refine to known paths using literals
67
69
  clientId: z.string(),
@@ -1 +1 @@
1
- {"version":3,"names":["JWK","UnixTime","z","RequestObject","object","header","typ","literal","alg","string","kid","trust_chain","array","payload","iss","iat","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","RpEntityConfiguration","sub","jwks","keys","metadata","wallet_relying_party","application_type","client_name","contacts","federation_entity","organization_name","homepage_uri","policy_uri","logo_uri","authority_hints","QRCodePayload","protocol","resource","clientId","requestURI"],"sourceRoot":"../../../src","sources":["rp/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,CAAC,MAAM,KAAK;AAGxB,OAAO,MAAMC,aAAa,GAAGD,CAAC,CAACE,MAAM,CAAC;EACpCC,MAAM,E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tC,CAAC,CAACE,MAAM,CAAC;EACpCqC,QAAQ,EAAEvC,CAAC,CAACK,OAAO,CAAC,QAAQ,CAAC;EAC7BmC,QAAQ,EAAExC,CAAC,CAACO,MAAM,CAAC,CAAC;EAAE;EACtBkC,QAAQ,EAAEzC,CAAC,CAACO,MAAM,CAAC,CAAC;EACpBmC,UAAU,EAAE1C,CAAC,CAACO,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA"}
1
+ {"version":3,"names":["JWK","UnixTime","z","RequestObject","object","header","typ","literal","optional","alg","string","kid","trust_chain","array","payload","iss","iat","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","RpEntityConfiguration","sub","jwks","keys","metadata","wallet_relying_party","application_type","client_name","contacts","authority_hints","QRCodePayload","protocol","resource","clientId","requestURI"],"sourceRoot":"../../../src","sources":["rp/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,OAAO,KAAKC,CAAC,MAAM,KAAK;AAGxB,OAAO,MAAMC,aAAa,GAAGD,CAAC,CAACE,MAAM,CAAC;EACpCC,MAAM,EAAEH,CAAC,CAACE,MAAM,CAAC;IACf;IACAE,GAAG,EAAEJ,CAAC,CAACK,OAAO,CAAC,KAAK,CAAC,CAACC,QAAQ,CAAC,CAAC;IAChCC,GAAG,EAAEP,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfC,GAAG,EAAET,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfE,WAAW,EAAEV,CAAC,CAACW,KAAK,CAACX,CAAC,CAACQ,MAAM,CAAC,CAAC;EACjC,CAAC,CAAC;EACFI,OAAO,EAAEZ,CAAC,CAACE,MAAM,CAAC;IAChBW,GAAG,EAAEb,CAAC,CAACQ,MAAM,CAAC,CAAC;IACfM,GAAG,EAAEf,QAAQ;IACbgB,GAAG,EAAEhB,QAAQ;IACbiB,KAAK,EAAEhB,CAAC,CAACQ,MAAM,CA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CAAC;QACrBuB,WAAW,EAAE/B,CAAC,CAACQ,MAAM,CAAC,CAAC;QACvBkB,IAAI,EAAE1B,CAAC,CAACW,KAAK,CAACb,GAAG,CAAC;QAClBkC,QAAQ,EAAEhC,CAAC,CAACW,KAAK,CAACX,CAAC,CAACQ,MAAM,CAAC,CAAC;MAC9B,CAAC;MACD;MACA;MACA;AACN;AACA;AACA;AACA;AACA;AACA;IACI,CAAC,CAAC;;IACFyB,eAAe,EAAEjC,CAAC,CAACW,KAAK,CAACX,CAAC,CAACQ,MAAM,CAAC,CAAC;EACrC,CAAC;AACH,CAAC,CAAC;AAGF,OAAO,MAAM0B,aAAa,GAAGlC,CAAC,CAACE,MAAM,CAAC;EACpCiC,QAAQ,EAAEnC,CAAC,CAACQ,MAAM,CAAC,CAAC;EACpB4B,QAAQ,EAAEpC,CAAC,CAACQ,MAAM,CAAC,CAAC;EAAE;EACtB6B,QAAQ,EAAErC,CAAC,CAACQ,MAAM,CAAC,CAAC;EACpB8B,UAAU,EAAEtC,CAAC,CAACQ,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA"}
@@ -1,3 +1,4 @@
1
+ import { removePadding } from "@pagopa/io-react-native-jwt";
1
2
  import { z } from "zod";
2
3
  export const JWK = z.object({
3
4
  /** JWK "alg" (Algorithm) Parameter. */
@@ -35,4 +36,37 @@ export const JWK = z.object({
35
36
  /** JWK "x5u" (X.509 URL) Parameter. */
36
37
  x5u: z.string().optional()
37
38
  });
39
+
40
+ /**
41
+ * Ensure key values are encoded using base64url and not just base64, as defined in https://datatracker.ietf.org/doc/html/rfc7517
42
+ *
43
+ * @see https://datatracker.ietf.org/doc/html/rfc7517
44
+ *
45
+ * @param key The key to fix
46
+ * @returns THe same input key with fixed values
47
+ */
48
+ export function fixBase64EncodingOnKey(key) {
49
+ const {
50
+ x,
51
+ y,
52
+ e,
53
+ n,
54
+ ...pk
55
+ } = key;
56
+ return {
57
+ ...pk,
58
+ ...(x ? {
59
+ x: removePadding(x)
60
+ } : {}),
61
+ ...(y ? {
62
+ y: removePadding(y)
63
+ } : {}),
64
+ ...(e ? {
65
+ e: removePadding(e)
66
+ } : {}),
67
+ ...(n ? {
68
+ n: removePadding(n)
69
+ } : {})
70
+ };
71
+ }
38
72
  //# sourceMappingURL=jwk.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["z","JWK","object","alg","string","optional","crv","d","dp","dq","e","ext","boolean","k","key_ops","array","kid","kty","union","literal","n","p","q","qi","use","x","y","x5c","x5t","x5u"],"sourceRoot":"../../../src","sources":["utils/jwk.ts"],"mappings":"AAAA,SAASA,CAAC,QAAQ,KAAK;AAGvB,OAAO,MAAMC,GAAG,GAAGD,CAAC,CAACE,MAAM,CAAC;EAC1B;EACAC,GAAG,EAAEH,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC1BC,GAAG,EAAEN,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC1BE,CAAC,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxBG,EAAE,EAAER,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACzBI,EAAE,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACzBK,CAAC,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxB;EACAM,GAAG,EAAEX,CAAC,CAACY,OAAO,CAAC,CAAC,CAACP,QAAQ,CAAC,CAAC;EAC3BQ,CAAC,EAAEb,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxB;EACAS,OAAO,EAAEd,CAAC,CAACe,KAAK,CAACf,CAAC,CAACI,MAAM,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACvC;EACAW,GAAG,EAAEhB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC1B;AACF;AACA;EACEY,GAAG,EAAEjB,CAAC,CAACkB,KAAK,CAAC,CAAClB,CAAC,CAACmB,OAAO,CAAC,KAAK,CAAC,EAAEnB,CAAC,CAACmB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;EACjDC,CAAC,EAAEpB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxBgB,CAAC,EAAErB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxBiB,CAAC,EAAEtB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxBkB,EAAE,EAAEvB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACzB;EACAmB,GAAG,EAAExB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC1BoB,CAAC,EAAEzB,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxBqB,CAAC,EAAE1B,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACxB;EACAsB,GAAG,EAAE3B,CAAC,CAACe,KAAK,CAACf,CAAC,CAACI,MAAM,CAAC,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACnC;EACAuB,GAAG,EAAE5B,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EAC1B;EACA,UAAU,EAAEL,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACjC;EACAwB,GAAG,EAAE7B,CAAC,CAACI,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC;AAC3B,CAAC,CAAC"}
1
+ {"version":3,"names":["removePadding","z","JWK","object","alg","string","optional","crv","d","dp","dq","e","ext","boolean","k","key_ops","array","kid","kty","union","literal","n","p","q","qi","use","x","y","x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AC,EAAE3B,aAAa,CAAC2B,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAIhB,CAAC,GAAG;MAAEA,CAAC,EAAEX,aAAa,CAACW,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAIU,CAAC,GAAG;MAAEA,CAAC,EAAErB,aAAa,CAACqB,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC;EACtC,CAAC;AACH"}
@@ -1,7 +1,7 @@
1
1
  import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
2
2
  import { verify as verifyJwt } from "@pagopa/io-react-native-jwt";
3
3
  import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
4
- import { JWK } from "../utils/jwk";
4
+ import { JWK, fixBase64EncodingOnKey } from "../utils/jwk";
5
5
  import { WalletInstanceAttestationRequestJwt } from "./types";
6
6
  import uuid from "react-native-uuid";
7
7
  import { WalletInstanceAttestationIssuingError } from "../utils/errors";
@@ -35,7 +35,7 @@ export class Issuing {
35
35
  jti: `${uuid.v4()}`,
36
36
  type: "WalletInstanceAttestationRequest",
37
37
  cnf: {
38
- jwk: publicKey
38
+ jwk: fixBase64EncodingOnKey(publicKey)
39
39
  }
40
40
  }).setProtectedHeader({
41
41
  alg: "ES256",
@@ -1 +1 @@
1
- {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","SignJWT","thumbprint","JWK","WalletInstanceAttestationRequestJwt","uuid","WalletInstanceAttestationIssuingError","Issuing","constructor","walletProviderBaseUrl","appFetch","arguments","length","undefined","fetch","getAttestationRequestToSign","jwk","parsedJwk","parse","keyThumbprint","publicKey","kid","walletInstanceAttestationRequest","iss","sub","jti","v4","type","cnf","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","getAttestation","attestationRequest","signature","signedAttestationRequest","appendSignature","decodedRequest","parsedRequest","payload","header","protectedHeader","tokenUrl","URL","href","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text"],"sourceRoot":"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AClE,kBAAiB6C,QAAQ,CAACM,MAAO,EACpC,CAAC;EACH;AACF"}
1
+ {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","SignJWT","thumbprint","JWK","fixBase64EncodingOnKey","WalletInstanceAttestationRequestJwt","uuid","WalletInstanceAttestationIssuingError","Issuing","constructor","walletProviderBaseUrl","appFetch","arguments","length","undefined","fetch","getAttestationRequestToSign","jwk","parsedJwk","parse","keyThumbprint","publicKey","kid","walletInstanceAttestationRequest","iss","sub","jti","v4","type","cnf","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","getAttestation","attestationRequest","signature","signedAttestationRequest","appendSignature","decodedRequest","parsedRequest","payload","header","protectedHeader","tokenUrl","URL","href","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,GAAG,EAAEC,sBAAsB,QAAQ,cAAc;AAC1D,SAASC,mCAAmC,QAAQ,SAAS;AAC7D,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,qCAAqC,QAAQ,iBAAiB;AAEvE,OAAO,MAAMC,OAAO,CAAC;EAGnBC,WAAWA,CACTC,qBAA6B,EAE7B;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACL,qBAAqB,GAAGA,qBAAqB;IAClD,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMK,2BAA2BA,CAACC,GAAQ,EAAmB;IAC3D,MAAMC,SAAS,GAAGf,GAAG,CAACgB,KAAK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yB,QAAQ,GAAG,IAAIC,GAAG,CAAC,OAAO,EAAE,IAAI,CAACrC,qBAAqB,CAAC,CAACsC,IAAI;IAClE,MAAMC,WAAW,GAAG;MAClBC,UAAU,EACR,iEAAiE;MACnEC,SAAS,EAAEZ;IACb,CAAC;IACD,MAAMa,QAAQ,GAAG,MAAM,IAAI,CAACzC,QAAQ,CAACmC,QAAQ,EAAE;MAC7CO,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACR,WAAW;IAClC,CAAC,CAAC;IAEF,IAAIG,QAAQ,CAACM,MAAM,KAAK,GAAG,EAAE;MAC3B,OAAO,MAAMN,QAAQ,CAACO,IAAI,CAAC,CAAC;IAC9B;IAEA,MAAM,IAAIpD,qCAAqC,CAC7C,mEAAmE,EAClE,kBAAiB6C,QAAQ,CAACM,MAAO,EACpC,CAAC;EACH;AACF"}
@@ -15,7 +15,11 @@ const Jwt = z.object({
15
15
  iat: UnixTime,
16
16
  exp: UnixTime,
17
17
  cnf: z.object({
18
- jwk: JWK
18
+ jwk: z.intersection(JWK,
19
+ // this key requires a kis because it must be referenced for DPoP
20
+ z.object({
21
+ kid: z.string()
22
+ }))
19
23
  })
20
24
  })
21
25
  });
@@ -38,7 +42,7 @@ export const WalletInstanceAttestationJwt = z.object({
38
42
  tos_uri: z.string().url(),
39
43
  logo_uri: z.string().url(),
40
44
  asc: z.string(),
41
- authorization_endpoint: z.string().url(),
45
+ authorization_endpoint: z.string(),
42
46
  response_types_supported: z.array(z.string()),
43
47
  vp_formats_supported: z.object({
44
48
  jwt_vp_json: z.object({
@@ -1 +1 @@
1
- {"version":3,"names":["JWK","z","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","sub","iat","exp","cnf","jwk","WalletInstanceAttestationRequestJwt","intersection","shape","literal","jti","type","WalletInstanceAttestationJwt","policy_uri","url","tos_uri","logo_uri","asc","authorization_endpoint","response_types_supported","vp_formats_supported","jwt_vp_json","alg_values_supported","jwt_vc_json","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,OAAO,KAAKC,CAAC,MAAM,KAAK;AAExB,MAAMC,QAAQ,GAAGD,CAAC,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,aAAa,CAAC;AAGrD,MAAMC,GAAG,GAAGL,CAAC,CAACM,MAAM,CAAC;EACnBC,MAAM,EAAEP,CAAC,CAACM,MAAM,CAAC;IACfE,GAAG,EAAER,CAAC,CAACS,MAAM,CAAC,CAAC;IACfC,GAAG,EAAEV,CAAC,CAACS,MAAM,CAAC,CAAC;IACfE,GAAG,EAAEX,CAAC,CAACS,MAAM,CAAC,CAAC;IACfG,GAAG,EAAEZ,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC,CAAC,CAACK,QAAQ,CAAC,CAAC;IACnCC,WAAW,EAAEf,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC,CAAC,CAACK,QAAQ,CAAC;EAC5C,CAAC,CAAC;EACFE,OAAO,EAAEhB,CAAC,CAACM,MAAM,CAAC;IAChBW,GAAG,EAAEjB,CAAC,CAACS,MAAM,CAAC,CAAC;IACfS,GAAG,EAAElB,CAAC,CAACS,MAAM,CAAC,CAAC;IACfU,GAAG,EAAElB,QAAQ;IACbmB,GAAG,EAAEnB,QAAQ;IACboB,GAAG,EAAErB,CAAC,CAACM,MAAM,CAAC;MACZgB,GAAG,EAAEvB;IACP,CAAC;EACH,CAAC;AACH,CAAC,CAAC;AAKF,OAAO,MAAMwB,mCAAmC,GAAGvB,CAAC,CAACM,MAAM,CAAC;EAC1DC,MAAM,EAAEP,CAAC,CAACwB,YAAY,CACpBnB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AAC,CAACS,MAAM,CAAC,CAAC,CAAC;IAC7C4B,oBAAoB,EAAErC,CAAC,CAACM,MAAM,CAAC;MAC7BgC,WAAW,EAAEtC,CAAC,CAACM,MAAM,CAAC;QACpBiC,oBAAoB,EAAEvC,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC;MAC1C,CAAC,CAAC;MACF+B,WAAW,EAAExC,CAAC,CAACM,MAAM,CAAC;QACpBiC,oBAAoB,EAAEvC,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC;MAC1C,CAAC;IACH,CAAC,CAAC;IACFgC,2CAA2C,EAAEzC,CAAC,CAACa,KAAK,CAACb,CAAC,CAACS,MAAM,CAAC,CAAC,CAAC;IAChEiC,qCAAqC,EAAE1C,CAAC,CAAC2C,OAAO,CAAC;EACnD,CAAC,CACH;AACF,CAAC,CAAC"}
1
+ {"version":3,"names":["JWK","z","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","sub","iat","exp","cnf","jwk","intersection","WalletInstanceAttestationRequestJwt","shape","literal","jti","type","WalletInstanceAttestationJwt","policy_uri","url","tos_uri","logo_uri","asc","authorization_endpoint","response_types_supported","vp_formats_supported","jwt_vp_json","alg_values_supported","jwt_vc_json","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,OAAO,KAAKC,CAAC,MAAM,KAAK;AAExB,MAAMC,QAAQ,GAAGD,CAAC,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,aAAa,CAAC;AAGrD,MAAMC,GAAG,GAAGL,CAAC,CAACM,MAAM,CAAC;EACnBC,MAAM,EAAEP,CAAC,CAACM,MAAM,CAAC;IACfE,GAAG,EAAER,CAAC,CAACS,MAAM,CAAC,CAAC;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