mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 18:23:31 +00:00
[PM-23386] Fix fix usages of encrypt service (#15476)
* Fix incorrect usages of encrypt service * Add docs * Fix types
This commit is contained in:
@@ -296,10 +296,18 @@ export class TokenService implements TokenServiceAbstraction {
|
||||
return await this.encryptService.encryptString(accessToken, accessTokenKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypts the access token using the provided access token key.
|
||||
*
|
||||
* @param accessTokenKey - the key used to decrypt the access token
|
||||
* @param encryptedAccessToken - the encrypted access token to decrypt
|
||||
* @returns the decrypted access token
|
||||
* @throws Error if the access token key is not provided or the decryption fails
|
||||
*/
|
||||
private async decryptAccessToken(
|
||||
accessTokenKey: AccessTokenKey,
|
||||
encryptedAccessToken: EncString,
|
||||
): Promise<string | null> {
|
||||
): Promise<string> {
|
||||
if (!accessTokenKey) {
|
||||
throw new Error(
|
||||
"decryptAccessToken: Access token key required. Cannot decrypt access token.",
|
||||
|
||||
Reference in New Issue
Block a user