@bloque/sdk-compliance 0.8.0 → 0.9.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/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/wire-types.d.ts +40 -4
- package/dist/kyc/types.d.ts +33 -5
- package/dist/tiers/types.d.ts +27 -0
- package/dist/tos-gate/tos-gate-client.d.ts +32 -10
- package/dist/tos-gate/types.d.ts +20 -3
- package/dist/verification-gate/types.d.ts +3 -0
- package/package.json +2 -2
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 i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__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__,{VerificationGateClient:()=>VerificationGateClient,mapVerificationFlow:()=>mapVerificationFlow,KycClient:()=>KycClient,ComplianceClient:()=>ComplianceClient,mapRequirementField:()=>mapRequirementField,TiersClient:()=>TiersClient,TosGateClient:()=>TosGateClient});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"}});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,result:t.result,documentsStatus:t.documents_status}}async getDocuments(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/documents`});return{documentsStatus:t.documents_status,documents:t.documents.map(e=>({documentType:e.document_type,side:e.side,
|
|
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 i in t)__webpack_require__.o(t,i)&&!__webpack_require__.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},__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__,{VerificationGateClient:()=>VerificationGateClient,mapVerificationFlow:()=>mapVerificationFlow,KycClient:()=>KycClient,ComplianceClient:()=>ComplianceClient,mapRequirementField:()=>mapRequirementField,TiersClient:()=>TiersClient,TosGateClient:()=>TosGateClient});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:e.type??"kyc",accompliceType:e.accompliceType??"person"}});return{type:t.type,level:t.level,provider:t.provider,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{type:t.type,level:t.level,provider:t.provider,status:t.status,url:t.verification_url,completedAt:t.completed_at,result:t.result,documentsStatus:t.documents_status}}async getDocuments(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/documents`});return{documentsStatus:t.documents_status,documents:t.documents.map(e=>({documentType:e.document_type,side:e.side,imageS3Key:e.image_s3_key,imageSizeBytes:e.image_size_bytes,downloadUrl:e.download_url}))}}}function mapRequirementFieldOption(e){return"string"==typeof e?e:{value:e.value,label:{en:e.label.en,es:e.label.es}}}function mapRequirementField(e){return{key:e.key,label:e.label,description:e.description,type:e.type,required:e.required,options:e.options?.map(mapRequirementFieldOption),locale:e.locale}}function mapRequirementStatus(e){return{key:e.key,kind:e.kind,status:e.status,description:e.description,title:e.title,fields:e.fields?.map(mapRequirementField),requiresUpload:e.requires_upload,submittedAt:e.submitted_at,graceUntil:e.grace_until}}function mapVerificationFlow(e){if(e)return{type:e.type,method:e.method,startEndpoint:e.start_endpoint,requestBody:{required:e.request_body.required,optional:e.request_body.optional,returnUrlPolicy:e.request_body.return_url_policy},responseUrlField:e.response_url_field,transactionalRedirect:e.transactional_redirect}}class TiersClient extends sdk_core_namespaceObject.BaseClient{async getStatus(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/tier-status`});return{identityUrn:t.identity_urn,effectiveLevel:t.effective_level,policyVersion:t.policy_version,levels:t.levels.map(e=>({level:e.level,name:e.name,satisfied:e.satisfied,requirements:e.requirements.map(mapRequirementStatus)})),nextLevel:t.next_level,missingRequirements:t.missing_requirements??[],pendingRequirements:t.pending_requirements??[],verificationFlow:mapVerificationFlow(t.verification_flow),nextRecomputeAt:t.next_recompute_at}}}function mapAcceptance(e){return{id:e.id,identityUrn:e.identity_urn,documentVersionId:e.document_version_id,documentVersionLabel:e.document_version_label,documentHash:e.document_hash,acceptedAt:e.accepted_at,authAssurance:e.auth_assurance,...e.account_activation&&{accountActivation:{attempted:e.account_activation.attempted,state:e.account_activation.state,publicAddress:e.account_activation.public_address,reason:e.account_activation.reason}}}}class TosGateClient extends sdk_core_namespaceObject.BaseClient{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/tos-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/tos-gate/init",authorizationOverride:`Bearer ${e.token}`});return{document:{documentVersionId:t.document.document_version_id,versionLabel:t.document.version_label,contentHash:t.document.content_hash,content:t.document.content},csrfToken:t.csrf_token,returnUrl:t.return_url,developerName:t.developer_name,showHome:t.show_home,accentColor:t.accent_color,passkeyRequired:t.passkey_required}}async challenge(e){let t=await this.httpClient.request({method:"GET",path:"/api/tos-gate/challenge",authorizationOverride:`Bearer ${e.token}`});return{passkey:t.passkey?this._mapPasskeyChallenge(t.passkey):null}}async accept(e){let t={csrf_token:e.csrfToken,...e.deviceAttestation&&{device_attestation:e.deviceAttestation},...!e.deviceAttestation&&e.passkey&&{passkey:{credential_id:e.passkey.credentialId,authenticator_data:e.passkey.authenticatorData,client_data:e.passkey.clientData,public_key:e.passkey.publicKey,context:e.passkey.context}}},i=await this.httpClient.request({method:"POST",path:"/api/tos-gate/accept",body:t,authorizationOverride:`Bearer ${e.token}`});return{acceptance:mapAcceptance(i.acceptance),returnUrl:i.return_url}}_mapPasskeyChallenge(e){return{challenge:e.challenge,context:e.context,expiresAtBlock:e.expires_at_block,userId:e.user_id,userName:e.user_name,publicAddress:e.public_address,rpId:e.rp_id}}}function mapUploadIntent(e){return{contentType:e.content_type,key:e.key,uploadUrl:e.upload_url,maxSizeBytes:e.max_size_bytes}}function mapRequirement(e){return{key:e.key,kind:e.kind,description:e.description,title:e.title,fields:e.fields?.map(mapRequirementField),uploadable:e.uploadable,uploadIntents:e.upload_intents?.map(mapUploadIntent)}}function mapDocumentToWire(e){return{requirement_key:e.requirementKey,s3_key:e.s3Key,document_type:e.documentType,side:e.side,original_filename:e.originalFilename}}function mapAnswerToWire(e){return{requirement_key:e.requirementKey,values:e.values}}class VerificationGateClient extends sdk_core_namespaceObject.BaseClient{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/verification-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/verification-gate/init",authorizationOverride:`Bearer ${e.token}`});return{requirements:t.requirements.map(mapRequirement),pendingRequirements:(t.pending_requirements??[]).map(e=>({key:e.key,description:e.description,title:e.title,submittedAt:e.submitted_at})),csrfToken:t.csrf_token,returnUrl:t.return_url,developerName:t.developer_name,accentColor:t.accent_color}}async submit(e){let t={csrf_token:e.csrfToken,documents:e.documents?.map(mapDocumentToWire),answers:e.answers?.map(mapAnswerToWire)},i=await this.httpClient.request({method:"POST",path:"/api/verification-gate/submit",body:t,authorizationOverride:`Bearer ${e.token}`});return{returnUrl:i.return_url,documents:i.documents,answers:i.answers}}}class ComplianceClient extends sdk_core_namespaceObject.BaseClient{kyc;tiers;tosGate;verificationGate;constructor(e){super(e),this.kyc=new KycClient(this.httpClient),this.tiers=new TiersClient(this.httpClient),this.tosGate=new TosGateClient(this.httpClient),this.verificationGate=new VerificationGateClient(this.httpClient)}}for(var __rspack_i in exports.ComplianceClient=__webpack_exports__.ComplianceClient,exports.KycClient=__webpack_exports__.KycClient,exports.TiersClient=__webpack_exports__.TiersClient,exports.TosGateClient=__webpack_exports__.TosGateClient,exports.VerificationGateClient=__webpack_exports__.VerificationGateClient,exports.mapRequirementField=__webpack_exports__.mapRequirementField,exports.mapVerificationFlow=__webpack_exports__.mapVerificationFlow,__webpack_exports__)-1===["ComplianceClient","KycClient","TiersClient","TosGateClient","VerificationGateClient","mapRequirementField","mapVerificationFlow"].indexOf(__rspack_i)&&(exports[__rspack_i]=__webpack_exports__[__rspack_i]);Object.defineProperty(exports,"__esModule",{value:!0});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BaseClient as e}from"@bloque/sdk-core";class t extends e{async startVerification(e){let t=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:e.urn,type:"kyc",accompliceType:"person"}});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,result:t.result,documentsStatus:t.documents_status}}async getDocuments(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/documents`});return{documentsStatus:t.documents_status,documents:t.documents.map(e=>({documentType:e.document_type,side:e.side,
|
|
1
|
+
import{BaseClient as e}from"@bloque/sdk-core";class t extends e{async startVerification(e){let t=await this.httpClient.request({method:"POST",path:"/api/compliance",body:{urn:e.urn,type:e.type??"kyc",accompliceType:e.accompliceType??"person"}});return{type:t.type,level:t.level,provider:t.provider,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{type:t.type,level:t.level,provider:t.provider,status:t.status,url:t.verification_url,completedAt:t.completed_at,result:t.result,documentsStatus:t.documents_status}}async getDocuments(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/documents`});return{documentsStatus:t.documents_status,documents:t.documents.map(e=>({documentType:e.document_type,side:e.side,imageS3Key:e.image_s3_key,imageSizeBytes:e.image_size_bytes,downloadUrl:e.download_url}))}}}function n(e){return"string"==typeof e?e:{value:e.value,label:{en:e.label.en,es:e.label.es}}}function i(e){return{key:e.key,label:e.label,description:e.description,type:e.type,required:e.required,options:e.options?.map(n),locale:e.locale}}function r(e){return{key:e.key,kind:e.kind,status:e.status,description:e.description,title:e.title,fields:e.fields?.map(i),requiresUpload:e.requires_upload,submittedAt:e.submitted_at,graceUntil:e.grace_until}}function a(e){if(e)return{type:e.type,method:e.method,startEndpoint:e.start_endpoint,requestBody:{required:e.request_body.required,optional:e.request_body.optional,returnUrlPolicy:e.request_body.return_url_policy},responseUrlField:e.response_url_field,transactionalRedirect:e.transactional_redirect}}class s extends e{async getStatus(e){let t=await this.httpClient.request({method:"GET",path:`/api/compliance/${e.urn}/tier-status`});return{identityUrn:t.identity_urn,effectiveLevel:t.effective_level,policyVersion:t.policy_version,levels:t.levels.map(e=>({level:e.level,name:e.name,satisfied:e.satisfied,requirements:e.requirements.map(r)})),nextLevel:t.next_level,missingRequirements:t.missing_requirements??[],pendingRequirements:t.pending_requirements??[],verificationFlow:a(t.verification_flow),nextRecomputeAt:t.next_recompute_at}}}class o extends e{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/tos-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/tos-gate/init",authorizationOverride:`Bearer ${e.token}`});return{document:{documentVersionId:t.document.document_version_id,versionLabel:t.document.version_label,contentHash:t.document.content_hash,content:t.document.content},csrfToken:t.csrf_token,returnUrl:t.return_url,developerName:t.developer_name,showHome:t.show_home,accentColor:t.accent_color,passkeyRequired:t.passkey_required}}async challenge(e){let t=await this.httpClient.request({method:"GET",path:"/api/tos-gate/challenge",authorizationOverride:`Bearer ${e.token}`});return{passkey:t.passkey?this._mapPasskeyChallenge(t.passkey):null}}async accept(e){var t;let n={csrf_token:e.csrfToken,...e.deviceAttestation&&{device_attestation:e.deviceAttestation},...!e.deviceAttestation&&e.passkey&&{passkey:{credential_id:e.passkey.credentialId,authenticator_data:e.passkey.authenticatorData,client_data:e.passkey.clientData,public_key:e.passkey.publicKey,context:e.passkey.context}}},i=await this.httpClient.request({method:"POST",path:"/api/tos-gate/accept",body:n,authorizationOverride:`Bearer ${e.token}`});return{acceptance:{id:(t=i.acceptance).id,identityUrn:t.identity_urn,documentVersionId:t.document_version_id,documentVersionLabel:t.document_version_label,documentHash:t.document_hash,acceptedAt:t.accepted_at,authAssurance:t.auth_assurance,...t.account_activation&&{accountActivation:{attempted:t.account_activation.attempted,state:t.account_activation.state,publicAddress:t.account_activation.public_address,reason:t.account_activation.reason}}},returnUrl:i.return_url}}_mapPasskeyChallenge(e){return{challenge:e.challenge,context:e.context,expiresAtBlock:e.expires_at_block,userId:e.user_id,userName:e.user_name,publicAddress:e.public_address,rpId:e.rp_id}}}function l(e){return{contentType:e.content_type,key:e.key,uploadUrl:e.upload_url,maxSizeBytes:e.max_size_bytes}}function u(e){return{key:e.key,kind:e.kind,description:e.description,title:e.title,fields:e.fields?.map(i),uploadable:e.uploadable,uploadIntents:e.upload_intents?.map(l)}}function c(e){return{requirement_key:e.requirementKey,s3_key:e.s3Key,document_type:e.documentType,side:e.side,original_filename:e.originalFilename}}function d(e){return{requirement_key:e.requirementKey,values:e.values}}class p extends e{async start(e){let t=await this.httpClient.request({method:"POST",path:"/api/verification-gate/start",body:{return_url:e.returnUrl}});return{token:t.token,url:t.url,expiresIn:t.expires_in}}async init(e){let t=await this.httpClient.request({method:"GET",path:"/api/verification-gate/init",authorizationOverride:`Bearer ${e.token}`});return{requirements:t.requirements.map(u),pendingRequirements:(t.pending_requirements??[]).map(e=>({key:e.key,description:e.description,title:e.title,submittedAt:e.submitted_at})),csrfToken:t.csrf_token,returnUrl:t.return_url,developerName:t.developer_name,accentColor:t.accent_color}}async submit(e){let t={csrf_token:e.csrfToken,documents:e.documents?.map(c),answers:e.answers?.map(d)},n=await this.httpClient.request({method:"POST",path:"/api/verification-gate/submit",body:t,authorizationOverride:`Bearer ${e.token}`});return{returnUrl:n.return_url,documents:n.documents,answers:n.answers}}}class m extends e{kyc;tiers;tosGate;verificationGate;constructor(e){super(e),this.kyc=new t(this.httpClient),this.tiers=new s(this.httpClient),this.tosGate=new o(this.httpClient),this.verificationGate=new p(this.httpClient)}}export{m as ComplianceClient,t as KycClient,s as TiersClient,o as TosGateClient,p as VerificationGateClient,i as mapRequirementField,a as mapVerificationFlow};
|
|
@@ -36,7 +36,7 @@ export interface StartKycVerificationResponse {
|
|
|
36
36
|
export interface GetKycVerificationResponse {
|
|
37
37
|
type: 'kyc' | 'kyb';
|
|
38
38
|
level: 'basic';
|
|
39
|
-
provider: 'AMLBOT';
|
|
39
|
+
provider: 'AMLBOT' | 'SUMSUB';
|
|
40
40
|
status: 'awaiting_compliance_verification' | 'approved' | 'rejected';
|
|
41
41
|
verification_url: string;
|
|
42
42
|
completed_at: string | null;
|
|
@@ -50,8 +50,9 @@ export interface GetKycVerificationResponse {
|
|
|
50
50
|
export interface ComplianceDocumentImage {
|
|
51
51
|
document_type: string;
|
|
52
52
|
side: string;
|
|
53
|
-
|
|
53
|
+
image_s3_key: string | null;
|
|
54
54
|
image_size_bytes: number;
|
|
55
|
+
download_url: string | null;
|
|
55
56
|
}
|
|
56
57
|
/**
|
|
57
58
|
* @internal
|
|
@@ -106,6 +107,9 @@ export interface TierRequirementStatusWire {
|
|
|
106
107
|
fields?: RequirementFieldWire[];
|
|
107
108
|
requires_upload?: boolean;
|
|
108
109
|
submitted_at?: string;
|
|
110
|
+
/** Present only on `tos` while a rollout `enforcement_starts_at` window
|
|
111
|
+
* is treating the requirement as satisfied. ISO-8601. */
|
|
112
|
+
grace_until?: string;
|
|
109
113
|
}
|
|
110
114
|
/**
|
|
111
115
|
* @internal
|
|
@@ -125,7 +129,13 @@ export interface TosHostedAcceptanceFlowHandoffWire {
|
|
|
125
129
|
type: 'tos_hosted_acceptance';
|
|
126
130
|
method: 'POST';
|
|
127
131
|
start_endpoint: string;
|
|
132
|
+
request_body: {
|
|
133
|
+
required: string[];
|
|
134
|
+
optional?: string[];
|
|
135
|
+
return_url_policy: 'server_allowlisted';
|
|
136
|
+
};
|
|
128
137
|
response_url_field: string;
|
|
138
|
+
transactional_redirect: boolean;
|
|
129
139
|
}
|
|
130
140
|
/**
|
|
131
141
|
* @internal
|
|
@@ -135,7 +145,13 @@ export interface DocumentSubmissionFlowHandoffWire {
|
|
|
135
145
|
type: 'document_submission';
|
|
136
146
|
method: 'POST';
|
|
137
147
|
start_endpoint: string;
|
|
148
|
+
request_body: {
|
|
149
|
+
required: string[];
|
|
150
|
+
optional?: string[];
|
|
151
|
+
return_url_policy: 'server_allowlisted';
|
|
152
|
+
};
|
|
138
153
|
response_url_field: string;
|
|
154
|
+
transactional_redirect: boolean;
|
|
139
155
|
}
|
|
140
156
|
/**
|
|
141
157
|
* @internal
|
|
@@ -155,6 +171,9 @@ export interface GetTierStatusResponse {
|
|
|
155
171
|
missing_requirements?: string[];
|
|
156
172
|
pending_requirements?: string[];
|
|
157
173
|
verification_flow?: VerificationFlowHandoffWire;
|
|
174
|
+
/** Earliest ISO-8601 instant this answer could change with no further
|
|
175
|
+
* input (e.g. TOS rollout cutoff). `null` when nothing time-driven is pending. */
|
|
176
|
+
next_recompute_at?: string | null;
|
|
158
177
|
}
|
|
159
178
|
/**
|
|
160
179
|
* @internal
|
|
@@ -200,12 +219,27 @@ export interface TosGateInitResponse {
|
|
|
200
219
|
document: TosGateDocumentWire;
|
|
201
220
|
csrf_token: string;
|
|
202
221
|
return_url: string;
|
|
222
|
+
/** The calling origin's branding name, substituted into the rendered
|
|
223
|
+
* document and shown in the hosted page's wordmark. */
|
|
224
|
+
developer_name?: string;
|
|
203
225
|
show_home: boolean;
|
|
204
226
|
accent_color?: string;
|
|
205
227
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
228
|
+
* Whether this document requires an account-activation passkey step —
|
|
229
|
+
* not the challenge itself. The challenge is bound to a block-hash
|
|
230
|
+
* window and must be minted separately, as late as possible, via
|
|
231
|
+
* `GET /api/tos-gate/challenge`.
|
|
208
232
|
*/
|
|
233
|
+
passkey_required: boolean;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* @internal
|
|
237
|
+
* `GET /api/tos-gate/challenge` response. Minted separately from `/init`,
|
|
238
|
+
* at the moment the user commits, since the challenge is bound to a
|
|
239
|
+
* bounded block-hash window.
|
|
240
|
+
*/
|
|
241
|
+
export interface TosGateChallengeResponse {
|
|
242
|
+
/** `null` when the identity has no account ready for a device. */
|
|
209
243
|
passkey: TosGatePasskeyChallengeWire | null;
|
|
210
244
|
}
|
|
211
245
|
/**
|
|
@@ -302,6 +336,8 @@ export interface VerificationGateInitResponse {
|
|
|
302
336
|
pending_requirements?: PendingVerificationRequirementWire[];
|
|
303
337
|
csrf_token: string;
|
|
304
338
|
return_url: string;
|
|
339
|
+
/** The calling origin's branding name, shown in the hosted page's wordmark. */
|
|
340
|
+
developer_name?: string;
|
|
305
341
|
accent_color?: string;
|
|
306
342
|
}
|
|
307
343
|
/**
|
package/dist/kyc/types.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/** Compliance verification type — individual (KYC) or business (KYB). */
|
|
2
|
+
export type KycComplianceType = 'kyc' | 'kyb';
|
|
3
|
+
/** Who is being verified within the request. */
|
|
4
|
+
export type KycAccompliceType = 'person' | 'company';
|
|
1
5
|
export interface KycVerificationParams {
|
|
2
6
|
/**
|
|
3
7
|
* URN (Uniform Resource Name) that uniquely identifies the user
|
|
@@ -9,18 +13,38 @@ export interface KycVerificationParams {
|
|
|
9
13
|
* @example "did:bloque:origin:..."
|
|
10
14
|
*/
|
|
11
15
|
urn: string;
|
|
16
|
+
/**
|
|
17
|
+
* Verification type to start.
|
|
18
|
+
* @default "kyc"
|
|
19
|
+
*/
|
|
20
|
+
type?: KycComplianceType;
|
|
21
|
+
/**
|
|
22
|
+
* Who is being verified.
|
|
23
|
+
* @default "person"
|
|
24
|
+
*/
|
|
25
|
+
accompliceType?: KycAccompliceType;
|
|
12
26
|
/**
|
|
13
27
|
* URL where webhook notifications will be sent when the verification
|
|
14
28
|
* status changes.
|
|
15
29
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @example "https://api.example.com/webhooks/kyc"
|
|
30
|
+
* @deprecated Not sent to the API — verification status webhooks are
|
|
31
|
+
* configured provider-side, not per-request. This field has no effect.
|
|
20
32
|
*/
|
|
21
33
|
webhookUrl?: string;
|
|
22
34
|
}
|
|
23
35
|
export interface KycVerificationResponse {
|
|
36
|
+
/**
|
|
37
|
+
* Verification type used.
|
|
38
|
+
*/
|
|
39
|
+
type: KycComplianceType;
|
|
40
|
+
/**
|
|
41
|
+
* Compliance level used.
|
|
42
|
+
*/
|
|
43
|
+
level: 'basic';
|
|
44
|
+
/**
|
|
45
|
+
* Compliance provider handling this verification.
|
|
46
|
+
*/
|
|
47
|
+
provider: 'AMLBOT' | 'SUMSUB';
|
|
24
48
|
/**
|
|
25
49
|
* Current status of the verification
|
|
26
50
|
*/
|
|
@@ -64,8 +88,12 @@ export interface GetKycDocumentsParams {
|
|
|
64
88
|
export interface KycDocumentImage {
|
|
65
89
|
documentType: string;
|
|
66
90
|
side: string;
|
|
67
|
-
|
|
91
|
+
/** S3 key for the stored image, or `null` if storage failed. */
|
|
92
|
+
imageS3Key: string | null;
|
|
68
93
|
imageSizeBytes: number;
|
|
94
|
+
/** Short-lived presigned download URL, or `null` if presigning failed
|
|
95
|
+
* (e.g. no storage client configured) — never a hard failure. */
|
|
96
|
+
downloadUrl: string | null;
|
|
69
97
|
}
|
|
70
98
|
export interface KycDocumentsResponse {
|
|
71
99
|
documentsStatus: string;
|
package/dist/tiers/types.d.ts
CHANGED
|
@@ -61,6 +61,14 @@ export interface TierRequirementStatus {
|
|
|
61
61
|
/** ISO-8601 timestamp of the submission behind a `'pending_review'`
|
|
62
62
|
* status, for a "submitted on X" line. */
|
|
63
63
|
submittedAt?: string;
|
|
64
|
+
/**
|
|
65
|
+
* ISO-8601. Set only on the `tos` requirement, and only while it reads
|
|
66
|
+
* `'satisfied'` because of a policy rollout `enforcement_starts_at`
|
|
67
|
+
* window — not for prior-version `grace_period_days`, and not from other
|
|
68
|
+
* requirement kinds. Use it to prompt "accept by X" even though
|
|
69
|
+
* `missingRequirements` / `verificationFlow` are quiet for the window.
|
|
70
|
+
*/
|
|
71
|
+
graceUntil?: string;
|
|
64
72
|
}
|
|
65
73
|
export interface TierLevelStatus {
|
|
66
74
|
level: number;
|
|
@@ -74,11 +82,24 @@ export interface TierLevelStatus {
|
|
|
74
82
|
* request, or just catch the `BloqueVerificationRequiredError` this maps
|
|
75
83
|
* onto and call its `getVerificationLink()` instead.
|
|
76
84
|
*/
|
|
85
|
+
export interface VerificationFlowRequestBody {
|
|
86
|
+
/** Field names the start endpoint requires in its request body. */
|
|
87
|
+
required: string[];
|
|
88
|
+
/** Field names the start endpoint accepts but doesn't require. */
|
|
89
|
+
optional?: string[];
|
|
90
|
+
/** `returnUrl` (when accepted) must be present in the backend's allowlist. */
|
|
91
|
+
returnUrlPolicy: 'server_allowlisted';
|
|
92
|
+
}
|
|
77
93
|
export interface VerificationFlowHandoff {
|
|
78
94
|
type: 'tos_hosted_acceptance' | 'document_submission';
|
|
79
95
|
method: 'POST';
|
|
80
96
|
startEndpoint: string;
|
|
97
|
+
requestBody: VerificationFlowRequestBody;
|
|
81
98
|
responseUrlField: string;
|
|
99
|
+
/** Whether opening the returned `url` redirects back with a transactional
|
|
100
|
+
* result appended, rather than just returning the user to `returnUrl`
|
|
101
|
+
* as-is. `false` for both flows today. */
|
|
102
|
+
transactionalRedirect: boolean;
|
|
82
103
|
}
|
|
83
104
|
export interface TierStatus {
|
|
84
105
|
identityUrn: string;
|
|
@@ -95,4 +116,10 @@ export interface TierStatus {
|
|
|
95
116
|
* there is nothing left for your user to do. */
|
|
96
117
|
pendingRequirements: string[];
|
|
97
118
|
verificationFlow?: VerificationFlowHandoff;
|
|
119
|
+
/**
|
|
120
|
+
* Earliest ISO-8601 instant this answer could change with no further
|
|
121
|
+
* input (TOS rollout cutoff, or satisfied evidence reaching `expires_at`).
|
|
122
|
+
* `null` / omitted when nothing time-driven is pending.
|
|
123
|
+
*/
|
|
124
|
+
nextRecomputeAt?: string | null;
|
|
98
125
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient } from '@bloque/sdk-core';
|
|
2
|
-
import type { StartGateResult, StartTosGateParams, TosGateAcceptParams, TosGateAcceptResult, TosGateInitParams, TosGateInitResult } from './types';
|
|
2
|
+
import type { StartGateResult, StartTosGateParams, TosGateAcceptParams, TosGateAcceptResult, TosGateChallengeParams, TosGateChallengeResult, TosGateInitParams, TosGateInitResult } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Level 0 TOS gate (`/api/tos-gate/*`) — the hosted page a user opens to
|
|
5
5
|
* accept the Terms of Service.
|
|
@@ -16,11 +16,13 @@ import type { StartGateResult, StartTosGateParams, TosGateAcceptParams, TosGateA
|
|
|
16
16
|
*
|
|
17
17
|
* Some TOS documents also require handing the identity's Kreivo PassAccount
|
|
18
18
|
* to a passkey on the same request (account activation). When that applies,
|
|
19
|
-
* `init()`'s `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* `
|
|
23
|
-
*
|
|
19
|
+
* `init()`'s `passkeyRequired` is `true` — the hosted page calls
|
|
20
|
+
* `challenge()` itself, right before the user commits, and runs WebAuthn
|
|
21
|
+
* against it automatically. Driving `init()`/`accept()` yourself means
|
|
22
|
+
* calling `challenge()` the same way (as late as possible — its challenge is
|
|
23
|
+
* bound to a short block-hash window) and passing the WebAuthn result as
|
|
24
|
+
* `accept()`'s `passkey` (or a finished `deviceAttestation`). Declining is
|
|
25
|
+
* fine — `accept()` without either still records the acceptance.
|
|
24
26
|
*/
|
|
25
27
|
export declare class TosGateClient extends BaseClient {
|
|
26
28
|
/**
|
|
@@ -41,17 +43,37 @@ export declare class TosGateClient extends BaseClient {
|
|
|
41
43
|
*
|
|
42
44
|
* @example
|
|
43
45
|
* ```typescript
|
|
44
|
-
* const { document, csrfToken,
|
|
46
|
+
* const { document, csrfToken, passkeyRequired } = await bloque.compliance.tosGate.init({
|
|
45
47
|
* token: gate.token,
|
|
46
48
|
* });
|
|
47
49
|
*
|
|
48
|
-
* if (
|
|
49
|
-
* // This document requires account activation
|
|
50
|
-
* // the
|
|
50
|
+
* if (passkeyRequired) {
|
|
51
|
+
* // This document requires account activation. Call challenge() right
|
|
52
|
+
* // before the user commits, run WebAuthn against it, then pass the
|
|
53
|
+
* // result to accept() as `passkey`.
|
|
51
54
|
* }
|
|
52
55
|
* ```
|
|
53
56
|
*/
|
|
54
57
|
init(params: TosGateInitParams): Promise<TosGateInitResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Mint the WebAuthn registration challenge for the token's identity.
|
|
60
|
+
* Separate from `init()`, and call it right before the user commits
|
|
61
|
+
* rather than at page load — the challenge is bound to a short
|
|
62
|
+
* block-hash window, so minting it early spends that window on however
|
|
63
|
+
* long the user takes to read the document.
|
|
64
|
+
*
|
|
65
|
+
* Only call this when `init()`'s `passkeyRequired` was `true`.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* const { passkey } = await bloque.compliance.tosGate.challenge({ token: gate.token });
|
|
70
|
+
* if (passkey) {
|
|
71
|
+
* // Build a PublicKeyCredentialCreationOptions from `passkey` and call
|
|
72
|
+
* // navigator.credentials.create(), then pass the result to accept().
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
challenge(params: TosGateChallengeParams): Promise<TosGateChallengeResult>;
|
|
55
77
|
/**
|
|
56
78
|
* Record TOS acceptance for the token's identity. Authorized solely by
|
|
57
79
|
* `params.token`; requires the single-use `csrfToken` from `init()`.
|
package/dist/tos-gate/types.d.ts
CHANGED
|
@@ -54,6 +54,10 @@ export interface TosGateInitResult {
|
|
|
54
54
|
/** Single-use acceptance nonce — pass as `csrfToken` to `accept()`. */
|
|
55
55
|
csrfToken: string;
|
|
56
56
|
returnUrl: string;
|
|
57
|
+
/** The calling origin's branding name, substituted into the rendered
|
|
58
|
+
* document and shown in the hosted page's wordmark. `undefined` when the
|
|
59
|
+
* origin has none configured. */
|
|
60
|
+
developerName?: string;
|
|
57
61
|
/** Whether the hosted page's intro screens should play before the document. */
|
|
58
62
|
showHome: boolean;
|
|
59
63
|
/** The calling origin's `gate_accent_color` (a CSS hex color), if it has
|
|
@@ -64,9 +68,22 @@ export interface TosGateInitResult {
|
|
|
64
68
|
* just opening `url` in a browser/webview. */
|
|
65
69
|
accentColor?: string;
|
|
66
70
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
71
|
+
* Whether this document requires an account-activation passkey step —
|
|
72
|
+
* `init()` only tells you *whether* to ask, not the challenge itself: the
|
|
73
|
+
* challenge is bound to a short block-hash window, so it's minted
|
|
74
|
+
* separately, as late as possible, via `challenge()` (call that right
|
|
75
|
+
* before the user commits, not at page load).
|
|
76
|
+
*/
|
|
77
|
+
passkeyRequired: boolean;
|
|
78
|
+
}
|
|
79
|
+
export interface TosGateChallengeParams {
|
|
80
|
+
/** The capability token returned by `start()`. */
|
|
81
|
+
token: string;
|
|
82
|
+
}
|
|
83
|
+
export interface TosGateChallengeResult {
|
|
84
|
+
/**
|
|
85
|
+
* Passkey registration challenge, or `null` when the identity has no
|
|
86
|
+
* account ready for a device (the gate then shows no passkey step).
|
|
70
87
|
*/
|
|
71
88
|
passkey: TosGatePasskeyChallenge | null;
|
|
72
89
|
}
|
|
@@ -73,6 +73,9 @@ export interface VerificationGateInitResult {
|
|
|
73
73
|
/** Single-use submit nonce — pass as `csrfToken` to `submit()`. */
|
|
74
74
|
csrfToken: string;
|
|
75
75
|
returnUrl: string;
|
|
76
|
+
/** The calling origin's branding name, shown in the hosted page's
|
|
77
|
+
* wordmark. `undefined` when the origin has none configured. */
|
|
78
|
+
developerName?: string;
|
|
76
79
|
/** The calling origin's `gate_accent_color` (a CSS hex color), if it has
|
|
77
80
|
* one configured — see {@link TosGateInitResult.accentColor} for the
|
|
78
81
|
* full explanation; both gates share the same origin-metadata source. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloque/sdk-compliance",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
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.
|
|
37
|
+
"@bloque/sdk-core": "0.9.0"
|
|
38
38
|
}
|
|
39
39
|
}
|