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,