1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

[EC-598] feat: add signatures to attestation

This commit is contained in:
Andreas Coroiu
2023-03-30 10:55:59 +02:00
parent 151afeb241
commit b3d5ab4472
3 changed files with 115 additions and 41 deletions

View File

@@ -11,11 +11,16 @@ export class Fido2Utils {
return Utils.fromUrlB64ToArray(str);
}
private static bufferSourceToUint8Array(bufferSource: BufferSource) {
if (bufferSource instanceof ArrayBuffer) {
static bufferSourceToUint8Array(bufferSource: BufferSource) {
if (Fido2Utils.isArrayBuffer(bufferSource)) {
return new Uint8Array(bufferSource);
} else {
return new Uint8Array(bufferSource.buffer);
}
}
/** Utility function to identify type of bufferSource. Necessary because of differences between runtimes */
static isArrayBuffer(bufferSource: BufferSource): bufferSource is ArrayBuffer {
return bufferSource instanceof ArrayBuffer || bufferSource.buffer === undefined;
}
}