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

Support FIDO2 authentication with devices that don’t have a PIN code #655

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

MultiColourPixel
Copy link

@MultiColourPixel MultiColourPixel commented Nov 10, 2024

This PR adds support for FIDO2 authentication with devices that don’t have a PIN code set.

This depends on a newer release of the LibFido2Swift library.
At the time of writing LibFido2Swift only supports pin-less assertation on the main branch. As such this PR will have to wait until @kinoroy creates a new release on his side.

The updated version has now been released and the PR has been updated to reflect this.

Some further updates were made on the LibFido2Swift library to make PIN-less assertation easier. This PR was updated in turn to improve the UX of the PIN-less authentication flow.

The flow now is that when a user tries to log in, if the request needs 2FA - where the second factor is a security key we check:

  • If a device is attached and PIN is not required. We then request the assertation straight away, at which point that flow presents the .securityKeyTouchToConfirm sheet.
  • If a device is attached but needs a PIN. Then the .twoFactor sheet is displayed like before.
  • If no device is attached. We then present the .twoFactor sheet.
    • If at this point the user inserts their security key but they do not have a PIN set, a button the two factor sheet will allow them to proceed without a PIN (as seen in the screenshot below).

The button for submitting without a pin was added to be inline with the other buttons on the PIN screen.

Ohh and I addressed a couple of issue that were being caught by the "Run Time Issue" breakpoint. Namely assigning the authError outside of the main thread.

Updated PIN Request flow

@kinoroy
Copy link
Contributor

kinoroy commented Nov 10, 2024

Hey, thanks for this! I went and created a release v0.1.3 for LibFido2Swift with support for PIN-less assertions

- This has the new functionality for checking if a device is attached.
- This object was being kept around after being created and as we need it in some other functions it made sense to make it lazy and keep it around that way.
- Arguably the FIDO2 instance could be removed after each time it’s been used, but as the FIDO2 class doesn’t have any state stored in it, it seems benign keeping it about for now.
- The Xcode “Run Time Issue” breakpoint was being hit whenever an error was being set, complaining about this being set outside of the main thread.
- We now check if in the handling of two factor option, the option to be used is a SecurityKey. If so, check if a FIDO2 device is attached and if it needs a PIN.
- When a PIN is not required, we can just move straight onto assertation, the code for which will present the touch key UI.
- Otherwise we fallback to the original flow.
@MultiColourPixel
Copy link
Author

@MattKiazyk heya, just wanted to see if we could get this merged in please? Would be nice to use this feature from the main project's build 😁

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.

2 participants