mirror of
https://github.com/bitwarden/jslib
synced 2025-12-23 19:53:55 +00:00
Add get key from storage for ensuring biometric browser integration (#408)
This commit is contained in:
@@ -100,7 +100,18 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
if (this.key != null) {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
keySuffix ||= 'auto';
|
||||
const symmetricKey = await this.getKeyFromStorage(keySuffix);
|
||||
|
||||
if (symmetricKey != null) {
|
||||
this.setKey(symmetricKey);
|
||||
}
|
||||
|
||||
return symmetricKey;
|
||||
}
|
||||
|
||||
async getKeyFromStorage(keySuffix: KeySuffixOptions): Promise<SymmetricCryptoKey> {
|
||||
const key = await this.retrieveKeyFromStorage(keySuffix);
|
||||
if (key != null) {
|
||||
|
||||
@@ -112,10 +123,9 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
return null;
|
||||
}
|
||||
|
||||
this.setKey(symmetricKey);
|
||||
return symmetricKey;
|
||||
}
|
||||
|
||||
return key == null ? null : this.key;
|
||||
return null;
|
||||
}
|
||||
|
||||
async getKeyHash(): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user