Skip to content

Commit

Permalink
feat(INJI-458): show loading screen after closing of web view in Open…
Browse files Browse the repository at this point in the history
…ID4VCI flow (#932)

* perf(INJI-458): cache fixed result of custom keystore presence

Each call over the RN bridge can take significant user-visible time, and since
the result is used multiple times and cannot change for a device in runtime,
it can be computed once stored for later use.

Signed-off-by: Harsh Vardhan <[email protected]>

* feat(INJI-458): show loading for android h/w keystore check & generation

Signed-off-by: Harsh Vardhan <[email protected]>

* feat(INJI-472): show loader on issuer select

Co-authored-by: KiruthikaJeyashankar <[email protected]>
Signed-off-by: Harsh Vardhan <[email protected]>

* refactor(INJI-458): rename const name to isHardwareKeystoreExists

Signed-off-by: Harsh Vardhan <[email protected]>

---------

Signed-off-by: Harsh Vardhan <[email protected]>
Co-authored-by: KiruthikaJeyashankar <[email protected]>
  • Loading branch information
vharsh and KiruthikaJeyashankar authored Oct 20, 2023
1 parent 294ed12 commit 86840ed
Show file tree
Hide file tree
Showing 16 changed files with 474 additions and 680 deletions.
18 changes: 14 additions & 4 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ fileignoreconfig:
checksum: 18af825821bc95e1056050623b804a5a8e7435b9e3383916a5d63024eeba9553
- filename: screens/WelcomeScreenController.ts
checksum: d8fe74404c80bf435459f4d20427a661fb622f0ee9f754345616abd346b98d14
- filename: shared/telemetry/TelemetryUtils.js
checksum: 9a61cd59a3718adf1f14faf3024fec66a3295ef373878a878a28e5cb1287afaa
- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts
checksum: 237a2640b7db70770d65da67c79f2929581e32f1162517e50b8d37e409f3387d
- filename: machines/store.ts
checksum: bbee269bd9703644c2a345819291caa42479b5ad0d5288713da780495b2ffb49
checksum: b9884f86b498dfbff75816d1f0d521c79971c8c28afa7824122d025b2699cdc4
- filename: shared/cryptoutil/cryptoUtil.ts
checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3
- filename: shared/telemetry/TelemetryUtils.js
checksum: ffe9aac2dcc590b98b0d588885c088eff189504ade653a77f74b67312bfd27ad
- filename: shared/fileStorage.ts
checksum: 07cb337dc1d5b0f0eef56270ac4f4f589260ee5e490183c024cf98a2aeafb139
- filename: shared/storage.ts
checksum: c8d874aa373bdf526bf59192139822f56915e702ef673bac4e0d7549b0fea3d0
checksum: c8d874aa373bdf526bf59192139822f56915e702ef673bac4e0d7549b0fea3d0
checksum: f9711b617b986af9bb733a31373e49494667ef07b74988fbf09688cb50ca73bd
- filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.ts
checksum: eec77ca61540327ff7cab3489ebdfd47aa373fd20b3ff87a6c322cd48d35fe8f
- filename: machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine.typegen.ts
checksum: f1f504bd8c14496ee71f8eb7f40d54411cc05be03347d644dcc2cca187a20678
version: ""
4 changes: 2 additions & 2 deletions App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {Alert} from 'react-native';
import {configureTelemetry} from './shared/telemetry/TelemetryUtils';
import {MessageOverlay} from './components/MessageOverlay';
import SecureKeystore from 'react-native-secure-keystore';
import {isCustomSecureKeystore} from './shared/cryptoutil/cryptoUtil';
import {isHardwareKeystoreExists} from './shared/cryptoutil/cryptoUtil';
import i18n from './i18n';
import './shared/flipperConfig';

Expand Down Expand Up @@ -91,7 +91,7 @@ const AppInitialization: React.FC = () => {
const {t} = useTranslation('common');

useEffect(() => {
if (isCustomSecureKeystore()) {
if (isHardwareKeystoreExists) {
SecureKeystore.updatePopup(
t('biometricPopup.title'),
t('biometricPopup.description'),
Expand Down
9 changes: 6 additions & 3 deletions machines/QrLoginMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import {MY_VCS_STORE_KEY, ESIGNET_BASE_URL} from '../shared/constants';
import {StoreEvents} from './store';
import {linkTransactionResponse, VC} from '../types/VC/ExistingMosipVC/vc';
import {request} from '../shared/request';
import {getJwt, isCustomSecureKeystore} from '../shared/cryptoutil/cryptoUtil';
import {
getJwt,
isHardwareKeystoreExists,
} from '../shared/cryptoutil/cryptoUtil';
import {
getBindingCertificateConstant,
getPrivateKey,
Expand Down Expand Up @@ -363,7 +366,7 @@ export const qrLoginMachine =
sendAuthenticate: async context => {
let privateKey;
const individualId = context.selectedVc.vcMetadata.id;
if (!isCustomSecureKeystore()) {
if (!isHardwareKeystoreExists) {
privateKey = await getPrivateKey(
context.selectedVc.walletBindingResponse?.walletBindingId,
);
Expand Down Expand Up @@ -397,7 +400,7 @@ export const qrLoginMachine =
sendConsent: async context => {
let privateKey;
const individualId = context.selectedVc.vcMetadata.id;
if (!isCustomSecureKeystore()) {
if (!isHardwareKeystoreExists) {
privateKey = await getPrivateKey(
context.selectedVc.walletBindingResponse?.walletBindingId,
);
Expand Down
83 changes: 0 additions & 83 deletions machines/QrLoginMachine.typegen.ts
Original file line number Diff line number Diff line change
@@ -1,83 +0,0 @@
// This file was automatically generated. Edits will be overwritten

export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
'done.invoke.QrLogin.linkTransaction:invocation[0]': {
type: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'done.invoke.QrLogin.sendingAuthenticate:invocation[0]': {
type: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'error.platform.QrLogin.linkTransaction:invocation[0]': {
type: 'error.platform.QrLogin.linkTransaction:invocation[0]';
data: unknown;
};
'error.platform.QrLogin.sendingAuthenticate:invocation[0]': {
type: 'error.platform.QrLogin.sendingAuthenticate:invocation[0]';
data: unknown;
};
'error.platform.QrLogin.sendingConsent:invocation[0]': {
type: 'error.platform.QrLogin.sendingConsent:invocation[0]';
data: unknown;
};
'xstate.init': {type: 'xstate.init'};
};
invokeSrcNameMap: {
linkTransaction: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
sendAuthenticate: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]';
sendConsent: 'done.invoke.QrLogin.sendingConsent:invocation[0]';
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
SetErrorMessage:
| 'error.platform.QrLogin.linkTransaction:invocation[0]'
| 'error.platform.QrLogin.sendingAuthenticate:invocation[0]'
| 'error.platform.QrLogin.sendingConsent:invocation[0]';
expandLinkTransResp: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
forwardToParent: 'DISMISS';
loadMyVcs: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
loadThumbprint: 'CONFIRM';
resetLinkTransactionId: 'GET';
resetSelectedVoluntaryClaims: 'GET';
setClaims: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
setConsentClaims: 'TOGGLE_CONSENT_CLAIM';
setLinkedTransactionId: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]';
setMyVcs: 'STORE_RESPONSE';
setScanData: 'GET';
setSelectedVc: 'SELECT_VC';
setThumbprint: 'STORE_RESPONSE';
setlinkTransactionResponse: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
};
eventsCausingDelays: {};
eventsCausingGuards: {};
eventsCausingServices: {
linkTransaction: 'GET';
sendAuthenticate: never;
sendConsent: 'STORE_RESPONSE';
};
matchesStates:
| 'ShowError'
| 'done'
| 'faceAuth'
| 'invalidIdentity'
| 'linkTransaction'
| 'loadMyVcs'
| 'loadingThumbprint'
| 'requestConsent'
| 'sendingAuthenticate'
| 'sendingConsent'
| 'showvcList'
| 'success'
| 'waitingForData';
tags: never;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {VCMetadata} from '../../../shared/VCMetadata';
import {VC} from '../../../types/VC/ExistingMosipVC/vc';
import {
generateKeys,
isCustomSecureKeystore,
isHardwareKeystoreExists,
WalletBindingResponse,
} from '../../../shared/cryptoutil/cryptoUtil';
import {log} from 'xstate/lib/actions';
Expand Down Expand Up @@ -632,7 +632,7 @@ export const EsignetMosipVCItemMachine = model.createMachine(
),
setPublicKey: assign({
publicKey: (context, event) => {
if (!isCustomSecureKeystore()) {
if (!isHardwareKeystoreExists) {
return (event.data as KeyPair).public;
}
return event.data as string;
Expand Down Expand Up @@ -788,7 +788,7 @@ export const EsignetMosipVCItemMachine = model.createMachine(
return walletResponse;
},
generateKeyPair: async context => {
if (!isCustomSecureKeystore()) {
if (!isHardwareKeystoreExists) {
return await generateKeys();
}
const isBiometricsEnabled = SecureKeystore.hasBiometricsEnabled();
Expand Down Expand Up @@ -825,7 +825,7 @@ export const EsignetMosipVCItemMachine = model.createMachine(
return vc != null;
},

isCustomSecureKeystore: () => isCustomSecureKeystore(),
isCustomSecureKeystore: () => isHardwareKeystoreExists,
},
},
);
Expand Down
Loading

0 comments on commit 86840ed

Please sign in to comment.