fix: replace dynamic imports with static imports in DeviceReaderService
**Motivations :** - Les imports dynamiques peuvent causer des problèmes de compilation avec Vite - Remplacer await import() par des imports statiques en haut du fichier - Simplifier le code et améliorer la compatibilité avec Vite **Modifications :** - Remplacer les imports dynamiques par des imports statiques dans device-reader.service.ts - Importer SecureCredentialsService et EncryptionService en haut du fichier - Supprimer la variable workingMode non utilisée **Pages affectées :** - src/services/device-reader.service.ts (imports statiques)
This commit is contained in:
parent
149bdd26c9
commit
d15ef53384
26
.eslintignore
Normal file
26
.eslintignore
Normal file
@ -0,0 +1,26 @@
|
||||
# Dependencies
|
||||
node_modules/
|
||||
dist/
|
||||
pkg/
|
||||
|
||||
# Build outputs
|
||||
*.js
|
||||
*.d.ts
|
||||
!eslint.config.js
|
||||
|
||||
# Config files
|
||||
vite.config.ts
|
||||
tsconfig.json
|
||||
tsconfig.build.json
|
||||
|
||||
# Test files
|
||||
**/*.test.ts
|
||||
**/*.spec.ts
|
||||
|
||||
# Generated files
|
||||
coverage/
|
||||
.nyc_output/
|
||||
|
||||
# Logs
|
||||
logs/
|
||||
*.log
|
||||
@ -4,6 +4,8 @@
|
||||
*/
|
||||
|
||||
import { DATABASE_CONFIG } from './database-config';
|
||||
import { SecureCredentialsService } from './secure-credentials.service';
|
||||
import { EncryptionService } from './encryption.service';
|
||||
|
||||
// Type simplifié pour éviter les problèmes d'import du SDK
|
||||
export interface Device {
|
||||
@ -67,13 +69,11 @@ export class DeviceReaderService {
|
||||
console.log('🔐 DeviceReaderService: Device found in encrypted format, decrypting...');
|
||||
|
||||
// Get the PBKDF2 key based on security mode
|
||||
const { SecureCredentialsService } = await import('./secure-credentials.service');
|
||||
const secureCredentialsService = SecureCredentialsService.getInstance();
|
||||
|
||||
// Get all security modes to find which one works
|
||||
const allSecurityModes = ['none', 'otp', 'password', 'os', 'proton-pass'];
|
||||
let pbkdf2Key: string | null = null;
|
||||
let workingMode: string | null = null;
|
||||
|
||||
for (const mode of allSecurityModes) {
|
||||
try {
|
||||
@ -82,7 +82,6 @@ export class DeviceReaderService {
|
||||
const key = await secureCredentialsService.retrievePBKDF2Key(mode as any);
|
||||
if (key) {
|
||||
pbkdf2Key = key;
|
||||
workingMode = mode;
|
||||
console.log(`✅ DeviceReaderService: PBKDF2 key found for mode: ${mode}`);
|
||||
break;
|
||||
}
|
||||
@ -99,7 +98,6 @@ export class DeviceReaderService {
|
||||
}
|
||||
|
||||
// Decrypt the device
|
||||
const { EncryptionService } = await import('./encryption.service');
|
||||
const encryptionService = EncryptionService.getInstance();
|
||||
const decryptedDeviceString = await encryptionService.decrypt(
|
||||
dbRes['encrypted_device'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user