vesant-sdk 1.0.4
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 +247 -0
- package/dist/client-CA9Wr_qb.d.ts +1108 -0
- package/dist/client-DMNkESa0.d.mts +1108 -0
- package/dist/compliance/index.d.mts +543 -0
- package/dist/compliance/index.d.ts +543 -0
- package/dist/compliance/index.js +2133 -0
- package/dist/compliance/index.js.map +1 -0
- package/dist/compliance/index.mjs +2130 -0
- package/dist/compliance/index.mjs.map +1 -0
- package/dist/geolocation/index.d.mts +73 -0
- package/dist/geolocation/index.d.ts +73 -0
- package/dist/geolocation/index.js +1100 -0
- package/dist/geolocation/index.js.map +1 -0
- package/dist/geolocation/index.mjs +1094 -0
- package/dist/geolocation/index.mjs.map +1 -0
- package/dist/index.d.mts +50 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +2968 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2948 -0
- package/dist/index.mjs.map +1 -0
- package/dist/kyc/core.d.mts +3 -0
- package/dist/kyc/core.d.ts +3 -0
- package/dist/kyc/core.js +773 -0
- package/dist/kyc/core.js.map +1 -0
- package/dist/kyc/core.mjs +771 -0
- package/dist/kyc/core.mjs.map +1 -0
- package/dist/kyc/index.d.mts +734 -0
- package/dist/kyc/index.d.ts +734 -0
- package/dist/kyc/index.js +773 -0
- package/dist/kyc/index.js.map +1 -0
- package/dist/kyc/index.mjs +771 -0
- package/dist/kyc/index.mjs.map +1 -0
- package/dist/react.d.mts +487 -0
- package/dist/react.d.ts +487 -0
- package/dist/react.js +1122 -0
- package/dist/react.js.map +1 -0
- package/dist/react.mjs +1102 -0
- package/dist/react.mjs.map +1 -0
- package/dist/risk-profile/index.d.mts +228 -0
- package/dist/risk-profile/index.d.ts +228 -0
- package/dist/risk-profile/index.js +548 -0
- package/dist/risk-profile/index.js.map +1 -0
- package/dist/risk-profile/index.mjs +546 -0
- package/dist/risk-profile/index.mjs.map +1 -0
- package/dist/types-Bnsnejor.d.mts +150 -0
- package/dist/types-Bnsnejor.d.ts +150 -0
- package/dist/types-CFupjwi8.d.ts +213 -0
- package/dist/types-CqOLbaXk.d.mts +213 -0
- package/package.json +94 -0
package/README.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Vesant Compliance SDK
|
|
2
|
+
|
|
3
|
+
> TypeScript SDK for Vesant Compliance Platform - Geolocation Verification, Risk Profiling, and Compliance Orchestration
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Geolocation Compliance** - IP verification, VPN/proxy detection, jurisdiction checks, device fingerprinting
|
|
8
|
+
- **Risk Profiling** - Automated customer risk profile creation and management
|
|
9
|
+
- **Compliance Orchestration** - Unified registration, login, and transaction verification
|
|
10
|
+
- **React Hooks** - Ready-to-use hooks for common compliance workflows
|
|
11
|
+
- **Tree-Shakeable** - Import only what you need
|
|
12
|
+
- **Type-Safe** - Full TypeScript support with detailed type definitions
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install vesant-compliance-sdk
|
|
18
|
+
# or
|
|
19
|
+
yarn add vesant-compliance-sdk
|
|
20
|
+
# or
|
|
21
|
+
pnpm add vesant-compliance-sdk
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick Start
|
|
25
|
+
|
|
26
|
+
### Initialize the SDK
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { ComplianceClient } from 'vesant-compliance-sdk';
|
|
30
|
+
|
|
31
|
+
const sdk = new ComplianceClient({
|
|
32
|
+
baseURL: process.env.VESANT_API_URL,
|
|
33
|
+
tenantId: process.env.VESANT_TENANT_ID,
|
|
34
|
+
apiKey: process.env.VESANT_API_KEY
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Registration Verification
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
const result = await sdk.verifyAtRegistration({
|
|
42
|
+
customerId: 'CUST-12345',
|
|
43
|
+
fullName: 'John Doe',
|
|
44
|
+
emailAddress: 'john@example.com',
|
|
45
|
+
ipAddress: req.ip,
|
|
46
|
+
deviceFingerprint: {
|
|
47
|
+
device_id: deviceId,
|
|
48
|
+
user_agent: req.headers['user-agent'],
|
|
49
|
+
platform: 'web'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
if (result.allowed) {
|
|
54
|
+
console.log('Registration approved');
|
|
55
|
+
console.log('Customer profile:', result.profile);
|
|
56
|
+
console.log('Risk category:', result.profile.risk_category);
|
|
57
|
+
|
|
58
|
+
if (result.requiresKYC) {
|
|
59
|
+
// Redirect to KYC flow
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
console.log('Registration blocked:', result.blockReasons);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Login Verification
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const result = await sdk.verifyAtLogin({
|
|
70
|
+
customerId: 'CUST-12345',
|
|
71
|
+
ipAddress: req.ip,
|
|
72
|
+
deviceFingerprint: getDeviceFingerprint()
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (result.allowed) {
|
|
76
|
+
if (result.requiresStepUp) {
|
|
77
|
+
// Trigger MFA/2FA
|
|
78
|
+
} else {
|
|
79
|
+
// Allow login
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
console.log('Login blocked:', result.blockReasons);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Transaction Verification
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
const result = await sdk.verifyAtTransaction({
|
|
90
|
+
customerId: 'CUST-12345',
|
|
91
|
+
ipAddress: req.ip,
|
|
92
|
+
amount: 5000,
|
|
93
|
+
currency: 'USD',
|
|
94
|
+
transactionType: 'withdrawal'
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (result.allowed) {
|
|
98
|
+
// Process transaction
|
|
99
|
+
} else if (result.requiresApproval) {
|
|
100
|
+
// Queue for manual review
|
|
101
|
+
} else {
|
|
102
|
+
console.log('Transaction blocked:', result.blockReasons);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Module-Specific Imports
|
|
107
|
+
|
|
108
|
+
Import only what you need to reduce bundle size:
|
|
109
|
+
|
|
110
|
+
### Geolocation Only
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { GeolocationClient } from 'vesant-compliance-sdk/geolocation';
|
|
114
|
+
|
|
115
|
+
const geoClient = new GeolocationClient({
|
|
116
|
+
baseURL: process.env.VESANT_API_URL,
|
|
117
|
+
tenantId: process.env.VESANT_TENANT_ID,
|
|
118
|
+
apiKey: process.env.VESANT_API_KEY
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const verification = await geoClient.verifyIP({
|
|
122
|
+
ip_address: '8.8.8.8',
|
|
123
|
+
user_id: 'user-123',
|
|
124
|
+
event_type: 'login'
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
console.log('Country:', verification.location.country_iso);
|
|
128
|
+
console.log('Is VPN:', verification.location.is_vpn);
|
|
129
|
+
console.log('Risk level:', verification.risk_level);
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Risk Profile Only
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { RiskProfileClient } from 'vesant-compliance-sdk/risk-profile';
|
|
136
|
+
|
|
137
|
+
const riskClient = new RiskProfileClient({
|
|
138
|
+
baseURL: process.env.VESANT_API_URL,
|
|
139
|
+
tenantId: process.env.VESANT_TENANT_ID,
|
|
140
|
+
apiKey: process.env.VESANT_API_KEY
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const profile = await riskClient.getProfile('CUST-12345');
|
|
144
|
+
console.log('Risk score:', profile.risk_score);
|
|
145
|
+
console.log('Risk category:', profile.risk_category);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## React Hooks
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { useRegistration } from 'vesant-compliance-sdk/react';
|
|
152
|
+
|
|
153
|
+
function RegistrationForm() {
|
|
154
|
+
const { verifyRegistration, loading, error } = useRegistration(sdk, {
|
|
155
|
+
onSuccess: (result) => {
|
|
156
|
+
console.log('Registration approved!', result.profile);
|
|
157
|
+
navigate('/dashboard');
|
|
158
|
+
},
|
|
159
|
+
onBlocked: (result) => {
|
|
160
|
+
alert(`Registration blocked: ${result.blockReasons.join(', ')}`);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
const handleSubmit = async (formData) => {
|
|
165
|
+
await verifyRegistration({
|
|
166
|
+
customerId: formData.customerId,
|
|
167
|
+
fullName: formData.fullName,
|
|
168
|
+
emailAddress: formData.email,
|
|
169
|
+
ipAddress: await getClientIP()
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<form onSubmit={handleSubmit}>
|
|
175
|
+
{/* Form fields */}
|
|
176
|
+
<button disabled={loading}>
|
|
177
|
+
{loading ? 'Verifying...' : 'Register'}
|
|
178
|
+
</button>
|
|
179
|
+
{error && <ErrorMessage>{error.message}</ErrorMessage>}
|
|
180
|
+
</form>
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Configuration
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
interface ComplianceClientConfig {
|
|
189
|
+
baseURL: string; // Vesant API Gateway URL
|
|
190
|
+
tenantId: string; // Your tenant ID
|
|
191
|
+
apiKey: string; // Your API key
|
|
192
|
+
timeout?: number; // Request timeout in ms (default: 10000)
|
|
193
|
+
retries?: number; // Retry attempts (default: 3)
|
|
194
|
+
debug?: boolean; // Enable debug logging (default: false)
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## API Methods
|
|
199
|
+
|
|
200
|
+
### ComplianceClient
|
|
201
|
+
|
|
202
|
+
| Method | Description |
|
|
203
|
+
|--------|-------------|
|
|
204
|
+
| `verifyAtRegistration(request)` | Verify new user registration |
|
|
205
|
+
| `verifyAtLogin(request)` | Verify user login |
|
|
206
|
+
| `verifyAtTransaction(request)` | Verify financial transaction |
|
|
207
|
+
| `requestCustomerLocation(input)` | Request live GPS location from customer |
|
|
208
|
+
| `getLocationRequest(requestId)` | Get location request status |
|
|
209
|
+
|
|
210
|
+
### GeolocationClient
|
|
211
|
+
|
|
212
|
+
| Method | Description |
|
|
213
|
+
|--------|-------------|
|
|
214
|
+
| `verifyIP(request)` | Verify IP address and check compliance |
|
|
215
|
+
| `validateCipherText(cipherText, userId, eventType)` | Validate device fingerprint |
|
|
216
|
+
| `listAlerts(filters)` | List compliance alerts |
|
|
217
|
+
| `listJurisdictions()` | Get jurisdiction configurations |
|
|
218
|
+
|
|
219
|
+
### RiskProfileClient
|
|
220
|
+
|
|
221
|
+
| Method | Description |
|
|
222
|
+
|--------|-------------|
|
|
223
|
+
| `createProfile(request)` | Create customer risk profile |
|
|
224
|
+
| `getProfile(customerId)` | Get profile by customer ID |
|
|
225
|
+
| `updateProfile(profileId, updates)` | Update customer profile |
|
|
226
|
+
| `getDashboardMetrics()` | Get risk dashboard metrics |
|
|
227
|
+
|
|
228
|
+
## Documentation
|
|
229
|
+
|
|
230
|
+
For detailed documentation, see the [docs](./docs) directory:
|
|
231
|
+
|
|
232
|
+
- [Installation](./docs/getting-started/installation.md)
|
|
233
|
+
- [Quick Start](./docs/getting-started/quick-start.md)
|
|
234
|
+
- [Configuration](./docs/getting-started/configuration.md)
|
|
235
|
+
- [Registration Flow](./docs/guides/registration.md)
|
|
236
|
+
- [Login Flow](./docs/guides/login.md)
|
|
237
|
+
- [Transaction Verification](./docs/guides/transactions.md)
|
|
238
|
+
- [React Hooks](./docs/react-hooks/overview.md)
|
|
239
|
+
- [Error Handling](./docs/advanced/error-handling.md)
|
|
240
|
+
|
|
241
|
+
## License
|
|
242
|
+
|
|
243
|
+
MIT
|
|
244
|
+
|
|
245
|
+
## Support
|
|
246
|
+
|
|
247
|
+
For support, contact your Vesant account representative or visit the [support portal](https://support.vesant.ai).
|