@bloque/sdk 0.0.20 → 0.0.21
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 +417 -17
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -30,6 +30,7 @@ This SDK is compatible with multiple JavaScript runtimes:
|
|
|
30
30
|
|
|
31
31
|
- **TypeScript First**: Built with TypeScript for complete type safety
|
|
32
32
|
- **Simple API**: Intuitive interface for managing organizations, compliance, accounts, and identity
|
|
33
|
+
- **Identity Registration**: Register individual users (KYC) and businesses (KYB) with multi-method authentication
|
|
33
34
|
- **Fully Async**: Promise-based API for modern JavaScript workflows
|
|
34
35
|
- **Lightweight**: Minimal dependencies for optimal bundle size
|
|
35
36
|
- **Modular**: Import only what you need with tree-shakeable exports
|
|
@@ -42,14 +43,20 @@ bun add @bloque/sdk
|
|
|
42
43
|
|
|
43
44
|
## Quick Start
|
|
44
45
|
|
|
46
|
+
### Backend (Node.js, Bun, Deno)
|
|
47
|
+
|
|
45
48
|
```typescript
|
|
46
49
|
import { SDK } from '@bloque/sdk';
|
|
47
50
|
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
48
51
|
|
|
49
|
-
// Initialize the SDK (
|
|
52
|
+
// Initialize the SDK with API key (backend only)
|
|
50
53
|
const bloque = new SDK({
|
|
51
|
-
|
|
54
|
+
auth: {
|
|
55
|
+
type: 'apiKey',
|
|
56
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
57
|
+
},
|
|
52
58
|
mode: 'production', // or 'sandbox' for testing
|
|
59
|
+
platform: 'node', // optional: 'node' | 'bun' | 'deno'
|
|
53
60
|
});
|
|
54
61
|
|
|
55
62
|
// Create an organization
|
|
@@ -88,26 +95,115 @@ async function createCard() {
|
|
|
88
95
|
}
|
|
89
96
|
```
|
|
90
97
|
|
|
98
|
+
### Frontend (Browser, React Native)
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { SDK } from '@bloque/sdk';
|
|
102
|
+
|
|
103
|
+
// Initialize the SDK with JWT authentication
|
|
104
|
+
const bloque = new SDK({
|
|
105
|
+
auth: { type: 'jwt' },
|
|
106
|
+
mode: 'production',
|
|
107
|
+
platform: 'browser', // or 'react-native'
|
|
108
|
+
// tokenStorage is optional for browser (uses localStorage by default)
|
|
109
|
+
// for react-native, provide a custom storage implementation
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// After user registration, the SDK automatically stores the JWT
|
|
113
|
+
const result = await bloque.identity.origins.register('ethereum-mainnet', {
|
|
114
|
+
assertionResult: { /* ... */ },
|
|
115
|
+
type: 'individual',
|
|
116
|
+
profile: { /* ... */ }
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// The token is now stored and used for subsequent requests
|
|
120
|
+
const alias = await bloque.identity.aliases.get('user@example.com');
|
|
121
|
+
```
|
|
122
|
+
|
|
91
123
|
## Configuration
|
|
92
124
|
|
|
93
125
|
### Initialize the SDK
|
|
94
126
|
|
|
127
|
+
The SDK supports different authentication methods depending on where it's running:
|
|
128
|
+
|
|
129
|
+
#### Backend Configuration (API Key)
|
|
130
|
+
|
|
131
|
+
For server-side applications (Node.js, Bun, Deno):
|
|
132
|
+
|
|
95
133
|
```typescript
|
|
96
134
|
import { SDK } from '@bloque/sdk';
|
|
97
|
-
import type { BloqueConfig } from '@bloque/sdk';
|
|
98
135
|
|
|
99
136
|
const bloque = new SDK({
|
|
100
|
-
|
|
101
|
-
|
|
137
|
+
auth: {
|
|
138
|
+
type: 'apiKey',
|
|
139
|
+
apiKey: process.env.BLOQUE_API_KEY!, // Your Bloque API key
|
|
140
|
+
},
|
|
141
|
+
mode: 'production', // 'sandbox' or 'production'
|
|
142
|
+
platform: 'node', // optional: 'node' | 'bun' | 'deno' (defaults to 'node')
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Frontend Configuration (JWT)
|
|
147
|
+
|
|
148
|
+
For client-side applications (Browser, React Native):
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { SDK } from '@bloque/sdk';
|
|
152
|
+
|
|
153
|
+
// Browser
|
|
154
|
+
const bloque = new SDK({
|
|
155
|
+
auth: { type: 'jwt' },
|
|
156
|
+
mode: 'production',
|
|
157
|
+
platform: 'browser',
|
|
158
|
+
// tokenStorage is optional - uses localStorage by default
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// React Native (with custom storage)
|
|
162
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
163
|
+
|
|
164
|
+
const bloque = new SDK({
|
|
165
|
+
auth: { type: 'jwt' },
|
|
166
|
+
mode: 'production',
|
|
167
|
+
platform: 'react-native',
|
|
168
|
+
tokenStorage: {
|
|
169
|
+
get: async () => await AsyncStorage.getItem('access_token'),
|
|
170
|
+
set: async (token: string) => await AsyncStorage.setItem('access_token', token),
|
|
171
|
+
clear: async () => await AsyncStorage.removeItem('access_token'),
|
|
172
|
+
},
|
|
102
173
|
});
|
|
103
174
|
```
|
|
104
175
|
|
|
105
176
|
### Configuration Options
|
|
106
177
|
|
|
107
|
-
- **`
|
|
108
|
-
-
|
|
178
|
+
- **`auth`** (object, required): Authentication configuration
|
|
179
|
+
- `type: 'apiKey'`: For backend platforms
|
|
180
|
+
- `apiKey` (string, required): Your Bloque API key
|
|
181
|
+
- `type: 'jwt'`: For frontend platforms
|
|
182
|
+
- Requires storing and managing JWT tokens via `tokenStorage`
|
|
183
|
+
|
|
184
|
+
- **`mode`** ('sandbox' | 'production', optional): Environment mode
|
|
109
185
|
- `sandbox`: For testing and development
|
|
110
|
-
- `production`: For live operations
|
|
186
|
+
- `production`: For live operations (default)
|
|
187
|
+
|
|
188
|
+
- **`platform`** (string, optional): Execution platform
|
|
189
|
+
- Backend: `'node'` (default) | `'bun'` | `'deno'`
|
|
190
|
+
- Frontend: `'browser'` | `'react-native'`
|
|
191
|
+
- Determines available authentication methods
|
|
192
|
+
|
|
193
|
+
- **`tokenStorage`** (object, optional): JWT token storage mechanism
|
|
194
|
+
- Required for JWT authentication on non-browser platforms
|
|
195
|
+
- Browser automatically uses `localStorage` if not provided
|
|
196
|
+
- Must implement: `get()`, `set(token)`, `clear()`
|
|
197
|
+
|
|
198
|
+
### Platform and Authentication Compatibility
|
|
199
|
+
|
|
200
|
+
| Platform | API Key Auth | JWT Auth | Token Storage |
|
|
201
|
+
|----------|--------------|----------|---------------|
|
|
202
|
+
| `node` | ✅ | ✅ | Required for JWT |
|
|
203
|
+
| `bun` | ✅ | ✅ | Required for JWT |
|
|
204
|
+
| `deno` | ✅ | ✅ | Required for JWT |
|
|
205
|
+
| `browser` | ❌ | ✅ | Optional (uses localStorage) |
|
|
206
|
+
| `react-native` | ❌ | ✅ | Required |
|
|
111
207
|
|
|
112
208
|
## API Reference
|
|
113
209
|
|
|
@@ -306,7 +402,152 @@ interface CardAccount {
|
|
|
306
402
|
|
|
307
403
|
### Identity
|
|
308
404
|
|
|
309
|
-
The identity resource allows you to retrieve user aliases
|
|
405
|
+
The identity resource allows you to register identities, retrieve user aliases, and manage authentication origins.
|
|
406
|
+
|
|
407
|
+
#### Register Identity
|
|
408
|
+
|
|
409
|
+
Register a new user or business identity to an authentication origin. Supports individual users (KYC) and businesses (KYB):
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
// Register individual user
|
|
413
|
+
const individual = await bloque.identity.origins.register('ethereum-mainnet', {
|
|
414
|
+
assertionResult: {
|
|
415
|
+
alias: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
|
|
416
|
+
challengeType: 'SIGNING_CHALLENGE',
|
|
417
|
+
value: {
|
|
418
|
+
signature: '0x1234567890abcdef...',
|
|
419
|
+
alias: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
type: 'individual',
|
|
423
|
+
profile: {
|
|
424
|
+
firstName: 'John',
|
|
425
|
+
lastName: 'Doe',
|
|
426
|
+
email: 'john@example.com'
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
// Register business
|
|
431
|
+
const business = await bloque.identity.origins.register('bloque-api', {
|
|
432
|
+
assertionResult: {
|
|
433
|
+
alias: 'business-123',
|
|
434
|
+
challengeType: 'API_KEY',
|
|
435
|
+
value: {
|
|
436
|
+
apiKey: 'sk_live_abc123',
|
|
437
|
+
alias: 'business-123'
|
|
438
|
+
}
|
|
439
|
+
},
|
|
440
|
+
type: 'business',
|
|
441
|
+
profile: {
|
|
442
|
+
legalName: 'Acme Corporation',
|
|
443
|
+
name: 'Acme Corp',
|
|
444
|
+
taxId: '12-3456789',
|
|
445
|
+
type: 'LLC',
|
|
446
|
+
incorporationDate: '2020-01-15',
|
|
447
|
+
addressLine1: '123 Business St',
|
|
448
|
+
city: 'New York',
|
|
449
|
+
state: 'NY',
|
|
450
|
+
postalCode: '10001',
|
|
451
|
+
country: 'United States'
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
**Parameters**:
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
// Registration parameters (discriminated union by type)
|
|
460
|
+
type RegisterParams = IndividualRegisterParams | BusinessRegisterParams;
|
|
461
|
+
|
|
462
|
+
interface IndividualRegisterParams {
|
|
463
|
+
assertionResult: AssertionResult;
|
|
464
|
+
extraContext?: Record<string, unknown>;
|
|
465
|
+
type: 'individual';
|
|
466
|
+
profile: UserProfile;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
interface BusinessRegisterParams {
|
|
470
|
+
assertionResult: AssertionResult;
|
|
471
|
+
extraContext?: Record<string, unknown>;
|
|
472
|
+
type: 'business';
|
|
473
|
+
profile: BusinessProfile;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// Assertion result for challenge verification
|
|
477
|
+
interface AssertionResult {
|
|
478
|
+
alias: string; // Identity identifier
|
|
479
|
+
challengeType: 'SIGNING_CHALLENGE' | 'API_KEY' | 'OAUTH_REDIRECT' | 'WEBAUTHN' | 'OTP' | 'PASSWORD';
|
|
480
|
+
value: {
|
|
481
|
+
signature?: string; // For SIGNING_CHALLENGE
|
|
482
|
+
apiKey?: string; // For API_KEY
|
|
483
|
+
alias: string;
|
|
484
|
+
};
|
|
485
|
+
originalChallengeParams?: {
|
|
486
|
+
challenge: string;
|
|
487
|
+
timestamp: number;
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Individual user profile (KYC)
|
|
492
|
+
interface UserProfile {
|
|
493
|
+
firstName?: string;
|
|
494
|
+
lastName?: string;
|
|
495
|
+
birthdate?: string; // ISO 8601 (YYYY-MM-DD)
|
|
496
|
+
email?: string;
|
|
497
|
+
phone?: string;
|
|
498
|
+
gender?: string;
|
|
499
|
+
addressLine1?: string;
|
|
500
|
+
addressLine2?: string;
|
|
501
|
+
city?: string;
|
|
502
|
+
state?: string;
|
|
503
|
+
postalCode?: string;
|
|
504
|
+
neighborhood?: string;
|
|
505
|
+
countryOfBirthCode?: string;
|
|
506
|
+
countryOfResidenceCode?: string;
|
|
507
|
+
personalIdType?: string;
|
|
508
|
+
personalIdNumber?: string;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Business profile (KYB)
|
|
512
|
+
interface BusinessProfile {
|
|
513
|
+
// Required fields
|
|
514
|
+
addressLine1: string;
|
|
515
|
+
city: string;
|
|
516
|
+
country: string;
|
|
517
|
+
incorporationDate: string;
|
|
518
|
+
legalName: string;
|
|
519
|
+
name: string;
|
|
520
|
+
postalCode: string;
|
|
521
|
+
state: string;
|
|
522
|
+
taxId: string;
|
|
523
|
+
type: string;
|
|
524
|
+
|
|
525
|
+
// Optional fields
|
|
526
|
+
addressLine2?: string;
|
|
527
|
+
countryCode?: string;
|
|
528
|
+
email?: string;
|
|
529
|
+
logo?: string;
|
|
530
|
+
phone?: string;
|
|
531
|
+
|
|
532
|
+
// Beneficial owner information
|
|
533
|
+
ownerName?: string;
|
|
534
|
+
ownerIdType?: string;
|
|
535
|
+
ownerIdNumber?: string;
|
|
536
|
+
ownerAddressLine1?: string;
|
|
537
|
+
ownerCity?: string;
|
|
538
|
+
ownerState?: string;
|
|
539
|
+
ownerPostalCode?: string;
|
|
540
|
+
ownerCountryCode?: string;
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
**Response**:
|
|
545
|
+
|
|
546
|
+
```typescript
|
|
547
|
+
interface RegisterResult {
|
|
548
|
+
accessToken: string; // JWT access token for authenticated sessions
|
|
549
|
+
}
|
|
550
|
+
```
|
|
310
551
|
|
|
311
552
|
#### Get Alias
|
|
312
553
|
|
|
@@ -357,7 +598,10 @@ import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
|
357
598
|
|
|
358
599
|
// Initialize SDK with your API key
|
|
359
600
|
const bloque = new SDK({
|
|
360
|
-
|
|
601
|
+
auth: {
|
|
602
|
+
type: 'apiKey',
|
|
603
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
604
|
+
},
|
|
361
605
|
mode: 'production',
|
|
362
606
|
});
|
|
363
607
|
|
|
@@ -399,7 +643,10 @@ import { SDK } from '@bloque/sdk';
|
|
|
399
643
|
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
400
644
|
|
|
401
645
|
const bloque = new SDK({
|
|
402
|
-
|
|
646
|
+
auth: {
|
|
647
|
+
type: 'apiKey',
|
|
648
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
649
|
+
},
|
|
403
650
|
mode: 'sandbox',
|
|
404
651
|
});
|
|
405
652
|
|
|
@@ -428,7 +675,10 @@ import { SDK } from '@bloque/sdk';
|
|
|
428
675
|
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
429
676
|
|
|
430
677
|
const bloque = new SDK({
|
|
431
|
-
|
|
678
|
+
auth: {
|
|
679
|
+
type: 'apiKey',
|
|
680
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
681
|
+
},
|
|
432
682
|
mode: 'production',
|
|
433
683
|
});
|
|
434
684
|
|
|
@@ -476,7 +726,10 @@ import { SDK } from '@bloque/sdk';
|
|
|
476
726
|
import type { KycVerificationParams } from '@bloque/sdk/compliance';
|
|
477
727
|
|
|
478
728
|
const bloque = new SDK({
|
|
479
|
-
|
|
729
|
+
auth: {
|
|
730
|
+
type: 'apiKey',
|
|
731
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
732
|
+
},
|
|
480
733
|
mode: 'production',
|
|
481
734
|
});
|
|
482
735
|
|
|
@@ -506,7 +759,10 @@ import { SDK } from '@bloque/sdk';
|
|
|
506
759
|
import type { GetKycVerificationParams } from '@bloque/sdk/compliance';
|
|
507
760
|
|
|
508
761
|
const bloque = new SDK({
|
|
509
|
-
|
|
762
|
+
auth: {
|
|
763
|
+
type: 'apiKey',
|
|
764
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
765
|
+
},
|
|
510
766
|
mode: 'production',
|
|
511
767
|
});
|
|
512
768
|
|
|
@@ -541,7 +797,10 @@ import { SDK } from '@bloque/sdk';
|
|
|
541
797
|
import type { CreateCardParams } from '@bloque/sdk/accounts';
|
|
542
798
|
|
|
543
799
|
const bloque = new SDK({
|
|
544
|
-
|
|
800
|
+
auth: {
|
|
801
|
+
type: 'apiKey',
|
|
802
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
803
|
+
},
|
|
545
804
|
mode: 'production',
|
|
546
805
|
});
|
|
547
806
|
|
|
@@ -577,7 +836,10 @@ try {
|
|
|
577
836
|
import { SDK } from '@bloque/sdk';
|
|
578
837
|
|
|
579
838
|
const bloque = new SDK({
|
|
580
|
-
|
|
839
|
+
auth: {
|
|
840
|
+
type: 'apiKey',
|
|
841
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
842
|
+
},
|
|
581
843
|
mode: 'production',
|
|
582
844
|
});
|
|
583
845
|
|
|
@@ -610,6 +872,134 @@ try {
|
|
|
610
872
|
}
|
|
611
873
|
```
|
|
612
874
|
|
|
875
|
+
### Registering Individual User Identity (KYC)
|
|
876
|
+
|
|
877
|
+
```typescript
|
|
878
|
+
import { SDK } from '@bloque/sdk';
|
|
879
|
+
import type { IndividualRegisterParams } from '@bloque/sdk/identity';
|
|
880
|
+
|
|
881
|
+
const bloque = new SDK({
|
|
882
|
+
auth: {
|
|
883
|
+
type: 'apiKey',
|
|
884
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
885
|
+
},
|
|
886
|
+
mode: 'production',
|
|
887
|
+
});
|
|
888
|
+
|
|
889
|
+
// Register an individual with blockchain signature
|
|
890
|
+
const params: IndividualRegisterParams = {
|
|
891
|
+
assertionResult: {
|
|
892
|
+
alias: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
|
|
893
|
+
challengeType: 'SIGNING_CHALLENGE',
|
|
894
|
+
value: {
|
|
895
|
+
signature: '0x1234567890abcdef...',
|
|
896
|
+
alias: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'
|
|
897
|
+
},
|
|
898
|
+
originalChallengeParams: {
|
|
899
|
+
challenge: 'bloque-challenge-1234567890',
|
|
900
|
+
timestamp: 1640995200
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
type: 'individual',
|
|
904
|
+
profile: {
|
|
905
|
+
firstName: 'John',
|
|
906
|
+
lastName: 'Doe',
|
|
907
|
+
email: 'john.doe@example.com',
|
|
908
|
+
phone: '+1234567890',
|
|
909
|
+
birthdate: '1990-01-15',
|
|
910
|
+
city: 'New York',
|
|
911
|
+
state: 'NY',
|
|
912
|
+
postalCode: '10001',
|
|
913
|
+
addressLine1: '123 Main St',
|
|
914
|
+
countryOfBirthCode: 'USA',
|
|
915
|
+
countryOfResidenceCode: 'USA',
|
|
916
|
+
personalIdType: 'SSN',
|
|
917
|
+
personalIdNumber: '123-45-6789'
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
try {
|
|
922
|
+
const result = await bloque.identity.origins.register('ethereum-mainnet', params);
|
|
923
|
+
|
|
924
|
+
console.log('User registered successfully!');
|
|
925
|
+
console.log('Access token:', result.accessToken);
|
|
926
|
+
|
|
927
|
+
// Store the access token securely for the user's session
|
|
928
|
+
// Use it for subsequent authenticated API calls
|
|
929
|
+
} catch (error) {
|
|
930
|
+
console.error('Registration failed:', error);
|
|
931
|
+
}
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
### Registering Business Identity (KYB)
|
|
935
|
+
|
|
936
|
+
```typescript
|
|
937
|
+
import { SDK } from '@bloque/sdk';
|
|
938
|
+
import type { BusinessRegisterParams } from '@bloque/sdk/identity';
|
|
939
|
+
|
|
940
|
+
const bloque = new SDK({
|
|
941
|
+
auth: {
|
|
942
|
+
type: 'apiKey',
|
|
943
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
944
|
+
},
|
|
945
|
+
mode: 'production',
|
|
946
|
+
});
|
|
947
|
+
|
|
948
|
+
// Register a business with API key authentication
|
|
949
|
+
const params: BusinessRegisterParams = {
|
|
950
|
+
assertionResult: {
|
|
951
|
+
alias: 'business-123',
|
|
952
|
+
challengeType: 'API_KEY',
|
|
953
|
+
value: {
|
|
954
|
+
apiKey: 'sk_live_abc123def456',
|
|
955
|
+
alias: 'business-123'
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
type: 'business',
|
|
959
|
+
profile: {
|
|
960
|
+
// Required business information
|
|
961
|
+
legalName: 'Acme Corporation',
|
|
962
|
+
name: 'Acme Corp',
|
|
963
|
+
taxId: '12-3456789',
|
|
964
|
+
type: 'LLC',
|
|
965
|
+
incorporationDate: '2020-01-15',
|
|
966
|
+
addressLine1: '123 Business St',
|
|
967
|
+
city: 'New York',
|
|
968
|
+
state: 'NY',
|
|
969
|
+
postalCode: '10001',
|
|
970
|
+
country: 'United States',
|
|
971
|
+
|
|
972
|
+
// Optional business information
|
|
973
|
+
addressLine2: 'Suite 100',
|
|
974
|
+
countryCode: 'US',
|
|
975
|
+
email: 'contact@acme.com',
|
|
976
|
+
phone: '+1-555-0123',
|
|
977
|
+
logo: 'https://acme.com/logo.png',
|
|
978
|
+
|
|
979
|
+
// Beneficial owner information (for compliance)
|
|
980
|
+
ownerName: 'Jane Smith',
|
|
981
|
+
ownerIdType: 'SSN',
|
|
982
|
+
ownerIdNumber: '123-45-6789',
|
|
983
|
+
ownerAddressLine1: '456 Owner Ave',
|
|
984
|
+
ownerCity: 'New York',
|
|
985
|
+
ownerState: 'NY',
|
|
986
|
+
ownerPostalCode: '10002',
|
|
987
|
+
ownerCountryCode: 'US'
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
|
|
991
|
+
try {
|
|
992
|
+
const result = await bloque.identity.origins.register('bloque-api', params);
|
|
993
|
+
|
|
994
|
+
console.log('Business registered successfully!');
|
|
995
|
+
console.log('Access token:', result.accessToken);
|
|
996
|
+
|
|
997
|
+
// Use the access token for authenticated API calls
|
|
998
|
+
} catch (error) {
|
|
999
|
+
console.error('Business registration failed:', error);
|
|
1000
|
+
}
|
|
1001
|
+
```
|
|
1002
|
+
|
|
613
1003
|
### Using in an API Endpoint
|
|
614
1004
|
|
|
615
1005
|
```typescript
|
|
@@ -617,7 +1007,10 @@ import { SDK } from '@bloque/sdk';
|
|
|
617
1007
|
import type { CreateOrgParams } from '@bloque/sdk/orgs';
|
|
618
1008
|
|
|
619
1009
|
const bloque = new SDK({
|
|
620
|
-
|
|
1010
|
+
auth: {
|
|
1011
|
+
type: 'apiKey',
|
|
1012
|
+
apiKey: process.env.BLOQUE_API_KEY!,
|
|
1013
|
+
},
|
|
621
1014
|
mode: process.env.NODE_ENV === 'production' ? 'production' : 'sandbox',
|
|
622
1015
|
});
|
|
623
1016
|
|
|
@@ -765,6 +1158,13 @@ import type {
|
|
|
765
1158
|
// Identity types
|
|
766
1159
|
import type {
|
|
767
1160
|
Alias,
|
|
1161
|
+
RegisterParams,
|
|
1162
|
+
IndividualRegisterParams,
|
|
1163
|
+
BusinessRegisterParams,
|
|
1164
|
+
RegisterResult,
|
|
1165
|
+
UserProfile,
|
|
1166
|
+
BusinessProfile,
|
|
1167
|
+
AssertionResult,
|
|
768
1168
|
} from '@bloque/sdk/identity';
|
|
769
1169
|
```
|
|
770
1170
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloque/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "Official Bloque SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"node": ">=22"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@bloque/sdk-accounts": "0.0.
|
|
67
|
-
"@bloque/sdk-compliance": "0.0.
|
|
68
|
-
"@bloque/sdk-core": "0.0.
|
|
69
|
-
"@bloque/sdk-identity": "0.0.
|
|
70
|
-
"@bloque/sdk-orgs": "0.0.
|
|
66
|
+
"@bloque/sdk-accounts": "0.0.21",
|
|
67
|
+
"@bloque/sdk-compliance": "0.0.21",
|
|
68
|
+
"@bloque/sdk-core": "0.0.21",
|
|
69
|
+
"@bloque/sdk-identity": "0.0.21",
|
|
70
|
+
"@bloque/sdk-orgs": "0.0.21"
|
|
71
71
|
}
|
|
72
72
|
}
|