debug: log credentialId during encryption for testing
This commit is contained in:
parent
0e75a49b08
commit
64f4d217d6
@ -248,8 +248,11 @@ export class WebAuthnService {
|
||||
* Sauvegarde la clé PBKDF2 chiffrée dans IndexedDB
|
||||
* NE PAS stocker credentialId avec la clé chiffrée
|
||||
*/
|
||||
private async savePBKDF2Key(encryptedKey: string, _credentialId: string, securityMode: SecurityMode): Promise<void> {
|
||||
private async savePBKDF2Key(encryptedKey: string, credentialId: string, securityMode: SecurityMode): Promise<void> {
|
||||
try {
|
||||
// TEST: Log credentialId used for encryption
|
||||
console.log('🔐 TEST: credentialId used for encryption:', credentialId);
|
||||
|
||||
const db = await this.openDatabase();
|
||||
console.log(`🔍 Available stores in ${DATABASE_CONFIG.name}:`, Array.from(db.objectStoreNames));
|
||||
const transaction = db.transaction([DATABASE_CONFIG.stores.pbkdf2keys.name], 'readwrite');
|
||||
@ -302,7 +305,23 @@ export class WebAuthnService {
|
||||
// Récupérer le credentialId dynamiquement via WebAuthn
|
||||
// IMPORTANT: Cela nécessite une interaction utilisateur (authentification biométrique)
|
||||
console.log('🔐 Requesting WebAuthn authentication to retrieve credential...');
|
||||
const credentialId = await this.getCurrentCredentialId();
|
||||
|
||||
// TEST: Try to get credentialId from sessionStorage first
|
||||
const storedCredentialId = sessionStorage.getItem('webauthn_credential_id');
|
||||
let credentialId: string | null = null;
|
||||
|
||||
if (storedCredentialId) {
|
||||
console.log('🔐 Using credentialId from sessionStorage:', storedCredentialId);
|
||||
credentialId = storedCredentialId;
|
||||
} else {
|
||||
// Fallback to WebAuthn
|
||||
credentialId = await this.getCurrentCredentialId();
|
||||
if (credentialId) {
|
||||
console.log('🔐 Storing credentialId in sessionStorage for testing');
|
||||
sessionStorage.setItem('webauthn_credential_id', credentialId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!credentialId) {
|
||||
console.log('🔍 WebAuthn authentication required but not available');
|
||||
console.log('ℹ️ For proton-pass or os mode, user interaction is required to decrypt the key');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user