@veryai/react-native-sdk 1.0.20 → 1.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +149 -0
- package/android/build.gradle +1 -1
- package/package.json +1 -1
- package/veryai-react-native-sdk.podspec +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# React Native SDK Integration
|
|
2
|
+
|
|
3
|
+
> **Full documentation**: [https://very.org/docs/native-sdk/integration](https://very.org/docs/native-sdk/integration)
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @veryai/react-native-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
For iOS, install the native dependency:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd ios && pod install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Add camera permission to `Info.plist`:
|
|
18
|
+
|
|
19
|
+
```xml
|
|
20
|
+
<key>NSCameraUsageDescription</key>
|
|
21
|
+
<string>Camera access is needed for palm biometric verification.</string>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Published on [npm](https://www.npmjs.com/package/@veryai/react-native-sdk).
|
|
25
|
+
|
|
26
|
+
## Getting an SDK Key
|
|
27
|
+
|
|
28
|
+
Native SDK keys are not yet available via the Developer Portal. Contact [support@very.org](mailto:support@very.org) to get your SDK key and client credentials.
|
|
29
|
+
|
|
30
|
+
## Enroll a New User
|
|
31
|
+
|
|
32
|
+
Pass `undefined` for `userId` to register a new user. The SDK opens a consent screen, collects the user's email, then guides them through a palm scan.
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import { VerySDK } from "@veryai/react-native-sdk";
|
|
36
|
+
|
|
37
|
+
const supported = await VerySDK.isSupported();
|
|
38
|
+
if (!supported) {
|
|
39
|
+
console.warn("Device not supported");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const result = await VerySDK.authenticate({
|
|
44
|
+
sdkKey: "your_sdk_key",
|
|
45
|
+
userId: undefined, // undefined = new enrollment
|
|
46
|
+
themeMode: "dark",
|
|
47
|
+
presentationStyle: "fullScreen",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (result.isSuccess) {
|
|
51
|
+
console.log("Auth code:", result.code);
|
|
52
|
+
console.log("User ID:", result.userId);
|
|
53
|
+
} else {
|
|
54
|
+
console.error("Error:", result.error, result.errorMessage);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Verify an Existing User
|
|
59
|
+
|
|
60
|
+
Pass the user's ID from a previous enrollment to verify their identity.
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const result = await VerySDK.authenticate({
|
|
64
|
+
sdkKey: "your_sdk_key",
|
|
65
|
+
userId: "vu-1ed0a927-...", // from previous enrollment
|
|
66
|
+
themeMode: "dark",
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (result.isSuccess) {
|
|
70
|
+
console.log("Verified:", result.code);
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Exchange the Auth Code (Backend)
|
|
75
|
+
|
|
76
|
+
When authentication succeeds, the SDK returns an authorization `code`. Send this to your backend, which exchanges it for an `id_token`:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
POST https://api.very.org/oauth2/token
|
|
80
|
+
Content-Type: application/x-www-form-urlencoded
|
|
81
|
+
|
|
82
|
+
grant_type=authorization_code
|
|
83
|
+
&client_id=your_client_id
|
|
84
|
+
&client_secret=your_client_secret
|
|
85
|
+
&code=AUTH_CODE_FROM_SDK
|
|
86
|
+
&redirect_uri=your_redirect_uri
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Response:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"access_token": "eyJhbGciOi...",
|
|
94
|
+
"token_type": "Bearer",
|
|
95
|
+
"expires_in": 3600,
|
|
96
|
+
"id_token": "eyJhbGciOi..."
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Decode the `id_token` JWT to get the user's identity:
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"iss": "https://connect.very.org",
|
|
105
|
+
"sub": "vu-1ed0a927-a336-45dd-9c73-20092db9ae8d",
|
|
106
|
+
"aud": ["your_client_id"],
|
|
107
|
+
"email": "user@example.com",
|
|
108
|
+
"exp": 1761013475,
|
|
109
|
+
"iat": 1761009875
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
- For **enrollment**: store the `sub` (user ID) — pass it as `userId` for future verifications
|
|
114
|
+
- For **verification**: confirm the `sub` matches the expected user
|
|
115
|
+
|
|
116
|
+
> **Important:** The `client_secret` for token exchange must only be stored on your backend. Never embed it in the mobile app.
|
|
117
|
+
|
|
118
|
+
## Configuration Reference
|
|
119
|
+
|
|
120
|
+
### VeryConfig
|
|
121
|
+
|
|
122
|
+
| Parameter | Type | Default | Description |
|
|
123
|
+
| ------------------- | ------- | -------------- | ------------------------------------------------------------------ |
|
|
124
|
+
| `sdkKey` | String | required | Your SDK API key |
|
|
125
|
+
| `userId` | String? | undefined | Undefined for enrollment, user ID for verification |
|
|
126
|
+
| `language` | String? | device | Locale code (e.g. `"en"`, `"es"`, `"ja"`). 35 languages supported. |
|
|
127
|
+
| `themeMode` | String | `"dark"` | `"dark"` or `"light"` |
|
|
128
|
+
| `baseUrl` | String? | production | Override API endpoint (for staging/testing) |
|
|
129
|
+
| `presentationStyle` | String | `"fullScreen"` | `"fullScreen"` or `"bottomSheet"` |
|
|
130
|
+
|
|
131
|
+
### VeryResult
|
|
132
|
+
|
|
133
|
+
| Property | Type | Description |
|
|
134
|
+
| -------------- | ------- | ------------------------------------------------------------- |
|
|
135
|
+
| `isSuccess` | boolean | Whether authentication completed successfully |
|
|
136
|
+
| `code` | string | Authorization code to exchange for `id_token` on your backend |
|
|
137
|
+
| `userId` | string | The user's VeryAI ID |
|
|
138
|
+
| `signedToken` | string? | Signed JWT token (when available) |
|
|
139
|
+
| `error` | string? | Error code string |
|
|
140
|
+
| `errorMessage` | string? | Human-readable error message |
|
|
141
|
+
|
|
142
|
+
## Requirements
|
|
143
|
+
|
|
144
|
+
- React Native 0.73+
|
|
145
|
+
- iOS 16.4+ / Android 10 (API 29)+
|
|
146
|
+
- Physical device (no simulator)
|
|
147
|
+
- Camera permission
|
|
148
|
+
|
|
149
|
+
Use `VerySDK.isSupported()` to check device compatibility at runtime before showing the verification UI.
|
package/android/build.gradle
CHANGED
|
@@ -54,6 +54,6 @@ dependencies {
|
|
|
54
54
|
if (findProject(':very-sdk') != null) {
|
|
55
55
|
implementation project(':very-sdk')
|
|
56
56
|
} else {
|
|
57
|
-
implementation "org.very:sdk:${project.findProperty('verySDKVersion') ?: '1.0.
|
|
57
|
+
implementation "org.very:sdk:${project.findProperty('verySDKVersion') ?: '1.0.22'}"
|
|
58
58
|
}
|
|
59
59
|
}
|
package/package.json
CHANGED