diff options
author | Matthew Miller <matthew@millerti.me> | 2020-05-23 15:14:05 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2020-05-23 15:14:05 -0700 |
commit | a767c65763f347d180941f20926728cf722ca66d (patch) | |
tree | f85d6e4494616e6531da709a1b04a7dca654c709 /packages/browser/src/methods/startAssertion.test.ts | |
parent | 1a38e1e786d91436d2d1fe456063545944835357 (diff) |
Fix padding count calculation
Diffstat (limited to 'packages/browser/src/methods/startAssertion.test.ts')
-rw-r--r-- | packages/browser/src/methods/startAssertion.test.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/browser/src/methods/startAssertion.test.ts b/packages/browser/src/methods/startAssertion.test.ts index 4e3bb07..259400c 100644 --- a/packages/browser/src/methods/startAssertion.test.ts +++ b/packages/browser/src/methods/startAssertion.test.ts @@ -22,7 +22,7 @@ const goodOpts1: PublicKeyCredentialRequestOptionsJSON = { publicKey: { challenge: 'fizz', allowCredentials: [{ - id: 'credId', + id: 'abcdefgfdnsdfunguisdfgs', type: 'public-key', transports: ['nfc'], }], @@ -48,11 +48,11 @@ test('should convert options before passing to navigator.credentials.get(...)', await startAssertion(goodOpts1); const argsPublicKey = mockNavigatorGet.mock.calls[0][0].publicKey; + const credId = base64js.fromByteArray(argsPublicKey.allowCredentials[0].id); expect(argsPublicKey.challenge).toEqual(toUint8Array(goodOpts1.publicKey.challenge)); // Make sure the credential ID is a proper base64 with a length that's a multiple of 4 - expect(argsPublicKey.allowCredentials[0].id.length % 4).toEqual(0); - expect(argsPublicKey.allowCredentials[0].id).toEqual(base64js.toByteArray('credId==')); + expect(credId.length % 4).toEqual(0); done(); }); |