@pagopa/io-react-native-wallet 0.25.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -35
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +19 -57
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +1 -0
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +1 -2
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/errors.js +1 -18
- package/lib/commonjs/credential/issuance/errors.js.map +1 -1
- package/lib/commonjs/credential/issuance/index.js +6 -0
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/status/02-status-attestation.js +2 -4
- package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -1
- package/lib/commonjs/index.js +1 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/misc.js +19 -58
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/issuing.js +1 -2
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/credential/issuance/03-start-user-authorization.js +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +19 -58
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +1 -0
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +1 -2
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/errors.js +0 -16
- package/lib/module/credential/issuance/errors.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/credential/status/02-status-attestation.js +2 -4
- package/lib/module/credential/status/02-status-attestation.js.map +1 -1
- package/lib/module/index.js +1 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/misc.js +14 -51
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +1 -2
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +16 -15
- 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 -0
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/errors.d.ts +0 -9
- package/lib/typescript/credential/issuance/errors.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +3 -3
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/status/02-status-attestation.d.ts +1 -2
- package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/utils/misc.d.ts +5 -25
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts +2 -2
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/package.json +2 -6
- package/src/credential/issuance/03-start-user-authorization.ts +1 -1
- package/src/credential/issuance/04-complete-user-authorization.ts +42 -103
- package/src/credential/issuance/05-authorize-access.ts +1 -0
- package/src/credential/issuance/06-obtain-credential.ts +1 -2
- package/src/credential/issuance/errors.ts +0 -15
- package/src/credential/issuance/index.ts +4 -0
- package/src/credential/status/02-status-attestation.ts +2 -4
- package/src/index.ts +0 -2
- package/src/utils/misc.ts +16 -63
- package/src/wallet-instance-attestation/issuing.ts +1 -2
- package/lib/commonjs/cie/README.md +0 -6
- package/lib/commonjs/cie/component.js +0 -182
- package/lib/commonjs/cie/component.js.map +0 -1
- package/lib/commonjs/cie/error.js +0 -44
- package/lib/commonjs/cie/error.js.map +0 -1
- package/lib/commonjs/cie/index.js +0 -32
- package/lib/commonjs/cie/index.js.map +0 -1
- package/lib/commonjs/cie/manager.js +0 -142
- package/lib/commonjs/cie/manager.js.map +0 -1
- package/lib/module/cie/README.md +0 -6
- package/lib/module/cie/component.js +0 -172
- package/lib/module/cie/component.js.map +0 -1
- package/lib/module/cie/error.js +0 -36
- package/lib/module/cie/error.js.map +0 -1
- package/lib/module/cie/index.js +0 -4
- package/lib/module/cie/index.js.map +0 -1
- package/lib/module/cie/manager.js +0 -133
- package/lib/module/cie/manager.js.map +0 -1
- package/lib/typescript/cie/component.d.ts +0 -46
- package/lib/typescript/cie/component.d.ts.map +0 -1
- package/lib/typescript/cie/error.d.ts +0 -31
- package/lib/typescript/cie/error.d.ts.map +0 -1
- package/lib/typescript/cie/index.d.ts +0 -4
- package/lib/typescript/cie/index.d.ts.map +0 -1
- package/lib/typescript/cie/manager.d.ts +0 -5
- package/lib/typescript/cie/manager.d.ts.map +0 -1
- package/src/cie/README.md +0 -6
- package/src/cie/component.tsx +0 -218
- package/src/cie/error.ts +0 -58
- package/src/cie/index.ts +0 -4
- package/src/cie/manager.ts +0 -183
package/src/cie/manager.ts
DELETED
@@ -1,183 +0,0 @@
|
|
1
|
-
import cieManager, { type Event as CEvent } from "@pagopa/react-native-cie";
|
2
|
-
import { Platform } from "react-native";
|
3
|
-
import { CieEvent, type OnCieEvent, type OnError } from "./component";
|
4
|
-
import { CieError, CieErrorType } from "./error";
|
5
|
-
|
6
|
-
const BASE_UAT_URL = "https://collaudo.idserver.servizicie.interno.gov.it/idp/";
|
7
|
-
|
8
|
-
export type ContinueWithUrl = (callbackUrl: string) => void;
|
9
|
-
|
10
|
-
export const startCieAndroid = (
|
11
|
-
useCieUat: boolean,
|
12
|
-
ciePin: string,
|
13
|
-
onError: OnError,
|
14
|
-
onEvent: OnCieEvent,
|
15
|
-
cieAuthorizationUri: string,
|
16
|
-
continueWithUrl: ContinueWithUrl
|
17
|
-
) => {
|
18
|
-
try {
|
19
|
-
cieManager.removeAllListeners();
|
20
|
-
cieManager
|
21
|
-
.start()
|
22
|
-
.then(async () => {
|
23
|
-
cieManager.onEvent(handleCieEvent(onError, onEvent));
|
24
|
-
cieManager.onError((e: Error) => {
|
25
|
-
console.error(e);
|
26
|
-
return onError(new CieError({ message: e.message }));
|
27
|
-
});
|
28
|
-
cieManager.onSuccess(handleCieSuccess(continueWithUrl));
|
29
|
-
await cieManager.setPin(ciePin);
|
30
|
-
cieManager.setAuthenticationUrl(cieAuthorizationUri);
|
31
|
-
cieManager.enableLog(useCieUat);
|
32
|
-
cieManager.setCustomIdpUrl(useCieUat ? getCieUatEndpoint() : null);
|
33
|
-
await cieManager.startListeningNFC();
|
34
|
-
onEvent(CieEvent.waiting_card);
|
35
|
-
})
|
36
|
-
.catch(onError);
|
37
|
-
} catch (e) {
|
38
|
-
onError(
|
39
|
-
new CieError({
|
40
|
-
message: `Unable to start CIE NFC manager on Android: ${e}`,
|
41
|
-
type: CieErrorType.NFC_ERROR,
|
42
|
-
})
|
43
|
-
);
|
44
|
-
}
|
45
|
-
};
|
46
|
-
|
47
|
-
export const startCieiOS = async (
|
48
|
-
useCieUat: boolean,
|
49
|
-
ciePin: string,
|
50
|
-
onError: OnError,
|
51
|
-
onEvent: OnCieEvent,
|
52
|
-
cieAuthorizationUri: string,
|
53
|
-
continueWithUrl: ContinueWithUrl
|
54
|
-
) => {
|
55
|
-
try {
|
56
|
-
cieManager.removeAllListeners();
|
57
|
-
cieManager.onEvent(handleCieEvent(onError, onEvent));
|
58
|
-
cieManager.onError((e: Error) =>
|
59
|
-
onError(new CieError({ message: e.message }))
|
60
|
-
);
|
61
|
-
cieManager.onSuccess(handleCieSuccess(continueWithUrl));
|
62
|
-
cieManager.enableLog(useCieUat);
|
63
|
-
cieManager.setCustomIdpUrl(useCieUat ? getCieUatEndpoint() : null);
|
64
|
-
await cieManager.setPin(ciePin);
|
65
|
-
cieManager.setAuthenticationUrl(cieAuthorizationUri);
|
66
|
-
cieManager
|
67
|
-
.start()
|
68
|
-
.then(async () => {
|
69
|
-
await cieManager.startListeningNFC();
|
70
|
-
onEvent(CieEvent.waiting_card);
|
71
|
-
})
|
72
|
-
.catch(onError);
|
73
|
-
} catch (e) {
|
74
|
-
onError(
|
75
|
-
new CieError({
|
76
|
-
message: `Unable to start CIE NFC manager on iOS: ${e}`,
|
77
|
-
type: CieErrorType.NFC_ERROR,
|
78
|
-
})
|
79
|
-
);
|
80
|
-
}
|
81
|
-
};
|
82
|
-
|
83
|
-
const handleCieEvent =
|
84
|
-
(onError: OnError, onEvent: OnCieEvent) => (event: CEvent) => {
|
85
|
-
switch (event.event) {
|
86
|
-
// Reading starts
|
87
|
-
case "ON_TAG_DISCOVERED":
|
88
|
-
onEvent(CieEvent.reading);
|
89
|
-
break;
|
90
|
-
// "Function not supported" seems to be TAG_ERROR_NFC_NOT_SUPPORTED
|
91
|
-
// for the iOS SDK
|
92
|
-
case "Function not supported" as unknown:
|
93
|
-
case "TAG_ERROR_NFC_NOT_SUPPORTED":
|
94
|
-
case "ON_TAG_DISCOVERED_NOT_CIE":
|
95
|
-
onError(
|
96
|
-
new CieError({
|
97
|
-
message: `Invalid CIE card: ${event.event}`,
|
98
|
-
type: CieErrorType.TAG_NOT_VALID,
|
99
|
-
})
|
100
|
-
);
|
101
|
-
break;
|
102
|
-
case "AUTHENTICATION_ERROR":
|
103
|
-
case "ON_NO_INTERNET_CONNECTION":
|
104
|
-
onError(
|
105
|
-
new CieError({
|
106
|
-
message: `Authentication error or no internet connection`,
|
107
|
-
type: CieErrorType.AUTHENTICATION_ERROR,
|
108
|
-
})
|
109
|
-
);
|
110
|
-
break;
|
111
|
-
case "EXTENDED_APDU_NOT_SUPPORTED":
|
112
|
-
onError(
|
113
|
-
new CieError({
|
114
|
-
message: `APDU not supported`,
|
115
|
-
type: CieErrorType.NFC_ERROR,
|
116
|
-
})
|
117
|
-
);
|
118
|
-
break;
|
119
|
-
case "Transmission Error":
|
120
|
-
case "ON_TAG_LOST":
|
121
|
-
onError(
|
122
|
-
new CieError({
|
123
|
-
message: `Trasmission error`,
|
124
|
-
type: CieErrorType.NFC_ERROR,
|
125
|
-
})
|
126
|
-
);
|
127
|
-
break;
|
128
|
-
|
129
|
-
// The card is temporarily locked. Unlock is available by CieID app
|
130
|
-
case "PIN Locked":
|
131
|
-
case "ON_CARD_PIN_LOCKED":
|
132
|
-
onError(
|
133
|
-
new CieError({
|
134
|
-
message: `PIN locked`,
|
135
|
-
type: CieErrorType.PIN_LOCKED,
|
136
|
-
})
|
137
|
-
);
|
138
|
-
break;
|
139
|
-
case "ON_PIN_ERROR":
|
140
|
-
onError(
|
141
|
-
new CieError({
|
142
|
-
message: `PIN locked`,
|
143
|
-
type: CieErrorType.PIN_ERROR,
|
144
|
-
attemptsLeft: event.attemptsLeft,
|
145
|
-
})
|
146
|
-
);
|
147
|
-
break;
|
148
|
-
|
149
|
-
// CIE is Expired or Revoked
|
150
|
-
case "CERTIFICATE_EXPIRED":
|
151
|
-
onError(
|
152
|
-
new CieError({
|
153
|
-
message: `Certificate expired`,
|
154
|
-
type: CieErrorType.CERTIFICATE_ERROR,
|
155
|
-
})
|
156
|
-
);
|
157
|
-
break;
|
158
|
-
case "CERTIFICATE_REVOKED":
|
159
|
-
onError(
|
160
|
-
new CieError({
|
161
|
-
message: `Certificate revoked`,
|
162
|
-
type: CieErrorType.CERTIFICATE_ERROR,
|
163
|
-
})
|
164
|
-
);
|
165
|
-
|
166
|
-
break;
|
167
|
-
|
168
|
-
default:
|
169
|
-
break;
|
170
|
-
}
|
171
|
-
};
|
172
|
-
|
173
|
-
const handleCieSuccess =
|
174
|
-
(continueWithUrl: ContinueWithUrl) => (url: string) => {
|
175
|
-
continueWithUrl(decodeURIComponent(url));
|
176
|
-
};
|
177
|
-
|
178
|
-
const getCieUatEndpoint = () =>
|
179
|
-
Platform.select({
|
180
|
-
ios: `${BASE_UAT_URL}Authn/SSL/Login2`,
|
181
|
-
android: BASE_UAT_URL,
|
182
|
-
default: null,
|
183
|
-
});
|