@pagopa/io-react-native-wallet 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/cie/component.js +180 -0
- package/lib/commonjs/cie/component.js.map +1 -0
- package/lib/commonjs/cie/error.js +44 -0
- package/lib/commonjs/cie/error.js.map +1 -0
- package/lib/commonjs/cie/index.js +32 -0
- package/lib/commonjs/cie/index.js.map +1 -0
- package/lib/commonjs/cie/manager.js +142 -0
- package/lib/commonjs/cie/manager.js.map +1 -0
- package/lib/commonjs/client/index.js +5 -2
- package/lib/commonjs/client/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +2 -2
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +7 -3
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +5 -5
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +2 -2
- package/lib/commonjs/credential/issuance/index.js +6 -0
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/cie/component.js +171 -0
- package/lib/module/cie/component.js.map +1 -0
- package/lib/module/cie/error.js +36 -0
- package/lib/module/cie/error.js.map +1 -0
- package/lib/module/cie/index.js +4 -0
- package/lib/module/cie/index.js.map +1 -0
- package/lib/module/cie/manager.js +133 -0
- package/lib/module/cie/manager.js.map +1 -0
- package/lib/module/client/index.js +5 -2
- package/lib/module/client/index.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +2 -2
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +4 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +5 -5
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +2 -2
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/index.js +2 -2
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/cie/component.d.ts +46 -0
- package/lib/typescript/cie/component.d.ts.map +1 -0
- package/lib/typescript/cie/error.d.ts +31 -0
- package/lib/typescript/cie/error.d.ts.map +1 -0
- package/lib/typescript/cie/index.d.ts +4 -0
- package/lib/typescript/cie/index.d.ts.map +1 -0
- package/lib/typescript/cie/manager.d.ts +5 -0
- package/lib/typescript/cie/manager.d.ts.map +1 -0
- package/lib/typescript/client/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +2 -2
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +6 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +2 -2
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/cie/component.tsx +216 -0
- package/src/cie/error.ts +58 -0
- package/src/cie/index.ts +4 -0
- package/src/cie/manager.ts +183 -0
- package/src/client/index.ts +4 -1
- package/src/credential/issuance/03-start-user-authorization.ts +2 -6
- package/src/credential/issuance/04-complete-user-authorization.ts +17 -14
- package/src/credential/issuance/05-authorize-access.ts +5 -5
- package/src/credential/issuance/06-obtain-credential.ts +2 -2
- package/src/credential/issuance/index.ts +2 -0
- package/src/index.ts +2 -0
- package/lib/commonjs/credential/issuance/03-start-credential-issuance.js +0 -287
- package/lib/commonjs/credential/issuance/03-start-credential-issuance.js.map +0 -1
- package/lib/module/credential/issuance/03-start-credential-issuance.js +0 -276
- package/lib/module/credential/issuance/03-start-credential-issuance.js.map +0 -1
- package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts +0 -41
- package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts.map +0 -1
- package/src/credential/issuance/03-start-credential-issuance.ts +0 -407
@@ -0,0 +1,180 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.WebViewComponent = exports.CieEvent = void 0;
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
8
|
+
var _reactNative = require("react-native");
|
9
|
+
var _reactNativeWebview = require("react-native-webview");
|
10
|
+
var _manager = require("./manager");
|
11
|
+
var _error = require("./error");
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
14
|
+
/* To obtain the authentication URL on CIE L3 it is necessary to take the
|
15
|
+
* link contained in the "Entra con lettura carta CIE" button.
|
16
|
+
* This link can then be used on CieManager.
|
17
|
+
* This javascript code takes the link in question and sends it to the react native function via postMessage
|
18
|
+
*/
|
19
|
+
const injectedJavaScript = `
|
20
|
+
(function() {
|
21
|
+
function sendDocumentContent() {
|
22
|
+
const idpAuthUrl = [...document.querySelectorAll("a")]
|
23
|
+
.filter(a => a.textContent.includes("lettura carta CIE"))
|
24
|
+
.map(a=>a.href)[0];
|
25
|
+
|
26
|
+
if(idpAuthUrl) {
|
27
|
+
window.ReactNativeWebView.postMessage(idpAuthUrl);
|
28
|
+
}
|
29
|
+
}
|
30
|
+
if (document.readyState === 'complete') {
|
31
|
+
sendDocumentContent();
|
32
|
+
} else {
|
33
|
+
window.addEventListener('load', sendDocumentContent);
|
34
|
+
}
|
35
|
+
})();
|
36
|
+
true;
|
37
|
+
`;
|
38
|
+
let CieEvent = /*#__PURE__*/function (CieEvent) {
|
39
|
+
CieEvent["reading"] = "reading";
|
40
|
+
CieEvent["completed"] = "completed";
|
41
|
+
CieEvent["waiting_card"] = "waiting_card";
|
42
|
+
return CieEvent;
|
43
|
+
}({});
|
44
|
+
exports.CieEvent = CieEvent;
|
45
|
+
/*
|
46
|
+
* To make sure the server recognizes the client as valid iPhone device (iOS only) we use a custom header
|
47
|
+
* on Android it is not required.
|
48
|
+
*/
|
49
|
+
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";
|
50
|
+
const defaultUserAgent = _reactNative.Platform.select({
|
51
|
+
ios: iOSUserAgent,
|
52
|
+
default: undefined
|
53
|
+
});
|
54
|
+
const webView = /*#__PURE__*/(0, _react.createRef)();
|
55
|
+
|
56
|
+
/**
|
57
|
+
* WebViewComponent
|
58
|
+
*
|
59
|
+
* Component that manages authentication via CIE L3 (NFC+PIN) based on WebView (react-native-webview).
|
60
|
+
* In particular, once rendered, it makes a series of calls to the authUrl in the WebView,
|
61
|
+
* extrapolates the authentication URL necessary for CieManager to sign via certificate
|
62
|
+
* and calls the CIE SDK which is responsible for starting card reading via NFC.
|
63
|
+
* At the end of the reading, a redirect is made in the WebView towards the page that asks
|
64
|
+
* the user for consent to send the data to the Service Provider. This moment can be captured
|
65
|
+
* via the onUserInteraction parameter. When the user allows or denies their consent,
|
66
|
+
* a redirect is made to the URL set by the Service Provider.
|
67
|
+
* This url can be configured using the redirectUrl parameter which allows you to close the WebView.
|
68
|
+
* The event can then be captured via the onSuccess parameter.
|
69
|
+
*
|
70
|
+
* @param {CIEParams} params - Parameters required by the component.
|
71
|
+
* @param {string} params.authUrl -The authentication URL of the Service Provider to which to authenticate.
|
72
|
+
* @param {boolean} params.useUat - If set to true it uses the CIE testing environment.
|
73
|
+
* @param {string} params.pin - CIE pin for use with NFC reading.
|
74
|
+
* @param {Function} params.onError - Callback function in case of error. The function is passed the Error parameter.
|
75
|
+
* @param {Function} params.onSuccess - Callback at the end of authentication to which the redirect URL including parameters is passed.
|
76
|
+
* @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.
|
77
|
+
* @param {Function} params.onEvent - Callback function that is called whenever there is a new CieEvent from the CIE reader.
|
78
|
+
* @returns {JSX.Element} - The configured component with WebView.
|
79
|
+
*/
|
80
|
+
const WebViewComponent = params => {
|
81
|
+
const [webViewUrl, setWebViewUrl] = _react.default.useState(params.authUrl);
|
82
|
+
const [isCardReadingFinished, setCardReadingFinished] = _react.default.useState(false);
|
83
|
+
|
84
|
+
/*
|
85
|
+
* Once the reading of the card with NFC is finished, it is necessary
|
86
|
+
* to change the URL of the WebView by redirecting to the URL returned by
|
87
|
+
* CieManager to allow the user to continue with the consent authorization
|
88
|
+
* */
|
89
|
+
const continueWithUrl = callbackUrl => {
|
90
|
+
setCardReadingFinished(true);
|
91
|
+
setWebViewUrl(callbackUrl);
|
92
|
+
};
|
93
|
+
|
94
|
+
// This function is called from the injected javascript code (postMessage). Which receives the authentication URL
|
95
|
+
const handleMessage = async event => {
|
96
|
+
const cieAuthorizationUri = event.nativeEvent.data;
|
97
|
+
const startCie = _reactNative.Platform.select({
|
98
|
+
ios: _manager.startCieiOS,
|
99
|
+
default: _manager.startCieAndroid
|
100
|
+
});
|
101
|
+
await startCie(params.useUat, params.pin, params.onError, params.onEvent, cieAuthorizationUri, continueWithUrl);
|
102
|
+
};
|
103
|
+
|
104
|
+
//This function is called when authentication with CIE ends and the SP URL containing code and state is returned
|
105
|
+
const handleShouldStartLoading = (onSuccess, redirectUrl) => event => {
|
106
|
+
if (isCardReadingFinished && event.url.includes(redirectUrl)) {
|
107
|
+
onSuccess(event.url);
|
108
|
+
return false;
|
109
|
+
} else {
|
110
|
+
return true;
|
111
|
+
}
|
112
|
+
};
|
113
|
+
const handleOnLoadEnd = (onError, onCieEvent) => e => {
|
114
|
+
const eventTitle = e.nativeEvent.title.toLowerCase();
|
115
|
+
if (eventTitle === "pagina web non disponibile" ||
|
116
|
+
// On Android, if we attempt to access the idp URL twice,
|
117
|
+
// we are presented with an error page titled "ERROR".
|
118
|
+
eventTitle === "errore") {
|
119
|
+
handleOnError(onError)(new Error(eventTitle));
|
120
|
+
}
|
121
|
+
|
122
|
+
/* At the end of loading the page, if the card has already been read
|
123
|
+
* then the WebView has loaded the page to ask the user for consent,
|
124
|
+
* so send the completed event
|
125
|
+
* */
|
126
|
+
if (isCardReadingFinished) {
|
127
|
+
onCieEvent(CieEvent.completed);
|
128
|
+
}
|
129
|
+
};
|
130
|
+
const handleOnError = onError => e => {
|
131
|
+
const error = e;
|
132
|
+
const webViewError = e;
|
133
|
+
const webViewHttpError = e;
|
134
|
+
if (webViewHttpError.nativeEvent.statusCode) {
|
135
|
+
const {
|
136
|
+
description,
|
137
|
+
statusCode
|
138
|
+
} = webViewHttpError.nativeEvent;
|
139
|
+
onError(new _error.CieError({
|
140
|
+
message: `WebView http error: ${description} with status code: ${statusCode}`,
|
141
|
+
type: _error.CieErrorType.WEB_VIEW_ERROR
|
142
|
+
}));
|
143
|
+
} else if (webViewError.nativeEvent) {
|
144
|
+
const {
|
145
|
+
code,
|
146
|
+
description
|
147
|
+
} = webViewError.nativeEvent;
|
148
|
+
onError(new _error.CieError({
|
149
|
+
message: `WebView error: ${description} with code: ${code}`,
|
150
|
+
type: _error.CieErrorType.WEB_VIEW_ERROR
|
151
|
+
}));
|
152
|
+
} else if (error.message !== undefined) {
|
153
|
+
onError(new _error.CieError({
|
154
|
+
message: `${error.message}`,
|
155
|
+
type: _error.CieErrorType.WEB_VIEW_ERROR
|
156
|
+
}));
|
157
|
+
} else {
|
158
|
+
onError(new _error.CieError({
|
159
|
+
message: "An error occurred in the WebView",
|
160
|
+
type: _error.CieErrorType.WEB_VIEW_ERROR
|
161
|
+
}));
|
162
|
+
}
|
163
|
+
};
|
164
|
+
return /*#__PURE__*/_react.default.createElement(_reactNativeWebview.WebView, {
|
165
|
+
ref: webView,
|
166
|
+
userAgent: defaultUserAgent,
|
167
|
+
javaScriptEnabled: true,
|
168
|
+
source: {
|
169
|
+
uri: webViewUrl
|
170
|
+
},
|
171
|
+
onLoadEnd: handleOnLoadEnd(params.onError, params.onEvent),
|
172
|
+
onError: handleOnError(params.onError),
|
173
|
+
onHttpError: handleOnError(params.onError),
|
174
|
+
injectedJavaScript: injectedJavaScript,
|
175
|
+
onShouldStartLoadWithRequest: handleShouldStartLoading(params.onSuccess, params.redirectUrl),
|
176
|
+
onMessage: handleMessage
|
177
|
+
});
|
178
|
+
};
|
179
|
+
exports.WebViewComponent = WebViewComponent;
|
180
|
+
//# sourceMappingURL=component.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeWebview","_manager","_error","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","injectedJavaScript","CieEvent","exports","iOSUserAgent","defaultUserAgent","Platform","select","ios","undefined","webView","createRef","WebViewComponent","params","webViewUrl","setWebViewUrl","React","useState","authUrl","isCardReadingFinished","setCardReadingFinished","continueWithUrl","callbackUrl","handleMessage","event","cieAuthorizationUri","nativeEvent","data","startCie","startCieiOS","startCieAndroid","useUat","pin","onError","onEvent","handleShouldStartLoading","onSuccess","redirectUrl","url","includes","handleOnLoadEnd","onCieEvent","e","eventTitle","title","toLowerCase","handleOnError","Error","completed","error","webViewError","webViewHttpError","statusCode","description","CieError","message","type","CieErrorType","WEB_VIEW_ERROR","code","createElement","WebView","ref","userAgent","javaScriptEnabled","source","uri","onLoadEnd","onHttpError","onShouldStartLoadWithRequest","onMessage"],"sourceRoot":"../../../src","sources":["cie/component.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AASA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAiD,SAAAK,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,SAAAP,wBAAAW,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,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AQ,EAAC;QAC3BC,IAAI,EAAEC,mBAAY,CAACC;MACrB,CAAC,CACH,CAAC;IACH,CAAC,MAAM;MACLzB,OAAO,CACL,IAAIqB,eAAQ,CAAC;QACXC,OAAO,EAAE,kCAAkC;QAC3CC,IAAI,EAAEC,mBAAY,CAACC;MACrB,CAAC,CACH,CAAC;IACH;EACF,CAAC;EAEH,oBACEtF,MAAA,CAAAc,OAAA,CAAA0E,aAAA,CAACpF,mBAAA,CAAAqF,OAAO;IACNC,GAAG,EAAEpD,OAAQ;IACbqD,SAAS,EAAE1D,gBAAiB;IAC5B2D,iBAAiB,EAAE,IAAK;IACxBC,MAAM,EAAE;MAAEC,GAAG,EAAEpD;IAAW,CAAE;IAC5BqD,SAAS,EAAE3B,eAAe,CAAC3B,MAAM,CAACoB,OAAO,EAAEpB,MAAM,CAACqB,OAAO,CAAE;IAC3DD,OAAO,EAAEa,aAAa,CAACjC,MAAM,CAACoB,OAAO,CAAE;IACvCmC,WAAW,EAAEtB,aAAa,CAACjC,MAAM,CAACoB,OAAO,CAAE;IAC3ChC,kBAAkB,EAAEA,kBAAmB;IACvCoE,4BAA4B,EAAElC,wBAAwB,CACpDtB,MAAM,CAACuB,SAAS,EAChBvB,MAAM,CAACwB,WACT,CAAE;IACFiC,SAAS,EAAE/C;EAAc,CAC1B,CAAC;AAEN,CAAC;AAACpB,OAAA,CAAAS,gBAAA,GAAAA,gBAAA"}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.CieErrorType = exports.CieError = void 0;
|
7
|
+
let CieErrorType = /*#__PURE__*/function (CieErrorType) {
|
8
|
+
CieErrorType[CieErrorType["GENERIC"] = 0] = "GENERIC";
|
9
|
+
CieErrorType[CieErrorType["TAG_NOT_VALID"] = 1] = "TAG_NOT_VALID";
|
10
|
+
CieErrorType[CieErrorType["WEB_VIEW_ERROR"] = 2] = "WEB_VIEW_ERROR";
|
11
|
+
CieErrorType[CieErrorType["NFC_ERROR"] = 3] = "NFC_ERROR";
|
12
|
+
CieErrorType[CieErrorType["AUTHENTICATION_ERROR"] = 4] = "AUTHENTICATION_ERROR";
|
13
|
+
CieErrorType[CieErrorType["PIN_ERROR"] = 5] = "PIN_ERROR";
|
14
|
+
CieErrorType[CieErrorType["PIN_LOCKED"] = 6] = "PIN_LOCKED";
|
15
|
+
CieErrorType[CieErrorType["CERTIFICATE_ERROR"] = 7] = "CERTIFICATE_ERROR";
|
16
|
+
return CieErrorType;
|
17
|
+
}({});
|
18
|
+
exports.CieErrorType = CieErrorType;
|
19
|
+
class CieError extends Error {
|
20
|
+
constructor(options) {
|
21
|
+
super(options.message);
|
22
|
+
if (options.type) {
|
23
|
+
this.type = options.type;
|
24
|
+
} else {
|
25
|
+
this.type = CieErrorType.GENERIC;
|
26
|
+
}
|
27
|
+
if (this.type === CieErrorType.PIN_ERROR) {
|
28
|
+
this.attemptsLeft = options.attemptsLeft;
|
29
|
+
} else if (this.type === CieErrorType.PIN_LOCKED) {
|
30
|
+
this.attemptsLeft = 0;
|
31
|
+
}
|
32
|
+
this.name = this.constructor.name;
|
33
|
+
}
|
34
|
+
toString() {
|
35
|
+
return JSON.stringify({
|
36
|
+
name: this.name,
|
37
|
+
type: CieErrorType[this.type],
|
38
|
+
message: this.message,
|
39
|
+
attemptsLeft: this.attemptsLeft
|
40
|
+
});
|
41
|
+
}
|
42
|
+
}
|
43
|
+
exports.CieError = CieError;
|
44
|
+
//# sourceMappingURL=error.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["CieErrorType","exports","CieError","Error","constructor","options","message","type","GENERIC","PIN_ERROR","attemptsLeft","PIN_LOCKED","name","toString","JSON","stringify"],"sourceRoot":"../../../src","sources":["cie/error.ts"],"mappings":";;;;;;IAAYA,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;AAAAC,OAAA,CAAAD,YAAA,GAAAA,YAAA;AA4BjB,MAAME,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,GAAGP,YAAY,CAACQ,OAAO;IAClC;IAEA,IAAI,IAAI,CAACD,IAAI,KAAKP,YAAY,CAACS,SAAS,EAAE;MACxC,IAAI,CAACC,YAAY,GAAGL,OAAO,CAACK,YAAY;IAC1C,CAAC,MAAM,IAAI,IAAI,CAACH,IAAI,KAAKP,YAAY,CAACW,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,EAAEP,YAAY,CAAC,IAAI,CAACO,IAAI,CAAC;MAC7BD,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBI,YAAY,EAAE,IAAI,CAACA;IACrB,CAAC,CAAC;EACJ;AACF;AAACT,OAAA,CAAAC,QAAA,GAAAA,QAAA"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "CieError", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function () {
|
9
|
+
return _error.CieError;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "CieErrorType", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function () {
|
15
|
+
return _error.CieErrorType;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "CieEvent", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function () {
|
21
|
+
return _component.CieEvent;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
Object.defineProperty(exports, "WebViewComponent", {
|
25
|
+
enumerable: true,
|
26
|
+
get: function () {
|
27
|
+
return _component.WebViewComponent;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
var _component = require("./component");
|
31
|
+
var _error = require("./error");
|
32
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_component","require","_error"],"sourceRoot":"../../../src","sources":["cie/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA"}
|
@@ -0,0 +1,142 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.startCieiOS = exports.startCieAndroid = void 0;
|
7
|
+
var _reactNativeCie = _interopRequireDefault(require("@pagopa/react-native-cie"));
|
8
|
+
var _reactNative = require("react-native");
|
9
|
+
var _component = require("./component");
|
10
|
+
var _error = require("./error");
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
|
+
const BASE_UAT_URL = "https://collaudo.idserver.servizicie.interno.gov.it/idp/";
|
13
|
+
const startCieAndroid = (useCieUat, ciePin, onError, onEvent, cieAuthorizationUri, continueWithUrl) => {
|
14
|
+
try {
|
15
|
+
_reactNativeCie.default.removeAllListeners();
|
16
|
+
_reactNativeCie.default.start().then(async () => {
|
17
|
+
_reactNativeCie.default.onEvent(handleCieEvent(onError, onEvent));
|
18
|
+
_reactNativeCie.default.onError(e => {
|
19
|
+
console.error(e);
|
20
|
+
return onError(new _error.CieError({
|
21
|
+
message: e.message
|
22
|
+
}));
|
23
|
+
});
|
24
|
+
_reactNativeCie.default.onSuccess(handleCieSuccess(continueWithUrl));
|
25
|
+
await _reactNativeCie.default.setPin(ciePin);
|
26
|
+
_reactNativeCie.default.setAuthenticationUrl(cieAuthorizationUri);
|
27
|
+
_reactNativeCie.default.enableLog(useCieUat);
|
28
|
+
_reactNativeCie.default.setCustomIdpUrl(useCieUat ? getCieUatEndpoint() : null);
|
29
|
+
await _reactNativeCie.default.startListeningNFC();
|
30
|
+
onEvent(_component.CieEvent.waiting_card);
|
31
|
+
}).catch(onError);
|
32
|
+
} catch {
|
33
|
+
onError(new _error.CieError({
|
34
|
+
message: "Unable to start CIE NFC manager on iOS",
|
35
|
+
type: _error.CieErrorType.NFC_ERROR
|
36
|
+
}));
|
37
|
+
}
|
38
|
+
};
|
39
|
+
exports.startCieAndroid = startCieAndroid;
|
40
|
+
const startCieiOS = async (useCieUat, ciePin, onError, onEvent, cieAuthorizationUri, continueWithUrl) => {
|
41
|
+
try {
|
42
|
+
_reactNativeCie.default.removeAllListeners();
|
43
|
+
_reactNativeCie.default.onEvent(handleCieEvent(onError, onEvent));
|
44
|
+
_reactNativeCie.default.onError(e => onError(new _error.CieError({
|
45
|
+
message: e.message
|
46
|
+
})));
|
47
|
+
_reactNativeCie.default.onSuccess(handleCieSuccess(continueWithUrl));
|
48
|
+
_reactNativeCie.default.enableLog(useCieUat);
|
49
|
+
_reactNativeCie.default.setCustomIdpUrl(useCieUat ? getCieUatEndpoint() : null);
|
50
|
+
await _reactNativeCie.default.setPin(ciePin);
|
51
|
+
_reactNativeCie.default.setAuthenticationUrl(cieAuthorizationUri);
|
52
|
+
_reactNativeCie.default.start().then(async () => {
|
53
|
+
await _reactNativeCie.default.startListeningNFC();
|
54
|
+
onEvent(_component.CieEvent.waiting_card);
|
55
|
+
}).catch(onError);
|
56
|
+
} catch {
|
57
|
+
onError(new _error.CieError({
|
58
|
+
message: "Unable to start CIE NFC manager on Android",
|
59
|
+
type: _error.CieErrorType.NFC_ERROR
|
60
|
+
}));
|
61
|
+
}
|
62
|
+
};
|
63
|
+
exports.startCieiOS = startCieiOS;
|
64
|
+
const handleCieEvent = (onError, onEvent) => event => {
|
65
|
+
switch (event.event) {
|
66
|
+
// Reading starts
|
67
|
+
case "ON_TAG_DISCOVERED":
|
68
|
+
onEvent(_component.CieEvent.reading);
|
69
|
+
break;
|
70
|
+
// "Function not supported" seems to be TAG_ERROR_NFC_NOT_SUPPORTED
|
71
|
+
// for the iOS SDK
|
72
|
+
case "Function not supported":
|
73
|
+
case "TAG_ERROR_NFC_NOT_SUPPORTED":
|
74
|
+
case "ON_TAG_DISCOVERED_NOT_CIE":
|
75
|
+
onError(new _error.CieError({
|
76
|
+
message: `Invalid CIE card: ${event.event}`,
|
77
|
+
type: _error.CieErrorType.TAG_NOT_VALID
|
78
|
+
}));
|
79
|
+
break;
|
80
|
+
case "AUTHENTICATION_ERROR":
|
81
|
+
case "ON_NO_INTERNET_CONNECTION":
|
82
|
+
onError(new _error.CieError({
|
83
|
+
message: `Authentication error or no internet connection`,
|
84
|
+
type: _error.CieErrorType.AUTHENTICATION_ERROR
|
85
|
+
}));
|
86
|
+
break;
|
87
|
+
case "EXTENDED_APDU_NOT_SUPPORTED":
|
88
|
+
onError(new _error.CieError({
|
89
|
+
message: `APDU not supported`,
|
90
|
+
type: _error.CieErrorType.NFC_ERROR
|
91
|
+
}));
|
92
|
+
break;
|
93
|
+
case "Transmission Error":
|
94
|
+
case "ON_TAG_LOST":
|
95
|
+
onError(new _error.CieError({
|
96
|
+
message: `Trasmission error`,
|
97
|
+
type: _error.CieErrorType.NFC_ERROR
|
98
|
+
}));
|
99
|
+
break;
|
100
|
+
|
101
|
+
// The card is temporarily locked. Unlock is available by CieID app
|
102
|
+
case "PIN Locked":
|
103
|
+
case "ON_CARD_PIN_LOCKED":
|
104
|
+
onError(new _error.CieError({
|
105
|
+
message: `PIN locked`,
|
106
|
+
type: _error.CieErrorType.PIN_LOCKED
|
107
|
+
}));
|
108
|
+
break;
|
109
|
+
case "ON_PIN_ERROR":
|
110
|
+
onError(new _error.CieError({
|
111
|
+
message: `PIN locked`,
|
112
|
+
type: _error.CieErrorType.PIN_ERROR,
|
113
|
+
attemptsLeft: event.attemptsLeft
|
114
|
+
}));
|
115
|
+
break;
|
116
|
+
|
117
|
+
// CIE is Expired or Revoked
|
118
|
+
case "CERTIFICATE_EXPIRED":
|
119
|
+
onError(new _error.CieError({
|
120
|
+
message: `Certificate expired`,
|
121
|
+
type: _error.CieErrorType.CERTIFICATE_ERROR
|
122
|
+
}));
|
123
|
+
break;
|
124
|
+
case "CERTIFICATE_REVOKED":
|
125
|
+
onError(new _error.CieError({
|
126
|
+
message: `Certificate revoked`,
|
127
|
+
type: _error.CieErrorType.CERTIFICATE_ERROR
|
128
|
+
}));
|
129
|
+
break;
|
130
|
+
default:
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
};
|
134
|
+
const handleCieSuccess = continueWithUrl => url => {
|
135
|
+
continueWithUrl(decodeURIComponent(url));
|
136
|
+
};
|
137
|
+
const getCieUatEndpoint = () => _reactNative.Platform.select({
|
138
|
+
ios: `${BASE_UAT_URL}Authn/SSL/Login2`,
|
139
|
+
android: BASE_UAT_URL,
|
140
|
+
default: null
|
141
|
+
});
|
142
|
+
//# sourceMappingURL=manager.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_reactNativeCie","_interopRequireDefault","require","_reactNative","_component","_error","obj","__esModule","default","BASE_UAT_URL","startCieAndroid","useCieUat","ciePin","onError","onEvent","cieAuthorizationUri","continueWithUrl","cieManager","removeAllListeners","start","then","handleCieEvent","e","console","error","CieError","message","onSuccess","handleCieSuccess","setPin","setAuthenticationUrl","enableLog","setCustomIdpUrl","getCieUatEndpoint","startListeningNFC","CieEvent","waiting_card","catch","type","CieErrorType","NFC_ERROR","exports","startCieiOS","event","reading","TAG_NOT_VALID","AUTHENTICATION_ERROR","PIN_LOCKED","PIN_ERROR","attemptsLeft","CERTIFICATE_ERROR","url","decodeURIComponent","Platform","select","ios","android"],"sourceRoot":"../../../src","sources":["cie/manager.ts"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAiD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEjD,MAAMG,YAAY,GAAG,0DAA0D;AAIxE,MAAMC,eAAe,GAAGA,CAC7BC,SAAkB,EAClBC,MAAc,EACdC,OAAgB,EAChBC,OAAmB,EACnBC,mBAA2B,EAC3BC,eAAgC,KAC7B;EACH,IAAI;IACFC,uBAAU,CAACC,kBAAkB,CAAC,CAAC;IAC/BD,uBAAU,CACPE,KAAK,CAAC,CAAC,CACPC,IAAI,CAAC,YAAY;MAChBH,uBAAU,CAACH,OAAO,CAACO,cAAc,CAACR,OAAO,EAAEC,OAAO,CAAC,CAAC;MACpDG,uBAAU,CAACJ,OAAO,CAAES,CAAQ,IAAK;QAC/BC,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;QAChB,OAAOT,OAAO,CAAC,IAAIY,eAAQ,CAAC;UAAEC,OAAO,EAAEJ,CAAC,CAACI;QAAQ,CAAC,CAAC,CAAC;MACtD,CAAC,CAAC;MACFT,uBAAU,CAACU,SAAS,CAACC,gBAAgB,CAACZ,eAAe,CAAC,CAAC;MACvD,MAAMC,uBAAU,CAACY,MAAM,CAACjB,MAAM,CAAC;MAC/BK,uBAAU,CAACa,oBAAoB,CAACf,mBAAmB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,CAACC;MACrB,CAAC,CACH,CAAC;MACD;;IAEF;IACA,KAAK,YAAY;IACjB,KAAK,oBAAoB;MACvB3B,OAAO,CACL,IAAIY,eAAQ,CAAC;QACXC,OAAO,EAAG,YAAW;QACrBY,IAAI,EAAEC,mBAAY,CAACQ;MACrB,CAAC,CACH,CAAC;MACD;IACF,KAAK,cAAc;MACjBlC,OAAO,CACL,IAAIY,eAAQ,CAAC;QACXC,OAAO,EAAG,YAAW;QACrBY,IAAI,EAAEC,mBAAY,CAACS,SAAS;QAC5BC,YAAY,EAAEN,KAAK,CAACM;MACtB,CAAC,CACH,CAAC;MACD;;IAEF;IACA,KAAK,qBAAqB;MACxBpC,OAAO,CACL,IAAIY,eAAQ,CAAC;QACXC,OAAO,EAAG,qBAAoB;QAC9BY,IAAI,EAAEC,mBAAY,CAACW;MACrB,CAAC,CACH,CAAC;MACD;IACF,KAAK,qBAAqB;MACxBrC,OAAO,CACL,IAAIY,eAAQ,CAAC;QACXC,OAAO,EAAG,qBAAoB;QAC9BY,IAAI,EAAEC,mBAAY,CAACW;MACrB,CAAC,CACH,CAAC;MAED;IAEF;MACE;EACJ;AACF,CAAC;AAEH,MAAMtB,gBAAgB,GACnBZ,eAAgC,IAAMmC,GAAW,IAAK;EACrDnC,eAAe,CAACoC,kBAAkB,CAACD,GAAG,CAAC,CAAC;AAC1C,CAAC;AAEH,MAAMlB,iBAAiB,GAAGA,CAAA,KACxBoB,qBAAQ,CAACC,MAAM,CAAC;EACdC,GAAG,EAAG,GAAE9C,YAAa,kBAAiB;EACtC+C,OAAO,EAAE/C,YAAY;EACrBD,OAAO,EAAE;AACX,CAAC,CAAC"}
|
@@ -27,10 +27,13 @@ const getWalletProviderClient = context => {
|
|
27
27
|
} = context;
|
28
28
|
return (0, _walletProvider.createApiClient)((method, url, params) => appFetch(url, {
|
29
29
|
method,
|
30
|
-
body: params ? JSON.stringify(params.body) : undefined
|
30
|
+
body: params ? JSON.stringify(params.body) : undefined,
|
31
|
+
headers: {
|
32
|
+
"Content-Type": "application/json"
|
33
|
+
}
|
31
34
|
}).then(validateResponse).then(res => {
|
32
35
|
const contentType = res.headers.get("content-type");
|
33
|
-
if (contentType
|
36
|
+
if (contentType !== null && contentType !== void 0 && contentType.includes("application/json")) {
|
34
37
|
return res.json();
|
35
38
|
}
|
36
39
|
return res.text();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_errors","require","_walletProvider","validateResponse","response","ok","problemDetail","ProblemDetail","parse","json","title","WalletProviderResponseError","type","detail","status","getWalletProviderClient","context","walletProviderBaseUrl","appFetch","fetch","createWalletProviderApiClient","method","url","params","body","JSON","stringify","undefined","then","res","contentType","
|
1
|
+
{"version":3,"names":["_errors","require","_walletProvider","validateResponse","response","ok","problemDetail","ProblemDetail","parse","json","title","WalletProviderResponseError","type","detail","status","getWalletProviderClient","context","walletProviderBaseUrl","appFetch","fetch","createWalletProviderApiClient","method","url","params","body","JSON","stringify","undefined","headers","then","res","contentType","get","includes","text","exports"],"sourceRoot":"../../../src","sources":["client/index.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAQA,MAAME,gBAAgB,GAAG,MAAOC,QAAkB,IAAK;EACrD,IAAI,CAACA,QAAQ,CAACC,EAAE,EAAE;IAChB,IAAIC,aAA4B,GAAG,CAAC,CAAC;IACrC,IAAI;MACFA,aAAa,GAAGC,6BAAa,CAACC,KAAK,CAAC,MAAMJ,QAAQ,CAACK,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,MAAM;MACNH,aAAa,GAAG;QACdI,KAAK,EAAE;MACT,CAAC;IACH;IAEA,MAAM,IAAIC,mCAA2B,CACnCL,aAAa,CAACI,KAAK,IAAI,uCAAuC,EAC9DJ,aAAa,CAACM,IAAI,EAClBN,aAAa,CAACO,MAAM,EACpBT,QAAQ,CAACU,MACX,CAAC;EACH;EACA,OAAOV,QAAQ;AACjB,CAAC;AAEM,MAAMW,uBAAuB,GAAIC,OAGvC,IAAK;EACJ,MAAM;IAAEC,qBAAqB;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAGH,OAAO;EAE3D,OAAO,IAAAI,+BAA6B,EAClC,CAACC,MAAM,EAAEC,GAAG,EAAEC,MAAM,KAClBL,QAAQ,CAACI,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,CAAC1B,gBAAgB,CAAC,CACtB0B,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,CAACrB,IAAI,CAAC,CAAC;IACnB;IACA,OAAOqB,GAAG,CAACI,IAAI,CAAC,CAAC;EACnB,CAAC,CAAC,EACNjB,qBACF,CAAC;AACH,CAAC;AAACkB,OAAA,CAAApB,uBAAA,GAAAA,uBAAA"}
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.startUserAuthorization = void 0;
|
7
|
-
var _misc = require("
|
8
|
-
var _par = require("
|
7
|
+
var _misc = require("../../utils/misc");
|
8
|
+
var _par = require("../../utils/par");
|
9
9
|
var _const = require("./const");
|
10
10
|
/**
|
11
11
|
* Ensures that the credential type requested is supported by the issuer and contained in the
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_misc","require","_par","_const","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","generateRandomAlphaNumericString","parEndpoint","pushed_authorization_request_endpoint","credentialDefinition","getPar","makeParRequest","issuerRequestUri","ASSERTION_TYPE","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;
|
1
|
+
{"version":3,"names":["_misc","require","_par","_const","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","generateRandomAlphaNumericString","parEndpoint","pushed_authorization_request_endpoint","credentialDefinition","getPar","makeParRequest","issuerRequestUri","ASSERTION_TYPE","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/03-start-user-authorization.ts"],"mappings":";;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,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,M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f,UAAU,EAAEC,cAAc,CAAC;EAEnE,MAAMoC,MAAM,GAAG,IAAAC,mBAAc,EAAC;IAAEhB,gBAAgB;IAAEG;EAAS,CAAC,CAAC;EAC7D,MAAMc,gBAAgB,GAAG,MAAMF,MAAM,CACnCV,QAAQ,EACRK,YAAY,EACZR,WAAW,EACXL,YAAY,EACZe,WAAW,EACXX,yBAAyB,EACzB,CAACa,oBAAoB,CAAC,EACtBI,qBACF,CAAC;EAED,OAAO;IAAED,gBAAgB;IAAEZ,QAAQ;IAAEK,YAAY;IAAEI;EAAqB,CAAC;AAC3E,CAAC;AAACK,OAAA,CAAArB,sBAAA,GAAAA,sBAAA"}
|
@@ -3,8 +3,8 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.completeUserAuthorizationWithQueryMode = exports.completeUserAuthorizationWithFormPostJwtMode = void 0;
|
7
|
-
var _auth = require("
|
6
|
+
exports.parseAuthRedirectUrl = exports.completeUserAuthorizationWithQueryMode = exports.completeUserAuthorizationWithFormPostJwtMode = void 0;
|
7
|
+
var _auth = require("../../utils/auth");
|
8
8
|
var _misc = require("../../utils/misc");
|
9
9
|
var _parseUrl = _interopRequireDefault(require("parse-url"));
|
10
10
|
var _errors = require("../../utils/errors");
|
@@ -72,6 +72,10 @@ const completeUserAuthorizationWithQueryMode = async (issuerRequestUri, clientId
|
|
72
72
|
throw new _errors.AuthorizationError("Invalid authentication redirect url");
|
73
73
|
}
|
74
74
|
}
|
75
|
+
return parseAuthRedirectUrl(authRedirectUrl);
|
76
|
+
};
|
77
|
+
exports.completeUserAuthorizationWithQueryMode = completeUserAuthorizationWithQueryMode;
|
78
|
+
const parseAuthRedirectUrl = authRedirectUrl => {
|
75
79
|
const urlParse = (0, _parseUrl.default)(authRedirectUrl);
|
76
80
|
const authRes = _auth.AuthorizationResultShape.safeParse(urlParse.query);
|
77
81
|
if (!authRes.success) {
|
@@ -86,7 +90,7 @@ const completeUserAuthorizationWithQueryMode = async (issuerRequestUri, clientId
|
|
86
90
|
};
|
87
91
|
|
88
92
|
// TODO: SIW-1120 implement generic credential issuance flow
|
89
|
-
exports.
|
93
|
+
exports.parseAuthRedirectUrl = parseAuthRedirectUrl;
|
90
94
|
const completeUserAuthorizationWithFormPostJwtMode = () => {
|
91
95
|
throw new Error("Not implemented");
|
92
96
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_reactNative","obj","__esModule","default","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","AuthorizationError","message","Linking","addEventListener","_ref","url","includes","openAuthUrlInBrowser","openURL","unitAuthRedirectIsNotUndefined","until","undefined","Promise","all","urlParse","parseUrl","authRes","AuthorizationResultShape","safeParse","query","success","authErr","AuthorizationErrorShape","error","AuthorizationIdpError","data","error_description","
|
1
|
+
{"version":3,"names":["_auth","require","_misc","_parseUrl","_interopRequireDefault","_errors","_reactNative","obj","__esModule","default","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","AuthorizationError","message","Linking","addEventListener","_ref","url","includes","openAuthUrlInBrowser","openURL","unitAuthRedirectIsNotUndefined","until","undefined","Promise","all","parseAuthRedirectUrl","exports","urlParse","parseUrl","authRes","AuthorizationResultShape","safeParse","query","success","authErr","AuthorizationErrorShape","error","AuthorizationIdpError","data","error_description","completeUserAuthorizationWithFormPostJwtMode","Error"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":";;;;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AAD,oBAAA,GAAAA,oBAAA;AACO,MAAMe,4CAA4C,GAAGA,CAAA,KAAM;EAChE,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;AACpC,CAAC;AAACf,OAAA,CAAAc,4CAAA,GAAAA,4CAAA"}
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.authorizeAccess = void 0;
|
7
|
-
var _misc = require("
|
8
|
-
var _crypto = require("
|
9
|
-
var _dpop = require("
|
7
|
+
var _misc = require("../../utils/misc");
|
8
|
+
var _crypto = require("../../utils/crypto");
|
9
|
+
var _dpop = require("../../utils/dpop");
|
10
10
|
var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
|
11
|
-
var _pop = require("
|
11
|
+
var _pop = require("../../utils/pop");
|
12
12
|
var WalletInstanceAttestation = _interopRequireWildcard(require("../../wallet-instance-attestation"));
|
13
13
|
var _const = require("./const");
|
14
14
|
var _types = require("./types");
|
15
|
-
var _errors = require("
|
15
|
+
var _errors = require("../../utils/errors");
|
16
16
|
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); }
|
17
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_misc","require","_crypto","_dpop","_reactNativeUuid","_interopRequireDefault","_pop","WalletInstanceAttestation","_interopRequireWildcard","_const","_types","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","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","withEphemeralKey","ephimeralContext","createDPopToken","htm","htu","jti","uuid","v4","signedWiaPoP","createPopToken","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","ASSERTION_TYPE","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatus","res","json","TokenResponse","safeParse","success","ValidationFailed","error","message","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,yBAAA,GAAAC,uBAAA,CAAAP,OAAA;AAEA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;
|
1
|
+
{"version":3,"names":["_misc","require","_crypto","_dpop","_reactNativeUuid","_interopRequireDefault","_pop","WalletInstanceAttestation","_interopRequireWildcard","_const","_types","_errors","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","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","withEphemeralKey","ephimeralContext","createDPopToken","htm","htu","jti","uuid","v4","signedWiaPoP","createPopToken","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","ASSERTION_TYPE","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","hasStatus","res","json","TokenResponse","safeParse","success","ValidationFailed","error","message","accessToken","data","exports"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,yBAAA,GAAAC,uBAAA,CAAAP,OAAA;AAEA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AAAsD,SAAAW,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;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AACkB,QAAQ,EAAE;IACxCwB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAExB;IACR,CAAC;IACDyB,IAAI,EAAEN,4BAA4B,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,eAAS,EAAC,GAAG,CAAC,CAAC,CACpBD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEF,IAAI,IAAKM,oBAAa,CAACC,SAAS,CAACP,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACY,OAAO,EAAE;IACrB,MAAM,IAAIC,wBAAgB,CAACb,QAAQ,CAACc,KAAK,CAACC,OAAO,CAAC;EACpD;EAEA,OAAO;IAAEC,WAAW,EAAEhB,QAAQ,CAACiB,IAAI;IAAEtC;EAAuB,CAAC;AAC/D,CAAC;AAACuC,OAAA,CAAAlE,eAAA,GAAAA,eAAA"}
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.obtainCredential = exports.createNonceProof = void 0;
|
7
7
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
8
|
-
var _misc = require("
|
9
|
-
var _errors = require("
|
8
|
+
var _misc = require("../../utils/misc");
|
9
|
+
var _errors = require("../../utils/errors");
|
10
10
|
var _types = require("./types");
|
11
11
|
const createNonceProof = async (nonce, issuer, audience, ctx) => {
|
12
12
|
const jwk = await ctx.getPublicKey();
|
@@ -27,6 +27,12 @@ Object.defineProperty(exports, "obtainCredential", {
|
|
27
27
|
return _obtainCredential.obtainCredential;
|
28
28
|
}
|
29
29
|
});
|
30
|
+
Object.defineProperty(exports, "parseAuthRedirectUrl", {
|
31
|
+
enumerable: true,
|
32
|
+
get: function () {
|
33
|
+
return _completeUserAuthorization.parseAuthRedirectUrl;
|
34
|
+
}
|
35
|
+
});
|
30
36
|
Object.defineProperty(exports, "startUserAuthorization", {
|
31
37
|
enumerable: true,
|
32
38
|
get: function () {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_evaluateIssuerTrust","require","_startUserAuthorization","_completeUserAuthorization","_authorizeAccess","_obtainCredential","_verifyAndParseCredential"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":"
|
1
|
+
{"version":3,"names":["_evaluateIssuerTrust","require","_startUserAuthorization","_completeUserAuthorization","_authorizeAccess","_obtainCredential","_verifyAndParseCredential"],"sourceRoot":"../../../../src","sources":["credential/issuance/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAIA,IAAAC,uBAAA,GAAAD,OAAA;AAIA,IAAAE,0BAAA,GAAAF,OAAA;AAKA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAIA,IAAAK,yBAAA,GAAAL,OAAA"}
|