mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
Prefer prefetching keys (#9289)
magical black-box key retrieval is slow, due to needing to repeatedly resolve (and potentially decrypt) keys. Doing the work up front is both more explicit and much faster. It would be preferable to move OrganizationId to an opaque type in the models, but that has rippling effects all over the place and ultimately is stopped by vault filtering on strings rather than ids, but still calling the property `organizationId`, we need to fix that first.
This commit is contained in:
@@ -5,6 +5,7 @@ import { EncString } from "@bitwarden/common/platform/models/domain/enc-string";
|
||||
|
||||
import { EncryptionType } from "../src/platform/enums";
|
||||
import { Utils } from "../src/platform/misc/utils";
|
||||
import { SymmetricCryptoKey } from "../src/platform/models/domain/symmetric-crypto-key";
|
||||
|
||||
function newGuid() {
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
||||
@@ -45,6 +46,10 @@ export function makeStaticByteArray(length: number, start = 0) {
|
||||
return arr;
|
||||
}
|
||||
|
||||
export function makeSymmetricCryptoKey<T extends SymmetricCryptoKey>(length: 32 | 64 = 64) {
|
||||
return new SymmetricCryptoKey(makeStaticByteArray(length)) as T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to mock a return value of a static fromJSON method.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user