@1auth/authn-webauthn
Advanced tools
Comparing version 0.0.0-alpha.50 to 0.0.0-alpha.51
43
index.js
@@ -36,13 +36,8 @@ import { | ||
verify: async (response, value) => { | ||
try { | ||
const { verified, registrationInfo } = await verifyRegistrationResponse({ | ||
...value, | ||
response | ||
}) | ||
if (!verified) throw new Error('Failed verifyRegistrationResponse') | ||
return { registrationInfo: jsonEncodeSecret(registrationInfo) } | ||
} catch (e) { | ||
console.error('@1auth/authn-webauthn token.verify()', e) | ||
return false | ||
} | ||
const { verified, registrationInfo } = await verifyRegistrationResponse({ | ||
...value, | ||
response | ||
}) | ||
if (!verified) throw new Error('Failed verifyRegistrationResponse') | ||
return { registrationInfo: jsonEncodeSecret(registrationInfo) } | ||
} | ||
@@ -89,17 +84,13 @@ } | ||
verify: async (response, value) => { | ||
try { | ||
const { verified, authenticationInfo } = | ||
await verifyAuthenticationResponse({ | ||
...value, | ||
credential: value.authenticator.credential, | ||
response | ||
}) | ||
if (!verified) throw new Error('Failed verifyAuthenticationResponse') | ||
value.authenticator.credential.counter = authenticationInfo.newCounter | ||
value.authenticator = jsonEncodeSecret(value.authenticator) | ||
return true | ||
} catch (e) { | ||
console.error('@1auth/authn-webauthn challenge.verify()', e) | ||
return false | ||
} | ||
const { verified, authenticationInfo } = await verifyAuthenticationResponse( | ||
{ | ||
...value, | ||
credential: value.authenticator.credential, | ||
response | ||
} | ||
) | ||
if (!verified) throw new Error('Failed verifyAuthenticationResponse') | ||
value.authenticator.credential.counter = authenticationInfo.newCounter | ||
value.authenticator = jsonEncodeSecret(value.authenticator) | ||
return true | ||
}, | ||
@@ -106,0 +97,0 @@ cleanup: async (sub, value, { sourceId } = {}) => { |
{ | ||
"name": "@1auth/authn-webauthn", | ||
"version": "0.0.0-alpha.50", | ||
"version": "0.0.0-alpha.51", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "type": "module", |
10910
330