Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .changeset/thin-spoons-trust.md
Comment thread
seanperez29 marked this conversation as resolved.
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 };
}
```
41 changes: 41 additions & 0 deletions packages/expo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,47 @@ You'll learn how to create an Expo application, install `@clerk/expo`, set up yo

For further information, guides, and examples visit the [Expo reference documentation](https://clerk.com/docs/references/expo/overview?utm_source=github&utm_medium=clerk_expo).

### Biometric trusted devices

Biometric trusted-device enrollment and sign-in are supported in development builds on iOS and Android. Android requires Android 9 (API 28) or later and an enrolled Class 3 biometric.

Trusted-device operations preserve Clerk API and native biometric error codes. Use `isTrustedDeviceError(error)` to safely inspect `error.code`; unrecognized error codes remain available for forward compatibility, while unfamiliar platform and status values are normalized to `unknown`.

#### Face ID on iOS

Apps that use Face ID for trusted-device enrollment or sign-in must provide `NSFaceIDUsageDescription`. You can have the Clerk config plugin add it during prebuild:

```json
{
"expo": {
"plugins": [
[
"@clerk/expo",
{
"faceIDPermission": "Allow $(PRODUCT_NAME) to use Face ID for secure sign-in."
}
]
]
}
}
```

The plugin only adds the permission when `faceIDPermission` is provided and does not overwrite `ios.infoPlist.NSFaceIDUsageDescription` if your app already defines it.

You can also configure the key directly:

```json
{
"expo": {
"ios": {
"infoPlist": {
"NSFaceIDUsageDescription": "Allow $(PRODUCT_NAME) to use Face ID for secure sign-in."
}
}
}
}
```

## Support

For help, visit our [support page](https://clerk.com/contact/support?utm_source=github&utm_medium=clerk_expo).
Expand Down
2 changes: 2 additions & 0 deletions packages/expo/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,6 @@ dependencies {
implementation "androidx.activity:activity-compose:$activityComposeVersion"
implementation "androidx.lifecycle:lifecycle-runtime-compose:$lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycleVersion"

testImplementation "junit:junit:4.13.2"
}
Loading
Loading