From 5ae824965ebee5590486c36fe0365c9ad802bb23 Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Tue, 2 Jun 2020 12:08:47 -0700 Subject: Update start methods to use new helper --- packages/browser/src/methods/startAssertion.ts | 12 ++++++------ packages/browser/src/methods/startAttestation.ts | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'packages/browser/src') diff --git a/packages/browser/src/methods/startAssertion.ts b/packages/browser/src/methods/startAssertion.ts index 1590634..81cad60 100644 --- a/packages/browser/src/methods/startAssertion.ts +++ b/packages/browser/src/methods/startAssertion.ts @@ -5,7 +5,7 @@ import { } from '@simplewebauthn/typescript-types'; import toUint8Array from '../helpers/toUint8Array'; -import toBase64String from '../helpers/toBase64String'; +import bufferToBase64URLString from '../helpers/bufferToBase64URLString'; import supportsWebauthn from '../helpers/supportsWebauthn'; import toPublicKeyCredentialDescriptor from '../helpers/toPublicKeyCredentialDescriptor'; @@ -41,18 +41,18 @@ export default async function startAssertion( let userHandle = undefined; if (response.userHandle) { - userHandle = toBase64String(response.userHandle); + userHandle = bufferToBase64URLString(response.userHandle); } // Convert values to base64 to make it easier to send back to the server return { ...credential, - rawId: toBase64String(rawId), + rawId: bufferToBase64URLString(rawId), response: { ...response, - authenticatorData: toBase64String(response.authenticatorData), - clientDataJSON: toBase64String(response.clientDataJSON), - signature: toBase64String(response.signature), + authenticatorData: bufferToBase64URLString(response.authenticatorData), + clientDataJSON: bufferToBase64URLString(response.clientDataJSON), + signature: bufferToBase64URLString(response.signature), userHandle, }, }; diff --git a/packages/browser/src/methods/startAttestation.ts b/packages/browser/src/methods/startAttestation.ts index 51ea6ec..1612961 100644 --- a/packages/browser/src/methods/startAttestation.ts +++ b/packages/browser/src/methods/startAttestation.ts @@ -5,7 +5,7 @@ import { } from '@simplewebauthn/typescript-types'; import toUint8Array from '../helpers/toUint8Array'; -import toBase64String from '../helpers/toBase64String'; +import bufferToBase64URLString from '../helpers/bufferToBase64URLString'; import supportsWebauthn from '../helpers/supportsWebauthn'; import toPublicKeyCredentialDescriptor from '../helpers/toPublicKeyCredentialDescriptor'; @@ -46,11 +46,11 @@ export default async function startAttestation( // Convert values to base64 to make it easier to send back to the server return { ...credential, - rawId: toBase64String(rawId), + rawId: bufferToBase64URLString(rawId), response: { ...response, - attestationObject: toBase64String(response.attestationObject), - clientDataJSON: toBase64String(response.clientDataJSON), - } + attestationObject: bufferToBase64URLString(response.attestationObject), + clientDataJSON: bufferToBase64URLString(response.clientDataJSON), + }, }; } -- cgit v1.2.3