mirror of
https://github.com/bitwarden/browser
synced 2026-03-01 19:11:22 +00:00
Key Management in crypto with TS strict
This commit is contained in:
@@ -27,7 +27,7 @@ export class RotateableKeySetService {
|
||||
const rawPublicKey = Utils.fromB64ToArray(publicKey);
|
||||
const encryptedUserKey = await this.encryptService.rsaEncrypt(userKey.key, rawPublicKey);
|
||||
const encryptedPublicKey = await this.encryptService.encrypt(rawPublicKey, userKey);
|
||||
return new RotateableKeySet(encryptedUserKey, encryptedPublicKey, encryptedPrivateKey);
|
||||
return new RotateableKeySet(encryptedUserKey, encryptedPublicKey!, encryptedPrivateKey);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ export class RotateableKeySetService {
|
||||
|
||||
const newRotateableKeySet = new RotateableKeySet<ExternalKey>(
|
||||
newEncryptedUserKey,
|
||||
newEncryptedPublicKey,
|
||||
newEncryptedPublicKey!,
|
||||
keySet.encryptedPrivateKey,
|
||||
);
|
||||
|
||||
|
||||
@@ -180,6 +180,6 @@ export class UserKeyRotationService {
|
||||
if (privateKey == null) {
|
||||
throw new Error("No private key found for user key rotation");
|
||||
}
|
||||
return (await this.encryptService.encrypt(privateKey, newUserKey)).encryptedString;
|
||||
return (await this.encryptService.encrypt(privateKey, newUserKey))!.encryptedString;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user