diff options
author | Matthew Miller <matthew@millerti.me> | 2020-09-09 09:45:16 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2020-09-09 09:45:16 -0700 |
commit | ce255875e223aedcb2c84419540c0881a60db01d (patch) | |
tree | 1d2badc7bc258321223c252dbb2a97c6bb36bb13 /packages/server/src/helpers/parseAuthenticatorData.ts | |
parent | b5ede7c63abc12746e9aa0579ec95c7ae4af61db (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.ts | 4 |
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); } |