-
Notifications
You must be signed in to change notification settings - Fork 466
feat(expo): add biometric trusted devices #9257
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
Open
seanperez29
wants to merge
10
commits into
main
Choose a base branch
from
sean/Trusted-device-sign-in
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c6c3b54
feat(expo): add biometric trusted devices
seanperez29 c5f43aa
fix(expo): fall back on invalid auth flow state
seanperez29 46d25f2
docs(expo): clarify useAuthFlow usage
seanperez29 c1d6966
chore(repo): update project files
seanperez29 e4b6e7c
fix(expo): address trusted-device review feedback
seanperez29 033a170
fix(expo): guard trusted devices before configuration
seanperez29 e4aff94
chore(repo): update repository files
seanperez29 eaff3ab
chore(repo): update staged changes
seanperez29 a48843f
chore(repo): update project files
seanperez29 6572eb2
chore(repo): apply staged updates
seanperez29 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| --- | ||
| '@clerk/expo': minor | ||
| --- | ||
|
|
||
| Add iOS and Android APIs for biometric trusted-device enrollment, sign-in, availability, listing, and revocation, including structured native error codes. Trusted-device sign-in synchronizes the JS client before resolving and returns the JS sign-in resource and `setActive()` so apps can continue second-factor, new-password, or client-trust steps. Add `useAuthViewState()` for keeping a non-dismissible root `<AuthView />` mounted through an optional trusted-device enrollment prompt, and support configuring the Face ID permission message through the Expo config plugin. | ||
|
|
||
| ```tsx | ||
| import { useTrustedDevices } from '@clerk/expo'; | ||
|
|
||
| export function useBiometricSignIn(identifierHint: string) { | ||
| const { enroll, getAvailability, signIn } = useTrustedDevices(); | ||
|
|
||
| // Call after the user completes a normal sign-in. | ||
| const enableBiometricSignIn = () => | ||
| enroll({ | ||
| identifierHint, | ||
| reason: 'Use biometrics to sign in next time.', | ||
| }); | ||
|
|
||
| // Call when the user returns to sign in. | ||
| const signInWithBiometrics = async () => { | ||
| const { isAvailable } = await getAvailability({ identifierHint }); | ||
|
|
||
| if (!isAvailable) { | ||
| return null; | ||
| } | ||
|
|
||
| const result = await signIn({ | ||
| identifierHint, | ||
| reason: 'Use biometrics to sign in.', | ||
| }); | ||
|
|
||
| // Continue any remaining steps through result.signIn. | ||
| return result; | ||
| }; | ||
|
|
||
| return { enableBiometricSignIn, signInWithBiometrics }; | ||
| } | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.