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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) 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/04-complete-user-authorization.js +6 -2
  12. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  13. package/lib/commonjs/credential/issuance/index.js +6 -0
  14. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  15. package/lib/commonjs/index.js +3 -1
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/module/cie/component.js +171 -0
  18. package/lib/module/cie/component.js.map +1 -0
  19. package/lib/module/cie/error.js +36 -0
  20. package/lib/module/cie/error.js.map +1 -0
  21. package/lib/module/cie/index.js +4 -0
  22. package/lib/module/cie/index.js.map +1 -0
  23. package/lib/module/cie/manager.js +133 -0
  24. package/lib/module/cie/manager.js.map +1 -0
  25. package/lib/module/client/index.js +5 -2
  26. package/lib/module/client/index.js.map +1 -1
  27. package/lib/module/credential/issuance/04-complete-user-authorization.js +3 -0
  28. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  29. package/lib/module/credential/issuance/index.js +2 -2
  30. package/lib/module/credential/issuance/index.js.map +1 -1
  31. package/lib/module/index.js +2 -1
  32. package/lib/module/index.js.map +1 -1
  33. package/lib/typescript/cie/component.d.ts +46 -0
  34. package/lib/typescript/cie/component.d.ts.map +1 -0
  35. package/lib/typescript/cie/error.d.ts +31 -0
  36. package/lib/typescript/cie/error.d.ts.map +1 -0
  37. package/lib/typescript/cie/index.d.ts +4 -0
  38. package/lib/typescript/cie/index.d.ts.map +1 -0
  39. package/lib/typescript/cie/manager.d.ts +5 -0
  40. package/lib/typescript/cie/manager.d.ts.map +1 -0
  41. package/lib/typescript/client/index.d.ts.map +1 -1
  42. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +5 -0
  43. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  44. package/lib/typescript/credential/issuance/index.d.ts +2 -2
  45. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  46. package/lib/typescript/index.d.ts +2 -1
  47. package/lib/typescript/index.d.ts.map +1 -1
  48. package/package.json +6 -2
  49. package/src/cie/component.tsx +216 -0
  50. package/src/cie/error.ts +58 -0
  51. package/src/cie/index.ts +4 -0
  52. package/src/cie/manager.ts +183 -0
  53. package/src/client/index.ts +4 -1
  54. package/src/credential/issuance/04-complete-user-authorization.ts +16 -13
  55. package/src/credential/issuance/index.ts +2 -0
  56. package/src/index.ts +2 -0
  57. package/lib/commonjs/credential/issuance/03-start-credential-issuance.js +0 -287
  58. package/lib/commonjs/credential/issuance/03-start-credential-issuance.js.map +0 -1
  59. package/lib/module/credential/issuance/03-start-credential-issuance.js +0 -276
  60. package/lib/module/credential/issuance/03-start-credential-issuance.js.map +0 -1
  61. package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts +0 -41
  62. package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts.map +0 -1
  63. package/src/credential/issuance/03-start-credential-issuance.ts +0 -407
@@ -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;AAC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ElD,YAAY,CAACmD;MACrB,CAAC,CACH,CAAC;IACH,CAAC,MAAM;MACLvB,OAAO,CACL,IAAI7B,QAAQ,CAAC;QACXkD,OAAO,EAAE,kCAAkC;QAC3CC,IAAI,EAAElD,YAAY,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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oB;IACzB,KAAK,aAAa;MAChBvB,OAAO,CACL,IAAIN,QAAQ,CAAC;QACXiB,OAAO,EAAG,mBAAkB;QAC5BW,IAAI,EAAE3B,YAAY,CAAC4B;MACrB,CAAC,CACH,CAAC;MACD;;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"}
@@ -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,kBAAkB;AACzB,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;AACJ;AACA;AACA;AACA;EACI,MAAMC,oBAAoB,GACxBJ,UAAU,CAACK,0BAA0B,CAACC,sBAAsB;EAC9D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC;IACjCC,SAAS,EAAEV,QAAQ;IACnBW,WAAW,EAAEZ,gBAAgB;IAC7Ba,OAAO,EAAEV;EACX,CAAC,CAAC;EACF,MAAMW,OAAO,GAAI,GAAER,oBAAqB,IAAGG,MAAO,EAAC;EACnD,IAAIM,eAAmC;EAEvC,IAAIV,oBAAoB,EAAE;IACxB,MAAMW,cAAc,GAAG,IAAIC,GAAG,CAACb,WAAW,CAAC,CAAC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vD;;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;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;AACJ;AACA;AACA;AACA;EACI,MAAMC,oBAAoB,GACxBJ,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AAC;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,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"}
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ import { CieError } from "./error";
3
+ export type OnSuccess = (url: string) => void;
4
+ export type OnError = (e: CieError) => void;
5
+ export type OnCieEvent = (e: CieEvent) => void;
6
+ export declare enum CieEvent {
7
+ "reading" = "reading",
8
+ "completed" = "completed",
9
+ "waiting_card" = "waiting_card"
10
+ }
11
+ type CIEParams = {
12
+ authUrl: string;
13
+ onSuccess: OnSuccess;
14
+ onError: OnError;
15
+ pin: string;
16
+ useUat: boolean;
17
+ redirectUrl: string;
18
+ onEvent: OnCieEvent;
19
+ };
20
+ /**
21
+ * WebViewComponent
22
+ *
23
+ * Component that manages authentication via CIE L3 (NFC+PIN) based on WebView (react-native-webview).
24
+ * In particular, once rendered, it makes a series of calls to the authUrl in the WebView,
25
+ * extrapolates the authentication URL necessary for CieManager to sign via certificate
26
+ * and calls the CIE SDK which is responsible for starting card reading via NFC.
27
+ * At the end of the reading, a redirect is made in the WebView towards the page that asks
28
+ * the user for consent to send the data to the Service Provider. This moment can be captured
29
+ * via the onUserInteraction parameter. When the user allows or denies their consent,
30
+ * a redirect is made to the URL set by the Service Provider.
31
+ * This url can be configured using the redirectUrl parameter which allows you to close the WebView.
32
+ * The event can then be captured via the onSuccess parameter.
33
+ *
34
+ * @param {CIEParams} params - Parameters required by the component.
35
+ * @param {string} params.authUrl -The authentication URL of the Service Provider to which to authenticate.
36
+ * @param {boolean} params.useUat - If set to true it uses the CIE testing environment.
37
+ * @param {string} params.pin - CIE pin for use with NFC reading.
38
+ * @param {Function} params.onError - Callback function in case of error. The function is passed the Error parameter.
39
+ * @param {Function} params.onSuccess - Callback at the end of authentication to which the redirect URL including parameters is passed.
40
+ * @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.
41
+ * @param {Function} params.onEvent - Callback function that is called whenever there is a new CieEvent from the CIE reader.
42
+ * @returns {JSX.Element} - The configured component with WebView.
43
+ */
44
+ export declare const WebViewComponent: (params: CIEParams) => React.JSX.Element;
45
+ export {};
46
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/cie/component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAYzC,OAAO,EAAE,QAAQ,EAAgB,MAAM,SAAS,CAAC;AA0BjD,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAC9C,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;AAC5C,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC;AAC/C,oBAAY,QAAQ;IAClB,SAAS,YAAY;IACrB,WAAW,cAAc;IACzB,cAAc,iBAAiB;CAChC;AAED,KAAK,SAAS,GAAG;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAeF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,gBAAgB,WAAY,SAAS,sBAyHjD,CAAC"}
@@ -0,0 +1,31 @@
1
+ export declare enum CieErrorType {
2
+ GENERIC = 0,
3
+ TAG_NOT_VALID = 1,
4
+ WEB_VIEW_ERROR = 2,
5
+ NFC_ERROR = 3,
6
+ AUTHENTICATION_ERROR = 4,
7
+ PIN_ERROR = 5,
8
+ PIN_LOCKED = 6,
9
+ CERTIFICATE_ERROR = 7
10
+ }
11
+ interface BaseCieError {
12
+ message: string;
13
+ type?: CieErrorType;
14
+ }
15
+ interface PinErrorOptions extends BaseCieError {
16
+ type: CieErrorType.PIN_ERROR;
17
+ attemptsLeft: number;
18
+ }
19
+ interface NonPinErrorOptions extends BaseCieError {
20
+ type?: Exclude<CieErrorType, CieErrorType.PIN_ERROR>;
21
+ attemptsLeft?: number;
22
+ }
23
+ type ErrorOptions = PinErrorOptions | NonPinErrorOptions;
24
+ export declare class CieError extends Error {
25
+ type: CieErrorType;
26
+ attemptsLeft?: number;
27
+ constructor(options: ErrorOptions);
28
+ toString(): string;
29
+ }
30
+ export {};
31
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/cie/error.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,OAAO,IAAA;IACP,aAAa,IAAA;IACb,cAAc,IAAA;IACd,SAAS,IAAA;IACT,oBAAoB,IAAA;IACpB,SAAS,IAAA;IACT,UAAU,IAAA;IACV,iBAAiB,IAAA;CAClB;AAED,UAAU,YAAY;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED,UAAU,eAAgB,SAAQ,YAAY;IAC5C,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC;IAC7B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,kBAAmB,SAAQ,YAAY;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,KAAK,YAAY,GAAG,eAAe,GAAG,kBAAkB,CAAC;AAEzD,qBAAa,QAAS,SAAQ,KAAK;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;gBACjB,OAAO,EAAE,YAAY;IAkBjC,QAAQ,IAAI,MAAM;CAQnB"}
@@ -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.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cie/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { type OnCieEvent, type OnError } from "./component";
2
+ export type ContinueWithUrl = (callbackUrl: string) => void;
3
+ export declare const startCieAndroid: (useCieUat: boolean, ciePin: string, onError: OnError, onEvent: OnCieEvent, cieAuthorizationUri: string, continueWithUrl: ContinueWithUrl) => void;
4
+ export declare const startCieiOS: (useCieUat: boolean, ciePin: string, onError: OnError, onEvent: OnCieEvent, cieAuthorizationUri: string, continueWithUrl: ContinueWithUrl) => Promise<void>;
5
+ //# sourceMappingURL=manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/cie/manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtE,MAAM,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;AAE5D,eAAO,MAAM,eAAe,cACf,OAAO,UACV,MAAM,WACL,OAAO,WACP,UAAU,uBACE,MAAM,mBACV,eAAe,SA6BjC,CAAC;AAEF,eAAO,MAAM,WAAW,cACX,OAAO,UACV,MAAM,WACL,OAAO,WACP,UAAU,uBACE,MAAM,mBACV,eAAe,kBA4BjC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEnF,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAuB3D,eAAO,MAAM,uBAAuB,YAAa;IAC/C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,4BAmBA,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,IAAI,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEnF,MAAM,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAuB3D,eAAO,MAAM,uBAAuB,YAAa;IAC/C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,4BAsBA,CAAC"}
@@ -24,5 +24,10 @@ export type CompleteUserAuthorizationWithQueryMode = (issuerRequestUri: Out<Star
24
24
  * @returns the authorization response which contains code, state and iss
25
25
  */
26
26
  export declare const completeUserAuthorizationWithQueryMode: CompleteUserAuthorizationWithQueryMode;
27
+ export declare const parseAuthRedirectUrl: (authRedirectUrl: string) => {
28
+ code: string;
29
+ state: string;
30
+ iss?: string | undefined;
31
+ };
27
32
  export declare const completeUserAuthorizationWithFormPostJwtMode: () => never;
28
33
  //# sourceMappingURL=04-complete-user-authorization.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAS,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,CACnD,gBAAgB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,kBAAkB,CAAC,EACjE,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,oBAAoB,KACxC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sCAAsC,EAAE,sCAsElD,CAAC;AAGJ,eAAO,MAAM,4CAA4C,aAExD,CAAC"}
1
+ {"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAS,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,CACnD,gBAAgB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,kBAAkB,CAAC,EACjE,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,oBAAoB,KACxC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sCAAsC,EAAE,sCAyDlD,CAAC;AAEJ,eAAO,MAAM,oBAAoB,oBAAqB,MAAM;;;;CAc3D,CAAC;AAGF,eAAO,MAAM,4CAA4C,aAExD,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { type StartFlow } from "./01-start-flow";
2
2
  import { evaluateIssuerTrust, type EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
3
3
  import { startUserAuthorization, type StartUserAuthorization } from "./03-start-user-authorization";
4
- import { completeUserAuthorizationWithQueryMode, type CompleteUserAuthorizationWithQueryMode } from "./04-complete-user-authorization";
4
+ import { completeUserAuthorizationWithQueryMode, parseAuthRedirectUrl, type CompleteUserAuthorizationWithQueryMode } from "./04-complete-user-authorization";
5
5
  import { authorizeAccess, type AuthorizeAccess } from "./05-authorize-access";
6
6
  import { obtainCredential, type ObtainCredential } from "./06-obtain-credential";
7
7
  import { verifyAndParseCredential, type VerifyAndParseCredential } from "./07-verify-and-parse-credential";
8
- export { evaluateIssuerTrust, startUserAuthorization, completeUserAuthorizationWithQueryMode, authorizeAccess, obtainCredential, verifyAndParseCredential, };
8
+ export { evaluateIssuerTrust, startUserAuthorization, completeUserAuthorizationWithQueryMode, authorizeAccess, obtainCredential, verifyAndParseCredential, parseAuthRedirectUrl, };
9
9
  export type { StartFlow, EvaluateIssuerTrust, StartUserAuthorization, CompleteUserAuthorizationWithQueryMode, AuthorizeAccess, ObtainCredential, VerifyAndParseCredential, };
10
10
  //# sourceMappingURL=index.d.ts.map