mirror of
https://github.com/selfxyz/self.git
synced 2026-01-10 15:18:18 -05:00
Fix/mock passports flow (#598)
* dont look for alternatives csca during the disclosure proof * update podfile,lock * yarn nice
This commit is contained in:
committed by
GitHub
parent
6d27b365c7
commit
45bb72d097
@@ -1811,9 +1811,9 @@ PODS:
|
||||
- segment-analytics-react-native (2.21.0):
|
||||
- React-Core
|
||||
- sovran-react-native
|
||||
- Sentry (8.49.0):
|
||||
- Sentry/Core (= 8.49.0)
|
||||
- Sentry/Core (8.49.0)
|
||||
- Sentry (8.52.0):
|
||||
- Sentry/Core (= 8.52.0)
|
||||
- Sentry/Core (8.52.0)
|
||||
- Sentry/HybridSDK (8.48.0)
|
||||
- SentryPrivate (8.21.0)
|
||||
- SocketRocket (0.7.0)
|
||||
@@ -2163,7 +2163,7 @@ SPEC CHECKSUMS:
|
||||
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
|
||||
QKMRZParser: 6b419b6f07d6bff6b50429b97de10846dc902c29
|
||||
QKMRZScanner: cf2348fd6ce441e758328da4adf231ef2b51d769
|
||||
RCT-Folly: 34124ae2e667a0e5f0ea378db071d27548124321
|
||||
RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740
|
||||
RCTDeprecation: 726d24248aeab6d7180dac71a936bbca6a994ed1
|
||||
RCTRequired: a94e7febda6db0345d207e854323c37e3a31d93b
|
||||
RCTTypeSafety: 28e24a6e44f5cbf912c66dde6ab7e07d1059a205
|
||||
|
||||
@@ -34,6 +34,7 @@ import {
|
||||
checkIfPassportDscIsInTree,
|
||||
checkPassportSupported,
|
||||
isPassportNullified,
|
||||
isUserRegistered,
|
||||
isUserRegisteredWithAlternativeCSCA,
|
||||
} from './validateDocument';
|
||||
|
||||
@@ -549,44 +550,52 @@ export const useProvingStore = create<ProvingState>((set, get) => {
|
||||
return;
|
||||
}
|
||||
|
||||
const { isRegistered, csca } =
|
||||
await isUserRegisteredWithAlternativeCSCA(
|
||||
/// disclosure
|
||||
if (circuitType === 'disclose') {
|
||||
// check if the user is registered using the csca from the passport data.
|
||||
const isRegisteredWithLocalCSCA = await isUserRegistered(
|
||||
passportData,
|
||||
secret as string,
|
||||
);
|
||||
console.log('isRegistered: ', isRegistered, 'csca: ', csca);
|
||||
|
||||
if (circuitType === 'disclose') {
|
||||
if (isRegistered) {
|
||||
if (isRegisteredWithLocalCSCA) {
|
||||
actor!.send({ type: 'VALIDATION_SUCCESS' });
|
||||
return;
|
||||
} else {
|
||||
actor!.send({ type: 'PASSPORT_DATA_NOT_FOUND' });
|
||||
return;
|
||||
}
|
||||
} else if (isRegistered) {
|
||||
reStorePassportDataWithRightCSCA(passportData, csca as string);
|
||||
actor!.send({ type: 'ALREADY_REGISTERED' });
|
||||
return;
|
||||
}
|
||||
|
||||
const isNullifierOnchain = await isPassportNullified(passportData);
|
||||
if (isNullifierOnchain) {
|
||||
console.log(
|
||||
'Passport is nullified, but not registered with this secret. Navigating to AccountRecoveryChoice',
|
||||
/// registration
|
||||
else {
|
||||
const { isRegistered, csca } =
|
||||
await isUserRegisteredWithAlternativeCSCA(
|
||||
passportData,
|
||||
secret as string,
|
||||
);
|
||||
if (isRegistered) {
|
||||
reStorePassportDataWithRightCSCA(passportData, csca as string);
|
||||
actor!.send({ type: 'ALREADY_REGISTERED' });
|
||||
return;
|
||||
}
|
||||
const isNullifierOnchain = await isPassportNullified(passportData);
|
||||
if (isNullifierOnchain) {
|
||||
console.log(
|
||||
'Passport is nullified, but not registered with this secret. Navigating to AccountRecoveryChoice',
|
||||
);
|
||||
actor!.send({ type: 'ACCOUNT_RECOVERY_CHOICE' });
|
||||
return;
|
||||
}
|
||||
const isDscRegistered = await checkIfPassportDscIsInTree(
|
||||
passportData,
|
||||
useProtocolStore.getState().passport.dsc_tree,
|
||||
);
|
||||
actor!.send({ type: 'ACCOUNT_RECOVERY_CHOICE' });
|
||||
return;
|
||||
console.log('isDscRegistered: ', isDscRegistered);
|
||||
if (isDscRegistered) {
|
||||
set({ circuitType: 'register' });
|
||||
}
|
||||
actor!.send({ type: 'VALIDATION_SUCCESS' });
|
||||
}
|
||||
const isDscRegistered = await checkIfPassportDscIsInTree(
|
||||
passportData,
|
||||
useProtocolStore.getState().passport.dsc_tree,
|
||||
);
|
||||
console.log('isDscRegistered: ', isDscRegistered);
|
||||
if (isDscRegistered) {
|
||||
set({ circuitType: 'register' });
|
||||
}
|
||||
actor!.send({ type: 'VALIDATION_SUCCESS' });
|
||||
} catch (error) {
|
||||
console.error('Error validating passport:', error);
|
||||
actor!.send({ type: 'VALIDATION_ERROR' });
|
||||
|
||||
Reference in New Issue
Block a user