mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Some groundwork for Send (#192)
* send work * New method to update the last used index (#184) Instead of updating it every time you call getNext(), it will be updated in a separate call, to avoid updating the index when the cipher did not auto-fill correctly (e.g wrong frame) Fixes #1392 * added OnlyOrg to PolicyType enum (#183) * [Require SSO] Add policy type enumeration (#186) * Added SsoAuthentication policy type * Updated policy type name // added comments for clarification of what each type controls * [SSO] New user provision flow (#173) * Initial commit of new user sso flow * Adjusted stateSplit conditional per review * Add logging to lowdb storage service (#188) * Fix lint errors/warnings (#187) * remove password api * access id * makeSendKey Co-authored-by: Josep Marí <xusoo@users.noreply.github.com> Co-authored-by: Addison Beck <abeck@bitwarden.com> Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Co-authored-by: Chad Scharf <3904944+cscharf@users.noreply.github.com>
This commit is contained in:
@@ -43,6 +43,10 @@ export class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
static fromUrlB64ToArray(str: string): Uint8Array {
|
||||
return Utils.fromB64ToArray(Utils.fromUrlB64ToB64(str));
|
||||
}
|
||||
|
||||
static fromHexToArray(str: string): Uint8Array {
|
||||
if (Utils.isNode || Utils.isNativeScript) {
|
||||
return new Uint8Array(Buffer.from(str, 'hex'));
|
||||
@@ -90,11 +94,13 @@ export class Utils {
|
||||
}
|
||||
|
||||
static fromBufferToUrlB64(buffer: ArrayBuffer): string {
|
||||
const output = this.fromBufferToB64(buffer)
|
||||
.replace(/\+/g, '-')
|
||||
return Utils.fromB64toUrlB64(Utils.fromBufferToB64(buffer))
|
||||
}
|
||||
|
||||
static fromB64toUrlB64(b64Str: string) {
|
||||
return b64Str.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/=/g, '');
|
||||
return output;
|
||||
}
|
||||
|
||||
static fromBufferToUtf8(buffer: ArrayBuffer): string {
|
||||
@@ -121,8 +127,8 @@ export class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
static fromUrlB64ToUtf8(b64Str: string): string {
|
||||
let output = b64Str.replace(/-/g, '+').replace(/_/g, '/');
|
||||
static fromUrlB64ToB64(urlB64Str: string): string {
|
||||
let output = urlB64Str.replace(/-/g, '+').replace(/_/g, '/');
|
||||
switch (output.length % 4) {
|
||||
case 0:
|
||||
break;
|
||||
@@ -136,7 +142,11 @@ export class Utils {
|
||||
throw new Error('Illegal base64url string!');
|
||||
}
|
||||
|
||||
return Utils.fromB64ToUtf8(output);
|
||||
return output;
|
||||
}
|
||||
|
||||
static fromUrlB64ToUtf8(urlB64Str: string): string {
|
||||
return Utils.fromB64ToUtf8(Utils.fromUrlB64ToB64(urlB64Str));
|
||||
}
|
||||
|
||||
static fromB64ToUtf8(b64Str: string): string {
|
||||
|
||||
Reference in New Issue
Block a user