mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-16 10:45:20 +01:00
[EC-598] feat: add b64 conversion
This commit is contained in:
parent
def0015188
commit
02e9621fa2
@ -1,9 +1,21 @@
|
||||
import { Utils } from "../../misc/utils";
|
||||
|
||||
export class Fido2Utils {
|
||||
static bufferToString(buffer: BufferSource): string {
|
||||
return "";
|
||||
static bufferToString(bufferSource: BufferSource): string {
|
||||
const buffer = Fido2Utils.bufferSourceToUint8Array(bufferSource);
|
||||
|
||||
return Utils.fromBufferToUrlB64(buffer);
|
||||
}
|
||||
|
||||
static stringToBuffer(str: string): Uint8Array {
|
||||
return new Uint8Array(0);
|
||||
return Utils.fromUrlB64ToArray(str);
|
||||
}
|
||||
|
||||
private static bufferSourceToUint8Array(bufferSource: BufferSource) {
|
||||
if (bufferSource instanceof ArrayBuffer) {
|
||||
return new Uint8Array(bufferSource);
|
||||
} else {
|
||||
return new Uint8Array(bufferSource.buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user