@bloque/sdk-compliance 0.0.21 → 0.0.23

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 CHANGED
@@ -1,342 +1,5 @@
1
- # @bloque/sdk-compliance
1
+ # `@bloque/sdk-compliance`
2
2
 
3
- Compliance and KYC verification client for the [Bloque](https://www.bloque.app) platform.
3
+ ⚠️ **Warning**: This package is intended for internal use. Its release cycle does not follow SemVer, which means we might release breaking changes (change APIs, remove functionality) without any prior warning.
4
4
 
5
- ## Features
6
-
7
- - **KYC Verification**: Start and manage Know Your Customer verification processes
8
- - **TypeScript First**: Built with TypeScript for complete type safety
9
- - **Fully Async**: Promise-based API for modern JavaScript workflows
10
- - **Lightweight**: Minimal dependencies for optimal bundle size
11
-
12
- ## Installation
13
-
14
- This package is included in the main `@bloque/sdk` package. You typically don't need to install it separately.
15
-
16
- ```bash
17
- bun add @bloque/sdk
18
- ```
19
-
20
- If you need to use this package standalone:
21
-
22
- ```bash
23
- bun add @bloque/sdk-compliance @bloque/sdk-core
24
- ```
25
-
26
- ## Usage
27
-
28
- ### With the Main SDK (Recommended)
29
-
30
- ```typescript
31
- import { SDK } from '@bloque/sdk';
32
-
33
- const bloque = new SDK({
34
- apiKey: process.env.BLOQUE_API_KEY!,
35
- mode: 'production',
36
- });
37
-
38
- // Start KYC verification
39
- const verification = await bloque.compliance.kyc.startVerification({
40
- urn: 'did:bloque:origin:user-123',
41
- });
42
-
43
- console.log('Verification URL:', verification.url);
44
- console.log('Status:', verification.status);
45
- ```
46
-
47
- ### Standalone Usage
48
-
49
- ```typescript
50
- import { ComplianceClient } from '@bloque/sdk-compliance';
51
- import { HttpClient } from '@bloque/sdk-core';
52
-
53
- const httpClient = new HttpClient({
54
- apiKey: process.env.BLOQUE_API_KEY!,
55
- mode: 'production',
56
- });
57
-
58
- const compliance = new ComplianceClient(httpClient);
59
-
60
- const verification = await compliance.kyc.startVerification({
61
- urn: 'did:bloque:origin:user-123',
62
- });
63
- ```
64
-
65
- ## API Reference
66
-
67
- ### KYC Verification
68
-
69
- #### `startVerification(params)`
70
-
71
- Initiates a KYC verification process for a user.
72
-
73
- **Parameters**:
74
-
75
- ```typescript
76
- interface KycVerificationParams {
77
- /**
78
- * URN (Uniform Resource Name) that uniquely identifies the user
79
- * within the system.
80
- *
81
- * This value is used to associate the KYC verification process
82
- * with a specific user.
83
- *
84
- * @example "did:bloque:origin:user-123"
85
- */
86
- urn: string;
87
-
88
- /**
89
- * URL where webhook notifications will be sent when the verification
90
- * status changes.
91
- *
92
- * This is optional. If provided, the platform will send POST requests
93
- * to this URL with verification status updates.
94
- *
95
- * @example "https://api.example.com/webhooks/kyc"
96
- */
97
- webhookUrl?: string;
98
- }
99
- ```
100
-
101
- **Returns**:
102
-
103
- ```typescript
104
- interface KycVerificationResponse {
105
- /**
106
- * URL where the user should complete the verification process.
107
- * Redirect the user to this URL to complete KYC.
108
- */
109
- url: string;
110
-
111
- /**
112
- * Current status of the verification
113
- */
114
- status: 'awaiting_compliance_verification' | 'approved' | 'rejected';
115
- }
116
- ```
117
-
118
- **Example**:
119
-
120
- ```typescript
121
- const verification = await bloque.compliance.kyc.startVerification({
122
- urn: 'did:bloque:origin:user-123',
123
- webhookUrl: 'https://api.example.com/webhooks/kyc', // Optional
124
- });
125
-
126
- // Redirect user to verification.url
127
- window.location.href = verification.url;
128
- ```
129
-
130
- #### `getVerification(params)`
131
-
132
- Retrieves the current status of a KYC verification.
133
-
134
- **Parameters**:
135
-
136
- ```typescript
137
- interface GetKycVerificationParams {
138
- /**
139
- * URN (Uniform Resource Name) that uniquely identifies the user
140
- * within the system.
141
- *
142
- * @example "did:bloque:user:123e4567"
143
- */
144
- urn: string;
145
- }
146
- ```
147
-
148
- **Returns**:
149
-
150
- ```typescript
151
- interface KycVerificationResponse {
152
- /**
153
- * Current status of the verification
154
- */
155
- status: 'awaiting_compliance_verification' | 'approved' | 'rejected';
156
-
157
- /**
158
- * URL where the user can complete or view the verification
159
- */
160
- url: string;
161
-
162
- /**
163
- * Date when the verification was completed (ISO 8601 format)
164
- * null if verification is not yet completed
165
- */
166
- completedAt: string | null;
167
- }
168
- ```
169
-
170
- **Example**:
171
-
172
- ```typescript
173
- const status = await bloque.compliance.kyc.getVerification({
174
- urn: 'did:bloque:user:123e4567',
175
- });
176
-
177
- console.log('Status:', status.status);
178
- console.log('Completed At:', status.completedAt);
179
-
180
- if (status.status === 'approved') {
181
- console.log('Verification approved!');
182
- }
183
- ```
184
-
185
- ## Complete Examples
186
-
187
- ### Basic KYC Verification
188
-
189
- ```typescript
190
- import { SDK } from '@bloque/sdk';
191
- import type { KycVerificationParams } from '@bloque/sdk-compliance';
192
-
193
- const bloque = new SDK({
194
- apiKey: process.env.BLOQUE_API_KEY!,
195
- mode: 'production',
196
- });
197
-
198
- async function startUserVerification(
199
- userUrn: string,
200
- webhookUrl?: string,
201
- ) {
202
- try {
203
- const params: KycVerificationParams = {
204
- urn: userUrn,
205
- webhookUrl,
206
- };
207
-
208
- const verification = await bloque.compliance.kyc.startVerification(params);
209
-
210
- console.log('✓ Verification started');
211
- console.log(' URL:', verification.url);
212
- console.log(' Status:', verification.status);
213
-
214
- return verification;
215
- } catch (error) {
216
- console.error('Failed to start verification:', error);
217
- throw error;
218
- }
219
- }
220
-
221
- // Usage
222
- await startUserVerification(
223
- 'did:bloque:origin:user-123',
224
- 'https://api.example.com/webhooks/kyc',
225
- );
226
- ```
227
-
228
- ### Getting Verification Status
229
-
230
- ```typescript
231
- import { SDK } from '@bloque/sdk';
232
- import type { GetKycVerificationParams } from '@bloque/sdk-compliance';
233
-
234
- const bloque = new SDK({
235
- apiKey: process.env.BLOQUE_API_KEY!,
236
- mode: 'production',
237
- });
238
-
239
- async function checkVerificationStatus(userUrn: string) {
240
- try {
241
- const params: GetKycVerificationParams = {
242
- urn: userUrn,
243
- };
244
-
245
- const status = await bloque.compliance.kyc.getVerification(params);
246
-
247
- console.log('✓ Verification status retrieved');
248
- console.log(' Status:', status.status);
249
- console.log(' Verification URL:', status.url);
250
- console.log(' Completed At:', status.completedAt);
251
-
252
- return status;
253
- } catch (error) {
254
- console.error('Failed to get verification status:', error);
255
- throw error;
256
- }
257
- }
258
-
259
- // Usage
260
- await checkVerificationStatus('did:bloque:user:123e4567');
261
- ```
262
-
263
- ## TypeScript Support
264
-
265
- This package is written in TypeScript and includes complete type definitions:
266
-
267
- ```typescript
268
- import type {
269
- ComplianceClient,
270
- KycClient,
271
- KycVerificationParams,
272
- KycVerificationResponse,
273
- GetKycVerificationParams,
274
- } from '@bloque/sdk-compliance';
275
-
276
- // Type-safe verification start
277
- const startParams: KycVerificationParams = {
278
- urn: 'did:bloque:origin:user-123',
279
- webhookUrl: 'https://api.example.com/webhooks/kyc', // Optional
280
- };
281
-
282
- const verification: KycVerificationResponse =
283
- await bloque.compliance.kyc.startVerification(startParams);
284
-
285
- // Type-safe verification status check
286
- const statusParams: GetKycVerificationParams = {
287
- urn: 'did:bloque:user:123e4567',
288
- };
289
-
290
- const status: KycVerificationStatus =
291
- await bloque.compliance.kyc.getVerification(statusParams);
292
- ```
293
-
294
- ## Error Handling
295
-
296
- Always wrap API calls in try-catch blocks:
297
-
298
- ```typescript
299
- // Start verification
300
- try {
301
- const verification = await bloque.compliance.kyc.startVerification({
302
- urn: userUrn,
303
- });
304
- // Handle success
305
- } catch (error) {
306
- if (error instanceof Error) {
307
- console.error('Verification failed:', error.message);
308
- }
309
- // Handle error
310
- }
311
-
312
- // Get verification status
313
- try {
314
- const status = await bloque.compliance.kyc.getVerification({
315
- urn: userUrn,
316
- });
317
- // Handle success
318
- } catch (error) {
319
- if (error instanceof Error) {
320
- console.error('Failed to get status:', error.message);
321
- }
322
- // Handle error
323
- }
324
- ```
325
-
326
- ## Requirements
327
-
328
- - Node.js 22.x or higher / Bun 1.x or higher
329
- - TypeScript 5.x or higher (for TypeScript projects)
330
-
331
- ## Links
332
-
333
- - [Homepage](https://www.bloque.app)
334
- - [Main SDK Documentation](../sdk/README.md)
335
- - [GitHub Repository](https://github.com/bloque-app/sdk)
336
- - [Issue Tracker](https://github.com/bloque-app/sdk/issues)
337
-
338
- ## License
339
-
340
- [MIT](../../LICENSE)
341
-
342
- Copyright (c) 2025-present Bloque Copilot Inc.
5
+ For documentation, please refer to the [main SDK documentation](../sdk/README.md).
package/dist/client.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { HttpClient } from '@bloque/sdk-core';
2
+ import { BaseClient } from '@bloque/sdk-core';
2
3
  import { KycClient } from './kyc/client';
3
- export declare class ComplianceClient {
4
- private readonly httpClient;
4
+ export declare class ComplianceClient extends BaseClient {
5
5
  readonly kyc: KycClient;
6
6
  constructor(httpClient: HttpClient);
7
7
  }
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var _ in t)__webpack_require__.o(t,_)&&!__webpack_require__.o(e,_)&&Object.defineProperty(e,_,{enumerable:!0,get:t[_]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{KycClient:()=>KycClient,ComplianceClient:()=>ComplianceClient});class KycClient{httpClient;constructor(e){this.httpClient=e}async startVerification(e){let t=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:e.urn,type:"kyc",accompliceType:"person",...e.webhookUrl&&{webhookUrl:e.webhookUrl}}});return{url:t.url,status:t.status,completedAt:null}}async getVerification(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}`});return{status:t.status,url:t.verification_url,completedAt:t.completed_at}}}class ComplianceClient{httpClient;kyc;constructor(e){this.httpClient=e,this.kyc=new KycClient(this.httpClient)}}for(var __rspack_i in exports.ComplianceClient=__webpack_exports__.ComplianceClient,exports.KycClient=__webpack_exports__.KycClient,__webpack_exports__)-1===["ComplianceClient","KycClient"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";const __rslib_import_meta_url__="u"<typeof document?new(require("url".replace("",""))).URL("file:"+__filename).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href;var __webpack_require__={};__webpack_require__.d=(e,t)=>{for(var _ in t)__webpack_require__.o(t,_)&&!__webpack_require__.o(e,_)&&Object.defineProperty(e,_,{enumerable:!0,get:t[_]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{KycClient:()=>KycClient,ComplianceClient:()=>ComplianceClient});const sdk_core_namespaceObject=require("@bloque/sdk-core");class KycClient extends sdk_core_namespaceObject.BaseClient{async startVerification(e){let t=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:e.urn,type:"kyc",accompliceType:"person",...e.webhookUrl&&{webhookUrl:e.webhookUrl}}});return{url:t.url,status:t.status,completedAt:null}}async getVerification(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}`});return{status:t.status,url:t.verification_url,completedAt:t.completed_at}}}class ComplianceClient extends sdk_core_namespaceObject.BaseClient{kyc;constructor(e){super(e),this.kyc=new KycClient(this.httpClient)}}for(var __rspack_i in exports.ComplianceClient=__webpack_exports__.ComplianceClient,exports.KycClient=__webpack_exports__.KycClient,__webpack_exports__)-1===["ComplianceClient","KycClient"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- class t{httpClient;constructor(t){this.httpClient=t}async startVerification(t){let e=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:t.urn,type:"kyc",accompliceType:"person",...t.webhookUrl&&{webhookUrl:t.webhookUrl}}});return{url:e.url,status:e.status,completedAt:null}}async getVerification(t){let e=await this.httpClient.request({method:"GET",path:`/api/compliance/${t.urn}`});return{status:e.status,url:e.verification_url,completedAt:e.completed_at}}}class e{httpClient;kyc;constructor(e){this.httpClient=e,this.kyc=new t(this.httpClient)}}export{e as ComplianceClient,t as KycClient};
1
+ import{BaseClient as t}from"@bloque/sdk-core";class e extends t{async startVerification(t){let e=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:t.urn,type:"kyc",accompliceType:"person",...t.webhookUrl&&{webhookUrl:t.webhookUrl}}});return{url:e.url,status:e.status,completedAt:null}}async getVerification(t){let e=await this.httpClient.request({method:"GET",path:`/api/compliance/${t.urn}`});return{status:e.status,url:e.verification_url,completedAt:e.completed_at}}}class r extends t{kyc;constructor(t){super(t),this.kyc=new e(this.httpClient)}}export{r as ComplianceClient,e as KycClient};
@@ -1,8 +1,6 @@
1
- import type { HttpClient } from '@bloque/sdk-core';
1
+ import { BaseClient } from '@bloque/sdk-core';
2
2
  import type { GetKycVerificationParams, KycVerificationParams, KycVerificationResponse } from './types';
3
- export declare class KycClient {
4
- private readonly httpClient;
5
- constructor(httpClient: HttpClient);
3
+ export declare class KycClient extends BaseClient {
6
4
  startVerification(params: KycVerificationParams): Promise<KycVerificationResponse>;
7
5
  getVerification(params: GetKycVerificationParams): Promise<KycVerificationResponse>;
8
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloque/sdk-compliance",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "bloque",
@@ -34,6 +34,6 @@
34
34
  "node": ">=22"
35
35
  },
36
36
  "dependencies": {
37
- "@bloque/sdk-core": "0.0.21"
37
+ "@bloque/sdk-core": "0.0.23"
38
38
  }
39
39
  }