feat: Supprimer le fallback et forcer WebAuthn
- Supprimer toutes les vérifications de contexte et fallback - Forcer l'appel direct à navigator.credentials.create() - Simplifier le code pour identifier le problème WebAuthn - Tester si WebAuthn fonctionne sans conditions
This commit is contained in:
parent
6d7da4d276
commit
cc8a2ea708
@ -104,31 +104,14 @@ export class SecureCredentialsService {
|
|||||||
const encryptedSpendKey = await this.encryptKey(credentialData.spendKey, masterKey);
|
const encryptedSpendKey = await this.encryptKey(credentialData.spendKey, masterKey);
|
||||||
const encryptedScanKey = await this.encryptKey(credentialData.scanKey, masterKey);
|
const encryptedScanKey = await this.encryptKey(credentialData.scanKey, masterKey);
|
||||||
|
|
||||||
// Vérifier si WebAuthn est disponible et si on est en HTTPS
|
// Forcer l'utilisation de WebAuthn (pas de fallback)
|
||||||
const isSecureContext = window.isSecureContext;
|
console.log('🔍 DEBUG: Forcing WebAuthn credential creation');
|
||||||
const hasWebAuthn = navigator.credentials && navigator.credentials.create;
|
secureLogger.info('Forcing WebAuthn credential creation', {
|
||||||
|
|
||||||
secureLogger.info('WebAuthn availability check', {
|
|
||||||
component: 'SecureCredentialsService',
|
component: 'SecureCredentialsService',
|
||||||
operation: 'webauthn_check',
|
operation: 'webauthn_force'
|
||||||
isSecureContext,
|
|
||||||
hasWebAuthn,
|
|
||||||
userAgent: navigator.userAgent,
|
|
||||||
protocol: window.location.protocol
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let credential = null;
|
const credential = await navigator.credentials.create({
|
||||||
|
|
||||||
if (isSecureContext && hasWebAuthn) {
|
|
||||||
// Stocker dans les credentials du navigateur (HTTPS requis)
|
|
||||||
try {
|
|
||||||
console.log('🔍 DEBUG: WebAuthn branch taken - attempting credential creation');
|
|
||||||
secureLogger.info('Attempting to create WebAuthn credential', {
|
|
||||||
component: 'SecureCredentialsService',
|
|
||||||
operation: 'webauthn_create_attempt'
|
|
||||||
});
|
|
||||||
|
|
||||||
credential = await navigator.credentials.create({
|
|
||||||
publicKey: {
|
publicKey: {
|
||||||
challenge: new Uint8Array(32),
|
challenge: new Uint8Array(32),
|
||||||
rp: { name: '4NK Secure Storage' },
|
rp: { name: '4NK Secure Storage' },
|
||||||
@ -154,23 +137,6 @@ export class SecureCredentialsService {
|
|||||||
component: 'SecureCredentialsService',
|
component: 'SecureCredentialsService',
|
||||||
operation: 'webauthn_create'
|
operation: 'webauthn_create'
|
||||||
});
|
});
|
||||||
} catch (error) {
|
|
||||||
secureLogger.warn('WebAuthn credential creation failed, using fallback', error as Error, {
|
|
||||||
component: 'SecureCredentialsService',
|
|
||||||
operation: 'webauthn_create'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log('🔍 DEBUG: WebAuthn fallback branch taken');
|
|
||||||
console.log('🔍 DEBUG: isSecureContext:', isSecureContext);
|
|
||||||
console.log('🔍 DEBUG: hasWebAuthn:', hasWebAuthn);
|
|
||||||
secureLogger.info('WebAuthn not available (HTTP context), using fallback storage', {
|
|
||||||
component: 'SecureCredentialsService',
|
|
||||||
operation: 'webauthn_fallback',
|
|
||||||
isSecureContext,
|
|
||||||
hasWebAuthn
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (credential) {
|
if (credential) {
|
||||||
// Stocker les données chiffrées dans IndexedDB
|
// Stocker les données chiffrées dans IndexedDB
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user