summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/parseAuthenticatorData.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-11-19 06:45:11 -0800
committerGitHub <noreply@github.com>2020-11-19 06:45:11 -0800
commitfa616e03d0c0f1ef5a47884036527a279cbd0b01 (patch)
treeed99cc677e695209b24c606fd776da98892bad62 /packages/server/src/helpers/parseAuthenticatorData.ts
parent9be61b1bbc617ace95a015e4c28bba880fd07f64 (diff)
parent3e5d75d2cf4472e949c2edcafe8c0c61f80d4482 (diff)
Merge pull request #68 from jstewmon/caret-transient-deps
chore: use caret specifier for dependencies
Diffstat (limited to 'packages/server/src/helpers/parseAuthenticatorData.ts')
-rw-r--r--packages/server/src/helpers/parseAuthenticatorData.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/server/src/helpers/parseAuthenticatorData.ts b/packages/server/src/helpers/parseAuthenticatorData.ts
index 6fea0bd..67f0e1a 100644
--- a/packages/server/src/helpers/parseAuthenticatorData.ts
+++ b/packages/server/src/helpers/parseAuthenticatorData.ts
@@ -1,4 +1,5 @@
import cbor from 'cbor';
+import { decodeCborFirst } from './decodeCbor';
/**
* Make sense of the authData buffer contained in an Attestation
@@ -50,7 +51,7 @@ export default function parseAuthenticatorData(authData: Buffer): ParsedAuthenti
intBuffer = intBuffer.slice(credIDLen);
// Decode the next CBOR item in the buffer, then re-encode it back to a Buffer
- const firstDecoded = cbor.decodeFirstSync(intBuffer);
+ const firstDecoded = decodeCborFirst(intBuffer);
const firstEncoded = Buffer.from(cbor.encode(firstDecoded));
credentialPublicKey = firstEncoded;
intBuffer = intBuffer.slice(firstEncoded.byteLength);
@@ -58,7 +59,7 @@ export default function parseAuthenticatorData(authData: Buffer): ParsedAuthenti
let extensionsDataBuffer: Buffer | undefined = undefined;
if (flags.ed) {
- const firstDecoded = cbor.decodeFirstSync(intBuffer);
+ const firstDecoded = decodeCborFirst(intBuffer);
const firstEncoded = Buffer.from(cbor.encode(firstDecoded));
extensionsDataBuffer = firstEncoded;
intBuffer = intBuffer.slice(firstEncoded.byteLength);