summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/parseAuthenticatorData.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src/helpers/parseAuthenticatorData.ts')
-rw-r--r--packages/server/src/helpers/parseAuthenticatorData.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/server/src/helpers/parseAuthenticatorData.ts b/packages/server/src/helpers/parseAuthenticatorData.ts
index 911c9e0..a816d15 100644
--- a/packages/server/src/helpers/parseAuthenticatorData.ts
+++ b/packages/server/src/helpers/parseAuthenticatorData.ts
@@ -18,11 +18,13 @@ export default function parseAuthenticatorData(authData: Buffer): ParsedAuthenti
const flagsBuf = authData.slice(pointer, (pointer += 1));
const flagsInt = flagsBuf[0];
+ // Bit positions can be referenced here:
+ // https://www.w3.org/TR/webauthn-2/#flags
const flags = {
- up: !!(flagsInt & 0x01),
- uv: !!(flagsInt & 0x04),
- at: !!(flagsInt & 0x40),
- ed: !!(flagsInt & 0x80),
+ up: !!(flagsInt & 1 << 0), // User Presence
+ uv: !!(flagsInt & 1 << 2), // User Verified
+ at: !!(flagsInt & 1 << 6), // Attested Credential Data Present
+ ed: !!(flagsInt & 1 << 7), // Extension Data Present
flagsInt,
};