summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/parseAuthenticatorData.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-09-09 09:45:16 -0700
committerMatthew Miller <matthew@millerti.me>2020-09-09 09:45:16 -0700
commitce255875e223aedcb2c84419540c0881a60db01d (patch)
tree1d2badc7bc258321223c252dbb2a97c6bb36bb13 /packages/server/src/helpers/parseAuthenticatorData.ts
parentb5ede7c63abc12746e9aa0579ec95c7ae4af61db (diff)
Explicitly cast cbor encode output to Buffer
Diffstat (limited to 'packages/server/src/helpers/parseAuthenticatorData.ts')
-rw-r--r--packages/server/src/helpers/parseAuthenticatorData.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/server/src/helpers/parseAuthenticatorData.ts b/packages/server/src/helpers/parseAuthenticatorData.ts
index 964d274..6fea0bd 100644
--- a/packages/server/src/helpers/parseAuthenticatorData.ts
+++ b/packages/server/src/helpers/parseAuthenticatorData.ts
@@ -51,7 +51,7 @@ export default function parseAuthenticatorData(authData: Buffer): ParsedAuthenti
// Decode the next CBOR item in the buffer, then re-encode it back to a Buffer
const firstDecoded = cbor.decodeFirstSync(intBuffer);
- const firstEncoded = cbor.encode(firstDecoded);
+ const firstEncoded = Buffer.from(cbor.encode(firstDecoded));
credentialPublicKey = firstEncoded;
intBuffer = intBuffer.slice(firstEncoded.byteLength);
}
@@ -59,7 +59,7 @@ export default function parseAuthenticatorData(authData: Buffer): ParsedAuthenti
let extensionsDataBuffer: Buffer | undefined = undefined;
if (flags.ed) {
const firstDecoded = cbor.decodeFirstSync(intBuffer);
- const firstEncoded = cbor.encode(firstDecoded);
+ const firstEncoded = Buffer.from(cbor.encode(firstDecoded));
extensionsDataBuffer = firstEncoded;
intBuffer = intBuffer.slice(firstEncoded.byteLength);
}