Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.

Commit 41a869e

Browse files
Merge pull request #3 from passageidentity/PSG-4526-readme
Setup readme
2 parents eab011a + 95a31a1 commit 41a869e

1 file changed

Lines changed: 99 additions & 7 deletions

File tree

README.md

Lines changed: 99 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,114 @@
11
# passage-flex-react-native
22

3-
Native passkey authentication for your React Native and Expo apps.
3+
Passkey Flex provides passkey authentication support to existing authentication systems. It handles the hard parts of incorporating native passkey APIs and provides a simple, clean solution to take your authentication to the next level.
4+
5+
Use the `passage-flex-react-native` SDK to implement Passkey Flex in your React Native app to use passkeys to register and authenticate, or as added security on secure user actions.
6+
7+
For full documentation, including setting up a backend SDK, visit the [Passkey Flex documentation here](https://docs-v2.passage.id/flex).
8+
9+
## Prerequisites
10+
11+
### A Passkey Flex app
12+
13+
1. Create a Passkey Flex app in the Passage Console at https://console.passage.id
14+
2. Add an Android and/or iOS app in the Native Apps section
15+
3. When you add your Native App info, you can generate the associated domain file for that app if you haven’t already created it yourself, as shown below:
16+
![Passage Native Apps screenshot](https://docs-v2.passage.id/_next/image?url=%2Fimages%2Fdownload-config.png&w=3840&q=75)
17+
18+
19+
### Hosted associated domains files
20+
21+
In order for passkeys to work, you’ll need to associate your native app(s) with the public web domain you assigned to your Passkey Flex app.
22+
23+
Android requires an `assetlinks.json` file configured and hosted (learn more [here](https://developer.android.com/identity/sign-in/credential-manager#add-support-dal)).
24+
25+
Apple requires an `apple-app-site-association` file configured and hosted (learn more [here](https://developer.apple.com/documentation/Xcode/supporting-associated-domains)).
426

527
## Installation
628

7-
```sh
8-
npm install passage-flex-react-native
29+
Install this package using npm:
30+
31+
```
32+
npm i --save @passageidentity/passage-flex-react-native
933
```
1034

35+
## App configuration
36+
37+
### Expo
38+
39+
- Add plugin in app.json
40+
41+
```json
42+
"plugins": [
43+
"@passageidentity/passage-flex-react-native",
44+
// ...
45+
]
46+
```
47+
48+
- Add `ASSOCIATED_DOMAIN` value to `.env` (in your app root)
49+
50+
```
51+
ASSOCIATED_DOMAIN=example.com
52+
```
53+
54+
- Run `npx expo prebuild`
55+
56+
### Bare React Native
57+
58+
See our [Passkey Complete documentation](https://docs.passage.id/mobile/cross-platform/cross-platform-passkey-configuration) for setting up a React Native app for passkeys and Passage.
59+
1160
## Usage
1261

62+
Import PassageFlex:
63+
64+
```tsx
65+
import { PassageFlex } from '@passageidentity/passage-flex-react-native';
66+
```
67+
68+
Initialize a Passage Flex instance using your `appId` found in [Passage Console](https://console.passage.id/):
69+
70+
```tsx
71+
const passageFlex = new PassageFlex('YOUR_APP_ID');
72+
```
73+
74+
### passageFlex.passkey.register
75+
76+
To register a new user passkey, use the `passageFlex.passkey.register` method.
77+
78+
Example:
79+
80+
```tsx
81+
const onPressRegister = async () => {
82+
// 1. Get transaction id string from your backend.
83+
const transactionId = await getRegisterTransactionId("newuser@email.com");
84+
// 2. Prompt user to create a passkey and get a Passage nonce value on success.
85+
const nonce = await passageFlex.passkey.register(transactionId);
86+
// 3. You can send this nonce to your backend to complete user registration.
87+
};
88+
```
89+
90+
### passageFlex.passkey.authenticate
91+
92+
To log in a user using a passkey, use the `passageFlex.passkey.authenticate` method.
93+
94+
Example:
95+
96+
```tsx
97+
const onPressLogIn = async () => {
98+
// 1. Get transaction id string from your backend.
99+
const transactionId = await getLogInTransactionId("existinguser@email.com");
100+
// 2. Prompt user to create a passkey and get a Passage nonce value on success.
101+
const nonce = await passageFlex.passkey.authenticate(transactionId);
102+
// 3. You can send this nonce to your backend to complete user authentication.
103+
};
104+
```
13105

14-
```js
15-
import { multiply } from 'passage-flex-react-native';
106+
### passageFlex.passkey.isSupported
16107

17-
// ...
108+
You can check if a user’s device supports passkeys by calling `passageFlex.passkey.isSupported`:
18109

19-
const result = await multiply(3, 7);
110+
```tsx
111+
const deviceSupportsPasskeys = passageFlex.passkey.isSupported();
20112
```
21113

22114

0 commit comments

Comments
 (0)