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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/lib/commonjs/cie/component.js +180 -0
  2. package/lib/commonjs/cie/component.js.map +1 -0
  3. package/lib/commonjs/cie/error.js +44 -0
  4. package/lib/commonjs/cie/error.js.map +1 -0
  5. package/lib/commonjs/cie/index.js +32 -0
  6. package/lib/commonjs/cie/index.js.map +1 -0
  7. package/lib/commonjs/cie/manager.js +142 -0
  8. package/lib/commonjs/cie/manager.js.map +1 -0
  9. package/lib/commonjs/client/index.js +5 -2
  10. package/lib/commonjs/client/index.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +2 -2
  12. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  13. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +7 -3
  14. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  15. package/lib/commonjs/credential/issuance/05-authorize-access.js +5 -5
  16. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  17. package/lib/commonjs/credential/issuance/06-obtain-credential.js +2 -2
  18. package/lib/commonjs/credential/issuance/index.js +6 -0
  19. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  20. package/lib/commonjs/index.js +3 -1
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/module/cie/component.js +171 -0
  23. package/lib/module/cie/component.js.map +1 -0
  24. package/lib/module/cie/error.js +36 -0
  25. package/lib/module/cie/error.js.map +1 -0
  26. package/lib/module/cie/index.js +4 -0
  27. package/lib/module/cie/index.js.map +1 -0
  28. package/lib/module/cie/manager.js +133 -0
  29. package/lib/module/cie/manager.js.map +1 -0
  30. package/lib/module/client/index.js +5 -2
  31. package/lib/module/client/index.js.map +1 -1
  32. package/lib/module/credential/issuance/03-start-user-authorization.js +2 -2
  33. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  34. package/lib/module/credential/issuance/04-complete-user-authorization.js +4 -1
  35. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  36. package/lib/module/credential/issuance/05-authorize-access.js +5 -5
  37. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  38. package/lib/module/credential/issuance/06-obtain-credential.js +2 -2
  39. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  40. package/lib/module/credential/issuance/index.js +2 -2
  41. package/lib/module/credential/issuance/index.js.map +1 -1
  42. package/lib/module/index.js +2 -1
  43. package/lib/module/index.js.map +1 -1
  44. package/lib/typescript/cie/component.d.ts +46 -0
  45. package/lib/typescript/cie/component.d.ts.map +1 -0
  46. package/lib/typescript/cie/error.d.ts +31 -0
  47. package/lib/typescript/cie/error.d.ts.map +1 -0
  48. package/lib/typescript/cie/index.d.ts +4 -0
  49. package/lib/typescript/cie/index.d.ts.map +1 -0
  50. package/lib/typescript/cie/manager.d.ts +5 -0
  51. package/lib/typescript/cie/manager.d.ts.map +1 -0
  52. package/lib/typescript/client/index.d.ts.map +1 -1
  53. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +2 -2
  54. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  55. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +6 -1
  56. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  57. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +1 -1
  58. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  59. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +1 -1
  60. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  61. package/lib/typescript/credential/issuance/index.d.ts +2 -2
  62. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  63. package/lib/typescript/index.d.ts +2 -1
  64. package/lib/typescript/index.d.ts.map +1 -1
  65. package/package.json +6 -2
  66. package/src/cie/component.tsx +216 -0
  67. package/src/cie/error.ts +58 -0
  68. package/src/cie/index.ts +4 -0
  69. package/src/cie/manager.ts +183 -0
  70. package/src/client/index.ts +4 -1
  71. package/src/credential/issuance/03-start-user-authorization.ts +2 -6
  72. package/src/credential/issuance/04-complete-user-authorization.ts +17 -14
  73. package/src/credential/issuance/05-authorize-access.ts +5 -5
  74. package/src/credential/issuance/06-obtain-credential.ts +2 -2
  75. package/src/credential/issuance/index.ts +2 -0
  76. package/src/index.ts +2 -0
  77. package/lib/commonjs/credential/issuance/03-start-credential-issuance.js +0 -287
  78. package/lib/commonjs/credential/issuance/03-start-credential-issuance.js.map +0 -1
  79. package/lib/module/credential/issuance/03-start-credential-issuance.js +0 -276
  80. package/lib/module/credential/issuance/03-start-credential-issuance.js.map +0 -1
  81. package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts +0 -41
  82. package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts.map +0 -1
  83. package/src/credential/issuance/03-start-credential-issuance.ts +0 -407
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "AuthorizationDetails", {
15
15
  return _par.AuthorizationDetails;
16
16
  }
17
17
  });
18
- exports.WalletInstanceAttestation = exports.WalletInstance = exports.Trust = exports.SdJwt = exports.PID = exports.Errors = exports.Credential = void 0;
18
+ exports.WalletInstanceAttestation = exports.WalletInstance = exports.Trust = exports.SdJwt = exports.PID = exports.Errors = exports.Credential = exports.Cie = void 0;
19
19
  Object.defineProperty(exports, "createCryptoContextFor", {
20
20
  enumerable: true,
21
21
  get: function () {
@@ -44,6 +44,8 @@ var Trust = _interopRequireWildcard(require("./trust"));
44
44
  exports.Trust = Trust;
45
45
  var WalletInstance = _interopRequireWildcard(require("./wallet-instance"));
46
46
  exports.WalletInstance = WalletInstance;
47
+ var Cie = _interopRequireWildcard(require("./cie"));
48
+ exports.Cie = Cie;
47
49
  var _par = require("./utils/par");
48
50
  var _crypto = require("./utils/crypto");
49
51
  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); }
@@ -1 +1 @@
1
- {"version":3,"names":["_jwk","require","Credential","_interopRequireWildcard","exports","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","_par","_crypto","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,IAAA,GAAAC,OAAA;AAGAA,OAAA;AAEA,IAAAC,UAAA,GAAAC,uBAAA,CAAAF,OAAA;AAA2CG,OAAA,CAAAF,UAAA,GAAAA,UAAA;AAC3C,IAAAG,GAAA,GAAAF,uBAAA,CAAAF,OAAA;AAA6BG,OAAA,CAAAC,GAAA,GAAAA,GAAA;AAC7B,IAAAC,KAAA,GAAAH,uBAAA,CAAAF,OAAA;AAAkCG,OAAA,CAAAE,KAAA,GAAAA,KAAA;AAClC,IAAAC,MAAA,GAAAJ,uBAAA,CAAAF,OAAA;AAAyCG,OAAA,CAAAG,MAAA,GAAAA,MAAA;AACzC,IAAAC,yBAAA,GAAAL,uBAAA,CAAAF,OAAA;AAA2EG,OAAA,CAAAI,yBAAA,GAAAA,yBAAA;AAC3E,IAAAC,KAAA,GAAAN,uBAAA,CAAAF,OAAA;AAAiCG,OAAA,CAAAK,KAAA,GAAAA,KAAA;AACjC,IAAAC,cAAA,GAAAP,uBAAA,CAAAF,OAAA;AAAoDG,OAAA,CAAAM,cAAA,GAAAA,cAAA;AACpD,IAAAC,IAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AAAwD,SAAAY,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,SAAAX,wBAAAe,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,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
1
+ {"version":3,"names":["_jwk","require","Credential","_interopRequireWildcard","exports","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","Cie","_par","_crypto","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnProperty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,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,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
@@ -0,0 +1,171 @@
1
+ import React, { createRef } from "react";
2
+ import { Platform } from "react-native";
3
+ import { WebView } from "react-native-webview";
4
+ import { startCieAndroid, startCieiOS } from "./manager";
5
+ import { CieError, CieErrorType } from "./error";
6
+
7
+ /* To obtain the authentication URL on CIE L3 it is necessary to take the
8
+ * link contained in the "Entra con lettura carta CIE" button.
9
+ * This link can then be used on CieManager.
10
+ * This javascript code takes the link in question and sends it to the react native function via postMessage
11
+ */
12
+ const injectedJavaScript = `
13
+ (function() {
14
+ function sendDocumentContent() {
15
+ const idpAuthUrl = [...document.querySelectorAll("a")]
16
+ .filter(a => a.textContent.includes("lettura carta CIE"))
17
+ .map(a=>a.href)[0];
18
+
19
+ if(idpAuthUrl) {
20
+ window.ReactNativeWebView.postMessage(idpAuthUrl);
21
+ }
22
+ }
23
+ if (document.readyState === 'complete') {
24
+ sendDocumentContent();
25
+ } else {
26
+ window.addEventListener('load', sendDocumentContent);
27
+ }
28
+ })();
29
+ true;
30
+ `;
31
+ export let CieEvent = /*#__PURE__*/function (CieEvent) {
32
+ CieEvent["reading"] = "reading";
33
+ CieEvent["completed"] = "completed";
34
+ CieEvent["waiting_card"] = "waiting_card";
35
+ return CieEvent;
36
+ }({});
37
+ /*
38
+ * To make sure the server recognizes the client as valid iPhone device (iOS only) we use a custom header
39
+ * on Android it is not required.
40
+ */
41
+ const iOSUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1";
42
+ const defaultUserAgent = Platform.select({
43
+ ios: iOSUserAgent,
44
+ default: undefined
45
+ });
46
+ const webView = /*#__PURE__*/createRef();
47
+
48
+ /**
49
+ * WebViewComponent
50
+ *
51
+ * Component that manages authentication via CIE L3 (NFC+PIN) based on WebView (react-native-webview).
52
+ * In particular, once rendered, it makes a series of calls to the authUrl in the WebView,
53
+ * extrapolates the authentication URL necessary for CieManager to sign via certificate
54
+ * and calls the CIE SDK which is responsible for starting card reading via NFC.
55
+ * At the end of the reading, a redirect is made in the WebView towards the page that asks
56
+ * the user for consent to send the data to the Service Provider. This moment can be captured
57
+ * via the onUserInteraction parameter. When the user allows or denies their consent,
58
+ * a redirect is made to the URL set by the Service Provider.
59
+ * This url can be configured using the redirectUrl parameter which allows you to close the WebView.
60
+ * The event can then be captured via the onSuccess parameter.
61
+ *
62
+ * @param {CIEParams} params - Parameters required by the component.
63
+ * @param {string} params.authUrl -The authentication URL of the Service Provider to which to authenticate.
64
+ * @param {boolean} params.useUat - If set to true it uses the CIE testing environment.
65
+ * @param {string} params.pin - CIE pin for use with NFC reading.
66
+ * @param {Function} params.onError - Callback function in case of error. The function is passed the Error parameter.
67
+ * @param {Function} params.onSuccess - Callback at the end of authentication to which the redirect URL including parameters is passed.
68
+ * @param {string} params.redirectUrl - Redirect URL set by the Service Provider. It is used to stop the flow and return to the calling function via onSuccess.
69
+ * @param {Function} params.onEvent - Callback function that is called whenever there is a new CieEvent from the CIE reader.
70
+ * @returns {JSX.Element} - The configured component with WebView.
71
+ */
72
+ export const WebViewComponent = params => {
73
+ const [webViewUrl, setWebViewUrl] = React.useState(params.authUrl);
74
+ const [isCardReadingFinished, setCardReadingFinished] = React.useState(false);
75
+
76
+ /*
77
+ * Once the reading of the card with NFC is finished, it is necessary
78
+ * to change the URL of the WebView by redirecting to the URL returned by
79
+ * CieManager to allow the user to continue with the consent authorization
80
+ * */
81
+ const continueWithUrl = callbackUrl => {
82
+ setCardReadingFinished(true);
83
+ setWebViewUrl(callbackUrl);
84
+ };
85
+
86
+ // This function is called from the injected javascript code (postMessage). Which receives the authentication URL
87
+ const handleMessage = async event => {
88
+ const cieAuthorizationUri = event.nativeEvent.data;
89
+ const startCie = Platform.select({
90
+ ios: startCieiOS,
91
+ default: startCieAndroid
92
+ });
93
+ await startCie(params.useUat, params.pin, params.onError, params.onEvent, cieAuthorizationUri, continueWithUrl);
94
+ };
95
+
96
+ //This function is called when authentication with CIE ends and the SP URL containing code and state is returned
97
+ const handleShouldStartLoading = (onSuccess, redirectUrl) => event => {
98
+ if (isCardReadingFinished && event.url.includes(redirectUrl)) {
99
+ onSuccess(event.url);
100
+ return false;
101
+ } else {
102
+ return true;
103
+ }
104
+ };
105
+ const handleOnLoadEnd = (onError, onCieEvent) => e => {
106
+ const eventTitle = e.nativeEvent.title.toLowerCase();
107
+ if (eventTitle === "pagina web non disponibile" ||
108
+ // On Android, if we attempt to access the idp URL twice,
109
+ // we are presented with an error page titled "ERROR".
110
+ eventTitle === "errore") {
111
+ handleOnError(onError)(new Error(eventTitle));
112
+ }
113
+
114
+ /* At the end of loading the page, if the card has already been read
115
+ * then the WebView has loaded the page to ask the user for consent,
116
+ * so send the completed event
117
+ * */
118
+ if (isCardReadingFinished) {
119
+ onCieEvent(CieEvent.completed);
120
+ }
121
+ };
122
+ const handleOnError = onError => e => {
123
+ const error = e;
124
+ const webViewError = e;
125
+ const webViewHttpError = e;
126
+ if (webViewHttpError.nativeEvent.statusCode) {
127
+ const {
128
+ description,
129
+ statusCode
130
+ } = webViewHttpError.nativeEvent;
131
+ onError(new CieError({
132
+ message: `WebView http error: ${description} with status code: ${statusCode}`,
133
+ type: CieErrorType.WEB_VIEW_ERROR
134
+ }));
135
+ } else if (webViewError.nativeEvent) {
136
+ const {
137
+ code,
138
+ description
139
+ } = webViewError.nativeEvent;
140
+ onError(new CieError({
141
+ message: `WebView error: ${description} with code: ${code}`,
142
+ type: CieErrorType.WEB_VIEW_ERROR
143
+ }));
144
+ } else if (error.message !== undefined) {
145
+ onError(new CieError({
146
+ message: `${error.message}`,
147
+ type: CieErrorType.WEB_VIEW_ERROR
148
+ }));
149
+ } else {
150
+ onError(new CieError({
151
+ message: "An error occurred in the WebView",
152
+ type: CieErrorType.WEB_VIEW_ERROR
153
+ }));
154
+ }
155
+ };
156
+ return /*#__PURE__*/React.createElement(WebView, {
157
+ ref: webView,
158
+ userAgent: defaultUserAgent,
159
+ javaScriptEnabled: true,
160
+ source: {
161
+ uri: webViewUrl
162
+ },
163
+ onLoadEnd: handleOnLoadEnd(params.onError, params.onEvent),
164
+ onError: handleOnError(params.onError),
165
+ onHttpError: handleOnError(params.onError),
166
+ injectedJavaScript: injectedJavaScript,
167
+ onShouldStartLoadWithRequest: handleShouldStartLoading(params.onSuccess, params.redirectUrl),
168
+ onMessage: handleMessage
169
+ });
170
+ };
171
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","createRef","Platform","WebView","startCieAndroid","startCieiOS","CieError","CieErrorType","injectedJavaScript","CieEvent","iOSUserAgent","defaultUserAgent","select","ios","default","undefined","webView","WebViewComponent","params","webViewUrl","setWebViewUrl","useState","authUrl","isCardReadingFinished","setCardReadingFinished","continueWithUrl","callbackUrl","handleMessage","event","cieAuthorizationUri","nativeEvent","data","startCie","useUat","pin","onError","onEvent","handleShouldStartLoading","onSuccess","redirectUrl","url","includes","handleOnLoadEnd","onCieEvent","e","eventTitle","title","toLowerCase","handleOnError","Error","completed","error","webViewError","webViewHttpError","statusCode","description","message","type","WEB_VIEW_ERROR","code","createElement","ref","userAgent","javaScriptEnabled","source","uri","onLoadEnd","onHttpError","onShouldStartLoadWithRequest","onMessage"],"sourceRoot":"../../../src","sources":["cie/component.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,OAAO,QAAQ,sBAAsB;AAS9C,SAASC,eAAe,EAAEC,WAAW,QAA8B,WAAW;AAC9E,SAASC,QAAQ,EAAEC,YAAY,QAAQ,SAAS;;AAEhD;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AAIH,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAgBpB;AACA;AACA;AACA;AACA,MAAMC,YAAY,GAChB,2IAA2I;AAC7I,MAAMC,gBAAgB,GAAGT,QAAQ,CAACU,MAAM,CAAC;EACvCC,GAAG,EAAEH,YAAY;EACjBI,OAAO,EAAEC;AACX,CAAC,CAAC;AAEF,MAAMC,OAAO,gBAAGf,SAAS,CAAU,CAAC;;AAEpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMgB,gBAAgB,GAAIC,MAAiB,IAAK;EACrD,MAAM,CAACC,UAAU,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CAACmD;MACrB,CAAC,CACH,CAAC;IACH;EACF,CAAC;EAEH,oBACE1D,KAAA,CAAA4D,aAAA,CAACzD,OAAO;IACN0D,GAAG,EAAE7C,OAAQ;IACb8C,SAAS,EAAEnD,gBAAiB;IAC5BoD,iBAAiB,EAAE,IAAK;IACxBC,MAAM,EAAE;MAAEC,GAAG,EAAE9C;IAAW,CAAE;IAC5B+C,SAAS,EAAExB,eAAe,CAACxB,MAAM,CAACiB,OAAO,EAAEjB,MAAM,CAACkB,OAAO,CAAE;IAC3DD,OAAO,EAAEa,aAAa,CAAC9B,MAAM,CAACiB,OAAO,CAAE;IACvCgC,WAAW,EAAEnB,aAAa,CAAC9B,MAAM,CAACiB,OAAO,CAAE;IAC3C3B,kBAAkB,EAAEA,kBAAmB;IACvC4D,4BAA4B,EAAE/B,wBAAwB,CACpDnB,MAAM,CAACoB,SAAS,EAChBpB,MAAM,CAACqB,WACT,CAAE;IACF8B,SAAS,EAAE1C;EAAc,CAC1B,CAAC;AAEN,CAAC"}
@@ -0,0 +1,36 @@
1
+ export let CieErrorType = /*#__PURE__*/function (CieErrorType) {
2
+ CieErrorType[CieErrorType["GENERIC"] = 0] = "GENERIC";
3
+ CieErrorType[CieErrorType["TAG_NOT_VALID"] = 1] = "TAG_NOT_VALID";
4
+ CieErrorType[CieErrorType["WEB_VIEW_ERROR"] = 2] = "WEB_VIEW_ERROR";
5
+ CieErrorType[CieErrorType["NFC_ERROR"] = 3] = "NFC_ERROR";
6
+ CieErrorType[CieErrorType["AUTHENTICATION_ERROR"] = 4] = "AUTHENTICATION_ERROR";
7
+ CieErrorType[CieErrorType["PIN_ERROR"] = 5] = "PIN_ERROR";
8
+ CieErrorType[CieErrorType["PIN_LOCKED"] = 6] = "PIN_LOCKED";
9
+ CieErrorType[CieErrorType["CERTIFICATE_ERROR"] = 7] = "CERTIFICATE_ERROR";
10
+ return CieErrorType;
11
+ }({});
12
+ export class CieError extends Error {
13
+ constructor(options) {
14
+ super(options.message);
15
+ if (options.type) {
16
+ this.type = options.type;
17
+ } else {
18
+ this.type = CieErrorType.GENERIC;
19
+ }
20
+ if (this.type === CieErrorType.PIN_ERROR) {
21
+ this.attemptsLeft = options.attemptsLeft;
22
+ } else if (this.type === CieErrorType.PIN_LOCKED) {
23
+ this.attemptsLeft = 0;
24
+ }
25
+ this.name = this.constructor.name;
26
+ }
27
+ toString() {
28
+ return JSON.stringify({
29
+ name: this.name,
30
+ type: CieErrorType[this.type],
31
+ message: this.message,
32
+ attemptsLeft: this.attemptsLeft
33
+ });
34
+ }
35
+ }
36
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CieErrorType","CieError","Error","constructor","options","message","type","GENERIC","PIN_ERROR","attemptsLeft","PIN_LOCKED","name","toString","JSON","stringify"],"sourceRoot":"../../../src","sources":["cie/error.ts"],"mappings":"AAAA,WAAYA,YAAY,0BAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAZA,YAAY,CAAZA,YAAY;EAAA,OAAZA,YAAY;AAAA;AA4BxB,OAAO,MAAMC,QAAQ,SAASC,KAAK,CAAC;EAGlCC,WAAWA,CAACC,OAAqB,EAAE;IACjC,KAAK,CAACA,OAAO,CAACC,OAAO,CAAC;IAEtB,IAAID,OAAO,CAACE,IAAI,EAAE;MAChB,IAAI,CAACA,IAAI,GAAGF,OAAO,CAACE,IAAI;IAC1B,CAAC,MAAM;MACL,IAAI,CAACA,IAAI,GAAGN,YAAY,CAACO,OAAO;IAClC;IAEA,IAAI,IAAI,CAACD,IAAI,KAAKN,YAAY,CAACQ,SAAS,EAAE;MACxC,IAAI,CAACC,YAAY,GAAGL,OAAO,CAACK,YAAY;IAC1C,CAAC,MAAM,IAAI,IAAI,CAACH,IAAI,KAAKN,YAAY,CAACU,UAAU,EAAE;MAChD,IAAI,CAACD,YAAY,GAAG,CAAC;IACvB;IAEA,IAAI,CAACE,IAAI,GAAG,IAAI,CAACR,WAAW,CAACQ,IAAI;EACnC;EAEAC,QAAQA,CAAA,EAAW;IACjB,OAAOC,IAAI,CAACC,SAAS,CAAC;MACpBH,IAAI,EAAE,IAAI,CAACA,IAAI;MACfL,IAAI,EAAEN,YAAY,CAAC,IAAI,CAACM,IAAI,CAAC;MAC7BD,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBI,YAAY,EAAE,IAAI,CAACA;IACrB,CAAC,CAAC;EACJ;AACF"}
@@ -0,0 +1,4 @@
1
+ import { CieEvent, WebViewComponent } from "./component";
2
+ import { CieError, CieErrorType } from "./error";
3
+ export { WebViewComponent, CieError, CieErrorType, CieEvent };
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CieEvent","WebViewComponent","CieError","CieErrorType"],"sourceRoot":"../../../src","sources":["cie/index.ts"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,gBAAgB,QAAQ,aAAa;AACxD,SAASC,QAAQ,EAAEC,YAAY,QAAQ,SAAS;AAEhD,SAASF,gBAAgB,EAAEC,QAAQ,EAAEC,YAAY,EAAEH,QAAQ"}
@@ -0,0 +1,133 @@
1
+ import cieManager from "@pagopa/react-native-cie";
2
+ import { Platform } from "react-native";
3
+ import { CieEvent } from "./component";
4
+ import { CieError, CieErrorType } from "./error";
5
+ const BASE_UAT_URL = "https://collaudo.idserver.servizicie.interno.gov.it/idp/";
6
+ export const startCieAndroid = (useCieUat, ciePin, onError, onEvent, cieAuthorizationUri, continueWithUrl) => {
7
+ try {
8
+ cieManager.removeAllListeners();
9
+ cieManager.start().then(async () => {
10
+ cieManager.onEvent(handleCieEvent(onError, onEvent));
11
+ cieManager.onError(e => {
12
+ console.error(e);
13
+ return onError(new CieError({
14
+ message: e.message
15
+ }));
16
+ });
17
+ cieManager.onSuccess(handleCieSuccess(continueWithUrl));
18
+ await cieManager.setPin(ciePin);
19
+ cieManager.setAuthenticationUrl(cieAuthorizationUri);
20
+ cieManager.enableLog(useCieUat);
21
+ cieManager.setCustomIdpUrl(useCieUat ? getCieUatEndpoint() : null);
22
+ await cieManager.startListeningNFC();
23
+ onEvent(CieEvent.waiting_card);
24
+ }).catch(onError);
25
+ } catch {
26
+ onError(new CieError({
27
+ message: "Unable to start CIE NFC manager on iOS",
28
+ type: CieErrorType.NFC_ERROR
29
+ }));
30
+ }
31
+ };
32
+ export const startCieiOS = async (useCieUat, ciePin, onError, onEvent, cieAuthorizationUri, continueWithUrl) => {
33
+ try {
34
+ cieManager.removeAllListeners();
35
+ cieManager.onEvent(handleCieEvent(onError, onEvent));
36
+ cieManager.onError(e => onError(new CieError({
37
+ message: e.message
38
+ })));
39
+ cieManager.onSuccess(handleCieSuccess(continueWithUrl));
40
+ cieManager.enableLog(useCieUat);
41
+ cieManager.setCustomIdpUrl(useCieUat ? getCieUatEndpoint() : null);
42
+ await cieManager.setPin(ciePin);
43
+ cieManager.setAuthenticationUrl(cieAuthorizationUri);
44
+ cieManager.start().then(async () => {
45
+ await cieManager.startListeningNFC();
46
+ onEvent(CieEvent.waiting_card);
47
+ }).catch(onError);
48
+ } catch {
49
+ onError(new CieError({
50
+ message: "Unable to start CIE NFC manager on Android",
51
+ type: CieErrorType.NFC_ERROR
52
+ }));
53
+ }
54
+ };
55
+ const handleCieEvent = (onError, onEvent) => event => {
56
+ switch (event.event) {
57
+ // Reading starts
58
+ case "ON_TAG_DISCOVERED":
59
+ onEvent(CieEvent.reading);
60
+ break;
61
+ // "Function not supported" seems to be TAG_ERROR_NFC_NOT_SUPPORTED
62
+ // for the iOS SDK
63
+ case "Function not supported":
64
+ case "TAG_ERROR_NFC_NOT_SUPPORTED":
65
+ case "ON_TAG_DISCOVERED_NOT_CIE":
66
+ onError(new CieError({
67
+ message: `Invalid CIE card: ${event.event}`,
68
+ type: CieErrorType.TAG_NOT_VALID
69
+ }));
70
+ break;
71
+ case "AUTHENTICATION_ERROR":
72
+ case "ON_NO_INTERNET_CONNECTION":
73
+ onError(new CieError({
74
+ message: `Authentication error or no internet connection`,
75
+ type: CieErrorType.AUTHENTICATION_ERROR
76
+ }));
77
+ break;
78
+ case "EXTENDED_APDU_NOT_SUPPORTED":
79
+ onError(new CieError({
80
+ message: `APDU not supported`,
81
+ type: CieErrorType.NFC_ERROR
82
+ }));
83
+ break;
84
+ case "Transmission Error":
85
+ case "ON_TAG_LOST":
86
+ onError(new CieError({
87
+ message: `Trasmission error`,
88
+ type: CieErrorType.NFC_ERROR
89
+ }));
90
+ break;
91
+
92
+ // The card is temporarily locked. Unlock is available by CieID app
93
+ case "PIN Locked":
94
+ case "ON_CARD_PIN_LOCKED":
95
+ onError(new CieError({
96
+ message: `PIN locked`,
97
+ type: CieErrorType.PIN_LOCKED
98
+ }));
99
+ break;
100
+ case "ON_PIN_ERROR":
101
+ onError(new CieError({
102
+ message: `PIN locked`,
103
+ type: CieErrorType.PIN_ERROR,
104
+ attemptsLeft: event.attemptsLeft
105
+ }));
106
+ break;
107
+
108
+ // CIE is Expired or Revoked
109
+ case "CERTIFICATE_EXPIRED":
110
+ onError(new CieError({
111
+ message: `Certificate expired`,
112
+ type: CieErrorType.CERTIFICATE_ERROR
113
+ }));
114
+ break;
115
+ case "CERTIFICATE_REVOKED":
116
+ onError(new CieError({
117
+ message: `Certificate revoked`,
118
+ type: CieErrorType.CERTIFICATE_ERROR
119
+ }));
120
+ break;
121
+ default:
122
+ break;
123
+ }
124
+ };
125
+ const handleCieSuccess = continueWithUrl => url => {
126
+ continueWithUrl(decodeURIComponent(url));
127
+ };
128
+ const getCieUatEndpoint = () => Platform.select({
129
+ ios: `${BASE_UAT_URL}Authn/SSL/Login2`,
130
+ android: BASE_UAT_URL,
131
+ default: null
132
+ });
133
+ //# sourceMappingURL=manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cieManager","Platform","CieEvent","CieError","CieErrorType","BASE_UAT_URL","startCieAndroid","useCieUat","ciePin","onError","onEvent","cieAuthorizationUri","continueWithUrl","removeAllListeners","start","then","handleCieEvent","e","console","error","message","onSuccess","handleCieSuccess","setPin","setAuthenticationUrl","enableLog","setCustomIdpUrl","getCieUatEndpoint","startListeningNFC","waiting_card","catch","type","NFC_ERROR","startCieiOS","event","reading","TAG_NOT_VALID","AUTHENTICATION_ERROR","PIN_LOCKED","PIN_ERROR","attemptsLeft","CERTIFICATE_ERROR","url","decodeURIComponent","select","ios","android","default"],"sourceRoot":"../../../src","sources":["cie/manager.ts"],"mappings":"AAAA,OAAOA,UAAU,MAAgC,0BAA0B;AAC3E,SAASC,QAAQ,QAAQ,cAAc;AACvC,SAASC,QAAQ,QAAuC,aAAa;AACrE,SAASC,QAAQ,EAAEC,YAAY,QAAQ,SAAS;AAEhD,MAAMC,YAAY,GAAG,0DAA0D;AAI/E,OAAO,MAAMC,eAAe,GAAGA,CAC7BC,SAAkB,EAClBC,MAAc,EACdC,OAAgB,EAChBC,OAAmB,EACnBC,mBAA2B,EAC3BC,eAAgC,KAC7B;EACH,IAAI;IACFZ,UAAU,CAACa,kBAAkB,CAAC,CAAC;IAC/Bb,UAAU,CACPc,KAAK,CAAC,CAAC,CACPC,IAAI,CAAC,YAAY;MAChBf,UAAU,CAACU,OAAO,CAACM,cAAc,CAACP,OAAO,EAAEC,OAAO,CAAC,CAAC;MACpDV,UAAU,CAACS,OAAO,CAAEQ,CAAQ,IAAK;QAC/BC,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;QAChB,OAAOR,OAAO,CAAC,IAAIN,QAAQ,CAAC;UAAEiB,OAAO,EAAEH,CAAC,CAACG;QAAQ,CAAC,CAAC,CAAC;MACtD,CAAC,CAAC;MACFpB,UAAU,CAACqB,SAAS,CAACC,gBAAgB,CAACV,eAAe,CAAC,CAAC;MACvD,MAAMZ,UAAU,CAACuB,MAAM,CAACf,MAAM,CAAC;MAC/BR,UAAU,C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D;;IAEF;IACA,KAAK,YAAY;IACjB,KAAK,oBAAoB;MACvBvB,OAAO,CACL,IAAIN,QAAQ,CAAC;QACXiB,OAAO,EAAG,YAAW;QACrBW,IAAI,EAAE3B,YAAY,CAACkC;MACrB,CAAC,CACH,CAAC;MACD;IACF,KAAK,cAAc;MACjB7B,OAAO,CACL,IAAIN,QAAQ,CAAC;QACXiB,OAAO,EAAG,YAAW;QACrBW,IAAI,EAAE3B,YAAY,CAACmC,SAAS;QAC5BC,YAAY,EAAEN,KAAK,CAACM;MACtB,CAAC,CACH,CAAC;MACD;;IAEF;IACA,KAAK,qBAAqB;MACxB/B,OAAO,CACL,IAAIN,QAAQ,CAAC;QACXiB,OAAO,EAAG,qBAAoB;QAC9BW,IAAI,EAAE3B,YAAY,CAACqC;MACrB,CAAC,CACH,CAAC;MACD;IACF,KAAK,qBAAqB;MACxBhC,OAAO,CACL,IAAIN,QAAQ,CAAC;QACXiB,OAAO,EAAG,qBAAoB;QAC9BW,IAAI,EAAE3B,YAAY,CAACqC;MACrB,CAAC,CACH,CAAC;MAED;IAEF;MACE;EACJ;AACF,CAAC;AAEH,MAAMnB,gBAAgB,GACnBV,eAAgC,IAAM8B,GAAW,IAAK;EACrD9B,eAAe,CAAC+B,kBAAkB,CAACD,GAAG,CAAC,CAAC;AAC1C,CAAC;AAEH,MAAMf,iBAAiB,GAAGA,CAAA,KACxB1B,QAAQ,CAAC2C,MAAM,CAAC;EACdC,GAAG,EAAG,GAAExC,YAAa,kBAAiB;EACtCyC,OAAO,EAAEzC,YAAY;EACrB0C,OAAO,EAAE;AACX,CAAC,CAAC"}
@@ -21,10 +21,13 @@ export const getWalletProviderClient = context => {
21
21
  } = context;
22
22
  return createWalletProviderApiClient((method, url, params) => appFetch(url, {
23
23
  method,
24
- body: params ? JSON.stringify(params.body) : undefined
24
+ body: params ? JSON.stringify(params.body) : undefined,
25
+ headers: {
26
+ "Content-Type": "application/json"
27
+ }
25
28
  }).then(validateResponse).then(res => {
26
29
  const contentType = res.headers.get("content-type");
27
- if (contentType === "application/json") {
30
+ if (contentType !== null && contentType !== void 0 && contentType.includes("application/json")) {
28
31
  return res.json();
29
32
  }
30
33
  return res.text();
@@ -1 +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
+ {"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","headers","then","res","contentType","get","includes","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,SAAS;IACtDC,OAAO,EAAE;MACP,cAAc,EAAE;IAClB;EACF,CAAC,CAAC,CACCC,IAAI,CAACvB,gBAAgB,CAAC,CACtBuB,IAAI,CAAEC,GAAG,IAAK;IACb,MAAMC,WAAW,GAAGD,GAAG,CAACF,OAAO,CAACI,GAAG,CAAC,cAAc,CAAC;IACnD,IAAID,WAAW,aAAXA,WAAW,eAAXA,WAAW,CAAEE,QAAQ,CAAC,kBAAkB,CAAC,EAAE;MAC7C,OAAOH,GAAG,CAACnB,IAAI,CAAC,CAAC;IACnB;IACA,OAAOmB,GAAG,CAACI,IAAI,CAAC,CAAC;EACnB,CAAC,CAAC,EACNhB,qBACF,CAAC;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
- import { generateRandomAlphaNumericString } from "../../../src/utils/misc";
2
- import { makeParRequest } from "../../../src/utils/par";
1
+ import { generateRandomAlphaNumericString } from "../../utils/misc";
2
+ import { makeParRequest } from "../../utils/par";
3
3
  import { ASSERTION_TYPE } from "./const";
4
4
  /**
5
5
  * Ensures that the credential type requested is supported by the issuer and contained in the
@@ -1 +1 @@
1
- {"version":3,"names":["generateRandomAlphaNumericString","makeParRequest","ASSERTION_TYPE","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","startUserAuthorization","ctx","wiaCryptoContext","walletInstanceAttestation","redirectUri","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","parEndpoint","pushed_authorization_request_endpoint","credentialDefinition","getPar","issuerRequestUri"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":"AAEA,SACEA,gCAAgC,QAE3B,yBAAyB;AAIhC,SAA8BC,cAAc,QAAQ,wBAAwB;AAC5E,SAASC,cAAc,QAAQ,SAAS;AAkBxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CACjCC,UAAkD,EAClDC,cAAgD,KACxB;EACxB,MAAMC,mCAAmC,GACvCF,UAAU,CAACG,wBAAwB,CAACD,mCAAmC;EAEzE,MAAM,CAACE,MAAM,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACJ,mCAAmC,CAAC,CAC9DK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACR,cAAc,CAAC,CAAC,CACzCS,GAAG,CAAEF,CAAC,KAAM;IACXG,2BAA2B,EAAEV,cAAc;IAC3CW,MAAM,EAAEV,mCAAmC,CAACM,CAAC,CAAC,CAAEI,MAAM;IACtDC,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEL,IAAI,CAACT,MAAM,EAAE;IACX,MAAM,IAAIU,KAAK,CAAE,mCAAkCb,cAAe,GAAE,CAAC;EACvE;EACA,OAAOG,MAAM;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMW,kBAAkB,GAAGA,CACzBf,UAAkD,EAClDC,cAAgD,KAC/B;EACjB,MAAMe,qBAAqB,GACzBhB,UAAU,CAACiB,0BAA0B,CAACC,wBAAwB;EAEhE,MAAMC,YAAY,GAChBlB,cAAc,KAAK,0BAA0B,GAAG,OAAO,GAAG,eAAe;EAE3E,IAAI,CAACe,qBAAqB,CAACP,QAAQ,CAACU,YAAY,CAAC,EAAE;IACjD,MAAM,IAAIL,KAAK,CAAE,sCAAqCb,cAAe,GAAE,CAAC;EAC1E;EAEA,OAAOkB,YAAY;AACrB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAA8C,GAAG,MAAAA,CAC5DpB,UAAU,EACVC,cAAc,EACdoB,GAAG,KACA;EACH,MAAM;IACJC,gBAAgB;IAChBC,yBAAyB;IACzBC,WAAW;IACXC,QAAQ,GAAGC;EACb,CAAC,GAAGL,GAAG;EAEP,MAAMM,QAAQ,GAAG,MAAML,gBAAgB,CAACM,YAAY,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,CAAC;EACzE,MAAMC,YAAY,GAAGpC,gCAAgC,CAAC,EAAE,CAAC;EACzD,MAAMqC,WAAW,GACfjC,UAAU,CAACiB,0BAA0B,CAACiB,qCAAqC;EAC7E,MAAMC,oBAAoB,GAAGpC,0BAA0B,CACrDC,UAAU,EACVC,cACF,CAAC;EACD,MAAMkB,YAAY,GAAGJ,kBAAkB,CAACf,UAAU,EAAEC,cAAc,CAAC;EAEnE,MAAMmC,MAAM,GAAGvC,cAAc,CAAC;IAAEyB,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAC7D,MAAMY,gBAAgB,GAAG,MAAMD,MAAM,CACnCT,QAAQ,EACRK,YAAY,EACZR,WAAW,EACXL,YAAY,EACZc,WAAW,EACXV,yBAAyB,EACzB,CAACY,oBAAoB,CAAC,EACtBrC,cACF,CAAC;EAED,OAAO;IAAEuC,gBAAgB;IAAEV,QAAQ;IAAEK,YAAY;IAAEG;EAAqB,CAAC;AAC3E,CAAC"}
1
+ {"version":3,"names":["generateRandomAlphaNumericString","makeParRequest","ASSERTION_TYPE","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","startUserAuthorization","ctx","wiaCryptoContext","walletInstanceAttestation","redirectUri","appFetch","fetch","clientId","getPublicKey","then","_","kid","codeVerifier","parEndpoint","pushed_authorization_request_endpoint","credentialDefinition","getPar","issuerRequestUri"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":"AAEA,SAASA,gCAAgC,QAAkB,kBAAkB;AAG7E,SAA8BC,cAAc,QAAQ,iBAAiB;AACrE,SAASC,cAAc,QAAQ,SAAS;AAkBxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,0BAA0B,GAAGA,CACjCC,UAAkD,EAClDC,cAAgD,KACxB;EACxB,MAAMC,mCAAmC,GACvCF,UAAU,CAACG,wBAAwB,CAACD,mCAAmC;EAEzE,MAAM,CAACE,MAAM,CAAC,GAAGC,MAAM,CAACC,IAAI,CAACJ,mCAAmC,CAAC,CAC9DK,MAAM,CAAEC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACR,cAAc,CAAC,CAAC,CACzCS,GAAG,CAAEF,CAAC,KAAM;IACXG,2BAA2B,EAAEV,cAAc;IAC3CW,MAAM,EAAEV,mCAAmC,CAACM,CAAC,CAAC,CAAEI,MAAM;IACtDC,IAAI,EAAE;EACR,CAAC,CAAC,CAAC;EAEL,IAAI,CAACT,MAAM,EAAE;IACX,MAAM,IAAIU,KAAK,CAAE,mCAAkCb,cAAe,GAAE,CAAC;EACvE;EACA,OAAOG,MAAM;AACf,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAMW,kBAAkB,GAAGA,CACzBf,UAAkD,EAClDC,cAAgD,KAC/B;EACjB,MAAMe,qBAAqB,GACzBhB,UAAU,CAACiB,0BAA0B,CAACC,wBAAwB;EAEhE,MAAMC,YAAY,GAChBlB,cAAc,KAAK,0BAA0B,GAAG,OAAO,GAAG,eAAe;EAE3E,IAAI,CAACe,qBAAqB,CAACP,QAAQ,CAACU,YAAY,CAAC,EAAE;IACjD,MAAM,IAAIL,KAAK,CAAE,sCAAqCb,cAAe,GAAE,CAAC;EAC1E;EAEA,OAAOkB,YAAY;AACrB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAA8C,GAAG,MAAAA,CAC5DpB,UAAU,EACVC,cAAc,EACdoB,GAAG,KACA;EACH,MAAM;IACJC,gBAAgB;IAChBC,yBAAyB;IACzBC,WAAW;IACXC,QAAQ,GAAGC;EACb,CAAC,GAAGL,GAAG;EAEP,MAAMM,QAAQ,GAAG,MAAML,gBAAgB,CAACM,YAAY,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,GAAG,CAAC;EACzE,MAAMC,YAAY,GAAGpC,gCAAgC,CAAC,EAAE,CAAC;EACzD,MAAMqC,WAAW,GACfjC,UAAU,CAACiB,0BAA0B,CAACiB,qCAAqC;EAC7E,MAAMC,oBAAoB,GAAGpC,0BAA0B,CACrDC,UAAU,EACVC,cACF,CAAC;EACD,MAAMkB,YAAY,GAAGJ,kBAAkB,CAACf,UAAU,EAAEC,cAAc,CAAC;EAEnE,MAAMmC,MAAM,GAAGvC,cAAc,CAAC;IAAEyB,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAC7D,MAAMY,gBAAgB,GAAG,MAAMD,MAAM,CACnCT,QAAQ,EACRK,YAAY,EACZR,WAAW,EACXL,YAAY,EACZc,WAAW,EACXV,yBAAyB,EACzB,CAACY,oBAAoB,CAAC,EACtBrC,cACF,CAAC;EAED,OAAO;IAAEuC,gBAAgB;IAAEV,QAAQ;IAAEK,YAAY;IAAEG;EAAqB,CAAC;AAC3E,CAAC"}
@@ -1,4 +1,4 @@
1
- import { AuthorizationErrorShape, AuthorizationResultShape } from "../../../src/utils/auth";
1
+ import { AuthorizationErrorShape, AuthorizationResultShape } from "../../utils/auth";
2
2
  import { until } from "../../utils/misc";
3
3
  import parseUrl from "parse-url";
4
4
  import { AuthorizationError, AuthorizationIdpError } from "../../utils/errors";
@@ -66,6 +66,9 @@ export const completeUserAuthorizationWithQueryMode = async (issuerRequestUri, c
66
66
  throw new AuthorizationError("Invalid authentication redirect url");
67
67
  }
68
68
  }
69
+ return parseAuthRedirectUrl(authRedirectUrl);
70
+ };
71
+ export const parseAuthRedirectUrl = authRedirectUrl => {
69
72
  const urlParse = parseUrl(authRedirectUrl);
70
73
  const authRes = AuthorizationResultShape.safeParse(urlParse.query);
71
74
  if (!authRes.success) {
@@ -1 +1 @@
1
- {"version":3,"names":["AuthorizationErrorShape","AuthorizationResultShape","until","parseUrl","AuthorizationError","AuthorizationIdpError","Linking","completeUserAuthorizationWithQueryMode","issuerRequestUri","clientId","issuerConf","idpHint","redirectUri","authorizationContext","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","authRedirectUrl","redirectSchema","URL","protocol","replace","authorize","catch","e","message","addEventListener","_ref","url","includes","openAuthUrlInBrowser","openURL","unitAuthRedirectIsNotUndefined","undefined","Promise","all","urlParse","authRes","safeParse","query","success","authErr","error","data","error_description","completeUserAuthorizationWithFormPostJwtMode","Error"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,wBAAwB,QAGnB,yBAAyB;AAChC,SAASC,KAAK,QAAkB,kBAAkB;AAElD,OAAOC,QAAQ,MAAM,WAAW;AAChC,SAASC,kBAAkB,EAAEC,qBAAqB,QAAQ,oBAAoB;AAE9E,SAASC,OAAO,QAAQ,cAAc;;AAEtC;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sCAA8E,GACzF,MAAAA,CACEC,gBAAgB,EAChBC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,WAAW,EACXC,oBAAoB,KACjB;EACH;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EAEA,MAAMsC,QAAQ,GAAGvC,QAAQ,CAACoB,eAAe,CAAC;EAC1C,MAAMoB,OAAO,GAAG1C,wBAAwB,CAAC2C,SAAS,CAACF,QAAQ,CAACG,KAAK,CAAC;EAClE,IAAI,CAACF,OAAO,CAACG,OAAO,EAAE;IACpB,MAAMC,OAAO,GAAG/C,uBAAuB,CAAC4C,SAAS,CAACF,QAAQ,CAACG,KAAK,CAAC;IACjE,IAAI,CAACE,OAAO,CAACD,OAAO,EAAE;MACpB,MAAM,IAAI1C,kBAAkB,CAACuC,OAAO,CAACK,KAAK,CAACjB,OAAO,CAAC,CAAC,CAAC;IACvD;;IACA,MAAM,IAAI1B,qBAAqB,CAC7B0C,OAAO,CAACE,IAAI,CAACD,KAAK,EAClBD,OAAO,CAACE,IAAI,CAACC,iBACf,CAAC;EACH;EACA,OAAOP,OAAO,CAACM,IAAI;AACrB,CAAC;;AAEH;AACA,OAAO,MAAME,4CAA4C,GAAGA,CAAA,KAAM;EAChE,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;AACpC,CAAC"}
1
+ {"version":3,"names":["AuthorizationErrorShape","AuthorizationResultShape","until","parseUrl","AuthorizationError","AuthorizationIdpError","Linking","completeUserAuthorizationWithQueryMode","issuerRequestUri","clientId","issuerConf","idpHint","redirectUri","authorizationContext","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","authRedirectUrl","redirectSchema","URL","protocol","replace","authorize","catch","e","message","addEventListener","_ref","url","includes","openAuthUrlInBrowser","openURL","unitAuthRedirectIsNotUndefined","undefined","Promise","all","parseAuthRedirectUrl","urlParse","authRes","safeParse","query","success","authErr","error","data","error_description","completeUserAuthorizationWithFormPostJwtMode","Error"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,wBAAwB,QAGnB,kBAAkB;AACzB,SAASC,KAAK,QAAkB,kBAAkB;AAEl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,oBAAoB,GAAG9B,OAAO,CAAC+B,OAAO,CAACf,OAAO,CAAC;;IAErD;AACN;AACA;AACA;IACM,MAAMgB,8BAA8B,GAAGpC,KAAK,CAC1C,MAAMqB,eAAe,KAAKgB,SAAS,EACnC,GACF,CAAC;IAED,MAAMC,OAAO,CAACC,GAAG,CAAC,CAACL,oBAAoB,EAAEE,8BAA8B,CAAC,CAAC;IAEzE,IAAIf,eAAe,KAAKgB,SAAS,EAAE;MACjC,MAAM,IAAInC,kBAAkB,CAAC,qCAAqC,CAAC;IACrE;EACF;EACA,OAAOsC,oBAAoB,CAACnB,eAAe,CAAC;AAC9C,CAAC;AAEH,OAAO,MAAMmB,oBAAoB,GAAInB,eAAuB,IAAK;EAC/D,MAAMoB,QAAQ,GAAGxC,QAAQ,CAACoB,eAAe,CAAC;EAC1C,MAAMqB,OAAO,GAAG3C,wBAAwB,CAAC4C,SAAS,CAACF,QAAQ,CAACG,KAAK,CAAC;EAClE,IAAI,CAACF,OAAO,CAACG,OAAO,EAAE;IACpB,MAAMC,OAAO,GAAGhD,uBAAuB,CAAC6C,SAAS,CAACF,QAAQ,CAACG,KAAK,CAAC;IACjE,IAAI,CAACE,OAAO,CAACD,OAAO,EAAE;MACpB,MAAM,IAAI3C,kBAAkB,CAACwC,OAAO,CAACK,KAAK,CAAClB,OAAO,CAAC,CAAC,CAAC;IACvD;;IACA,MAAM,IAAI1B,qBAAqB,CAC7B2C,OAAO,CAACE,IAAI,CAACD,KAAK,EAClBD,OAAO,CAACE,IAAI,CAACC,iBACf,CAAC;EACH;EACA,OAAOP,OAAO,CAACM,IAAI;AACrB,CAAC;;AAED;AACA,OAAO,MAAME,4CAA4C,GAAGA,CAAA,KAAM;EAChE,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;AACpC,CAAC"}
@@ -1,12 +1,12 @@
1
- import { hasStatus } from "../../../src/utils/misc";
2
- import { withEphemeralKey } from "../../../src/utils/crypto";
3
- import { createDPopToken } from "../../../src/utils/dpop";
1
+ import { hasStatus } from "../../utils/misc";
2
+ import { withEphemeralKey } from "../../utils/crypto";
3
+ import { createDPopToken } from "../../utils/dpop";
4
4
  import uuid from "react-native-uuid";
5
- import { createPopToken } from "../../../src/utils/pop";
5
+ import { createPopToken } from "../../utils/pop";
6
6
  import * as WalletInstanceAttestation from "../../wallet-instance-attestation";
7
7
  import { ASSERTION_TYPE } from "./const";
8
8
  import { TokenResponse } from "./types";
9
- import { ValidationFailed } from "../../../src/utils/errors";
9
+ import { ValidationFailed } from "../../utils/errors";
10
10
  /**
11
11
  * Creates and sends the DPoP Proof JWT to be presented with the authorization code to the /token endpoint of the authorization server
12
12
  * for requesting the issuance of an access token bound to the public key of the Wallet Instance contained within the DPoP.
@@ -1 +1 @@
1
- {"version":3,"names":["hasStatus","withEphemeralKey","createDPopToken","uuid","createPopToken","WalletInstanceAttestation","ASSERTION_TYPE","TokenResponse","ValidationFailed","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","ephimeralContext","htm","htu","jti","v4","signedWiaPoP","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","res","json","safeParse","success","error","message","accessToken","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":"AAAA,SAASA,SAAS,QAAkB,yBAAyB;AAG7D,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,eAAe,QAAQ,yBAAyB;AACzD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,cAAc,QAAQ,wBAAwB;AACvD,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAE9E,SAASC,cAAc,QAAQ,SAAS;AACx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,QAAQ;IACnBD,IAAI;IACJmC,YAAY,EAAEjC,WAAW;IACzBkC,aAAa,EAAEjC,YAAY;IAC3BkC,qBAAqB,EAAE1C,cAAc;IACrC2C,gBAAgB,EAAE/B,yBAAyB,GAAG,GAAG,GAAGwB;EACtD,CAAC;EAED,MAAMQ,4BAA4B,GAAG,IAAIC,eAAe,CAACR,WAAW,CAAC;EACrE,MAAMS,QAAQ,GAAG,MAAMpC,QAAQ,CAACkB,QAAQ,EAAE;IACxCmB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAEnB;IACR,CAAC;IACDoB,IAAI,EAAEN,4BAA4B,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACCC,IAAI,CAAC1D,SAAS,CAAC,GAAG,CAAC,CAAC,CACpB0D,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEF,IAAI,IAAKjD,aAAa,CAACsD,SAAS,CAACL,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACU,OAAO,EAAE;IACrB,MAAM,IAAItD,gBAAgB,CAAC4C,QAAQ,CAACW,KAAK,CAACC,OAAO,CAAC;EACpD;EAEA,OAAO;IAAEC,WAAW,EAAEb,QAAQ,CAACc,IAAI;IAAE9B;EAAuB,CAAC;AAC/D,CAAC"}
1
+ {"version":3,"names":["hasStatus","withEphemeralKey","createDPopToken","uuid","createPopToken","WalletInstanceAttestation","ASSERTION_TYPE","TokenResponse","ValidationFailed","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","ephimeralContext","htm","htu","jti","v4","signedWiaPoP","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","res","json","safeParse","success","error","message","accessToken","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":"AAAA,SAASA,SAAS,QAAkB,kBAAkB;AAGtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,kBAAkB;AAClD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAE9E,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAgBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAgC,GAAG,MAAAA,CAC9CC,UAAU,EACVC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,YAAY,EACZC,OAAO,KACJ;EACH,MAAM;IACJC,QAAQ,GAAGC,KAAK;IAChBC,yBAAyB;IACzBC;EACF,CAAC,GAAGJ,OAAO;EAEX,MAAMK,WAAW,GACfV,UAAU,CAACW,0BAA0B,CAACC,qCAAqC;EAC7E,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAACJ,WAAW,CAAC;EACnC,MAAMK,GAAG,GAAI,GAAEF,MAAM,CAACG,QAAS,KAAIH,MAAM,CAACI,QAAS,EAAC;EACpD,MAAMC,GAAG,GAAGvB,yBAAyB,CAACwB,MAAM,CAACX,yBAAyB,CAAC,CACpEY,OAAO,CAACC,GAAG,CAACC,GAAG,CAACC,GAAG;EAEtB,MAAMC,QAAQ,GAAGxB,UAAU,CAACW,0BAA0B,CAACc,cAAc;EACrE;EACA,MAAMC,sBAAsB,GAAG,MAAMnC,gBAAgB,CACnD,MAAOoC,gBAAgB,IAAK;IAC1B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,EAAEb,QAAQ,CAACc,IAAI;IAAE9B;EAAuB,CAAC;AAC/D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { SignJWT } from "@pagopa/io-react-native-jwt";
2
- import { hasStatus } from "../../../src/utils/misc";
3
- import { ValidationFailed } from "../../../src/utils/errors";
2
+ import { hasStatus } from "../../utils/misc";
3
+ import { ValidationFailed } from "../../utils/errors";
4
4
  import { CredentialResponse } from "./types";
5
5
  export const createNonceProof = async (nonce, issuer, audience, ctx) => {
6
6
  const jwk = await ctx.getPublicKey();
@@ -1 +1 @@
1
- {"version":3,"names":["SignJWT","hasStatus","ValidationFailed","CredentialResponse","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","tokenRequestSignedDPop","context","credentialCryptoContext","appFetch","fetch","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","credentialRes","method","headers","DPoP","Authorization","token_type","access_token","body","JSON","stringify","then","res","json","safeParse","success","error","message","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":"AAAA,SAASA,OAAO,QAA4B,6BAA6B;AAGzE,SAASC,SAAS,QAAkB,yBAAyB;AAE7D,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,kBAAkB,QAAQ,SAAS;AAc5C,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAAkB,KACE;EACpB,MAAMC,GAAG,GAAG,MAAMD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,OAAO,IAAIV,OAAO,CAACQ,GAAG,CAAC,CACpBG,UAAU,CAAC;IACVN;EACF,CAAC,CAAC,CACDO,kBAAkB,CAA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,gBAAgB;MACrBa,UAAU,EAAE;IACd;EACF,CAAC;EAED,MAAMC,aAAa,GAAG,MAAMnB,QAAQ,CAACE,aAAa,EAAE;IAClDkB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,kBAAkB;MAClCC,IAAI,EAAEzB,sBAAsB;MAC5B0B,aAAa,EAAG,GAAE7B,WAAW,CAAC8B,UAAW,IAAG9B,WAAW,CAAC+B,YAAa;IACvE,CAAC;IACDC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACd,yBAAyB;EAChD,CAAC,CAAC,CACCe,IAAI,CAACvD,SAAS,CAAC,GAAG,CAAC,CAAC,CACpBuD,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEH,IAAI,IAAKlD,kBAAkB,CAACwD,SAAS,CAACN,IAAI,CAAC,CAAC;EAErD,IAAI,CAACP,aAAa,CAACc,OAAO,EAAE;IAC1B,MAAM,IAAI1D,gBAAgB,CAAC4C,aAAa,CAACe,KAAK,CAACC,OAAO,CAAC;EACzD;EAEA,OAAOhB,aAAa,CAACiB,IAAI;AAC3B,CAAC"}
1
+ {"version":3,"names":["SignJWT","hasStatus","ValidationFailed","CredentialResponse","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","tokenRequestSignedDPop","context","credentialCryptoContext","appFetch","fetch","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","credentialRes","method","headers","DPoP","Authorization","token_type","access_token","body","JSON","stringify","then","res","json","safeParse","success","error","message","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":"AAAA,SAASA,OAAO,QAA4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CAACE,MAAM,KAAKhB,oBAAoB,CAACgB,MAAM,IACxCF,CAAC,CAACG,IAAI,KAAKjB,oBAAoB,CAACiB,IACpC,CAAC;EAED,IAAI,CAACN,6BAA6B,EAAE;IAClC,MAAM,IAAIhC,gBAAgB,CACxB,qEACF,CAAC;EACH;;EAEA;EACA,MAAMuC,yBAAyB,GAAG;IAChCC,qBAAqB,EAAE;MACrBF,IAAI,EAAE,CAACjB,oBAAoB,CAACe,2BAA2B;IACzD,CAAC;IACDC,MAAM,EAAEhB,oBAAoB,CAACgB,MAAM;IACnCI,KAAK,EAAE;MACLC,GAAG,EAAEZ,gBAAgB;MACrBa,UAAU,EAAE;IACd;EACF,CAAC;EAED,MAAMC,aAAa,GAAG,MAAMnB,QAAQ,CAACE,aAAa,EAAE;IAClDkB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,kBAAkB;MAClCC,IAAI,EAAEzB,sBAAsB;MAC5B0B,aAAa,EAAG,GAAE7B,WAAW,CAAC8B,UAAW,IAAG9B,WAAW,CAAC+B,YAAa;IACvE,CAAC;IACDC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACd,yBAAyB;EAChD,CAAC,CAAC,CACCe,IAAI,CAACvD,SAAS,CAAC,GAAG,CAAC,CAAC,CACpBuD,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEH,IAAI,IAAKlD,kBAAkB,CAACwD,SAAS,CAACN,IAAI,CAAC,CAAC;EAErD,IAAI,CAACP,aAAa,CAACc,OAAO,EAAE;IAC1B,MAAM,IAAI1D,gBAAgB,CAAC4C,aAAa,CAACe,KAAK,CAACC,OAAO,CAAC;EACzD;EAEA,OAAOhB,aAAa,CAACiB,IAAI;AAC3B,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { evaluateIssuerTrust } from "./02-evaluate-issuer-trust";
2
2
  import { startUserAuthorization } from "./03-start-user-authorization";
3
- import { completeUserAuthorizationWithQueryMode } from "./04-complete-user-authorization";
3
+ import { completeUserAuthorizationWithQueryMode, parseAuthRedirectUrl } from "./04-complete-user-authorization";
4
4
  import { authorizeAccess } from "./05-authorize-access";
5
5
  import { obtainCredential } from "./06-obtain-credential";
6
6
  import { verifyAndParseCredential } from "./07-verify-and-parse-credential";
7
- export { evaluateIssuerTrust, startUserAuthorization, completeUserAuthorizationWithQueryMode, authorizeAccess, obtainCredential, verifyAndParseCredential };
7
+ export { evaluateIssuerTrust, startUserAuthorization, completeUserAuthorizationWithQueryMode, authorizeAccess, obtainCredential, verifyAndParseCredential, parseAuthRedirectUrl };
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["evaluateIssuerTrust","startUserAuthorization","completeUserAuthorizationWithQueryMode","authorizeAccess","obtainCredential","verifyAndParseCredential"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":"AACA,SACEA,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,+BAA+B;AACtC,SACEC,sCAAsC,QAEjC,kCAAkC;AACzC,SAASC,eAAe,QAA8B,uBAAuB;AAC7E,SACEC,gBAAgB,QAEX,wBAAwB;AAC/B,SACEC,wBAAwB,QAEnB,kCAAkC;AAEzC,SACEL,mBAAmB,EACnBC,sBAAsB,EACtBC,sCAAsC,EACtCC,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB"}
1
+ {"version":3,"names":["evaluateIssuerTrust","startUserAuthorization","completeUserAuthorizationWithQueryMode","parseAuthRedirectUrl","authorizeAccess","obtainCredential","verifyAndParseCredential"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":"AACA,SACEA,mBAAmB,QAEd,4BAA4B;AACnC,SACEC,sBAAsB,QAEjB,+BAA+B;AACtC,SACEC,sCAAsC,EACtCC,oBAAoB,QAEf,kCAAkC;AACzC,SAASC,eAAe,QAA8B,uBAAuB;AAC7E,SACEC,gBAAgB,QAEX,wBAAwB;AAC/B,SACEC,wBAAwB,QAEnB,kCAAkC;AAEzC,SACEN,mBAAmB,EACnBC,sBAAsB,EACtBC,sCAAsC,EACtCE,eAAe,EACfC,gBAAgB,EAChBC,wBAAwB,EACxBH,oBAAoB"}
@@ -9,7 +9,8 @@ import * as Errors from "./utils/errors";
9
9
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
10
10
  import * as Trust from "./trust";
11
11
  import * as WalletInstance from "./wallet-instance";
12
+ import * as Cie from "./cie";
12
13
  import { AuthorizationDetail, AuthorizationDetails } from "./utils/par";
13
14
  import { createCryptoContextFor } from "./utils/crypto";
14
- export { SdJwt, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey };
15
+ export { SdJwt, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey, Cie };
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["fixBase64EncodingOnKey","Credential","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","AuthorizationDetail","AuthorizationDetails","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,aAAa;AACpD;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,aAAa;AACvE,SAASC,sBAAsB,QAAQ,gBAAgB;AAGvD,SACEP,KAAK,EACLD,GAAG,EACHD,UAAU,EACVI,yBAAyB,EACzBE,cAAc,EACdH,MAAM,EACNE,KAAK,EACLI,sBAAsB,EACtBF,mBAAmB,EACnBC,oBAAoB,EACpBT,sBAAsB"}
1
+ {"version":3,"names":["fixBase64EncodingOnKey","Credential","PID","SdJwt","Errors","WalletInstanceAttestation","Trust","WalletInstance","Cie","AuthorizationDetail","AuthorizationDetails","createCryptoContextFor"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AACA,SAASA,sBAAsB,QAAQ,aAAa;AACpD;AACA;AACA,OAAO,gCAAgC;AAEvC,OAAO,KAAKC,UAAU,MAAM,cAAc;AAC1C,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,OAAO,KAAKC,KAAK,MAAM,UAAU;AACjC,OAAO,KAAKC,MAAM,MAAM,gBAAgB;AACxC,OAAO,KAAKC,yBAAyB,MAAM,+BAA+B;AAC1E,OAAO,KAAKC,KAAK,MAAM,SAAS;AAChC,OAAO,KAAKC,cAAc,MAAM,mBAAmB;AACnD,OAAO,KAAKC,GAAG,MAAM,OAAO;AAC5B,SAASC,mBAAmB,EAAEC,oBAAoB,QAAQ,aAAa;AACvE,SAASC,sBAAsB,QAAQ,gBAAgB;AAGvD,SACER,KAAK,EACLD,GAAG,EACHD,UAAU,EACVI,yBAAyB,EACzBE,cAAc,EACdH,MAAM,EACNE,KAAK,EACLK,sBAAsB,EACtBF,mBAAmB,EACnBC,oBAAoB,EACpBV,sBAAsB,EACtBQ,GAAG"}