1
0
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:
Bernd Schoolmann
2025-05-22 15:05:28 +02:00
committed by GitHub
parent 0555d827c6
commit 068c63e891
2 changed files with 5 additions and 6 deletions

View File

@@ -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 () => {

View File

@@ -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);
}),
);