Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(passport): Passkeys #2659

Merged
merged 21 commits into from
Sep 6, 2023
Merged

Conversation

betimshahini
Copy link
Contributor

Description

Implements registration and login of passkeys

Related Issues

Testing

  • Go to Passport Settings
  • Select Passkeys option in auth screen.
  • Register new key
  • Log out
  • Back in the login screen, Passkeys, select login with existing key.

Checklist

  • I have read the CONTRIBUTING guidelines
  • I have tested my code (manually and/or automated if applicable)
  • I have updated the documentation (if necessary)

@betimshahini betimshahini marked this pull request as ready for review September 5, 2023 19:10
szkl
szkl previously approved these changes Sep 5, 2023
@szkl szkl self-requested a review September 5, 2023 23:32
@@ -21,3 +21,4 @@ SECRET_APPLE_OAUTH_CLIENT_SECRET=""
INTERNAL_DISCORD_OAUTH_CLIENT_ID=""
SECRET_DISCORD_OAUTH_CLIENT_SECRET=""

SECRET_WEBAUTHN_SIGNING_KEY=''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SECRET_WEBAUTHN_SIGNING_KEY=''
SECRET_WEBAUTHN_SIGNING_KEY=''

Comment on lines 172 to 173
registrationOptions &&
registrationOptions.challenge &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
registrationOptions &&
registrationOptions.challenge &&
registrationOptions?.challenge &&

Comment on lines +27 to +31
if (e instanceof errors.JWTExpired)
throw new BadRequestError({
message:
'Passkey request authentication has expired. Please try again.',
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would an else clause needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added


if (
!registrationPayload.nickname ||
(registrationPayload.nickname && registrationPayload.nickname.length < 4)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(registrationPayload.nickname && registrationPayload.nickname.length < 4)
(registrationPayload.nickname?.length <= 3)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping the number in the condition as it matches with the error message. Addressed the null item.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the error message says 4 or more. It doesn't accept 4 letter names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, though that was happening in the component, and not this bit of code. Updated the component condition to be the same < 4 so should be consistent in front and backend.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just searched for < 4 and posted the comment. I wasn't paying enough attention 🤭

@betimshahini betimshahini merged commit 1f6840e into main Sep 6, 2023
14 checks passed
@betimshahini betimshahini deleted the feat/2629-webauthn-reg-and-login branch September 6, 2023 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(passport): WebAuthn registration and login support
2 participants