mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
Use UrlB64 encoding for auth-email header (#450)
This commit is contained in:
@@ -159,6 +159,10 @@ export class Utils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static fromUtf8ToUrlB64(utfStr: string): string {
|
||||||
|
return Utils.fromBufferToUrlB64(Utils.fromUtf8ToArray(utfStr));
|
||||||
|
}
|
||||||
|
|
||||||
static fromB64ToUtf8(b64Str: string): string {
|
static fromB64ToUtf8(b64Str: string): string {
|
||||||
if (Utils.isNode || Utils.isNativeScript) {
|
if (Utils.isNode || Utils.isNativeScript) {
|
||||||
return Buffer.from(b64Str, 'base64').toString('utf8');
|
return Buffer.from(b64Str, 'base64').toString('utf8');
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import { TwoFactorProviderType } from '../../enums/twoFactorProviderType';
|
|||||||
import { CaptchaProtectedRequest } from './captchaProtectedRequest';
|
import { CaptchaProtectedRequest } from './captchaProtectedRequest';
|
||||||
import { DeviceRequest } from './deviceRequest';
|
import { DeviceRequest } from './deviceRequest';
|
||||||
|
|
||||||
|
import { Utils } from '../../misc/utils';
|
||||||
|
|
||||||
export class TokenRequest implements CaptchaProtectedRequest {
|
export class TokenRequest implements CaptchaProtectedRequest {
|
||||||
email: string;
|
email: string;
|
||||||
masterPasswordHash: string;
|
masterPasswordHash: string;
|
||||||
@@ -76,7 +78,7 @@ export class TokenRequest implements CaptchaProtectedRequest {
|
|||||||
|
|
||||||
alterIdentityTokenHeaders(headers: Headers) {
|
alterIdentityTokenHeaders(headers: Headers) {
|
||||||
if (this.clientSecret == null && this.masterPasswordHash != null && this.email != null) {
|
if (this.clientSecret == null && this.masterPasswordHash != null && this.email != null) {
|
||||||
headers.set('Auth-Email', this.email);
|
headers.set('Auth-Email', Utils.fromUtf8ToUrlB64(this.email));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user