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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -32,7 +32,7 @@ const Jwt = z.object({
32
32
  });
33
33
  const WalletInstanceAttestationRequestJwt = z.object({
34
34
  header: z.intersection(Jwt.shape.header, z.object({
35
- typ: z.literal("wiar+jwt")
35
+ typ: z.literal("war+jwt")
36
36
  })),
37
37
  payload: z.intersection(Jwt.shape.payload, z.object({
38
38
  aud: z.string(),
@@ -47,16 +47,16 @@ const WalletInstanceAttestationJwt = z.object({
47
47
  })),
48
48
  payload: z.intersection(Jwt.shape.payload, z.object({
49
49
  sub: z.string(),
50
- attested_security_context: z.string(),
50
+ aal: z.string(),
51
51
  authorization_endpoint: z.string(),
52
52
  response_types_supported: z.array(z.string()),
53
53
  vp_formats_supported: z.object({
54
- jwt_vp_json: z.object({
55
- alg_values_supported: z.array(z.string())
56
- }),
57
- jwt_vc_json: z.object({
58
- alg_values_supported: z.array(z.string())
59
- })
54
+ "vc+sd-jwt": z.object({
55
+ "sd-jwt_alg_values": z.array(z.string())
56
+ }).optional(),
57
+ "vp+sd-jwt": z.object({
58
+ "sd-jwt_alg_values": z.array(z.string())
59
+ }).optional()
60
60
  }),
61
61
  request_object_signing_alg_values_supported: z.array(z.string()),
62
62
  presentation_definition_uri_supported: z.boolean()
@@ -1 +1 @@
1
- {"version":3,"names":["_jwk","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","exports","WalletInstanceAttestationJwt","sub","attested_security_context","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,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAA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z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","exports","WalletInstanceAttestationJwt","sub","aal","authorization_endpoint","response_types_supported","vp_formats_supported","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,S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ACfyB,sBAAsB,EAAEzD,CAAC,CAACgC,MAAM,CAAC,CAAC;IAClC0B,wBAAwB,EAAE1D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC;IAC7C2B,oBAAoB,EAAE3D,CAAC,CAAC6B,MAAM,CAAC;MAC7B,WAAW,EAAE7B,CAAC,CACX6B,MAAM,CAAC;QACN,mBAAmB,EAAE7B,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC,CAAC;MACb,WAAW,EAAErC,CAAC,CACX6B,MAAM,CAAC;QACN,mBAAmB,EAAE7B,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC;IACd,CAAC,CAAC;IACFuB,2CAA2C,EAAE5D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC;IAChE6B,qCAAqC,EAAE7D,CAAC,CAAC8D,OAAO,CAAC;EACnD,CAAC,CACH;AACF,CAAC,CAAC;AAACT,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
@@ -0,0 +1,102 @@
1
+ import z from "zod";
2
+ export const NonceDetailView = z.object({
3
+ nonce: z.string()
4
+ });
5
+ export const WalletAttestationView = z.string();
6
+ export const CreateWalletInstanceBody = z.object({
7
+ challenge: z.string(),
8
+ key_attestation: z.string(),
9
+ hardware_key_tag: z.string()
10
+ });
11
+ export const CreateWalletAttestationBody = z.object({
12
+ grant_type: z.literal("urn:ietf:params:oauth:grant-type:jwt-bearer"),
13
+ assertion: z.string()
14
+ });
15
+ export const ProblemDetail = z.object({
16
+ type: z.string().optional(),
17
+ title: z.string().optional(),
18
+ status: z.number().optional(),
19
+ detail: z.string().optional(),
20
+ instance: z.string().optional()
21
+ });
22
+ export const FiscalCode = z.string();
23
+ export const Id = z.string();
24
+ export const get_GetNonce = {
25
+ method: z.literal("GET"),
26
+ path: z.literal("/nonce"),
27
+ parameters: z.never(),
28
+ response: NonceDetailView
29
+ };
30
+ export const post_CreateWalletInstance = {
31
+ method: z.literal("POST"),
32
+ path: z.literal("/wallet-instances"),
33
+ parameters: z.object({
34
+ body: CreateWalletInstanceBody
35
+ }),
36
+ response: z.unknown()
37
+ };
38
+ export const post_CreateWalletAttestation = {
39
+ method: z.literal("POST"),
40
+ path: z.literal("/token"),
41
+ parameters: z.object({
42
+ body: CreateWalletAttestationBody
43
+ }),
44
+ response: z.unknown()
45
+ };
46
+
47
+ // <EndpointByMethod>
48
+ export const EndpointByMethod = {
49
+ get: {
50
+ "/nonce": get_GetNonce
51
+ },
52
+ post: {
53
+ "/wallet-instances": post_CreateWalletInstance,
54
+ "/token": post_CreateWalletAttestation
55
+ }
56
+ };
57
+
58
+ // </EndpointByMethod>
59
+ // <EndpointByMethod.Shorthands>
60
+ // </EndpointByMethod.Shorthands>
61
+ // <ApiClientTypes>
62
+ // </ApiClientTypes>
63
+ // <ApiClient>
64
+ export class ApiClient {
65
+ baseUrl = "";
66
+ constructor(fetcher) {
67
+ this.fetcher = fetcher;
68
+ }
69
+ setBaseUrl(baseUrl) {
70
+ this.baseUrl = baseUrl;
71
+ return this;
72
+ }
73
+
74
+ // <ApiClient.get>
75
+ get(path) {
76
+ return this.fetcher("get", this.baseUrl + path, arguments.length <= 1 ? undefined : arguments[1]);
77
+ }
78
+ // </ApiClient.get>
79
+
80
+ // <ApiClient.post>
81
+ post(path) {
82
+ return this.fetcher("post", this.baseUrl + path, arguments.length <= 1 ? undefined : arguments[1]);
83
+ }
84
+ // </ApiClient.post>
85
+ }
86
+
87
+ export function createApiClient(fetcher, baseUrl) {
88
+ return new ApiClient(fetcher).setBaseUrl(baseUrl ?? "");
89
+ }
90
+
91
+ /**
92
+ Example usage:
93
+ const api = createApiClient((method, url, params) =>
94
+ fetch(url, { method, body: JSON.stringify(params) }).then((res) => res.json()),
95
+ );
96
+ api.get("/users").then((users) => console.log(users));
97
+ api.post("/users", { body: { name: "John" } }).then((user) => console.log(user));
98
+ api.put("/users/:id", { path: { id: 1 }, body: { name: "John" } }).then((user) => console.log(user));
99
+ */
100
+
101
+ // </ApiClient
102
+ //# sourceMappingURL=wallet-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["z","NonceDetailView","object","nonce","string","WalletAttestationView","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","literal","assertion","ProblemDetail","type","optional","title","status","number","detail","instance","FiscalCode","Id","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","post_CreateWalletAttestation","EndpointByMethod","get","post","ApiClient","baseUrl","constructor","fetcher","setBaseUrl","arguments","length","undefined","createApiClient"],"sourceRoot":"../../../../src","sources":["client/generated/wallet-provider.ts"],"mappings":"AAAA,OAAOA,CAAC,MAAM,KAAK;AAGnB,OAAO,MAAMC,eAAe,GAAGD,CAAC,CAACE,MAAM,CAAC;EACtCC,KAAK,EAAEH,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;AAGF,OAAO,MAAMC,qBAAqB,GAAGL,CAAC,CAACI,MAAM,CAAC,CAAC;AAG/C,OAAO,MAAME,wBAAwB,GAAGN,CAAC,CAACE,MAAM,CAAC;EAC/CK,SAAS,EAAEP,CAAC,CAACI,MAAM,CAAC,CAAC;EACrBI,eAAe,EAAER,CAAC,CAACI,MAAM,CAAC,CAAC;EAC3BK,gBAAgB,EAAET,CAAC,CAACI,MAAM,CAAC;AAC7B,CAAC,CAAC;AAGF,OAAO,MAAMM,2BAA2B,GAAGV,CAAC,CAACE,MAAM,CAAC;EAClDS,UAAU,EAAEX,CAAC,CAACY,OAAO,CAAC,6CAA6C,CAAC;EACpEC,SAAS,EAAEb,CAAC,CAACI,MAAM,CAAC;AACtB,CAAC,CAAC;AAGF,OAAO,MAAMU,aAAa,GAAGd,CAAC,CAACE,MAAM,CAAC;EACpCa,IAAI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ProblemDetail, createApiClient as createWalletProviderApiClient } from "./generated/wallet-provider";
3
+ const validateResponse = async response => {
4
+ if (!response.ok) {
5
+ let problemDetail = {};
6
+ try {
7
+ problemDetail = ProblemDetail.parse(await response.json());
8
+ } catch {
9
+ problemDetail = {
10
+ title: "Invalid response from Wallet Provider"
11
+ };
12
+ }
13
+ throw new WalletProviderResponseError(problemDetail.title ?? "Invalid response from Wallet Provider", problemDetail.type, problemDetail.detail, response.status);
14
+ }
15
+ return response;
16
+ };
17
+ export const getWalletProviderClient = context => {
18
+ const {
19
+ walletProviderBaseUrl,
20
+ appFetch = fetch
21
+ } = context;
22
+ return createWalletProviderApiClient((method, url, params) => appFetch(url, {
23
+ method,
24
+ body: params ? JSON.stringify(params.body) : undefined
25
+ }).then(validateResponse).then(res => {
26
+ const contentType = res.headers.get("content-type");
27
+ if (contentType === "application/json") {
28
+ return res.json();
29
+ }
30
+ return res.text();
31
+ }), walletProviderBaseUrl);
32
+ };
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WalletProviderResponseError","ProblemDetail","createApiClient","createWalletProviderApiClient","validateResponse","response","ok","problemDetail","parse","json","title","type","detail","status","getWalletProviderClient","context","walletProviderBaseUrl","appFetch","fetch","method","url","params","body","JSON","stringify","undefined","then","res","contentType","headers","get","text"],"sourceRoot":"../../../src","sources":["client/index.ts"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,iBAAiB;AAC7D,SACEC,aAAa,EACbC,eAAe,IAAIC,6BAA6B,QAC3C,6BAA6B;AAKpC,MAAMC,gBAAgB,GAAG,MAAOC,QAAkB,IAAK;EACrD,IAAI,CAACA,QAAQ,CAACC,EAAE,EAAE;IAChB,IAAIC,aAA4B,GAAG,CAAC,CAAC;IACrC,IAAI;MACFA,aAAa,GAAGN,aAAa,CAACO,KAAK,CAAC,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,MAAM;MACNF,aAAa,GAAG;QACdG,KAAK,EAAE;MACT,CAAC;IACH;IAEA,MAAM,IAAIV,2BAA2B,CACnCO,aAAa,CAACG,KAAK,IAAI,uCAAuC,EAC9DH,aAAa,CAACI,IAAI,EAClBJ,aAAa,CAACK,MAAM,EACpBP,QAAQ,CAACQ,MACX,CAAC;EACH;EACA,OAAOR,QAAQ;AACjB,CAAC;AAED,OAAO,MAAMS,uBAAuB,GAAIC,OAGvC,IAAK;EACJ,MAAM;IAAEC,qBAAqB;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAGH,OAAO;EAE3D,OAAOZ,6BAA6B,CAClC,CAACgB,MAAM,EAAEC,GAAG,EAAEC,MAAM,KAClBJ,QAAQ,CAACG,GAAG,EAAE;IACZD,MAAM;IACNG,IAAI,EAAED,MAAM,GAAGE,IAAI,CAACC,SAAS,CAACH,MAAM,CAACC,IAAI,CAAC,GAAGG;EAC/C,CAAC,CAAC,CACCC,IAAI,CAACtB,gBAAgB,CAAC,CACtBsB,IAAI,CAAEC,GAAG,IAAK;IACb,MAAMC,WAAW,GAAGD,GAAG,CAACE,OAAO,CAACC,GAAG,CAAC,cAAc,CAAC;IACnD,IAAIF,WAAW,KAAK,kBAAkB,EAAE;MACtC,OAAOD,GAAG,CAAClB,IAAI,CAAC,CAAC;IACnB;IACA,OAAOkB,GAAG,CAACI,IAAI,CAAC,CAAC;EACnB,CAAC,CAAC,EACNf,qBACF,CAAC;AACH,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { getCredentialIssuerEntityConfiguration } from "../../trust";
2
2
  /**
3
+ * WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
3
4
  * The Issuer trust evaluation phase.
4
5
  * Fetch the Issuer's configuration and verify trust.
5
6
  *
6
- * @param issuerUrl The base url of the Issuer
7
+ * @param issuerUrl The base url of the Issuer returned by {@link startFlow}
7
8
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
8
9
  * @returns The Issuer's configuration
9
10
  */
@@ -1 +1 @@
1
- {"version":3,"names":["getCredentialIssuerEntityConfiguration","evaluateIssuerTrust","issuerUrl","context","arguments","length","undefined","issuerConf","appFetch","then","_","payload","metadata"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-evaluate-issuer-trust.ts"],"mappings":"AAAA,SAASA,sCAAsC,QAAQ,aAAa;AAcpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAwC,GAAG,eAAAA,CACtDC,SAAS,EAEN;EAAA,IADHC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,UAAU,GAAG,MAAMP,sCAAsC,CAACE,SAAS,EAAE;IACzEM,QAAQ,EAAEL,OAAO,CAACK;EACpB,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAACC,QAAQ,CAAC;EAClC,OAAO;IAAEL;EAAW,CAAC;AACvB,CAAC"}
1
+ {"version":3,"names":["getCredentialIssuerEntityConfiguration","evaluateIssuerTrust","issuerUrl","context","arguments","length","undefined","issuerConf","appFetch","then","_","payload","metadata"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-evaluate-issuer-trust.ts"],"mappings":"AAAA,SAASA,sCAAsC,QAAQ,aAAa;AAcpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAwC,GAAG,eAAAA,CACtDC,SAAS,EAEN;EAAA,IADHC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,UAAU,GAAG,MAAMP,sCAAsC,CAACE,SAAS,EAAE;IACzEM,QAAQ,EAAEL,OAAO,CAACK;EACpB,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAACC,QAAQ,CAAC;EAClC,OAAO;IAAEL;EAAW,CAAC;AACvB,CAAC"}
@@ -0,0 +1,276 @@
1
+ import uuid from "react-native-uuid";
2
+ import { makeParRequest } from "../../utils/par";
3
+ import { SignJWT } from "@pagopa/io-react-native-jwt";
4
+ import { generateRandomAlphaNumericString, hasStatus, until } from "../../utils/misc";
5
+ import { ASSERTION_TYPE } from "./const";
6
+ import parseUrl from "parse-url";
7
+ import { AuthorizationError, AuthorizationIdpError, ValidationFailed } from "../../utils/errors";
8
+ import { AuthorizationErrorShape, AuthorizationResultShape } from "../../utils/auth";
9
+ import { withEphemeralKey } from "../../utils/crypto";
10
+ import { createDPopToken } from "../../utils/dpop";
11
+ import { createPopToken } from "../../utils/pop";
12
+ import { CredentialResponse, TokenResponse } from "./types";
13
+ import * as WalletInstanceAttestation from "../../wallet-instance-attestation";
14
+ import { Linking } from "react-native";
15
+
16
+ /**
17
+ * Ensures that the credential type requested is supported by the issuer and contained in the
18
+ * issuer configuration.
19
+ * @param issuerConf The issuer configuration
20
+ * @param credentialType The type of the credential to be requested
21
+ * @returns The credential definition to be used in the request which includes the format and the type and its type
22
+ */
23
+ const selectCredentialDefinition = (issuerConf, credentialType) => {
24
+ const credential_configurations_supported = issuerConf.openid_credential_issuer.credential_configurations_supported;
25
+ const [result] = Object.keys(credential_configurations_supported).filter(e => e.includes(credentialType)).map(e => ({
26
+ credential_configuration_id: credentialType,
27
+ format: credential_configurations_supported[e].format,
28
+ type: "openid_credential"
29
+ }));
30
+ if (!result) {
31
+ throw new Error(`No credential support the type '${credentialType}'`);
32
+ }
33
+ return result;
34
+ };
35
+
36
+ /**
37
+ * Ensures that the response mode requested is supported by the issuer and contained in the issuer configuration.
38
+ * @param issuerConf The issuer configuration
39
+ * @param credentialType The type of the credential to be requested
40
+ * @returns The response mode to be used in the request, "query" for PersonIdentificationData and "form_post.jwt" for all other types.
41
+ */
42
+ const selectResponseMode = (issuerConf, credentialType) => {
43
+ const responseModeSupported = issuerConf.oauth_authorization_server.response_modes_supported;
44
+ const responseMode = credentialType === "PersonIdentificationData" ? "query" : "form_post.jwt";
45
+ if (!responseModeSupported.includes(responseMode)) {
46
+ throw new Error(`No response mode support the type '${credentialType}'`);
47
+ }
48
+ return responseMode;
49
+ };
50
+ /**
51
+ * Starts the credential issuance flow to obtain a credential from the issuer.
52
+ * @param issuerConf The Issuer configuration
53
+ * @param credentialType The type of the credential to be requested
54
+ * @param context.wiaCryptoContext The context to access the key associated with the Wallet Instance Attestation
55
+ * @param context.credentialCryptoContext The context to access the key to associat with credential
56
+ * @param context.walletInstanceAttestation The Wallet Instance Attestation token
57
+ * @param context.authorizationContext The context to identify the user which will be used to start the authorization. It's needed only when requesting a PersonalIdentificationData credential. The implementantion should open an in-app browser capable of catching the redirectSchema. If not specified, the default browser is used.
58
+ * @param context.redirectUri The internal URL to which to redirect has passed the in-app browser login phase. If you don't use authorizationContext remember to register this URL as customUrl or deepLink. See https://reactnative.dev/docs/linking
59
+ * @param context.idphint Unique identifier of the SPID IDP
60
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
61
+ * @throws {AuthorizationError} When the response from the authorization response is not parsable
62
+ * @returns The credential obtained
63
+ */
64
+
65
+ export const startCredentialIssuance = async (issuerConf, credentialType, ctx) => {
66
+ const {
67
+ wiaCryptoContext,
68
+ credentialCryptoContext,
69
+ walletInstanceAttestation,
70
+ authorizationContext,
71
+ redirectUri,
72
+ idphint,
73
+ appFetch = fetch
74
+ } = ctx;
75
+
76
+ /**
77
+ * Creates and sends a PAR request to the /as/par endpoint of the authroization server.
78
+ * This starts the authentication flow to obtain an access token.
79
+ * This token enables the Wallet Instance to request a digital credential from the Credential Endpoint of the Credential Issuer.
80
+ * This is an HTTP POST request containing the Wallet Instance identifier (client id), the code challenge and challenge method as specified by PKCE according to RFC 9126
81
+ * along with the WTE and its proof of possession (WTE-PoP).
82
+ * Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details),
83
+ * the application session identifier on the Wallet Instance side (state),
84
+ * the method (query or form_post.jwt) by which the Authorization Server
85
+ * should transmit the Authorization Response containing the authorization code issued upon the end user's authentication (response_mode)
86
+ * to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirect_uri of the Wallet Instance where the Authorization Response
87
+ * should be delivered. The redirect is achived by using a custom URL scheme that the Wallet Instance is registered to handle.
88
+ */
89
+ const clientId = await wiaCryptoContext.getPublicKey().then(_ => _.kid);
90
+ const codeVerifier = generateRandomAlphaNumericString(64);
91
+ const parEndpoint = issuerConf.oauth_authorization_server.pushed_authorization_request_endpoint;
92
+ const parUrl = new URL(parEndpoint);
93
+ const aud = `${parUrl.protocol}//${parUrl.hostname}`;
94
+ const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
95
+ const credentialDefinition = selectCredentialDefinition(issuerConf, credentialType);
96
+ const responseMode = selectResponseMode(issuerConf, credentialType);
97
+ const getPar = makeParRequest({
98
+ wiaCryptoContext,
99
+ appFetch
100
+ });
101
+ const issuerRequestUri = await getPar(clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, [credentialDefinition], ASSERTION_TYPE);
102
+
103
+ /**
104
+ * Starts the authorization flow which dependes on the response mode and the request credential.
105
+ * If the response mode is "query" the authorization flow is handled differently via the authorization context which opens an in-app browser capable of catching the redirectSchema.
106
+ * The form_post.jwt mode is not currently supported.
107
+ */
108
+ const authorizeFlowResult = await (async () => {
109
+ const authzRequestEndpoint = issuerConf.oauth_authorization_server.authorization_endpoint;
110
+ if (responseMode === "query") {
111
+ const params = new URLSearchParams({
112
+ client_id: clientId,
113
+ request_uri: issuerRequestUri,
114
+ idphint
115
+ });
116
+
117
+ /**
118
+ * Starts the authorization flow to obtain an authorization code by performing a GET request to the /authorize endpoint of the authorization server.
119
+ */
120
+ return await authorizeUserWithQueryMode(authzRequestEndpoint, params, redirectUri, authorizationContext);
121
+ } else {
122
+ throw new AuthorizationError("Response mode not supported for this type of credential");
123
+ }
124
+ })();
125
+
126
+ /**
127
+ * Creates and sends the DPoP Proof JWT to be presented with the authorization code to the /token endpoint of the authorization server
128
+ * for requesting the issuance of an access token bound to the public key of the Wallet Instance contained within the DPoP.
129
+ * This enables the Wallet Instance to request a digital credential.
130
+ * The DPoP Proof JWT is generated according to the section 4.3 of the DPoP RFC 9449 specification.
131
+ */
132
+
133
+ const {
134
+ code
135
+ } = authorizeFlowResult;
136
+ const tokenUrl = issuerConf.oauth_authorization_server.token_endpoint;
137
+ // Use an ephemeral key to be destroyed after use
138
+ const tokenRequestSignedDPop = await withEphemeralKey(async ephimeralContext => {
139
+ return await createDPopToken({
140
+ htm: "POST",
141
+ htu: tokenUrl,
142
+ jti: `${uuid.v4()}`
143
+ }, ephimeralContext);
144
+ });
145
+ const signedWiaPoP = await createPopToken({
146
+ jti: `${uuid.v4()}`,
147
+ aud,
148
+ iss
149
+ }, wiaCryptoContext);
150
+ const requestBody = {
151
+ grant_type: "authorization_code",
152
+ client_id: clientId,
153
+ code,
154
+ redirect_uri: redirectUri,
155
+ code_verifier: codeVerifier,
156
+ client_assertion_type: ASSERTION_TYPE,
157
+ client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
158
+ };
159
+ const authorizationRequestFormBody = new URLSearchParams(requestBody);
160
+ const tokenRes = await appFetch(tokenUrl, {
161
+ method: "POST",
162
+ headers: {
163
+ "Content-Type": "application/x-www-form-urlencoded",
164
+ DPoP: tokenRequestSignedDPop
165
+ },
166
+ body: authorizationRequestFormBody.toString()
167
+ }).then(hasStatus(200)).then(res => res.json()).then(body => TokenResponse.safeParse(body));
168
+ if (!tokenRes.success) {
169
+ throw new ValidationFailed(tokenRes.error.message);
170
+ }
171
+
172
+ /**
173
+ * Validates the token response and extracts the access token, c_nonce and c_nonce_expires_in.
174
+ */
175
+ const accessTokenResponse = tokenRes.data;
176
+ const credentialUrl = issuerConf.openid_credential_issuer.credential_endpoint;
177
+
178
+ /**
179
+ * JWT proof token to bind the request nonce to the key that will bind the holder User with the Credential
180
+ * This is presented along with the access token to the Credential Endpoint as proof of possession of the private key used to sign the Access Token.
181
+ * @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-proof-types
182
+ */
183
+ const signedNonceProof = await createNonceProof(accessTokenResponse.c_nonce, clientId, credentialUrl, credentialCryptoContext);
184
+
185
+ // Validation of accessTokenResponse.authorization_details if contain credentialDefinition
186
+ const constainsCredentialDefinition = accessTokenResponse.authorization_details.some(c => c.credential_configuration_id === credentialDefinition.credential_configuration_id && c.format === credentialDefinition.format && c.type === credentialDefinition.type);
187
+ if (!constainsCredentialDefinition) {
188
+ throw new ValidationFailed("The access token response does not contain the requested credential");
189
+ }
190
+
191
+ /** The credential request body */
192
+ const credentialRequestFormBody = {
193
+ credential_definition: {
194
+ type: [credentialDefinition.credential_configuration_id]
195
+ },
196
+ format: credentialDefinition.format,
197
+ proof: {
198
+ jwt: signedNonceProof,
199
+ proof_type: "jwt"
200
+ }
201
+ };
202
+ const credentialRes = await appFetch(credentialUrl, {
203
+ method: "POST",
204
+ headers: {
205
+ "Content-Type": "application/json",
206
+ DPoP: tokenRequestSignedDPop,
207
+ Authorization: `${accessTokenResponse.token_type} ${accessTokenResponse.access_token}`
208
+ },
209
+ body: JSON.stringify(credentialRequestFormBody)
210
+ }).then(hasStatus(200)).then(res => res.json()).then(body => CredentialResponse.safeParse(body));
211
+ if (!credentialRes.success) {
212
+ throw new ValidationFailed(credentialRes.error.message);
213
+ }
214
+ return credentialRes.data;
215
+ };
216
+
217
+ /**
218
+ * Authorizes the user using the query mode and the authorization context.
219
+ * @param authzRequestEndpoint The authorization endpoint of the authorization server
220
+ * @param params The query parameters to be used in the request
221
+ * @param redirectUri The URL to which the redirect is made is usually a custom URL or deeplink
222
+ * @param authorizationContext The AuthorizationContext to manage the internal webview. If not specified, the default browser is used
223
+ * @returns The authrozation result containing the authorization code, state and issuer
224
+ */
225
+ export const authorizeUserWithQueryMode = async (authzRequestEndpoint, params, redirectUri, authorizationContext) => {
226
+ const authUrl = `${authzRequestEndpoint}?${params}`;
227
+ var authRedirectUrl;
228
+ if (authorizationContext) {
229
+ const redirectSchema = new URL(redirectUri).protocol.replace(":", "");
230
+ authRedirectUrl = await authorizationContext.authorize(authUrl, redirectSchema).catch(e => {
231
+ throw new AuthorizationError(e.message);
232
+ });
233
+ } else {
234
+ // handler for redirectUri
235
+ Linking.addEventListener("url", _ref => {
236
+ let {
237
+ url
238
+ } = _ref;
239
+ if (url.includes(redirectUri)) {
240
+ authRedirectUrl = url;
241
+ }
242
+ });
243
+ const openAuthUrlInBrowser = Linking.openURL(authUrl);
244
+
245
+ /*
246
+ * Waits for 120 seconds for the identificationRedirectUrl variable to be set
247
+ * by the custom url handler. If the timeout is exceeded, throw an exception
248
+ */
249
+ const unitAuthRedirectIsNotUndefined = until(() => authRedirectUrl !== undefined, 120);
250
+ await Promise.all([openAuthUrlInBrowser, unitAuthRedirectIsNotUndefined]);
251
+ if (authRedirectUrl === undefined) {
252
+ throw new AuthorizationError("Invalid authentication redirect url");
253
+ }
254
+ }
255
+ const urlParse = parseUrl(authRedirectUrl);
256
+ const authRes = AuthorizationResultShape.safeParse(urlParse.query);
257
+ if (!authRes.success) {
258
+ const authErr = AuthorizationErrorShape.safeParse(urlParse.query);
259
+ if (!authErr.success) {
260
+ throw new AuthorizationError(authRes.error.message); // an error occured while parsing the result and the error
261
+ }
262
+
263
+ throw new AuthorizationIdpError(authErr.data.error, authErr.data.error_description);
264
+ }
265
+ return authRes.data;
266
+ };
267
+ export const createNonceProof = async (nonce, issuer, audience, ctx) => {
268
+ const jwk = await ctx.getPublicKey();
269
+ return new SignJWT(ctx).setPayload({
270
+ nonce
271
+ }).setProtectedHeader({
272
+ typ: "openid4vci-proof+jwt",
273
+ jwk
274
+ }).setAudience(audience).setIssuer(issuer).setIssuedAt().setExpirationTime("5min").sign();
275
+ };
276
+ //# sourceMappingURL=03-start-credential-issuance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["uuid","makeParRequest","SignJWT","generateRandomAlphaNumericString","hasStatus","until","ASSERTION_TYPE","parseUrl","AuthorizationError","AuthorizationIdpError","ValidationFailed","AuthorizationErrorShape","AuthorizationResultShape","withEphemeralKey","createDPopToken","createPopToken","CredentialResponse","TokenResponse","WalletInstanceAttestation","Linking","selectCredentialDefinition","issuerConf","credentialType","credential_configurations_supported","openid_credential_issuer","result","Object","keys","filter","e","includes","map","credential_configuration_id","format","type","Error","selectResponseMode","responseModeSupported","oauth_authorization_server","response_modes_supported","responseMode","startCredentialIssuance","ctx","wiaCryptoContext","credentialCryptoContext","walletInstanceAttestation","authorizationContext","redirectUri","idphint","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","parEndpoint","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","credentialDefinition","getPar","issuerRequestUri","authorizeFlowResult","authzRequestEndpoint","authorization_endpoint","params","URLSearchParams","client_id","request_uri","authorizeUserWithQueryMode","code","tokenUrl","token_endpoint","tokenRequestSignedDPop","ephimeralContext","htm","htu","jti","v4","signedWiaPoP","requestBody","grant_type","redirect_uri","code_verifier","client_assertion_type","client_assertion","authorizationRequestFormBody","tokenRes","method","headers","DPoP","body","toString","res","json","safeParse","success","error","message","accessTokenResponse","data","credentialUrl","credential_endpoint","signedNonceProof","createNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","credentialRes","Authorization","token_type","access_token","JSON","stringify","authUrl","authRedirectUrl","redirectSchema","replace","authorize","catch","addEventListener","_ref","url","openAuthUrlInBrowser","openURL","unitAuthRedirectIsNotUndefined","undefined","Promise","all","urlParse","authRes","query","authErr","error_description","nonce","issuer","audience","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-credential-issuance.ts"],"mappings":"AAAA,OAAOA,IAAI,MAAM,mBAAmB;AACpC,SAA8BC,cAAc,QAAQ,iBAAiB;AACrE,S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