INNER CODE UNIT · JavaScript
parseAuthenticatorData
mylofi/webauthn-local-client · src/walc.js:565
function parseAuthenticatorData(authData) {
// https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API/Authenticator_data
// 32 bytes: rpIdHash
// 1 byte: flags
// Bit 0, User Presence (UP)
// Bit 2, User Verification (UV)
// Bit 3, Backup Eligibility (BE)
// Bit 4, Backup State (BS)
// Bit 6, Attested Credential Data (AT)
// Bit 7, Extension Data (ED)
// 4 bytes: signCount (0 means disabled)
// ? bytes: attestation data
// ? bytes: authenticator extension data
var rpIdHash = authData.slice(0,32);
var rawFlags = authData[32];
var userPresence = ((rawFlags & 1) == 1);
var userVerification = ((rawFlags & 4) == 4);