@pagopa/io-react-native-wallet 0.7.4 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. package/README.md +49 -31
  2. package/lib/commonjs/credential/index.js +13 -0
  3. package/lib/commonjs/credential/index.js.map +1 -0
  4. package/lib/commonjs/credential/issuance/01-start-flow.js +2 -0
  5. package/lib/commonjs/credential/issuance/01-start-flow.js.map +1 -0
  6. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +26 -0
  7. package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  8. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +119 -0
  9. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -0
  10. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +6 -0
  11. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -0
  12. package/lib/commonjs/credential/issuance/05-authorize-access.js +63 -0
  13. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -0
  14. package/lib/commonjs/credential/issuance/06-obtain-credential.js +128 -0
  15. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -0
  16. package/lib/commonjs/credential/issuance/07-confirm-credential.js +6 -0
  17. package/lib/commonjs/credential/issuance/07-confirm-credential.js.map +1 -0
  18. package/lib/commonjs/credential/issuance/const.js +9 -0
  19. package/lib/commonjs/credential/issuance/const.js.map +1 -0
  20. package/lib/commonjs/credential/issuance/index.js +34 -0
  21. package/lib/commonjs/credential/issuance/index.js.map +1 -0
  22. package/lib/commonjs/credential/presentation/01-start-flow.js +55 -0
  23. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -0
  24. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js +32 -0
  25. package/lib/commonjs/credential/presentation/02-evaluate-rp-trust.js.map +1 -0
  26. package/lib/commonjs/credential/presentation/03-get-request-object.js +68 -0
  27. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -0
  28. package/lib/commonjs/credential/presentation/04-send-authorization-response.js +139 -0
  29. package/lib/commonjs/credential/presentation/04-send-authorization-response.js.map +1 -0
  30. package/lib/commonjs/credential/presentation/index.js +34 -0
  31. package/lib/commonjs/credential/presentation/index.js.map +1 -0
  32. package/lib/commonjs/{rp → credential/presentation}/types.js +17 -34
  33. package/lib/commonjs/credential/presentation/types.js.map +1 -0
  34. package/lib/commonjs/index.js +10 -61
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/pid/index.js +1 -3
  37. package/lib/commonjs/pid/index.js.map +1 -1
  38. package/lib/commonjs/sd-jwt/index.js +1 -1
  39. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  40. package/lib/commonjs/sd-jwt/types.js +1 -1
  41. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  42. package/lib/commonjs/trust/chain.js +32 -4
  43. package/lib/commonjs/trust/chain.js.map +1 -1
  44. package/lib/commonjs/trust/index.js +105 -20
  45. package/lib/commonjs/trust/index.js.map +1 -1
  46. package/lib/commonjs/trust/types.js +54 -35
  47. package/lib/commonjs/trust/types.js.map +1 -1
  48. package/lib/commonjs/utils/crypto.js +5 -18
  49. package/lib/commonjs/utils/crypto.js.map +1 -1
  50. package/lib/commonjs/utils/errors.js +35 -4
  51. package/lib/commonjs/utils/errors.js.map +1 -1
  52. package/lib/commonjs/utils/misc.js +23 -0
  53. package/lib/commonjs/utils/misc.js.map +1 -0
  54. package/lib/commonjs/utils/par.js +86 -0
  55. package/lib/commonjs/utils/par.js.map +1 -0
  56. package/lib/module/credential/index.js +4 -0
  57. package/lib/module/credential/index.js.map +1 -0
  58. package/lib/module/credential/issuance/01-start-flow.js +2 -0
  59. package/lib/module/credential/issuance/01-start-flow.js.map +1 -0
  60. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +19 -0
  61. package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -0
  62. package/lib/module/credential/issuance/03-start-user-authorization.js +109 -0
  63. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -0
  64. package/lib/module/credential/issuance/04-complete-user-authorization.js +2 -0
  65. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -0
  66. package/lib/module/credential/issuance/05-authorize-access.js +55 -0
  67. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -0
  68. package/lib/module/credential/issuance/06-obtain-credential.js +117 -0
  69. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -0
  70. package/lib/module/credential/issuance/07-confirm-credential.js +2 -0
  71. package/lib/module/credential/issuance/07-confirm-credential.js.map +1 -0
  72. package/lib/module/credential/issuance/const.js +2 -0
  73. package/lib/module/credential/issuance/const.js.map +1 -0
  74. package/lib/module/credential/issuance/index.js +6 -0
  75. package/lib/module/credential/issuance/index.js.map +1 -0
  76. package/lib/module/credential/presentation/01-start-flow.js +46 -0
  77. package/lib/module/credential/presentation/01-start-flow.js.map +1 -0
  78. package/lib/module/credential/presentation/02-evaluate-rp-trust.js +25 -0
  79. package/lib/module/credential/presentation/02-evaluate-rp-trust.js.map +1 -0
  80. package/lib/module/credential/presentation/03-get-request-object.js +60 -0
  81. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -0
  82. package/lib/module/credential/presentation/04-send-authorization-response.js +128 -0
  83. package/lib/module/credential/presentation/04-send-authorization-response.js.map +1 -0
  84. package/lib/module/credential/presentation/index.js +6 -0
  85. package/lib/module/credential/presentation/index.js.map +1 -0
  86. package/lib/module/credential/presentation/types.js +21 -0
  87. package/lib/module/credential/presentation/types.js.map +1 -0
  88. package/lib/module/index.js +4 -5
  89. package/lib/module/index.js.map +1 -1
  90. package/lib/module/pid/index.js +1 -2
  91. package/lib/module/pid/index.js.map +1 -1
  92. package/lib/module/sd-jwt/index.js +1 -1
  93. package/lib/module/sd-jwt/index.js.map +1 -1
  94. package/lib/module/sd-jwt/types.js +1 -1
  95. package/lib/module/sd-jwt/types.js.map +1 -1
  96. package/lib/module/trust/chain.js +30 -3
  97. package/lib/module/trust/chain.js.map +1 -1
  98. package/lib/module/trust/index.js +99 -16
  99. package/lib/module/trust/index.js.map +1 -1
  100. package/lib/module/trust/types.js +50 -31
  101. package/lib/module/trust/types.js.map +1 -1
  102. package/lib/module/utils/crypto.js +2 -15
  103. package/lib/module/utils/crypto.js.map +1 -1
  104. package/lib/module/utils/errors.js +35 -4
  105. package/lib/module/utils/errors.js.map +1 -1
  106. package/lib/module/utils/misc.js +17 -0
  107. package/lib/module/utils/misc.js.map +1 -0
  108. package/lib/module/utils/par.js +74 -0
  109. package/lib/module/utils/par.js.map +1 -0
  110. package/lib/typescript/credential/index.d.ts +4 -0
  111. package/lib/typescript/credential/index.d.ts.map +1 -0
  112. package/lib/typescript/credential/issuance/01-start-flow.d.ts +11 -0
  113. package/lib/typescript/credential/issuance/01-start-flow.d.ts.map +1 -0
  114. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +18 -0
  115. package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -0
  116. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +31 -0
  117. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -0
  118. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +16 -0
  119. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -0
  120. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +26 -0
  121. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -0
  122. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +32 -0
  123. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -0
  124. package/lib/typescript/credential/issuance/07-confirm-credential.d.ts +11 -0
  125. package/lib/typescript/credential/issuance/07-confirm-credential.d.ts.map +1 -0
  126. package/lib/typescript/credential/issuance/const.d.ts +2 -0
  127. package/lib/typescript/credential/issuance/const.d.ts.map +1 -0
  128. package/lib/typescript/credential/issuance/index.d.ts +10 -0
  129. package/lib/typescript/credential/issuance/index.d.ts.map +1 -0
  130. package/lib/typescript/credential/presentation/01-start-flow.d.ts +20 -0
  131. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -0
  132. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts +18 -0
  133. package/lib/typescript/credential/presentation/02-evaluate-rp-trust.d.ts.map +1 -0
  134. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +25 -0
  135. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -0
  136. package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts +34 -0
  137. package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts.map +1 -0
  138. package/lib/typescript/credential/presentation/index.d.ts +7 -0
  139. package/lib/typescript/credential/presentation/index.d.ts.map +1 -0
  140. package/lib/typescript/credential/presentation/types.d.ts +49 -0
  141. package/lib/typescript/credential/presentation/types.d.ts.map +1 -0
  142. package/lib/typescript/index.d.ts +4 -5
  143. package/lib/typescript/index.d.ts.map +1 -1
  144. package/lib/typescript/pid/index.d.ts +1 -2
  145. package/lib/typescript/pid/index.d.ts.map +1 -1
  146. package/lib/typescript/sd-jwt/index.d.ts +2 -2
  147. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  148. package/lib/typescript/sd-jwt/types.d.ts +5 -5
  149. package/lib/typescript/trust/chain.d.ts +12 -3
  150. package/lib/typescript/trust/chain.d.ts.map +1 -1
  151. package/lib/typescript/trust/index.d.ts +198 -24
  152. package/lib/typescript/trust/index.d.ts.map +1 -1
  153. package/lib/typescript/trust/types.d.ts +1299 -623
  154. package/lib/typescript/trust/types.d.ts.map +1 -1
  155. package/lib/typescript/utils/crypto.d.ts +1 -1
  156. package/lib/typescript/utils/crypto.d.ts.map +1 -1
  157. package/lib/typescript/utils/dpop.d.ts +2 -2
  158. package/lib/typescript/utils/errors.d.ts.map +1 -1
  159. package/lib/typescript/utils/misc.d.ts +8 -0
  160. package/lib/typescript/utils/misc.d.ts.map +1 -0
  161. package/lib/typescript/utils/par.d.ts +68 -0
  162. package/lib/typescript/utils/par.d.ts.map +1 -0
  163. package/package.json +2 -2
  164. package/src/credential/index.ts +4 -0
  165. package/src/credential/issuance/01-start-flow.ts +10 -0
  166. package/src/credential/issuance/02-evaluate-issuer-trust.ts +31 -0
  167. package/src/credential/issuance/03-start-user-authorization.ts +138 -0
  168. package/src/credential/issuance/04-complete-user-authorization.ts +17 -0
  169. package/src/credential/issuance/05-authorize-access.ts +92 -0
  170. package/src/credential/issuance/06-obtain-credential.ts +179 -0
  171. package/src/credential/issuance/07-confirm-credential.ts +14 -0
  172. package/src/credential/issuance/const.ts +2 -0
  173. package/src/credential/issuance/index.ts +32 -0
  174. package/src/credential/presentation/01-start-flow.ts +51 -0
  175. package/src/credential/presentation/02-evaluate-rp-trust.ts +33 -0
  176. package/src/credential/presentation/03-get-request-object.ts +85 -0
  177. package/src/credential/presentation/04-send-authorization-response.ts +168 -0
  178. package/src/credential/presentation/index.ts +26 -0
  179. package/src/credential/presentation/types.ts +27 -0
  180. package/src/index.ts +7 -28
  181. package/src/pid/index.ts +1 -2
  182. package/src/sd-jwt/index.ts +2 -2
  183. package/src/sd-jwt/types.ts +1 -1
  184. package/src/trust/chain.ts +45 -3
  185. package/src/trust/index.ts +136 -19
  186. package/src/trust/types.ts +57 -35
  187. package/src/utils/crypto.ts +2 -20
  188. package/src/utils/errors.ts +40 -8
  189. package/src/utils/misc.ts +23 -0
  190. package/src/utils/par.ts +103 -0
  191. package/lib/commonjs/pid/issuing.js +0 -276
  192. package/lib/commonjs/pid/issuing.js.map +0 -1
  193. package/lib/commonjs/rp/__test__/index.test.js +0 -172
  194. package/lib/commonjs/rp/__test__/index.test.js.map +0 -1
  195. package/lib/commonjs/rp/index.js +0 -239
  196. package/lib/commonjs/rp/index.js.map +0 -1
  197. package/lib/commonjs/rp/types.js.map +0 -1
  198. package/lib/module/pid/issuing.js +0 -266
  199. package/lib/module/pid/issuing.js.map +0 -1
  200. package/lib/module/rp/__test__/index.test.js +0 -168
  201. package/lib/module/rp/__test__/index.test.js.map +0 -1
  202. package/lib/module/rp/index.js +0 -228
  203. package/lib/module/rp/index.js.map +0 -1
  204. package/lib/module/rp/types.js +0 -36
  205. package/lib/module/rp/types.js.map +0 -1
  206. package/lib/typescript/pid/issuing.d.ts +0 -57
  207. package/lib/typescript/pid/issuing.d.ts.map +0 -1
  208. package/lib/typescript/rp/__test__/index.test.d.ts +0 -2
  209. package/lib/typescript/rp/__test__/index.test.d.ts.map +0 -1
  210. package/lib/typescript/rp/index.d.ts +0 -43
  211. package/lib/typescript/rp/index.d.ts.map +0 -1
  212. package/lib/typescript/rp/types.d.ts +0 -122
  213. package/lib/typescript/rp/types.d.ts.map +0 -1
  214. package/src/pid/issuing.ts +0 -405
  215. package/src/rp/__test__/index.test.ts +0 -250
  216. package/src/rp/index.ts +0 -287
  217. package/src/rp/types.ts +0 -42
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.hasStatus = void 0;
7
+ var _errors = require("./errors");
8
+ /**
9
+ * Check if a response is in the expected status, other
10
+ * @param status The expected status
11
+ * @returns The given response object
12
+ */
13
+ const hasStatus = status => res => {
14
+ if (res.status !== status) {
15
+ throw new _errors.IoWalletError(`Http request failed. Expected ${status}, got ${res.status}, url: ${res.url}`);
16
+ }
17
+ return res;
18
+ };
19
+
20
+ // extract a type from an async function output
21
+ // helpful to bind the input of a function to the output of another
22
+ exports.hasStatus = hasStatus;
23
+ //# sourceMappingURL=misc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","hasStatus","status","res","IoWalletError","url","exports"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,GACnBC,MAAc,IACdC,GAAa,IAAe;EAC3B,IAAIA,GAAG,CAACD,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAM,IAAIE,qBAAa,CACpB,iCAAgCF,MAAO,SAAQC,GAAG,CAACD,MAAO,UAASC,GAAG,CAACE,GAAI,EAC9E,CAAC;EACH;EACA,OAAOF,GAAG;AACZ,CAAC;;AAEH;AACA;AAAAG,OAAA,CAAAL,SAAA,GAAAA,SAAA"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeParRequest = exports.AuthorizationDetails = exports.AuthorizationDetail = void 0;
7
+ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
8
+ var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
9
+ var z = _interopRequireWildcard(require("zod"));
10
+ var WalletInstanceAttestation = _interopRequireWildcard(require("../wallet-instance-attestation"));
11
+ var _misc = require("./misc");
12
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ const AuthorizationDetail = z.object({
16
+ credential_definition: z.object({
17
+ type: z.string()
18
+ }),
19
+ format: z.literal("vc+sd-jwt"),
20
+ type: z.literal("openid_credential")
21
+ });
22
+ exports.AuthorizationDetail = AuthorizationDetail;
23
+ const AuthorizationDetails = z.array(AuthorizationDetail);
24
+
25
+ /**
26
+ * Make a PAR request to the issuer and return the response url
27
+ */
28
+ exports.AuthorizationDetails = AuthorizationDetails;
29
+ const makeParRequest = _ref => {
30
+ let {
31
+ wiaCryptoContext,
32
+ appFetch = fetch
33
+ } = _ref;
34
+ return async (clientId, codeVerifier, walletProviderBaseUrl, parEndpoint, walletInstanceAttestation, authorizationDetails, assertionType) => {
35
+ const wiaPublicKey = await wiaCryptoContext.getPublicKey();
36
+ const parUrl = new URL(parEndpoint);
37
+ const aud = `${parUrl.protocol}//${parUrl.hostname}`;
38
+ const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
39
+
40
+ /** A code challenge is provided so that the PAR is bound
41
+ to the subsequent authorization code request
42
+ @see https://datatracker.ietf.org/doc/html/rfc9126#name-request */
43
+ const codeChallengeMethod = "s256";
44
+ const codeChallenge = await (0, _ioReactNativeJwt.sha256ToBase64)(codeVerifier);
45
+
46
+ /** The PAR request token is signed used the Wallet Instance Attestation key.
47
+ The signature can be verified by reading the public key from the key set shippet
48
+ with the it will ship the Wallet Instance Attestation.
49
+ The key is matched by its kid */
50
+ const signedJwtForPar = await new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setProtectedHeader({
51
+ kid: wiaPublicKey.kid
52
+ }).setPayload({
53
+ iss,
54
+ aud,
55
+ jti: `${_reactNativeUuid.default.v4()}`,
56
+ client_assertion_type: assertionType,
57
+ authorization_details: authorizationDetails,
58
+ response_type: "code",
59
+ redirect_uri: walletProviderBaseUrl,
60
+ state: `${_reactNativeUuid.default.v4()}`,
61
+ client_id: clientId,
62
+ code_challenge_method: codeChallengeMethod,
63
+ code_challenge: codeChallenge
64
+ }).setIssuedAt().setExpirationTime("1h").sign();
65
+
66
+ /** The request body for the Pushed Authorization Request */
67
+ var formBody = new URLSearchParams({
68
+ response_type: "code",
69
+ client_id: clientId,
70
+ code_challenge: codeChallenge,
71
+ code_challenge_method: "S256",
72
+ client_assertion_type: assertionType,
73
+ client_assertion: walletInstanceAttestation,
74
+ request: signedJwtForPar
75
+ });
76
+ return await appFetch(parEndpoint, {
77
+ method: "POST",
78
+ headers: {
79
+ "Content-Type": "application/x-www-form-urlencoded"
80
+ },
81
+ body: formBody.toString()
82
+ }).then((0, _misc.hasStatus)(201)).then(res => res.json()).then(result => result.request_uri);
83
+ };
84
+ };
85
+ exports.makeParRequest = makeParRequest;
86
+ //# sourceMappingURL=par.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","credential_definition","type","string","format","literal","exports","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","fetch","clientId","codeVerifier","walletProviderBaseUrl","parEndpoint","walletInstanceAttestation","authorizationDetails","assertionType","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","codeChallengeMethod","codeChallenge","sha256ToBase64","signedJwtForPar","SignJWT","setProtectedHeader","setPayload","jti","uuid","v4","client_assertion_type","authorization_details","response_type","redirect_uri","state","client_id","code_challenge_method","code_challenge","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","client_assertion","request","method","headers","body","toString","then","hasStatus","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,C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AAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA;AAAC9D,OAAA,CAAAG,cAAA,GAAAA,cAAA"}
@@ -0,0 +1,4 @@
1
+ import * as Issuance from "./issuance";
2
+ import * as Presentation from "./presentation";
3
+ export { Issuance, Presentation };
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Issuance","Presentation"],"sourceRoot":"../../../src","sources":["credential/index.ts"],"mappings":"AAAA,OAAO,KAAKA,QAAQ,MAAM,YAAY;AACtC,OAAO,KAAKC,YAAY,MAAM,gBAAgB;AAE9C,SAASD,QAAQ,EAAEC,YAAY"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=01-start-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["credential/issuance/01-start-flow.ts"],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import { getCredentialIssuerEntityConfiguration } from "../../trust";
2
+ /**
3
+ * The Issuer trust evaluation phase.
4
+ * Fetch the Issuer's configuration and verify trust.
5
+ *
6
+ * @param issuerUrl The base url of the Issuer
7
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
8
+ * @returns The Issuer's configuration
9
+ */
10
+ export const evaluateIssuerTrust = async function (issuerUrl) {
11
+ let context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12
+ const issuerConf = await getCredentialIssuerEntityConfiguration(issuerUrl, {
13
+ appFetch: context.appFetch
14
+ }).then(_ => _.payload.metadata);
15
+ return {
16
+ issuerConf
17
+ };
18
+ };
19
+ //# sourceMappingURL=02-evaluate-issuer-trust.js.map
@@ -0,0 +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"}
@@ -0,0 +1,109 @@
1
+ import * as z from "zod";
2
+ import uuid from "react-native-uuid";
3
+ import { makeParRequest } from "../../utils/par";
4
+ import { getJwtFromFormPost } from "../../utils/decoder";
5
+ import { hasStatus } from "../../utils/misc";
6
+ import { ASSERTION_TYPE } from "./const";
7
+ const selectCredentialDefinition = (issuerConf, credentialType) => {
8
+ const {
9
+ credentials_supported
10
+ } = issuerConf.openid_credential_issuer;
11
+ const [result] = credentials_supported.filter(e => e.credential_definition.type.includes(credentialType)).map(e => ({
12
+ credential_definition: {
13
+ type: credentialType
14
+ },
15
+ format: e.format,
16
+ type: "openid_credential"
17
+ }));
18
+ if (!result) {
19
+ throw new Error(`No credential support the type '${credentialType}'`);
20
+ }
21
+ return result;
22
+ };
23
+ const decodeAuthorizationResponse = async raw => {
24
+ const {
25
+ decodedJwt: {
26
+ payload
27
+ }
28
+ } = await getJwtFromFormPost(raw);
29
+
30
+ /**
31
+ * FIXME: [SIW-628] This step must not make any difference on the credential
32
+ * we are authorizing for, being a PID or any other (Q)EAA.
33
+ *
34
+ * Currently, PID issuer is implemented to skip the CompleteUserAuthorization step
35
+ * thus returning a stubbed (code, state) pair.
36
+ *
37
+ * This is a workaround to proceeed the flow anyway.
38
+ * If the response does not map what expected (CorrectShape),
39
+ * we try parse into (code, state) to check if we are in the PID scenario.
40
+ * In that case, a stub value is returned (will not be evaluated anyway).
41
+ *
42
+ * This workaround will be obsolete once the PID issuer fixes its implementation
43
+ */
44
+ const CorrectShape = z.object({
45
+ request_uri: z.string()
46
+ });
47
+ const WrongShapeForPID = z.object({
48
+ code: z.string(),
49
+ state: z.string()
50
+ });
51
+ const [correct, wrong] = [CorrectShape.safeParse(payload), WrongShapeForPID.safeParse(payload)];
52
+ if (correct.success) {
53
+ return correct.data;
54
+ } else if (wrong.success) {
55
+ return {
56
+ request_uri: "https://fake-request-uri"
57
+ };
58
+ }
59
+ throw correct.error;
60
+ };
61
+ /**
62
+ * Start the User authorization phase.
63
+ * Perform the Pushed Authorization Request as defined in OAuth 2.0 protocol.
64
+ *
65
+ * @param issuerConf The Issuer configuration
66
+ * @param credentialType The type of the credential to be requested
67
+ * @param context.wiaCryptoContext The context to access the key associated with the Wallet Instance Attestation
68
+ * @param context.walletInstanceAttestation The Wallet Instance Attestation token
69
+ * @param context.walletProviderBaseUrl The base url of the Wallet Provider
70
+ * @param context.additionalParams Hash set of parameters to be passed to the authorization endpoint
71
+ * (used as a temporary fix until we have a proper User identity in the PID token provider)
72
+ * TODO: [SIW-630]
73
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
74
+ * @returns The request uri to continue the authorization to
75
+ */
76
+ export const startUserAuthorization = async (issuerConf, credentialType, ctx) => {
77
+ const {
78
+ wiaCryptoContext,
79
+ walletInstanceAttestation,
80
+ walletProviderBaseUrl,
81
+ additionalParams = {},
82
+ appFetch = fetch
83
+ } = ctx;
84
+ const clientId = await wiaCryptoContext.getPublicKey().then(_ => _.kid);
85
+ const codeVerifier = `${uuid.v4()}`;
86
+ // Make a PAR request to the credential issuer and return the response url
87
+ const parUrl = issuerConf.openid_credential_issuer.pushed_authorization_request_endpoint;
88
+ const getPar = makeParRequest({
89
+ wiaCryptoContext,
90
+ appFetch
91
+ });
92
+ const issuerRequestUri = await getPar(clientId, codeVerifier, walletProviderBaseUrl, parUrl, walletInstanceAttestation, [selectCredentialDefinition(issuerConf, credentialType)], ASSERTION_TYPE);
93
+
94
+ // Initialize authorization by requesting the authz request uri
95
+ const authzRequestEndpoint = issuerConf.openid_credential_issuer.authorization_endpoint;
96
+ const params = new URLSearchParams({
97
+ client_id: clientId,
98
+ request_uri: issuerRequestUri,
99
+ ...additionalParams
100
+ });
101
+ const {
102
+ request_uri
103
+ } = await appFetch(`${authzRequestEndpoint}?${params}`).then(hasStatus(200)).then(res => res.text()).then(decodeAuthorizationResponse);
104
+ return {
105
+ requestUri: request_uri,
106
+ clientId
107
+ };
108
+ };
109
+ //# sourceMappingURL=03-start-user-authorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["z","uuid","makeParRequest","getJwtFromFormPost","hasStatus","ASSERTION_TYPE","selectCredentialDefinition","issuerConf","credentialType","credentials_supported","openid_credential_issuer","result","filter","e","credential_definition","type","includes","map","format","Error","decodeAuthorizationResponse","raw","decodedJwt","payload","CorrectShape","object","request_uri","string","WrongShapeForPID","code","state","correct","wrong","safeParse","success","data","error","startUserAuthorization","ctx","wiaCryptoContext","walletInstanceAttestation","walletProviderBaseUrl","additionalParams","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","v4","parUrl","pushed_authorization_request_endpoint","getPar","issuerRequestUri","authzRequestEndpoint","authorization_endpoint","params","URLSearchParams","client_id","res","text","requestUri"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AACxB,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAA8BC,cAAc,QAAQ,iBAAiB;AAErE,SAASC,kBAAkB,QAAQ,qBAAqB;AACxD,SAASC,SAAS,QAAkB,kBAAkB;AAGtD,SAASC,cAAc,QAAQ,SAAS;AAExC,MAAMC,0BAA0B,GAAGA,CACjCC,UAAkD,EAClDC,cAAgD,KACxB;EACxB,MAAM;IAAEC;EAAsB,CAA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,EAAC,CAAC,CACxEX,IAAI,CAAC3C,SAAS,CAAC,GAAG,CAAC,CAAC,CACpB2C,IAAI,CAAEc,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBf,IAAI,CAAC3B,2BAA2B,CAAC;EAEpC,OAAO;IAAE2C,UAAU,EAAErC,WAAW;IAAEmB;EAAS,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=04-complete-user-authorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import uuid from "react-native-uuid";
2
+ import { withEphemeralKey } from "../../utils/crypto";
3
+ import { createDPopToken } from "../../utils/dpop";
4
+ import { hasStatus } from "../../utils/misc";
5
+ import { ASSERTION_TYPE } from "./const";
6
+ /**
7
+ * Obtain the access token to finally request the credential
8
+ *
9
+ * @param issuerConf The Issuer configuration
10
+ * @param code The access code from the User authorization phase
11
+ * @param clientId Identifies the current client across all the requests of the issuing flow
12
+ * @param context.walletInstanceAttestation The Wallet Instance Attestation token
13
+ * @param context.walletProviderBaseUrl The base url of the Wallet Provider
14
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
15
+ * @returns
16
+ */
17
+ export const authorizeAccess = async (issuerConf, code, clientId, context) => {
18
+ const {
19
+ appFetch = fetch,
20
+ walletInstanceAttestation,
21
+ walletProviderBaseUrl
22
+ } = context;
23
+ const tokenUrl = issuerConf.openid_credential_issuer.token_endpoint;
24
+
25
+ // Use an ephemeral key to be destroyed after use
26
+ const signedDPop = await withEphemeralKey(ephemeralContext => createDPopToken({
27
+ htm: "POST",
28
+ htu: tokenUrl,
29
+ jti: `${uuid.v4()}`
30
+ }, ephemeralContext));
31
+ const codeVerifier = `${uuid.v4()}`;
32
+ const requestBody = {
33
+ grant_type: "authorization code",
34
+ client_id: clientId,
35
+ code,
36
+ code_verifier: codeVerifier,
37
+ client_assertion_type: ASSERTION_TYPE,
38
+ client_assertion: walletInstanceAttestation,
39
+ redirect_uri: walletProviderBaseUrl
40
+ };
41
+ var formBody = new URLSearchParams(requestBody);
42
+ return appFetch(tokenUrl, {
43
+ method: "POST",
44
+ headers: {
45
+ "Content-Type": "application/x-www-form-urlencoded",
46
+ DPoP: signedDPop
47
+ },
48
+ body: formBody.toString()
49
+ }).then(hasStatus(200)).then(res => res.json()).then(body => ({
50
+ accessToken: body.access_token,
51
+ nonce: body.c_nonce,
52
+ clientId
53
+ }));
54
+ };
55
+ //# sourceMappingURL=05-authorize-access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["uuid","withEphemeralKey","createDPopToken","hasStatus","ASSERTION_TYPE","authorizeAccess","issuerConf","code","clientId","context","appFetch","fetch","walletInstanceAttestation","walletProviderBaseUrl","tokenUrl","openid_credential_issuer","token_endpoint","signedDPop","ephemeralContext","htm","htu","jti","v4","codeVerifier","requestBody","grant_type","client_id","code_verifier","client_assertion_type","client_assertion","redirect_uri","formBody","URLSearchParams","method","headers","DPoP","body","toString","then","res","json","accessToken","access_token","nonce","c_nonce"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":"AAAA,OAAOA,IAAI,MAAM,mBAAmB;AACpC,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,kBAAkB;AAElD,SAASC,SAAS,QAAkB,kBAAkB;AAEtD,SAASC,cAAc,QAAQ,SAAS;AAqBxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAgC,GAAG,MAAAA,CAC9CC,UAAU,EACVC,IAAI,EACJC,QAAQ,EACRC,OAAO,KAC+D;EACtE,MAAM;IACJC,QAAQ,GAAGC,KAAK;IAChBC,yBAAyB;IACzBC;EACF,CAAC,GAAGJ,OAAO;EAEX,MAAMK,QAAQ,GAAGR,UAAU,CAACS,wBAAwB,CAACC,cAAc;;EAEnE;EACA,MAAMC,UAAU,GAAG,MAAMhB,gBAAgB,CAAEiB,gBAAgB,IACzDhB,eAAe,CACb;IACEiB,GAAG,EAAE,MAAM;IACXC,GAAG,EAAEN,QAAQ;IACbO,GAAG,EAAG,GAAErB,IAAI,CAACsB,EAAE,CAAC,CAAE;EACpB,CAAC,EACDJ,gBACF,CACF,CAAC;EAED,MAAMK,YAAY,GAAI,GAAEvB,IAAI,CAACsB,EAAE,CAAC,CAAE,EAAC;EACnC,MAAME,WAAW,GAAG;IAClBC,UAAU,EAAE,oBAAoB;IAChCC,SAAS,EAAElB,QAAQ;IACnBD,IAAI;IACJoB,aAAa,EAAEJ,YAAY;IAC3BK,qBAAqB,EAAExB,cAAc;IACrCyB,gBAAgB,EAAEjB,yBAAyB;IAC3CkB,YAAY,EAAEjB;EAChB,CAAC;EACD,IAAIkB,QAAQ,GAAG,IAAIC,eAAe,CAACR,WAAW,CAAC;EAE/C,OAAOd,QAAQ,CAACI,QAAQ,EAAE;IACxBmB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAElB;IACR,CAAC;IACDmB,IAAI,EAAEL,QAAQ,CAACM,QAAQ,CAAC;EAC1B,CAAC,CAAC,CACCC,IAAI,CAACnC,SAAS,CAAC,GAAG,CAAC,CAAC,CACpBmC,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEF,IAAI,KAAM;IACfK,WAAW,EAAEL,IAAI,CAACM,YAAY;IAC9BC,KAAK,EAAEP,IAAI,CAACQ,OAAO;IACnBpC;EACF,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,117 @@
1
+ import * as z from "zod";
2
+ import uuid from "react-native-uuid";
3
+ import { SignJWT } from "@pagopa/io-react-native-jwt";
4
+ import { verify as verifySdJwt } from "../../sd-jwt";
5
+ import { createDPopToken } from "../../utils/dpop";
6
+ import { hasStatus } from "../../utils/misc";
7
+ import { SdJwt4VC } from "../../sd-jwt/types";
8
+ import { IoWalletError } from "../../utils/errors";
9
+ /**
10
+ * Return the signed jwt for nonce proof of possession
11
+ */
12
+ export const createNonceProof = async (nonce, issuer, audience, ctx) => {
13
+ return new SignJWT(ctx).setPayload({
14
+ nonce,
15
+ jwk: await ctx.getPublicKey()
16
+ }).setProtectedHeader({
17
+ type: "openid4vci-proof+jwt"
18
+ }).setAudience(audience).setIssuer(issuer).setIssuedAt().setExpirationTime("1h").sign();
19
+ };
20
+
21
+ /**
22
+ * Given a credential, verify it's in the supported format
23
+ * and the credential is correctly signed
24
+ * and it's bound to the given key
25
+ *
26
+ * @param rawCredential The received credential
27
+ * @param issuerKeys The set of public keys of the issuer,
28
+ * which will be used to verify the signature
29
+ * @param holderBindingContext The access to the holder's key
30
+ *
31
+ * @throws If the signature verification fails
32
+ * @throws If the credential is not in the SdJwt4VC format
33
+ * @throws If the holder binding is not properly configured
34
+ *
35
+ */
36
+ async function verifyCredential(rawCredential, issuerKeys, holderBindingContext) {
37
+ const [{
38
+ sdJwt
39
+ }, holderBindingKey] =
40
+ // parallel for optimization
41
+ await Promise.all([verifySdJwt(rawCredential, issuerKeys, SdJwt4VC), holderBindingContext.getPublicKey()]);
42
+ if (!sdJwt.payload.cnf.jwk.kid || sdJwt.payload.cnf.jwk.kid !== holderBindingKey.kid) {
43
+ throw new IoWalletError(`Failed to verify holder binding, expected kid: ${holderBindingKey.kid}, got: ${sdJwt.payload.cnf.jwk.kid}`);
44
+ }
45
+ }
46
+ const CredentialEndpointResponse = z.object({
47
+ credential: z.string(),
48
+ format: z.literal("vc+sd-jwt")
49
+ });
50
+ /**
51
+ * Fetch a credential from the issuer
52
+ *
53
+ * @param issuerConf The Issuer configuration
54
+ * @param accessToken The access token to grant access to the credential, obtained with the access authorization step
55
+ * @param nonce The nonce value to prevent reply attacks, obtained with the access authorization step
56
+ * @param clientId Identifies the current client across all the requests of the issuing flow
57
+ * @param credentialType The type of the credential to be requested
58
+ * @param context.credentialCryptoContext The context to access the key the Credential will be bound to
59
+ * @param context.walletProviderBaseUrl The base url of the Wallet Provider
60
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
61
+ * @returns The signed credential token
62
+ */
63
+ export const obtainCredential = async (issuerConf, accessToken, nonce, clientId, credentialType, context) => {
64
+ const {
65
+ credentialCryptoContext,
66
+ walletProviderBaseUrl,
67
+ appFetch = fetch
68
+ } = context;
69
+ const credentialUrl = issuerConf.openid_credential_issuer.credential_endpoint;
70
+
71
+ /** DPoP token for demonstating the possession
72
+ of the key that will bind the holder User with the Credential
73
+ @see https://datatracker.ietf.org/doc/html/rfc9449 */
74
+ const signedDPopForPid = await createDPopToken({
75
+ htm: "POST",
76
+ htu: credentialUrl,
77
+ jti: `${uuid.v4()}`
78
+ }, credentialCryptoContext);
79
+
80
+ /** JWT proof token to bind the request nonce
81
+ to the key that will bind the holder User with the Credential
82
+ @see https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-proof-types */
83
+ const signedNonceProof = await createNonceProof(nonce, clientId, walletProviderBaseUrl, credentialCryptoContext);
84
+
85
+ /** The credential request body */
86
+ const formBody = new URLSearchParams({
87
+ credential_definition: JSON.stringify({
88
+ type: [credentialType]
89
+ }),
90
+ format: "vc+sd-jwt",
91
+ proof: JSON.stringify({
92
+ jwt: signedNonceProof,
93
+ proof_type: "jwt"
94
+ })
95
+ });
96
+ const {
97
+ credential,
98
+ format
99
+ } = await appFetch(credentialUrl, {
100
+ method: "POST",
101
+ headers: {
102
+ "Content-Type": "application/x-www-form-urlencoded",
103
+ DPoP: signedDPopForPid,
104
+ Authorization: accessToken
105
+ },
106
+ body: formBody.toString()
107
+ }).then(hasStatus(200)).then(res => res.json()).then(CredentialEndpointResponse.parse);
108
+
109
+ /** validate the received credential signature
110
+ is correct and refers to the public keys of the issuer */
111
+ await verifyCredential(credential, issuerConf.openid_credential_issuer.jwks.keys, credentialCryptoContext);
112
+ return {
113
+ credential,
114
+ format
115
+ };
116
+ };
117
+ //# sourceMappingURL=06-obtain-credential.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["z","uuid","SignJWT","verify","verifySdJwt","createDPopToken","hasStatus","SdJwt4VC","IoWalletError","createNonceProof","nonce","issuer","audience","ctx","setPayload","jwk","getPublicKey","setProtectedHeader","type","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","verifyCredential","rawCredential","issuerKeys","holderBindingContext","sdJwt","holderBindingKey","Promise","all","payload","cnf","kid","CredentialEndpointResponse","object","credential","string","format","literal","obtainCredential","issuerConf","accessToken","clientId","credentialType","context","credentialCryptoContext","walletProviderBaseUrl","appFetch","fetch","credentialUrl","openid_credential_issuer","credential_endpoint","signedDPopForPid","htm","htu","jti","v4","signedNonceProof","formBody","URLSearchParams","credential_definition","JSON","stringify","proof","jwt","proof_type","method","headers","DPoP","Authorization","body","toString","then","res","json","parse","jwks","keys"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AACxB,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,OAAO,QAA4B,6BAA6B;AACzE,SAASC,MAAM,IAAIC,WAAW,QAAQ,cAAc;AACpD,SAASC,eAAe,QAAQ,kBAAkB;AAGlD,SAASC,SAAS,QAAkB,kBAAkB;AAGtD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,aAAa,QAAQ,oBAAoB;AAGlD;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAAkB,KACE;EACpB,OAAO,IAAIX,OAAO,CAACW,GAAG,CAAC,CACpBC,UAAU,CAAC;IACVJ,KAAK;IACLK,GAAG,EAAE,MAAMF,GAAG,CAACG,YAAY,CAAC;EAC9B,CAAC,CAAC,CACDC,kBAAkB,CAAC;IAClBC,IAAI,E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zC;AACF;EACE,MAAMrD,gBAAgB,CACpBa,UAAU,EACVK,UAAU,CAACU,wBAAwB,CAAC0B,IAAI,CAACC,IAAI,EAC7ChC,uBACF,CAAC;EAED,OAAO;IAAEV,UAAU;IAAEE;EAAO,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=07-confirm-credential.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["credential/issuance/07-confirm-credential.ts"],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export const ASSERTION_TYPE = "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation";
2
+ //# sourceMappingURL=const.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ASSERTION_TYPE"],"sourceRoot":"../../../../src","sources":["credential/issuance/const.ts"],"mappings":"AAAA,OAAO,MAAMA,cAAc,GACzB,oEAAoE"}
@@ -0,0 +1,6 @@
1
+ import { evaluateIssuerTrust } from "./02-evaluate-issuer-trust";
2
+ import { startUserAuthorization } from "./03-start-user-authorization";
3
+ import { authorizeAccess } from "./05-authorize-access";
4
+ import { obtainCredential } from "./06-obtain-credential";
5
+ export { evaluateIssuerTrust, startUserAuthorization, authorizeAccess, obtainCredential };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["evaluateIssuerTrust","startUserAuthorization","authorizeAccess","obtainCredential"],"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;AAG/B,SACEH,mBAAmB,EACnBC,sBAAsB,EACtBC,eAAe,EACfC,gBAAgB"}
@@ -0,0 +1,46 @@
1
+ import * as z from "zod";
2
+ import { decodeBase64 } from "@pagopa/io-react-native-jwt";
3
+ import { AuthRequestDecodeError } from "../../utils/errors";
4
+ const QRCodePayload = z.object({
5
+ protocol: z.string(),
6
+ resource: z.string(),
7
+ // TODO: refine to known paths using literals
8
+ clientId: z.string(),
9
+ requestURI: z.string()
10
+ });
11
+
12
+ /**
13
+ * The beginning of the presentation flow.
14
+ * To be implemented accordind to the user touchpoint
15
+ *
16
+ * @param Optional parameters, depending on the starting touchoint
17
+ * @returns The url for the Relying Party to connect with
18
+ */
19
+
20
+ /**
21
+ * Start a presentation flow by decoding an incoming QR-code
22
+ *
23
+ * @param qrcode The encoded QR-code content
24
+ * @returns The url for the Relying Party to connect with
25
+ * @throws If the provided qr code fails to be decoded
26
+ */
27
+ export const startFlowFromQR = async qrcode => {
28
+ const decoded = decodeBase64(qrcode);
29
+ const decodedUrl = new URL(decoded);
30
+ const protocol = decodedUrl.protocol;
31
+ const resource = decodedUrl.hostname;
32
+ const requestURI = decodedUrl.searchParams.get("request_uri");
33
+ const clientId = decodedUrl.searchParams.get("client_id");
34
+ const result = QRCodePayload.safeParse({
35
+ protocol,
36
+ resource,
37
+ requestURI,
38
+ clientId
39
+ });
40
+ if (result.success) {
41
+ return result.data;
42
+ } else {
43
+ throw new AuthRequestDecodeError(result.error.message, `${decodedUrl}`);
44
+ }
45
+ };
46
+ //# sourceMappingURL=01-start-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["z","decodeBase64","AuthRequestDecodeError","QRCodePayload","object","protocol","string","resource","clientId","requestURI","startFlowFromQR","qrcode","decoded","decodedUrl","URL","hostname","searchParams","get","result","safeParse","success","data","error","message"],"sourceRoot":"../../../../src","sources":["credential/presentation/01-start-flow.ts"],"mappings":"AAAA,OAAO,KAAKA,CAAC,MAAM,KAAK;AACxB,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3D,MAAMC,aAAa,GAAGH,CAAC,CAACI,MAAM,CAAC;EAC7BC,QAAQ,EAAEL,CAAC,CAACM,MAAM,CAAC,CAAC;EACpBC,QAAQ,EAAEP,CAAC,CAACM,MAAM,CAAC,CAAC;EAAE;EACtBE,QAAQ,EAAER,CAAC,CAACM,MAAM,CAAC,CAAC;EACpBG,UAAU,EAAET,CAAC,CAACM,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,eAAoC,GAAG,MAAOC,MAAM,IAAK;EACpE,MAAMC,OAAO,GAAGX,YAAY,CAACU,MAAM,CAAC;EACpC,MAAME,UAAU,GAAG,IAAIC,GAAG,CAACF,OAAO,CAAC;EACnC,MAAMP,QAAQ,GAAGQ,UAAU,CAACR,QAAQ;EACpC,MAAME,QAAQ,GAAGM,UAAU,CAACE,QAAQ;EACpC,MAAMN,UAAU,GAAGI,UAAU,CAACG,YAAY,CAACC,GAAG,CAAC,aAAa,CAAC;EAC7D,MAAMT,QAAQ,GAAGK,UAAU,CAACG,YAAY,CAACC,GAAG,CAAC,WAAW,CAAC;EAEzD,MAAMC,MAAM,GAAGf,aAAa,CAACgB,SAAS,CAAC;IACrCd,QAAQ;IACRE,QAAQ;IACRE,UAAU;IACVD;EACF,CAAC,CAAC;EAEF,IAAIU,MAAM,CAACE,OAAO,EAAE;IAClB,OAAOF,MAAM,CAACG,IAAI;EACpB,CAAC,MAAM;IACL,MAAM,IAAInB,sBAAsB,CAACgB,MAAM,CAACI,KAAK,CAACC,OAAO,EAAG,GAAEV,UAAW,EAAC,CAAC;EACzE;AACF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { getRelyingPartyEntityConfiguration } from "../../trust";
2
+ /**
3
+ * The Relying Party trust evaluation phase.
4
+ * Fetch the Relying Party's configuration and verify trust.
5
+ *
6
+ * @param rpUrl The base url of the Issuer
7
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
8
+ * @returns The Relying Party's configuration
9
+ */
10
+ export const evaluateRelyingPartyTrust = async function (rpUrl) {
11
+ let {
12
+ appFetch = fetch
13
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
14
+ const {
15
+ payload: {
16
+ metadata: rpConf
17
+ }
18
+ } = await getRelyingPartyEntityConfiguration(rpUrl, {
19
+ appFetch
20
+ });
21
+ return {
22
+ rpConf
23
+ };
24
+ };
25
+ //# sourceMappingURL=02-evaluate-rp-trust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getRelyingPartyEntityConfiguration","evaluateRelyingPartyTrust","rpUrl","appFetch","fetch","arguments","length","undefined","payload","metadata","rpConf"],"sourceRoot":"../../../../src","sources":["credential/presentation/02-evaluate-rp-trust.ts"],"mappings":"AAAA,SAASA,kCAAkC,QAAQ,aAAa;AAchE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,yBAAoD,GAAG,eAAAA,CAClEC,KAAK,EAEF;EAAA,IADH;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEzB,MAAM;IACJG,OAAO,EAAE;MAAEC,QAAQ,EAAEC;IAAO;EAC9B,CAAC,GAAG,MAAMV,kCAAkC,CAACE,KAAK,EAAE;IAClDC;EACF,CAAC,CAAC;EACF,OAAO;IAAEO;EAAO,CAAC;AACnB,CAAC"}