vult-security-kyc 0.0.1 → 0.0.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 +160 -49
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,77 +9,188 @@ The client side construction for the KYC Widget
|
|
|
9
9
|
* [Typescript](https://www.typescriptlang.org/)
|
|
10
10
|
* [Yarn](https://yarnpkg.com//)
|
|
11
11
|
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Install the package using npm or yarn:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install vult-security-kyc
|
|
18
|
+
# or
|
|
19
|
+
yarn add vult-security-kyc
|
|
20
|
+
```
|
|
21
|
+
|
|
12
22
|
## Usage
|
|
13
23
|
|
|
24
|
+
The package provides two ways to use the KYC Widget:
|
|
25
|
+
1. **Generic Class Usage** - Use the `KYCWidget` class directly for maximum flexibility
|
|
26
|
+
2. **React Components** - Use the pre-built React components (`VULTIda` and `VULTIdv`)
|
|
27
|
+
|
|
28
|
+
### Generic Class Usage
|
|
29
|
+
|
|
30
|
+
The `KYCWidget` class can be used in any JavaScript/TypeScript application (not just React). This gives you full control over when and how the widget is initialized and started.
|
|
31
|
+
|
|
14
32
|
```typescript
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
import { KYCWidget, IDV, IDA } from 'vult-security-kyc';
|
|
34
|
+
|
|
35
|
+
// Initialize ID Verification widget
|
|
36
|
+
const idvWidget = new KYCWidget({
|
|
37
|
+
Session_Type: IDV, // or "IDVerification"
|
|
38
|
+
env: "dev", // Options: "dev" | "development" | "stage" | "demo" | "prod" | "production"
|
|
39
|
+
onComplete: (response) => {
|
|
40
|
+
console.log("ID Verification completed", response);
|
|
41
|
+
// Handle completion logic here
|
|
42
|
+
},
|
|
43
|
+
onDismiss: () => {
|
|
44
|
+
console.log("Widget dismissed");
|
|
45
|
+
// Handle dismissal logic here
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Start ID Verification with a session ID
|
|
50
|
+
function startVerification(sessionId: string) {
|
|
51
|
+
idvWidget.startIDVerify(sessionId);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Initialize ID Authentication widget
|
|
55
|
+
const idaWidget = new KYCWidget({
|
|
56
|
+
Session_Type: IDA, // or "IDAuthentication"
|
|
57
|
+
env: "prod",
|
|
58
|
+
onComplete: (response) => {
|
|
59
|
+
console.log("ID Authentication completed", response);
|
|
60
|
+
},
|
|
61
|
+
onDismiss: () => {
|
|
62
|
+
console.log("Widget dismissed");
|
|
63
|
+
}
|
|
35
64
|
});
|
|
36
65
|
|
|
37
|
-
|
|
38
|
-
|
|
66
|
+
// Start ID Authentication with a session ID
|
|
67
|
+
function startAuthentication(sessionId: string) {
|
|
68
|
+
idaWidget.startIDAuthenticate(sessionId);
|
|
39
69
|
}
|
|
40
|
-
|
|
41
|
-
|
|
70
|
+
|
|
71
|
+
// Close the widget programmatically
|
|
72
|
+
function closeWidget() {
|
|
73
|
+
idvWidget.close(); // or idaWidget.close()
|
|
42
74
|
}
|
|
43
75
|
```
|
|
44
76
|
|
|
45
|
-
|
|
77
|
+
**Configuration Interface:**
|
|
46
78
|
|
|
47
79
|
```typescript
|
|
48
|
-
interface
|
|
49
|
-
Session_Type: "IDVerification" | "IDAuthentication"
|
|
50
|
-
|
|
51
|
-
|
|
80
|
+
interface KYCWidgetConfig {
|
|
81
|
+
Session_Type: "IDVerification" | "IDAuthentication";
|
|
82
|
+
env: "dev" | "development" | "stage" | "demo" | "prod" | "production";
|
|
83
|
+
onComplete?: (response?: any) => void;
|
|
84
|
+
onDismiss?: () => void;
|
|
52
85
|
}
|
|
53
86
|
```
|
|
54
|
-
## Development
|
|
55
87
|
|
|
56
|
-
###
|
|
88
|
+
### IDA Component (ID Authentication)
|
|
57
89
|
|
|
58
|
-
|
|
59
|
-
# Step 1: Clear yarn cache for the specific package
|
|
60
|
-
yarn cache clean kyc-widget
|
|
90
|
+
For React applications, you can use the `VULTIda` component for ID Authentication. This component handles the widget lifecycle automatically.
|
|
61
91
|
|
|
62
|
-
|
|
63
|
-
|
|
92
|
+
```typescript
|
|
93
|
+
import { useState } from 'react';
|
|
94
|
+
import { VULTIda } from 'vult-security-kyc/components';
|
|
95
|
+
import type { VULTProps } from 'vult-security-kyc/components';
|
|
96
|
+
|
|
97
|
+
function MyComponent() {
|
|
98
|
+
const [sessionId, setSessionId] = useState<string>('');
|
|
99
|
+
|
|
100
|
+
const handleComplete = () => {
|
|
101
|
+
console.log('ID Authentication completed');
|
|
102
|
+
// Handle completion logic
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const handleDismiss = () => {
|
|
106
|
+
console.log('Widget dismissed');
|
|
107
|
+
// Handle dismissal logic
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
return (
|
|
111
|
+
<div>
|
|
112
|
+
<button onClick={() => setSessionId('your-session-id-here')}>
|
|
113
|
+
Start ID Authentication
|
|
114
|
+
</button>
|
|
115
|
+
|
|
116
|
+
{sessionId && (
|
|
117
|
+
<VULTIda
|
|
118
|
+
sessionId={sessionId}
|
|
119
|
+
environment="prod"
|
|
120
|
+
autoClose={true}
|
|
121
|
+
onComplete={handleComplete}
|
|
122
|
+
onDismiss={handleDismiss}
|
|
123
|
+
/>
|
|
124
|
+
)}
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
```
|
|
64
129
|
|
|
65
|
-
|
|
66
|
-
rm -rf node_modules/kyc-widget
|
|
130
|
+
**VULTIda Props:**
|
|
67
131
|
|
|
68
|
-
|
|
69
|
-
|
|
132
|
+
```typescript
|
|
133
|
+
interface VULTProps {
|
|
134
|
+
sessionId: string; // Required: The session ID for authentication
|
|
135
|
+
environment: "dev" | "development" | "stage" | "demo" | "prod" | "production"; // Required
|
|
136
|
+
autoClose?: boolean; // Optional: Automatically close widget on completion (default: true)
|
|
137
|
+
onComplete?: () => void; // Optional: Callback when authentication completes
|
|
138
|
+
onDismiss?: () => void; // Optional: Callback when widget is dismissed
|
|
139
|
+
}
|
|
140
|
+
```
|
|
70
141
|
|
|
71
|
-
|
|
72
|
-
yarn cache clean
|
|
142
|
+
### IDV Component (ID Verification)
|
|
73
143
|
|
|
74
|
-
|
|
75
|
-
rm -rf node_modules
|
|
76
|
-
rm yarn.lock
|
|
144
|
+
For React applications, you can use the `VULTIdv` component for ID Verification. This component handles the widget lifecycle automatically.
|
|
77
145
|
|
|
78
|
-
|
|
79
|
-
|
|
146
|
+
```typescript
|
|
147
|
+
import { useState } from 'react';
|
|
148
|
+
import { VULTIdv } from 'vult-security-kyc/components';
|
|
149
|
+
import type { VULTProps } from 'vult-security-kyc/components';
|
|
150
|
+
|
|
151
|
+
function MyComponent() {
|
|
152
|
+
const [sessionId, setSessionId] = useState<string>('');
|
|
153
|
+
|
|
154
|
+
const handleComplete = () => {
|
|
155
|
+
console.log('ID Verification completed');
|
|
156
|
+
// Handle completion logic
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const handleDismiss = () => {
|
|
160
|
+
console.log('Widget dismissed');
|
|
161
|
+
// Handle dismissal logic
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<div>
|
|
166
|
+
<button onClick={() => setSessionId('your-session-id-here')}>
|
|
167
|
+
Start ID Verification
|
|
168
|
+
</button>
|
|
169
|
+
|
|
170
|
+
{sessionId && (
|
|
171
|
+
<VULTIdv
|
|
172
|
+
sessionId={sessionId}
|
|
173
|
+
environment="dev"
|
|
174
|
+
autoClose={true}
|
|
175
|
+
onComplete={handleComplete}
|
|
176
|
+
onDismiss={handleDismiss}
|
|
177
|
+
/>
|
|
178
|
+
)}
|
|
179
|
+
</div>
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
```
|
|
80
183
|
|
|
81
|
-
|
|
82
|
-
|
|
184
|
+
**VULTIdv Props:**
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
interface VULTProps {
|
|
188
|
+
sessionId: string; // Required: The session ID for verification
|
|
189
|
+
environment: "dev" | "development" | "stage" | "demo" | "prod" | "production"; // Required
|
|
190
|
+
autoClose?: boolean; // Optional: Automatically close widget on completion (default: true)
|
|
191
|
+
onComplete?: () => void; // Optional: Callback when verification completes
|
|
192
|
+
onDismiss?: () => void; // Optional: Callback when widget is dismissed
|
|
193
|
+
}
|
|
83
194
|
```
|
|
84
195
|
|
|
85
196
|
## Licensing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vult-security-kyc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "typescript widget",
|
|
5
5
|
"author": "Nexrage",
|
|
6
6
|
"license": "ISC",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"preview": "vite preview"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"isomorphic-dompurify": "
|
|
53
|
+
"isomorphic-dompurify": "2.30.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": ">=16.8.0",
|