mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 10:43:35 +00:00
[PM-3732] Use subtle to make aes keys (#6162)
* Provide `aesGenerateKey` to make aes keys * Use aesGenerateKey when generating a key data * Fix device test
This commit is contained in:
@@ -354,6 +354,20 @@ describe("WebCrypto Function Service", () => {
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("aesGenerateKey", () => {
|
||||
it.each([128, 192, 256, 512])("Should make a key of %s bits long", async (length) => {
|
||||
const cryptoFunctionService = getWebCryptoFunctionService();
|
||||
const key = await cryptoFunctionService.aesGenerateKey(length);
|
||||
expect(key.byteLength * 8).toBe(length);
|
||||
});
|
||||
|
||||
it("should not repeat itself for 512 length special case", async () => {
|
||||
const cryptoFunctionService = getWebCryptoFunctionService();
|
||||
const key = await cryptoFunctionService.aesGenerateKey(512);
|
||||
expect(key.slice(0, 32)).not.toEqual(key.slice(32, 64));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function testPbkdf2(
|
||||
|
||||
Reference in New Issue
Block a user