diff --git a/passkeys-backend/assets/index.html b/passkeys-backend/assets/index.html index f447ad71..8c946652 100644 --- a/passkeys-backend/assets/index.html +++ b/passkeys-backend/assets/index.html @@ -1,15 +1,15 @@ - - - + + + Passkeys Demo - - - - + + + + @@ -143,143 +146,182 @@

Sign up or sign in

- +
- + ― or ― - +
diff --git a/passkeys-backend/functions/registration/start.js b/passkeys-backend/functions/registration/start.js index d0bb6834..5b6aadb1 100644 --- a/passkeys-backend/functions/registration/start.js +++ b/passkeys-backend/functions/registration/start.js @@ -69,6 +69,7 @@ exports.handler = async (context, event, callback) => { response.setStatusCode(200); response.setBody(APIResponse.data.next_step); } catch (error) { + console.error('Error in passkeys registration start:', error.message); const statusCode = error.status || 400; response.setStatusCode(statusCode); response.setBody(error.message); diff --git a/passkeys-backend/tests/registration-start.test.js b/passkeys-backend/tests/registration-start.test.js index 053c74aa..ecfc9d58 100644 --- a/passkeys-backend/tests/registration-start.test.js +++ b/passkeys-backend/tests/registration-start.test.js @@ -81,6 +81,36 @@ describe('registration/start', () => { handlerFunction(mockContext, { username: 'user001' }, callback); }); + it('works with a phone number as a username', (done) => { + const modifiedBody = structuredClone(mockRequestBody); + modifiedBody.to.user_identifier = '+14151234567'; + modifiedBody.content.user.display_name = '+14151234567'; + + const callback = (_, { _body }) => { + expect(axios.post).toHaveBeenCalledWith( + 'https://api.com/Factors', + modifiedBody, + { auth: { password: 'mockPassword', username: 'mockUsername' } } + ); + done(); + }; + + const mockContextWithoutAndroidKeys = { + API_URL: 'https://api.com', + DOMAIN_NAME: 'example.com', + getTwilioClient: () => ({ + username: 'mockUsername', + password: 'mockPassword', + }), + }; + + handlerFunction( + mockContextWithoutAndroidKeys, + { username: '+14151234567' }, + callback + ); + }); + it('works with empty ANDROID_APP_KEYS', (done) => { const callback = (_, { _body }) => { expect(axios.post).toHaveBeenCalledWith(