@bloque/sdk-compliance 0.0.20 → 0.0.22
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 +23 -7
- package/dist/client.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/kyc/client.d.ts +2 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ Compliance and KYC verification client for the [Bloque](https://www.bloque.app)
|
|
|
9
9
|
- **Fully Async**: Promise-based API for modern JavaScript workflows
|
|
10
10
|
- **Lightweight**: Minimal dependencies for optimal bundle size
|
|
11
11
|
|
|
12
|
+
> **📌 Important:** All compliance operations require connecting to a user session first using `bloque.connect(urn)`. This ensures proper authentication and authorization for user-specific operations. See the [Usage](#usage) section for details.
|
|
13
|
+
|
|
12
14
|
## Installation
|
|
13
15
|
|
|
14
16
|
This package is included in the main `@bloque/sdk` package. You typically don't need to install it separately.
|
|
@@ -31,13 +33,20 @@ bun add @bloque/sdk-compliance @bloque/sdk-core
|
|
|
31
33
|
import { SDK } from '@bloque/sdk';
|
|
32
34
|
|
|
33
35
|
const bloque = new SDK({
|
|
34
|
-
|
|
36
|
+
origin: 'your-origin', // Required: your origin identifier
|
|
37
|
+
auth: {
|
|
38
|
+
type: 'apiKey',
|
|
39
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
40
|
+
},
|
|
35
41
|
mode: 'production',
|
|
36
42
|
});
|
|
37
43
|
|
|
38
|
-
//
|
|
39
|
-
const
|
|
40
|
-
|
|
44
|
+
// Connect to user session first
|
|
45
|
+
const userSession = await bloque.connect('did:bloque:your-origin:user-alias');
|
|
46
|
+
|
|
47
|
+
// Start KYC verification through the session
|
|
48
|
+
const verification = await userSession.compliance.kyc.startVerification({
|
|
49
|
+
urn: 'did:bloque:your-origin:user-alias',
|
|
41
50
|
});
|
|
42
51
|
|
|
43
52
|
console.log('Verification URL:', verification.url);
|
|
@@ -191,7 +200,11 @@ import { SDK } from '@bloque/sdk';
|
|
|
191
200
|
import type { KycVerificationParams } from '@bloque/sdk-compliance';
|
|
192
201
|
|
|
193
202
|
const bloque = new SDK({
|
|
194
|
-
|
|
203
|
+
origin: 'your-origin',
|
|
204
|
+
auth: {
|
|
205
|
+
type: 'apiKey',
|
|
206
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
207
|
+
},
|
|
195
208
|
mode: 'production',
|
|
196
209
|
});
|
|
197
210
|
|
|
@@ -200,12 +213,15 @@ async function startUserVerification(
|
|
|
200
213
|
webhookUrl?: string,
|
|
201
214
|
) {
|
|
202
215
|
try {
|
|
216
|
+
// Connect to user session
|
|
217
|
+
const userSession = await bloque.connect(userUrn);
|
|
218
|
+
|
|
203
219
|
const params: KycVerificationParams = {
|
|
204
220
|
urn: userUrn,
|
|
205
221
|
webhookUrl,
|
|
206
222
|
};
|
|
207
223
|
|
|
208
|
-
const verification = await
|
|
224
|
+
const verification = await userSession.compliance.kyc.startVerification(params);
|
|
209
225
|
|
|
210
226
|
console.log('✓ Verification started');
|
|
211
227
|
console.log(' URL:', verification.url);
|
|
@@ -220,7 +236,7 @@ async function startUserVerification(
|
|
|
220
236
|
|
|
221
237
|
// Usage
|
|
222
238
|
await startUserVerification(
|
|
223
|
-
'did:bloque:origin:user-
|
|
239
|
+
'did:bloque:your-origin:user-alias',
|
|
224
240
|
'https://api.example.com/webhooks/kyc',
|
|
225
241
|
);
|
|
226
242
|
```
|
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{
|
|
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
|
-
|
|
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};
|
package/dist/kyc/client.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import
|
|
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.
|
|
3
|
+
"version": "0.0.22",
|
|
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.
|
|
37
|
+
"@bloque/sdk-core": "0.0.22"
|
|
38
38
|
}
|
|
39
39
|
}
|