summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/assertion/verifyAssertionResponse.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-05-21 17:16:14 -0700
committerMatthew Miller <matthew@millerti.me>2020-05-21 17:16:14 -0700
commit445670d6f574c96ded5715e0bf56e3862ab08bf3 (patch)
treef112d2098074630e0919f4a0fa680b1387dd8fee /packages/server/src/assertion/verifyAssertionResponse.ts
parent99e6a2e86472530cb4be12bef34ea72975a6b75d (diff)
Remove all console logging
Diffstat (limited to 'packages/server/src/assertion/verifyAssertionResponse.ts')
-rw-r--r--packages/server/src/assertion/verifyAssertionResponse.ts17
1 files changed, 5 insertions, 12 deletions
diff --git a/packages/server/src/assertion/verifyAssertionResponse.ts b/packages/server/src/assertion/verifyAssertionResponse.ts
index c126b84..fb668f4 100644
--- a/packages/server/src/assertion/verifyAssertionResponse.ts
+++ b/packages/server/src/assertion/verifyAssertionResponse.ts
@@ -27,28 +27,20 @@ export default function verifyAssertionResponse(
const { base64AuthenticatorData, base64ClientDataJSON, base64Signature } = response;
const clientDataJSON = decodeClientDataJSON(base64ClientDataJSON);
- console.debug('decodedClientDataJSON:', clientDataJSON);
-
const { type, origin } = clientDataJSON;
// Check that the origin is our site
if (origin !== expectedOrigin) {
- console.error('client origin did not equal our origin');
- console.debug('expectedOrigin:', expectedOrigin);
- console.debug('assertion\'s origin:', origin);
- throw new Error('Assertion origin was an unexpected value');
+ throw new Error(`Unexpected assertion origin: ${origin}`);
}
// Make sure we're handling an assertion
if (type !== 'webauthn.get') {
- console.error('type did not equal "webauthn.get"');
- console.debug('attestation\'s type:', type);
- throw new Error('Assertion type was an unexpected value');
+ throw new Error(`Unexpected assertion type: ${type}`);
}
const authDataBuffer = base64url.toBuffer(base64AuthenticatorData);
const authData = parseAssertionAuthData(authDataBuffer);
- console.log('parsed authData:', authData);
if (!(authData.flags & U2F_USER_PRESENTED)) {
throw new Error('User was NOT present during assertion!');
@@ -66,8 +58,9 @@ export default function verifyAssertionResponse(
// dataStruct. It's related to how the authenticator maintains the number of times its been
// used for this client. If this happens, then someone's somehow increased the counter
// on the device without going through this site
- console.debug(`Response counter ${counter} was not greater than ${authenticator.counter}`);
- throw new Error(`Counter in response did not increment from ${authenticator.counter}`);
+ throw new Error(
+ `Response counter value ${counter} was lower than expected ${authenticator.counter}`,
+ );
}
const clientDataHash = toHash(base64url.toBuffer(base64ClientDataJSON));