f-23 / react-native-passkey

Passkeys for React Native
MIT License
121 stars 25 forks source link

feat: Support for Multiple Authentication Methods #25

Closed onghwan closed 3 months ago

onghwan commented 7 months ago

Hello,

I am currently working with the iOS system sheet controlled by the withSecurityKey boolean variable. As it stands, there is no option to switch between using a passkey or a security key once the ASAuthorizationController is initiated. This limitation restricts the flexibility needed for a more dynamic authentication process.

I propose an enhancement where ASAuthorizationController can be initialized with multiple requests, allowing users to switch between authentication methods directly from the system sheet. Enabling this feature would activate the "Other Sign in Options" button on the sheet, providing users the ability to change their request method on the fly.

The desired implementation could look something like this:

let securityKeyProvider = // existing security key provider
let platformKeyProvider = // existing platform key provider

let controller = ASAuthorizationController(authorizationRequests: [platformKeyProvider, securityKeyProvider])

In a JavaScript context, the usage could be as follows:

register(request) // Default to exposing only passkey.
register(request, ['passkey']) // Expose only passkey.
register(request, ['securitykey']) // Expose only security key.
register(request, ['passkey', 'securitykey']) // Initially expose passkey with an option for security key under "Other Sign in Options".
register(request, ['securitykey', 'passkey']) // Initially expose security key with an option for passkey under "Other Sign in Options".

This feature would greatly enhance the user experience by providing more flexibility and control over the authentication process. Could you please consider supporting this functionality?

Thank you for your time and consideration.

f-23 commented 6 months ago

Hi @onghwan

thank you for bringing this up! Sounds like a reasonable improvement. I will keep it in mind for the next update.

github-actions[bot] commented 3 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 3 months ago

This issue was closed because it has been stalled for 5 days with no activity.