Revert random key fallback, rely on PBKDF2 login-derived key
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2321b80127
commit
bbd920d75e
1 changed files with 2 additions and 5 deletions
|
|
@ -1820,12 +1820,9 @@ async function getOrCreateEncKey() {
|
||||||
const raw = base64ToBytes(stored);
|
const raw = base64ToBytes(stored);
|
||||||
_encKey = await crypto.subtle.importKey('raw', raw, {name: 'AES-GCM'}, false, ['encrypt', 'decrypt']);
|
_encKey = await crypto.subtle.importKey('raw', raw, {name: 'AES-GCM'}, false, ['encrypt', 'decrypt']);
|
||||||
return _encKey;
|
return _encKey;
|
||||||
} catch (e) { /* fall through, generate new */ }
|
} catch (e) { /* fall through */ }
|
||||||
}
|
}
|
||||||
_encKey = await crypto.subtle.generateKey({name: 'AES-GCM', length: 256}, true, ['encrypt', 'decrypt']);
|
throw new Error('Encryption key not found — please log out and log in again.');
|
||||||
const raw = await crypto.subtle.exportKey('raw', _encKey);
|
|
||||||
localStorage.setItem(storageKey, bytesToBase64(new Uint8Array(raw)));
|
|
||||||
return _encKey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function encryptBytes(key, plainBytes) {
|
async function encryptBytes(key, plainBytes) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue