@flonkid/kyc 1.4.0
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 +110 -0
- package/dist/index.cjs +998 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +132 -0
- package/dist/index.d.ts +132 -0
- package/dist/index.js +993 -0
- package/dist/index.js.map +1 -0
- package/dist/server.cjs +212 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +127 -0
- package/dist/server.d.ts +127 -0
- package/dist/server.js +184 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +153 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# @flonkid/kyc
|
|
2
|
+
|
|
3
|
+
Official SDK for [Flonk](https://flonk.id) identity verification.
|
|
4
|
+
|
|
5
|
+
- **Dashboard**: [dashboard.flonk.id](https://dashboard.flonk.id)
|
|
6
|
+
- **Docs**: [docs.flonk.id](https://docs.flonk.id)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @flonkid/kyc
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Browser — Imperative
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import { FlonkKYC } from '@flonkid/kyc';
|
|
18
|
+
|
|
19
|
+
const kyc = new FlonkKYC();
|
|
20
|
+
const widget = await kyc.init({
|
|
21
|
+
publishableKey: 'pk_live_...',
|
|
22
|
+
onSuccess: (result) => console.log('Verified:', result),
|
|
23
|
+
onError: (err) => console.error(err),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Later: widget.destroy()
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Browser — React Component
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { FlonkKYCWidget } from '@flonkid/kyc';
|
|
33
|
+
|
|
34
|
+
function App() {
|
|
35
|
+
return (
|
|
36
|
+
<FlonkKYCWidget
|
|
37
|
+
publishableKey="pk_live_..."
|
|
38
|
+
onSuccess={(result) => console.log('Verified:', result)}
|
|
39
|
+
onError={(err) => console.error(err)}
|
|
40
|
+
/>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Props
|
|
46
|
+
|
|
47
|
+
| Prop | Type | Description |
|
|
48
|
+
|------|------|-------------|
|
|
49
|
+
| `publishableKey` | `string` | Client-side key (`pk_live_*` or `pk_sandbox_*`) |
|
|
50
|
+
| `serverUrl` | `string` | Your backend endpoint for session creation |
|
|
51
|
+
| `sessionId` | `string` | Pre-created session ID |
|
|
52
|
+
| `embedToken` | `string` | JWT token from server-to-server flow |
|
|
53
|
+
| `lang` | `'en' \| 'de' \| 'uk'` | Widget language |
|
|
54
|
+
| `onSuccess` | `(result) => void` | Verification completed |
|
|
55
|
+
| `onError` | `(error) => void` | Error occurred |
|
|
56
|
+
| `onCancel` | `() => void` | User closed widget |
|
|
57
|
+
| `onReady` | `() => void` | Widget loaded |
|
|
58
|
+
| `autoOpen` | `boolean` | Open on mount (default: `true`) |
|
|
59
|
+
|
|
60
|
+
## Server — Node.js
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { FlonkKYCServer } from '@flonkid/kyc/server';
|
|
64
|
+
|
|
65
|
+
const flonk = new FlonkKYCServer({ secretKey: 'sk_live_...' });
|
|
66
|
+
|
|
67
|
+
// Create session
|
|
68
|
+
const session = await flonk.sessions.create({
|
|
69
|
+
clientMetadata: { userId: 'user_123' },
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// Verify webhook signature
|
|
73
|
+
const event = flonk.webhooks.constructEvent(rawBody, signature, secret);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Webhook Events
|
|
77
|
+
|
|
78
|
+
| Event | Description |
|
|
79
|
+
|-------|-------------|
|
|
80
|
+
| `verification.completed` | AI verification finished |
|
|
81
|
+
| `verification.status_changed` | Admin changed status |
|
|
82
|
+
| `verification.updated` | Admin edited verification data |
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
const event = flonk.webhooks.constructEvent(rawBody, signature, secret);
|
|
86
|
+
|
|
87
|
+
switch (event.type) {
|
|
88
|
+
case 'verification.completed':
|
|
89
|
+
// Automated decision
|
|
90
|
+
break;
|
|
91
|
+
case 'verification.status_changed':
|
|
92
|
+
// Admin approved/rejected
|
|
93
|
+
break;
|
|
94
|
+
case 'verification.updated':
|
|
95
|
+
// Admin edited extracted data
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Links
|
|
101
|
+
|
|
102
|
+
- [Full Documentation](https://docs.flonk.id)
|
|
103
|
+
- [Dashboard](https://dashboard.flonk.id)
|
|
104
|
+
- [Webhook Guide](https://docs.flonk.id/docs/webhooks)
|
|
105
|
+
- [API Reference](https://docs.flonk.id/docs/api-verification)
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
Proprietary. Copyright (c) 2026 Flonk. All rights reserved.
|
|
110
|
+
See [Terms of Service](https://flonk.id/terms) for usage terms.
|