mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 07:13:32 +00:00
[PM-13779] Add vNext CollectionService without ActiveUserState (#11705)
- add tests - install jest-extended for additional matchers - allow for generation of different crypto keys in tests
This commit is contained in:
@@ -46,8 +46,15 @@ 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;
|
||||
/**
|
||||
* Creates a symmetric crypto key for use in tests. This is deterministic, i.e. it will produce identical keys
|
||||
* for identical argument values. Provide a unique value to the `seed` parameter to create different keys.
|
||||
*/
|
||||
export function makeSymmetricCryptoKey<T extends SymmetricCryptoKey>(
|
||||
length: 32 | 64 = 64,
|
||||
seed = 0,
|
||||
) {
|
||||
return new SymmetricCryptoKey(makeStaticByteArray(length, seed)) as T;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user