1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 00:03:56 +00:00

[PM-23621] Require userId for initAccount on the key-service (#15684)

* require userID for initAccount on key service

* add unit test coverage

* update consumer
This commit is contained in:
Thomas Avery
2025-07-22 10:30:50 -05:00
committed by GitHub
parent da6fb82fd8
commit e99abb49ec
4 changed files with 112 additions and 12 deletions

View File

@@ -386,11 +386,12 @@ export abstract class KeyService {
/**
* Initialize all necessary crypto keys needed for a new account.
* Warning! This completely replaces any existing keys!
* @param userId The user id of the target user.
* @returns The user's newly created public key, private key, and encrypted private key
*
* @throws An error if there is no user currently active.
* @throws An error if the userId is null or undefined.
* @throws An error if the user already has a user key.
*/
abstract initAccount(): Promise<{
abstract initAccount(userId: UserId): Promise<{
userKey: UserKey;
publicKey: string;
privateKey: EncString;