Merge pull request #405 from selfxyz/hotfix/stuck-on-splash-screen

feat: improve tree and registration
This commit is contained in:
turnoffthiscomputer
2025-03-11 15:59:18 -04:00
committed by GitHub
3 changed files with 5 additions and 1 deletions

View File

@@ -201,6 +201,9 @@ export async function isUserRegistered(
passportData: PassportData,
secret: string,
) {
if (!passportData) {
return false;
}
const commitment = generateCommitment(
secret,
PASSPORT_ATTESTATION_ID,

View File

@@ -14,6 +14,7 @@ export const DSC_TREE_URL = 'https://tree.self.xyz/dsc';
export const CSCA_TREE_URL_STAGING = 'https://tree.staging.self.xyz/csca';
export const DSC_TREE_URL_STAGING = 'https://tree.staging.self.xyz/dsc';
export const IDENTITY_TREE_URL = 'https://tree.self.xyz/identity';
export const IDENTITY_TREE_URL_STAGING = 'https://tree.staging.self.xyz/identity';
export const PASSPORT_ATTESTATION_ID = '1'; //"8518753152044246090169372947057357973469996808638122125210848696986717482788"

View File

@@ -47,7 +47,7 @@ export async function getDSCTree(endpointType: EndpointType): Promise<string> {
}
export async function getCommitmentTree(documentType: DocumentType | null): Promise<string> {
const identityTreeUrl = documentType === null || documentType === 'passport' ? IDENTITY_TREE_URL : IDENTITY_TREE_URL_STAGING;
const identityTreeUrl = !documentType || typeof documentType !== 'string' || documentType === 'passport' ? IDENTITY_TREE_URL : IDENTITY_TREE_URL_STAGING;
const response = await fetch(identityTreeUrl);
return await response.json().then(data => data.data ? data.data : data);
}