add card verification

This commit is contained in:
Michele Balistreri 2024-10-15 13:03:58 +02:00
parent 00a64681f5
commit f31564e8ec
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
4 changed files with 15 additions and 6 deletions

View File

@ -1246,7 +1246,7 @@ PODS:
- Yoga
- react-native-get-random-values (1.11.0):
- React-Core
- react-native-status-keycard (2.6.1):
- react-native-status-keycard (2.6.2):
- Keycard
- React
- React-nativeconfig (0.75.3)
@ -1826,7 +1826,7 @@ SPEC CHECKSUMS:
React-Mapbuffer: 714f2fae68edcabfc332b754e9fbaa8cfc68fdd4
React-microtasksnativemodule: 4943ad8f99be8ccf5a63329fa7d269816609df9e
react-native-get-random-values: 21325b2244dfa6b58878f51f9aa42821e7ba3d06
react-native-status-keycard: 9803b8545df3bde6880a2419ffbf3df404b3201f
react-native-status-keycard: 76a5c826352ee1d70de854b3e8b12670946bc1c8
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
React-NativeModulesApple: 0506da59fc40d2e1e6e12a233db5e81c46face27
React-perflogger: 3bbb82f18e9ac29a1a6931568e99d6305ef4403b

6
package-lock.json generated
View File

@ -17,7 +17,7 @@
"react-native": "0.75.3",
"react-native-get-random-values": "^1.11.0",
"react-native-modal": "^13.0.1",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.6.1",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.6.2",
"react-native-svg": "^15.7.1",
"react-native-vector-icons": "^10.1.0",
"react-native-vision-camera": "^4.5.3",
@ -13225,8 +13225,8 @@
}
},
"node_modules/react-native-status-keycard": {
"version": "2.6.1",
"resolved": "git+ssh://git@github.com/status-im/react-native-status-keycard.git#2f9d46b2c720a8f2d76b510259bf8f538463ffa3",
"version": "2.6.2",
"resolved": "git+ssh://git@github.com/status-im/react-native-status-keycard.git#26c476b362e68aa9076412c97de082abaabab4bd",
"license": "MPL 2.0"
},
"node_modules/react-native-svg": {

View File

@ -20,7 +20,7 @@
"react-native": "0.75.3",
"react-native-get-random-values": "^1.11.0",
"react-native-modal": "^13.0.1",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.6.1",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.6.2",
"react-native-svg": "^15.7.1",
"react-native-vector-icons": "^10.1.0",
"react-native-vision-camera": "^4.5.3",

View File

@ -26,6 +26,7 @@ enum Step {
LoginSuccess,
LoginError,
FactoryReset,
NotAuthentic,
}
const Main = () => {
@ -105,6 +106,12 @@ const Main = () => {
newPinCounter = appInfo["pin-retry-counter"];
}
if (appInfo["authentic?"] === false) {
setStep(Step.NotAuthentic);
await stopNFC();
return;
}
switch (stepRef.current) {
case Step.Discovery:
if (appInfo["initialized?"]) {
@ -208,6 +215,7 @@ const Main = () => {
const loadData = async () => {
await Keycard.setPairings(await getPairings());
await Keycard.setCertificationAuthorities(["029ab99ee1e7a71bdf45b3f9c58c99866ff1294d2c1e304e228a86e10c3343501c"]);
const tmp = await AsyncStorage.getItem("wallet-key");
walletKey.current = tmp !== null ? tmp : "";
@ -319,6 +327,7 @@ const Main = () => {
{step == Step.FactoryReset && <InfoScreen icon="alert-circle" title="Factory Reset" message={factoryResetMessage()} onPressFunc={connectCard} onCancelFunc={cancelFactoryReset}></InfoScreen>}
{step == Step.LoginSuccess && <InfoScreen icon="check-circle" title="Success!" message="Login successful. You can now proceed to the Operator Dashboard in your browser" onPressFunc={toHome}></InfoScreen>}
{step == Step.LoginError && <InfoScreen icon="close-circle" title="Error" message={errorMessage} onPressFunc={toHome}></InfoScreen>}
{step == Step.NotAuthentic && <InfoScreen icon="close-circle" title="Error" message="We couldn't verify that this is an authentic Keycard. Please contact your distributor." onPressFunc={cancel}></InfoScreen>}
<NFCModal isVisible={isModalVisible} onChangeFunc={stopNFC}></NFCModal>
</ImageBackground>
);