mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
hasEncKey checks
This commit is contained in:
parent
5fac067713
commit
cc6f732a14
@ -17,6 +17,7 @@ export abstract class CryptoService {
|
|||||||
getOrgKeys: () => Promise<Map<string, SymmetricCryptoKey>>;
|
getOrgKeys: () => Promise<Map<string, SymmetricCryptoKey>>;
|
||||||
getOrgKey: (orgId: string) => Promise<SymmetricCryptoKey>;
|
getOrgKey: (orgId: string) => Promise<SymmetricCryptoKey>;
|
||||||
hasKey: () => Promise<boolean>;
|
hasKey: () => Promise<boolean>;
|
||||||
|
hasEncKey: () => Promise<boolean>;
|
||||||
clearKey: () => Promise<any>;
|
clearKey: () => Promise<any>;
|
||||||
clearKeyHash: () => Promise<any>;
|
clearKeyHash: () => Promise<any>;
|
||||||
clearEncKey: (memoryOnly?: boolean) => Promise<any>;
|
clearEncKey: (memoryOnly?: boolean) => Promise<any>;
|
||||||
|
@ -40,8 +40,7 @@ export class AttachmentsComponent implements OnInit {
|
|||||||
this.cipherDomain = await this.loadCipher();
|
this.cipherDomain = await this.loadCipher();
|
||||||
this.cipher = await this.cipherDomain.decrypt();
|
this.cipher = await this.cipherDomain.decrypt();
|
||||||
|
|
||||||
const key = await this.cryptoService.getEncKey();
|
this.hasUpdatedKey = await this.cryptoService.hasEncKey();
|
||||||
this.hasUpdatedKey = key != null;
|
|
||||||
const isPremium = this.tokenService.getPremium();
|
const isPremium = this.tokenService.getPremium();
|
||||||
this.canAccessAttachments = isPremium || this.cipher.organizationId != null;
|
this.canAccessAttachments = isPremium || this.cipher.organizationId != null;
|
||||||
|
|
||||||
|
@ -211,6 +211,11 @@ export class CryptoService implements CryptoServiceAbstraction {
|
|||||||
return (await this.getKey()) != null;
|
return (await this.getKey()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async hasEncKey(): Promise<boolean> {
|
||||||
|
const encKey = await this.storageService.get<string>(Keys.encKey);
|
||||||
|
return encKey != null;
|
||||||
|
}
|
||||||
|
|
||||||
clearKey(): Promise<any> {
|
clearKey(): Promise<any> {
|
||||||
this.key = this.legacyEtmKey = null;
|
this.key = this.legacyEtmKey = null;
|
||||||
return this.secureStorageService.remove(Keys.key);
|
return this.secureStorageService.remove(Keys.key);
|
||||||
|
Loading…
Reference in New Issue
Block a user