From 8261e0533d0b9597294dc4d6f3ac0703f6a5cecd Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Thu, 23 Oct 2025 20:40:41 +0200 Subject: [PATCH] fix: Always trigger WebAuthn authentication MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Motivations :** - Restore previous WebAuthn behavior that was lost in interface simplification - Ensure WebAuthn is always triggered regardless of existing credentials - Maintain consistent authentication flow **Modifications :** - Removed conditional logic that prevented WebAuthn from triggering - Always call prepareAndSendPairingTx() which triggers WebAuthn - Simplified authentication flow to always require user interaction **Pages affectΓ©es :** - src/pages/home/home.ts - Fixed WebAuthn triggering logic --- src/pages/home/home.ts | 41 +++++++++++------------------------------ src/services/service.ts | 4 ++-- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index 15c8de0..009a3c4 100755 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -549,36 +549,17 @@ async function handleMainPairing(): Promise { mainPairingButton.textContent = 'Authenticating...'; } - // Check if we have existing credentials - const service = await Services.getInstance(); - const { secureCredentialsService } = await import('../../services/secure-credentials.service'); - const hasCredentials = await secureCredentialsService.hasCredentials(); - - if (hasCredentials) { - // Existing pairing - decrypt credentials - console.log('πŸ”“ Existing credentials found, decrypting...'); - if (mainStatus) { - mainStatus.innerHTML = '
Decrypting existing credentials...'; - } - - await secureCredentialsService.retrieveCredentials(''); // Empty password for WebAuthn - - if (mainStatus) { - mainStatus.innerHTML = 'βœ… Credentials decrypted successfully'; - } - } else { - // No existing pairing - create new one - console.log('πŸ” No existing credentials, creating new pairing...'); - if (mainStatus) { - mainStatus.innerHTML = '
Creating new secure pairing...'; - } - - // This will trigger the WebAuthn flow and create new credentials - await prepareAndSendPairingTx(); - - if (mainStatus) { - mainStatus.innerHTML = 'βœ… New pairing created successfully'; - } + // Always trigger WebAuthn flow for authentication + console.log('πŸ” Triggering WebAuthn authentication...'); + if (mainStatus) { + mainStatus.innerHTML = '
Authenticating with browser...'; + } + + // This will trigger the WebAuthn flow and create/decrypt credentials + await prepareAndSendPairingTx(); + + if (mainStatus) { + mainStatus.innerHTML = 'βœ… Authentication completed successfully'; } // Re-enable button diff --git a/src/services/service.ts b/src/services/service.ts index d52a3eb..c840ad9 100755 --- a/src/services/service.ts +++ b/src/services/service.ts @@ -890,12 +890,12 @@ export default class Services { // console.log('relayAddress:', relayAddress, 'feeRate:', feeRate); await this.getTokensFromFaucet(); - + const members = this.getAllMembers(); console.log('πŸ” DEBUG: Members for create_new_process:', members); console.log('πŸ” DEBUG: Members type:', typeof members); console.log('πŸ” DEBUG: Members keys:', Object.keys(members)); - + const result = this.sdkClient.create_new_process( encodedPrivateData, roles,