zopassport 0.1.0 → 0.1.3
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 +65 -36
- package/package.json +2 -2
- package/scripts/init.js +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Zo Passport SDK
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
>
|
|
3
|
+
**A trans-dimensional reputation system**
|
|
4
|
+
|
|
5
|
+
> One line reputation to rule the world
|
|
6
|
+
|
|
7
|
+
**Flow:** Phone OTP → Avatar → Passport → Wallet
|
|
6
8
|
|
|
7
9
|
Complete authentication, onboarding, and passport experience for Zo World applications.
|
|
8
10
|
|
|
@@ -26,11 +28,11 @@ cp .env.example .env
|
|
|
26
28
|
npm install && npm run dev
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
That's it! 🎉 Your full Zo Passport app is running at http://localhost:5173
|
|
30
32
|
|
|
31
|
-
🔑 Get your client key
|
|
33
|
+
🔑 **Get your client key from a Zo House near you**
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
📦 **Repository:** https://github.com/ZoHouse/zopassport
|
|
34
36
|
|
|
35
37
|
---
|
|
36
38
|
|
|
@@ -38,10 +40,10 @@ npm install && npm run dev
|
|
|
38
40
|
|
|
39
41
|
After `npm install zopassport`, you get:
|
|
40
42
|
|
|
41
|
-
✅ **Complete Demo App** - Full working phone → passport → wallet flow
|
|
42
|
-
✅ **All Dependencies** - React, Vite, TypeScript pre-configured
|
|
43
|
-
✅ **All Assets** - Images, videos, icons bundled
|
|
44
|
-
✅ **Environment Template** - Just add your client key
|
|
43
|
+
- ✅ **Complete Demo App** - Full working phone → passport → wallet flow
|
|
44
|
+
- ✅ **All Dependencies** - React, Vite, TypeScript pre-configured
|
|
45
|
+
- ✅ **All Assets** - Images, videos, icons bundled
|
|
46
|
+
- ✅ **Environment Template** - Just add your client key
|
|
45
47
|
|
|
46
48
|
---
|
|
47
49
|
|
|
@@ -51,7 +53,7 @@ Want to integrate into your existing app? Use it as a library:
|
|
|
51
53
|
|
|
52
54
|
### 1. Initialize the SDK
|
|
53
55
|
|
|
54
|
-
```
|
|
56
|
+
```javascript
|
|
55
57
|
import { ZoPassportSDK } from 'zopassport';
|
|
56
58
|
|
|
57
59
|
const sdk = new ZoPassportSDK({
|
|
@@ -62,8 +64,14 @@ const sdk = new ZoPassportSDK({
|
|
|
62
64
|
|
|
63
65
|
### 2. React Integration
|
|
64
66
|
|
|
65
|
-
```
|
|
66
|
-
import {
|
|
67
|
+
```jsx
|
|
68
|
+
import {
|
|
69
|
+
ZoPassportProvider,
|
|
70
|
+
useZoPassport,
|
|
71
|
+
ZoLanding,
|
|
72
|
+
ZoOnboarding,
|
|
73
|
+
ZoPassportCard
|
|
74
|
+
} from 'zopassport/react';
|
|
67
75
|
|
|
68
76
|
function App() {
|
|
69
77
|
return (
|
|
@@ -101,6 +109,8 @@ function YourApp() {
|
|
|
101
109
|
}
|
|
102
110
|
```
|
|
103
111
|
|
|
112
|
+
---
|
|
113
|
+
|
|
104
114
|
## Features
|
|
105
115
|
|
|
106
116
|
### ✅ Authentication
|
|
@@ -123,12 +133,14 @@ function YourApp() {
|
|
|
123
133
|
- Location detection
|
|
124
134
|
- Avatar preview
|
|
125
135
|
|
|
136
|
+
---
|
|
137
|
+
|
|
126
138
|
## Components
|
|
127
139
|
|
|
128
140
|
### `<ZoLanding />`
|
|
129
141
|
Full-screen landing page with video background and auth modal.
|
|
130
142
|
|
|
131
|
-
```
|
|
143
|
+
```jsx
|
|
132
144
|
<ZoLanding
|
|
133
145
|
onAuthSuccess={(userId, user) => {}}
|
|
134
146
|
sendOTP={async (code, phone) => sdk.auth.sendOTP(code, phone)}
|
|
@@ -142,7 +154,7 @@ Full-screen landing page with video background and auth modal.
|
|
|
142
154
|
### `<ZoOnboarding />`
|
|
143
155
|
Complete onboarding flow component.
|
|
144
156
|
|
|
145
|
-
```
|
|
157
|
+
```jsx
|
|
146
158
|
<ZoOnboarding
|
|
147
159
|
onComplete={(data) => console.log(data)}
|
|
148
160
|
updateProfile={(updates) => sdk.updateProfile(updates)}
|
|
@@ -153,7 +165,7 @@ Complete onboarding flow component.
|
|
|
153
165
|
### `<ZoPassportCard />`
|
|
154
166
|
Passport card display component.
|
|
155
167
|
|
|
156
|
-
```
|
|
168
|
+
```jsx
|
|
157
169
|
<ZoPassportCard
|
|
158
170
|
profile={{
|
|
159
171
|
avatar: 'https://...',
|
|
@@ -167,7 +179,7 @@ Passport card display component.
|
|
|
167
179
|
### `<ZoAuth />`
|
|
168
180
|
Standalone phone OTP authentication component.
|
|
169
181
|
|
|
170
|
-
```
|
|
182
|
+
```jsx
|
|
171
183
|
<ZoAuth
|
|
172
184
|
onSuccess={(userId, user) => {}}
|
|
173
185
|
onClose={() => {}}
|
|
@@ -179,12 +191,14 @@ Standalone phone OTP authentication component.
|
|
|
179
191
|
### `<PhoneInput />` & `<OTPInput />`
|
|
180
192
|
Low-level input components for custom auth flows.
|
|
181
193
|
|
|
194
|
+
---
|
|
195
|
+
|
|
182
196
|
## Hooks
|
|
183
197
|
|
|
184
198
|
### `useZoPassport()`
|
|
185
199
|
Main hook for authentication state and operations.
|
|
186
200
|
|
|
187
|
-
```
|
|
201
|
+
```javascript
|
|
188
202
|
const {
|
|
189
203
|
sdk,
|
|
190
204
|
user,
|
|
@@ -200,7 +214,7 @@ const {
|
|
|
200
214
|
### `useProfile()`
|
|
201
215
|
Profile operations and completion tracking.
|
|
202
216
|
|
|
203
|
-
```
|
|
217
|
+
```javascript
|
|
204
218
|
const {
|
|
205
219
|
user,
|
|
206
220
|
completion,
|
|
@@ -213,7 +227,7 @@ const {
|
|
|
213
227
|
### `useAvatar()`
|
|
214
228
|
Avatar generation operations.
|
|
215
229
|
|
|
216
|
-
```
|
|
230
|
+
```javascript
|
|
217
231
|
const {
|
|
218
232
|
avatarUrl,
|
|
219
233
|
isGenerating,
|
|
@@ -221,6 +235,8 @@ const {
|
|
|
221
235
|
} = useAvatar();
|
|
222
236
|
```
|
|
223
237
|
|
|
238
|
+
---
|
|
239
|
+
|
|
224
240
|
## Assets Required
|
|
225
241
|
|
|
226
242
|
Include these assets in your `public/` folder:
|
|
@@ -255,22 +271,27 @@ public/
|
|
|
255
271
|
└── rank1.jpeg # Fallback avatar
|
|
256
272
|
```
|
|
257
273
|
|
|
274
|
+
---
|
|
275
|
+
|
|
258
276
|
## CDN Assets
|
|
259
277
|
|
|
260
278
|
The SDK uses these CDN URLs for passport backgrounds:
|
|
261
279
|
|
|
262
|
-
- **Founder Background
|
|
263
|
-
- **Citizen Background
|
|
280
|
+
- **Founder Background:** `https://proxy.cdn.zo.xyz/gallery/media/images/a1659b07-94f0-4490-9b3c-3366715d9717_20250515053726.png`
|
|
281
|
+
- **Citizen Background:** `https://proxy.cdn.zo.xyz/gallery/media/images/bda9da5a-eefe-411d-8d90-667c80024463_20250515053805.png`
|
|
264
282
|
|
|
265
283
|
You can override these via props.
|
|
266
284
|
|
|
285
|
+
---
|
|
286
|
+
|
|
267
287
|
## Storage Adapters
|
|
268
288
|
|
|
269
289
|
### Web (Default)
|
|
270
290
|
Uses `localStorage` automatically.
|
|
271
291
|
|
|
272
292
|
### React Native
|
|
273
|
-
|
|
293
|
+
|
|
294
|
+
```javascript
|
|
274
295
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
275
296
|
import { ZoPassportSDK, AsyncStorageAdapter } from 'zopassport';
|
|
276
297
|
|
|
@@ -281,7 +302,8 @@ const sdk = new ZoPassportSDK({
|
|
|
281
302
|
```
|
|
282
303
|
|
|
283
304
|
### Server-Side / Testing
|
|
284
|
-
|
|
305
|
+
|
|
306
|
+
```javascript
|
|
285
307
|
import { ZoPassportSDK, MemoryStorageAdapter } from 'zopassport';
|
|
286
308
|
|
|
287
309
|
const sdk = new ZoPassportSDK({
|
|
@@ -290,6 +312,8 @@ const sdk = new ZoPassportSDK({
|
|
|
290
312
|
});
|
|
291
313
|
```
|
|
292
314
|
|
|
315
|
+
---
|
|
316
|
+
|
|
293
317
|
## TypeScript
|
|
294
318
|
|
|
295
319
|
Full TypeScript support with exported types:
|
|
@@ -303,9 +327,7 @@ import type {
|
|
|
303
327
|
} from 'zopassport';
|
|
304
328
|
```
|
|
305
329
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
MIT © Zo World Team
|
|
330
|
+
---
|
|
309
331
|
|
|
310
332
|
## Wallet Integration
|
|
311
333
|
|
|
@@ -313,7 +335,7 @@ The SDK includes a built-in wallet system for managing Zo World assets.
|
|
|
313
335
|
|
|
314
336
|
### Framework-Agnostic Usage
|
|
315
337
|
|
|
316
|
-
```
|
|
338
|
+
```javascript
|
|
317
339
|
// Get wallet balance
|
|
318
340
|
const balance = await sdk.wallet.getBalance();
|
|
319
341
|
console.log('Balance:', balance.total_amount);
|
|
@@ -327,24 +349,24 @@ console.log('Transactions:', transactions);
|
|
|
327
349
|
|
|
328
350
|
The SDK provides ready-to-use wallet components:
|
|
329
351
|
|
|
330
|
-
```
|
|
352
|
+
```jsx
|
|
331
353
|
import { WalletScreen, WalletCard } from 'zopassport/react';
|
|
332
354
|
|
|
333
355
|
// Full wallet screen
|
|
334
356
|
<WalletScreen onBack={() => console.log('Back')} />
|
|
335
357
|
|
|
336
358
|
// Wallet card widget
|
|
337
|
-
<WalletCard
|
|
338
|
-
balance={100}
|
|
339
|
-
user={user}
|
|
340
|
-
isOpen={isOpen}
|
|
341
|
-
onToggle={() => setIsOpen(!isOpen)}
|
|
359
|
+
<WalletCard
|
|
360
|
+
balance={100}
|
|
361
|
+
user={user}
|
|
362
|
+
isOpen={isOpen}
|
|
363
|
+
onToggle={() => setIsOpen(!isOpen)}
|
|
342
364
|
/>
|
|
343
365
|
```
|
|
344
366
|
|
|
345
367
|
### React Hooks
|
|
346
368
|
|
|
347
|
-
```
|
|
369
|
+
```jsx
|
|
348
370
|
import { useWalletBalance, useTransactions } from 'zopassport/react';
|
|
349
371
|
|
|
350
372
|
const MyWallet = () => {
|
|
@@ -355,6 +377,8 @@ const MyWallet = () => {
|
|
|
355
377
|
};
|
|
356
378
|
```
|
|
357
379
|
|
|
380
|
+
---
|
|
381
|
+
|
|
358
382
|
## Universal UI Support (Web + Mobile)
|
|
359
383
|
|
|
360
384
|
The SDK's UI components are built with React Native but can run on the web using `react-native-web`.
|
|
@@ -405,3 +429,8 @@ module.exports = withTM({
|
|
|
405
429
|
});
|
|
406
430
|
```
|
|
407
431
|
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## License
|
|
435
|
+
|
|
436
|
+
MIT © Zo World Team
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zopassport",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Zo Passport SDK - Phone to Avatar to Passport. Complete authentication and onboarding flow for Zo World.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
],
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|
|
50
|
-
"url": "https://github.com/
|
|
50
|
+
"url": "https://github.com/ZoHouse/zopassport.git"
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://zo.xyz",
|
|
53
53
|
"bugs": {
|
package/scripts/init.js
CHANGED
|
@@ -174,7 +174,7 @@ async function init() {
|
|
|
174
174
|
log('║ ║', GREEN);
|
|
175
175
|
log('║ 2. Edit .env with your Zo client key: ║', GREEN);
|
|
176
176
|
log('║ ' + BOLD + 'VITE_ZO_CLIENT_KEY=your-key-here' + RESET + GREEN + ' ║', GREEN);
|
|
177
|
-
log('║ Get
|
|
177
|
+
log('║ Get token from a Zo House near you ║', GREEN);
|
|
178
178
|
log('║ ║', GREEN);
|
|
179
179
|
log('║ 3. Install dependencies: ║', GREEN);
|
|
180
180
|
log('║ ' + BOLD + 'npm install' + RESET + GREEN + ' ║', GREEN);
|