mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
Fix send rotation broken due to incorrect types (#14874)
This commit is contained in:
@@ -477,11 +477,9 @@ describe("SendService", () => {
|
||||
let encryptedKey: EncString;
|
||||
|
||||
beforeEach(() => {
|
||||
encryptService.unwrapSymmetricKey.mockResolvedValue(
|
||||
new SymmetricCryptoKey(new Uint8Array(32)),
|
||||
);
|
||||
encryptService.decryptBytes.mockResolvedValue(new Uint8Array(16));
|
||||
encryptedKey = new EncString("Re-encrypted Send Key");
|
||||
encryptService.wrapSymmetricKey.mockResolvedValue(encryptedKey);
|
||||
encryptService.encryptBytes.mockResolvedValue(encryptedKey);
|
||||
});
|
||||
|
||||
it("returns re-encrypted user sends", async () => {
|
||||
|
||||
@@ -292,8 +292,9 @@ export class SendService implements InternalSendServiceAbstraction {
|
||||
) {
|
||||
const requests = await Promise.all(
|
||||
sends.map(async (send) => {
|
||||
const sendKey = await this.encryptService.unwrapSymmetricKey(send.key, originalUserKey);
|
||||
send.key = await this.encryptService.wrapSymmetricKey(sendKey, rotateUserKey);
|
||||
// Send key is not a key but a 16 byte seed used to derive the key
|
||||
const sendKey = await this.encryptService.decryptBytes(send.key, originalUserKey);
|
||||
send.key = await this.encryptService.encryptBytes(sendKey, rotateUserKey);
|
||||
return new SendWithIdRequest(send);
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user