diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index 1c5abdd..7c06f12 100755 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -87,6 +87,11 @@ export async function initHomePage(): Promise { }); } + // Trigger WebAuthn authentication first + console.log('🔐 Triggering WebAuthn authentication...'); + await handleMainPairing(); + + // After WebAuthn, get device address and setup UI console.log('🔧 Getting device address...'); const spAddress = await service.getDeviceAddress(); console.log('🔧 Generating create button...'); @@ -94,10 +99,6 @@ export async function initHomePage(): Promise { console.log('🔧 Displaying emojis...'); displayEmojis(spAddress); - // Now trigger WebAuthn authentication - console.log('🔐 Triggering WebAuthn authentication...'); - await handleMainPairing(); - console.log('✅ Home page initialization completed'); } catch (error) { console.error('❌ Error initializing home page:', error); diff --git a/src/services/secure-credentials.service.ts b/src/services/secure-credentials.service.ts index 0e7354d..c1c66d2 100644 --- a/src/services/secure-credentials.service.ts +++ b/src/services/secure-credentials.service.ts @@ -140,7 +140,7 @@ export class SecureCredentialsService { // Récupérer les clés du SDK générées par PBKDF2 let spendKey: string; let scanKey: string; - + try { const device = await this.getDeviceFromSDK(); if (device && device.sp_wallet && device.sp_wallet.spend_key && device.sp_wallet.scan_key) { @@ -198,12 +198,12 @@ export class SecureCredentialsService { // Importer le service pour accéder au SDK const { Services } = await import('./service'); const service = await Services.getInstance(); - + // Vérifier que le SDK est initialisé if (!service.sdkClient) { throw new Error('SDK not initialized - cannot get device'); } - + const device = service.dumpDeviceFromMemory(); console.log('🔍 Device from SDK:', device); return device;