diff options
author | Matthew Miller <matthew@millerti.me> | 2021-04-17 22:06:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-17 22:06:35 -0700 |
commit | becd1415ff3fba22218f808f6dac761901b71a5c (patch) | |
tree | 541f90e33aa08659c985c5c3f91ebfaed74692e8 /packages/browser/src/methods/startAssertion.test.ts | |
parent | cb445cd8404af140120260ca77294a70d7202a71 (diff) | |
parent | 926eda9ae5f12b88179c6c13d0ee5ede49e5e411 (diff) |
Merge pull request #120 from MasterKale/fix/simplify-encoding-user-handle-in-assertion-response
fix/simplify-encoding-user-handle-in-assertion-response
Diffstat (limited to 'packages/browser/src/methods/startAssertion.test.ts')
-rw-r--r-- | packages/browser/src/methods/startAssertion.test.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/browser/src/methods/startAssertion.test.ts b/packages/browser/src/methods/startAssertion.test.ts index c077219..f005a26 100644 --- a/packages/browser/src/methods/startAssertion.test.ts +++ b/packages/browser/src/methods/startAssertion.test.ts @@ -6,7 +6,7 @@ import { } from '@simplewebauthn/typescript-types'; import supportsWebauthn from '../helpers/supportsWebauthn'; -import toUint8Array from '../helpers/toUint8Array'; +import utf8StringToBuffer from '../helpers/utf8StringToBuffer'; import bufferToBase64URLString from '../helpers/bufferToBase64URLString'; import startAssertion from './startAssertion'; @@ -23,7 +23,7 @@ const mockUserHandle = 'mockUserHandle'; // With ASCII challenge const goodOpts1: PublicKeyCredentialRequestOptionsJSON = { - challenge: bufferToBase64URLString(toUint8Array('fizz')), + challenge: bufferToBase64URLString(utf8StringToBuffer('fizz')), allowCredentials: [ { id: 'C0VGlvYFratUdAV1iCw-ULpUW8E-exHPXQChBfyVeJZCMfjMFcwDmOFgoMUz39LoMtCJUBW8WPlLkGT6q8qTCg', @@ -36,7 +36,7 @@ const goodOpts1: PublicKeyCredentialRequestOptionsJSON = { // With UTF-8 challenge const goodOpts2UTF8: PublicKeyCredentialRequestOptionsJSON = { - challenge: bufferToBase64URLString(toUint8Array('やれやれだぜ')), + challenge: bufferToBase64URLString(utf8StringToBuffer('やれやれだぜ')), allowCredentials: [], timeout: 1, }; @@ -78,7 +78,7 @@ test('should convert options before passing to navigator.credentials.get(...)', test('should support optional allowCredential', async () => { await startAssertion({ - challenge: bufferToBase64URLString(toUint8Array('fizz')), + challenge: bufferToBase64URLString(utf8StringToBuffer('fizz')), timeout: 1, }); @@ -87,7 +87,7 @@ test('should support optional allowCredential', async () => { test('should convert allow allowCredential to undefined when empty', async () => { await startAssertion({ - challenge: bufferToBase64URLString(toUint8Array('fizz')), + challenge: bufferToBase64URLString(utf8StringToBuffer('fizz')), timeout: 1, allowCredentials: [], }); @@ -120,7 +120,7 @@ test('should return base64url-encoded response values', async done => { expect(response.response.authenticatorData).toEqual('bW9ja0F1dGhlbnRpY2F0b3JEYXRh'); expect(response.response.clientDataJSON).toEqual('bW9ja0NsaWVudERhdGFKU09O'); expect(response.response.signature).toEqual('bW9ja1NpZ25hdHVyZQ'); - expect(response.response.userHandle).toEqual('bW9ja1VzZXJIYW5kbGU'); + expect(response.response.userHandle).toEqual('mockUserHandle'); done(); }); |