diff options
author | Matthew Miller <matthew@millerti.me> | 2021-04-15 21:37:46 -0700 |
---|---|---|
committer | Matthew Miller <matthew@millerti.me> | 2021-04-15 21:37:46 -0700 |
commit | 1a4c8ab2ab4bcb27b83b2be6d8d0fddaaa56ba50 (patch) | |
tree | 947b86bcaf959b17b134e966b8bd979992d0f5c3 /packages/browser/src/methods/startAssertion.ts | |
parent | 032e8cb32467c140e945dd71b868828b9fb4a259 (diff) |
Convert assertion userHandle back to UTF-8 string
This is the opposite of how `user.id` is converted to an ArrayBuffer prior to being passed into `navigator.credentials.create()`, so when this value is returned to the RP in an assertion it will now look like the string value originally specified in attestation options, instead of the base64url-encoded version of that string “for some reason”.
Diffstat (limited to 'packages/browser/src/methods/startAssertion.ts')
-rw-r--r-- | packages/browser/src/methods/startAssertion.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/browser/src/methods/startAssertion.ts b/packages/browser/src/methods/startAssertion.ts index fa25f47..786d55b 100644 --- a/packages/browser/src/methods/startAssertion.ts +++ b/packages/browser/src/methods/startAssertion.ts @@ -6,6 +6,7 @@ import { import bufferToBase64URLString from '../helpers/bufferToBase64URLString'; import base64URLStringToBuffer from '../helpers/base64URLStringToBuffer'; +import bufferToUTF8String from '../helpers/bufferToUTF8String'; import supportsWebauthn from '../helpers/supportsWebauthn'; import toPublicKeyCredentialDescriptor from '../helpers/toPublicKeyCredentialDescriptor'; @@ -46,7 +47,7 @@ export default async function startAssertion( let userHandle = undefined; if (response.userHandle) { - userHandle = bufferToBase64URLString(response.userHandle); + userHandle = bufferToUTF8String(response.userHandle); } // Convert values to base64 to make it easier to send back to the server |