summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/src/methods/startAssertion.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-05-23 15:14:05 -0700
committerMatthew Miller <matthew@millerti.me>2020-05-23 15:14:05 -0700
commita767c65763f347d180941f20926728cf722ca66d (patch)
treef85d6e4494616e6531da709a1b04a7dca654c709 /packages/browser/src/methods/startAssertion.ts
parent1a38e1e786d91436d2d1fe456063545944835357 (diff)
Fix padding count calculation
Diffstat (limited to 'packages/browser/src/methods/startAssertion.ts')
-rw-r--r--packages/browser/src/methods/startAssertion.ts3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/browser/src/methods/startAssertion.ts b/packages/browser/src/methods/startAssertion.ts
index 8e411ec..0733194 100644
--- a/packages/browser/src/methods/startAssertion.ts
+++ b/packages/browser/src/methods/startAssertion.ts
@@ -27,7 +27,8 @@ export default async function startAssertion(
challenge: toUint8Array(requestOptionsJSON.publicKey.challenge),
allowCredentials: requestOptionsJSON.publicKey.allowCredentials.map((cred) => {
// Make sure the credential ID length is a multiple of 4
- let id = cred.id.padEnd(cred.id.length + (cred.id.length % 4), '=');
+ const padLength = 4 - cred.id.length % 4;
+ let id = cred.id.padEnd(cred.id.length + padLength, '=');
return {
...cred,