@notabene/javascript-sdk 2.9.1-next.1 → 2.9.3-next.3
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 +208 -25
- package/dist/cjs/notabene.d.ts +43 -22
- package/dist/cjs/package.json +2 -1
- package/dist/esm/notabene.d.ts +43 -22
- package/dist/esm/notabene.js +7 -1
- package/dist/esm/package.json +2 -1
- package/dist/notabene.d.ts +43 -22
- package/dist/notabene.js +7 -1
- package/package.json +2 -1
- package/src/types.ts +2 -1
- package/src/utils/connections.ts +46 -21
- package/src/utils/encryption.ts +13 -6
package/README.md
CHANGED
|
@@ -43,6 +43,11 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
43
43
|
- [Parameters](#parameters-2)
|
|
44
44
|
- [Deposit Assist](#deposit-assist)
|
|
45
45
|
- [Parameters](#parameters-3)
|
|
46
|
+
- [Counterparty Assist](#counterparty-assist)
|
|
47
|
+
- [Use Cases](#use-cases)
|
|
48
|
+
- [Counterparty Assist Configuration](#counterparty-assist-configuration)
|
|
49
|
+
- [Component Response](#component-response)
|
|
50
|
+
- [Retrieving Completed Data](#retrieving-completed-data)
|
|
46
51
|
- [Error handling](#error-handling)
|
|
47
52
|
- [Error reference](#error-reference)
|
|
48
53
|
- [Transaction parameters](#transaction-parameters)
|
|
@@ -63,6 +68,7 @@ This library is the JavaScript SDK for loading the Notabene UX components in the
|
|
|
63
68
|
- [Counterparty Field Properties](#counterparty-field-properties)
|
|
64
69
|
- [Full Example](#full-example)
|
|
65
70
|
- [Field reference](#field-reference)
|
|
71
|
+
- [Configure Counterparty Assist](#counterparty-assist-configuration)
|
|
66
72
|
- [Locales](#locales)
|
|
67
73
|
- [Theming](#theming)
|
|
68
74
|
- [License](#license)
|
|
@@ -297,6 +303,10 @@ const withdrawal = notabene.createWithdrawalAssist({
|
|
|
297
303
|
currency: 'USD', // ISO currency code
|
|
298
304
|
price: 1700.12, // Asset price
|
|
299
305
|
},
|
|
306
|
+
customer: {
|
|
307
|
+
name: 'John Smith',
|
|
308
|
+
email: "john.smith@domain.com",
|
|
309
|
+
},
|
|
300
310
|
});
|
|
301
311
|
```
|
|
302
312
|
|
|
@@ -306,6 +316,7 @@ const withdrawal = notabene.createWithdrawalAssist({
|
|
|
306
316
|
- `destination`: The destination or blockchain address for the withdrawal. See [Destination](#destination)
|
|
307
317
|
- `amountDecimal`: The amount to transfer in decimal format. See [Transaction Amount](#transaction-amount)
|
|
308
318
|
- `assetPrice`: Optional price information in a fiat currency. See [Asset Price](#asset-price)
|
|
319
|
+
- `customer`: Optional Customer object containing their name and email
|
|
309
320
|
|
|
310
321
|
If any of the required parameters are missing the component will just show the Notabene badge.
|
|
311
322
|
|
|
@@ -323,6 +334,10 @@ const withdrawal = notabene.createWithdrawalAssist(
|
|
|
323
334
|
currency: 'USD', // ISO currency code
|
|
324
335
|
price: 1700.12, // Asset price
|
|
325
336
|
},
|
|
337
|
+
customer: {
|
|
338
|
+
name: 'John Smith',
|
|
339
|
+
email: "john.smith@domain.com",
|
|
340
|
+
},
|
|
326
341
|
},
|
|
327
342
|
{
|
|
328
343
|
proofs: {
|
|
@@ -342,6 +357,10 @@ See [Transaction Options](#transaction-options)
|
|
|
342
357
|
|
|
343
358
|
The Connect Wallet component helps you collect and verify the address of your users self-hosted wallet in one go.
|
|
344
359
|
|
|
360
|
+
### Parameters
|
|
361
|
+
|
|
362
|
+
- `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
|
|
363
|
+
|
|
345
364
|
```js
|
|
346
365
|
const connect = notabene.createConnectWallet({
|
|
347
366
|
asset: 'ETH',
|
|
@@ -350,31 +369,6 @@ const connect = notabene.createConnectWallet({
|
|
|
350
369
|
const { proof, txCreate } = await connect.openModal();
|
|
351
370
|
```
|
|
352
371
|
|
|
353
|
-
### Parameters
|
|
354
|
-
|
|
355
|
-
- `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
|
|
356
|
-
|
|
357
|
-
### Configuration Options
|
|
358
|
-
|
|
359
|
-
Include configuration Options as a second optional parameter:
|
|
360
|
-
|
|
361
|
-
```js
|
|
362
|
-
const connect = notabene.createConnectWallet(
|
|
363
|
-
{
|
|
364
|
-
asset: 'ETH',
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
proofs: {
|
|
368
|
-
microTransfer: {
|
|
369
|
-
destination: '0x...',
|
|
370
|
-
amountSubunits: '12344',
|
|
371
|
-
timeout: 86440,
|
|
372
|
-
},
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
);
|
|
376
|
-
```
|
|
377
|
-
|
|
378
372
|
## Deposit Request
|
|
379
373
|
|
|
380
374
|
The Deposit Request lets your customers request deposits that are fully Travel Rule compliant.
|
|
@@ -430,6 +424,188 @@ If any of the required parameters are missing the component will just show the N
|
|
|
430
424
|
|
|
431
425
|
---
|
|
432
426
|
|
|
427
|
+
## Counterparty Handoff
|
|
428
|
+
|
|
429
|
+
**Counterparty Assist** is a feature built into the existing **Withdrawal** and **Deposit Assist** components. When enabled, it allows users to hand off data collection to a counterparty — or to another device — by sharing a secure link. This helps ensure more accurate and complete information, especially when the counterparty is best suited to provide the required data.
|
|
430
|
+
|
|
431
|
+
This feature does not function as a standalone component. Instead, it augments the Withdrawal and Deposit flows when configured.
|
|
432
|
+
|
|
433
|
+
### Use Cases
|
|
434
|
+
|
|
435
|
+
#### Third Parties (`natural`, `legal`)
|
|
436
|
+
|
|
437
|
+
During the counterparty data collection step, users can generate and share a link to allow third-party counterparties (individuals or organizations) to enter their own data. This ensures data accuracy and supports robust address verification by allowing the rightful owner to provide the necessary information.
|
|
438
|
+
|
|
439
|
+
#### First Parties (`self`)
|
|
440
|
+
|
|
441
|
+
During the address verification step, users can share a link to complete self-hosted wallet proof submissions on another device. This is especially useful if the original device used to initiate the process doesn't support signing or wallet access.
|
|
442
|
+
|
|
443
|
+
### Counterparty Assist Configuration
|
|
444
|
+
|
|
445
|
+
You can enable **Counterparty Assist** by specifying the counterparty types you want the feature to apply to using the counterpartyAssist configuration field.
|
|
446
|
+
|
|
447
|
+
- `false`: Disable the feature explicitly
|
|
448
|
+
- `undefined` (not configured): Feature is disabled by default
|
|
449
|
+
- `{ counterpartyTypes: [PersonType.SELF, PersonType.NATURAL, PersonType.LEGAL] }`: Enable for specific counterparty types
|
|
450
|
+
|
|
451
|
+
**Example Config**
|
|
452
|
+
|
|
453
|
+
```js
|
|
454
|
+
import Notabene, {
|
|
455
|
+
PersonType,
|
|
456
|
+
} from '@notabene/javascript-sdk';
|
|
457
|
+
|
|
458
|
+
// Counterparty assist is enabled for specific counterparty types
|
|
459
|
+
const options: TransactionOptions = {
|
|
460
|
+
...
|
|
461
|
+
counterpartyAssist: {
|
|
462
|
+
counterpartyTypes: [
|
|
463
|
+
PersonType.LEGAL, // JS: 'legal'
|
|
464
|
+
PersonType.NATURAL, // JS: 'natural'
|
|
465
|
+
PersonType.SELF, // JS: 'self'
|
|
466
|
+
],
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### Component Response
|
|
472
|
+
|
|
473
|
+
The component emits a response once a participant has completed their portion of the process. Depending on the party type — **Third Party** (`natural`, `legal`) or **First Party** (`self`) — the behavior and expectations differ slightly.
|
|
474
|
+
|
|
475
|
+
#### Third Parties (`natural`, `legal`)
|
|
476
|
+
|
|
477
|
+
When a third party completes their step after following the shared link, the host application will receive a **`COMPLETE`** message from the component. However, because not all required data may be available at this point, the `response` object will include the information gathered so far, along with a `refreshSource` field. This allows the host to fetch the latest encrypted data once it's available.
|
|
478
|
+
|
|
479
|
+
##### Refresh Source Fields
|
|
480
|
+
|
|
481
|
+
| Field | Type | Description |
|
|
482
|
+
|-------|--------|--------------------------------------------------------------------------------------------------|
|
|
483
|
+
| `url` | URI | The endpoint where the host can retrieve the encrypted data. |
|
|
484
|
+
| `key` | string | The encryption key used to decrypt the PII (Personally Identifiable Information). Not stored by Notabene. |
|
|
485
|
+
|
|
486
|
+
**Example Response**
|
|
487
|
+
|
|
488
|
+
```js
|
|
489
|
+
{
|
|
490
|
+
type: CMType.COMPLETE, // 'complete'
|
|
491
|
+
response: { // transaciton data + refresh source
|
|
492
|
+
destination: "0xFf9A04788972C3803959454ECAE1ed327826a216",
|
|
493
|
+
asset: "eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
494
|
+
customer: {
|
|
495
|
+
type: "natural",
|
|
496
|
+
name: "sdfsd",
|
|
497
|
+
email: "sdjlf@sdlfj.com"
|
|
498
|
+
},
|
|
499
|
+
amountDecimal: 100,
|
|
500
|
+
counterparty: {
|
|
501
|
+
type: "natural"
|
|
502
|
+
},
|
|
503
|
+
account: {
|
|
504
|
+
caip10: "eip155:1:0xFf9A04788972C3803959454ECAE1ed327826a216",
|
|
505
|
+
blockchainAddress: "0xFf9A04788972C3803959454ECAE1ed327826a216",
|
|
506
|
+
chain: "eip155:1",
|
|
507
|
+
did: "did:pkh:eip155:1:0xFf9A04788972C3803959454ECAE1ed327826a216",
|
|
508
|
+
valid: true
|
|
509
|
+
},
|
|
510
|
+
refreshSource: {
|
|
511
|
+
url: "https://safe-connections.notabene.id/17f76e4c-9a2a-4c34-afcb-b4868e609a96", // endpoint to retreive data
|
|
512
|
+
key: "1Lcp5SFhaMHH7CAEILrS8IWA6BXS4tFZunPx08WU5Ok=" // key that can be used to decrypt data
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
#### First Parties (`self`)
|
|
519
|
+
|
|
520
|
+
When the user is the originator (i.e., acting on their own behalf), they complete the verification process via a shared link and are then prompted to return to the original page to continue.
|
|
521
|
+
|
|
522
|
+
Upon completion, the component emits a **`COMPLETE`** response. In this case, the component handles all necessary data updates internally, so **no additional action is required from the host** to retrieve updated data. The host can directly proceed to submit the transfer to the Notabene API.
|
|
523
|
+
|
|
524
|
+
### Retrieving Completed Data
|
|
525
|
+
**(Third Parties Only: `natural`, `legal`)**
|
|
526
|
+
|
|
527
|
+
When data submission is handed off to third parties, we cannot predict how long it will take them to complete the process. For this reason, we provide the host with all the information needed to retrieve the data and allow them to design how the user experiences this flow.
|
|
528
|
+
|
|
529
|
+
To simplify retrieval and decryption, we provide an asynchronous [`getRefreshResult`](./docs/notabene/functions/getRefreshResult.md) function. It accepts a `refreshSource` and returns information about the associated transaction.
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
**Example**
|
|
533
|
+
|
|
534
|
+
```js
|
|
535
|
+
import { getRefreshResult } from "@notabene/javascript-sdk";
|
|
536
|
+
|
|
537
|
+
const transaction = await getRefreshResult({
|
|
538
|
+
url: "https://safe-connections.notabene.id/17f76e4c-9a2a-4c34-afcb-b4868e609a96",
|
|
539
|
+
key: "1Lcp5SFhaMHH7CAEILrS8IWA6BXS4tFZunPx08WU5Ok="
|
|
540
|
+
})
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
#### Response from `getRefreshResult`
|
|
544
|
+
|
|
545
|
+
| **Property** | **Type** | **Optional?** | **Description** |
|
|
546
|
+
|--------------|---------------------------------------|---------------|---------------------------------------------------------------------------------|
|
|
547
|
+
| `id` | `UUID` | No | Unique identifier for the transaction. |
|
|
548
|
+
| `metadata` | `ConnectionMetadata` | No | Metadata associated with the transaction. |
|
|
549
|
+
| `status` | `'active'` \| `'completed'` \| `'closed'` | No | Current status of the transaction’s data collection. |
|
|
550
|
+
| `tx` | `T` | Yes | Ongoing transaction data (available when status is `active`). |
|
|
551
|
+
| `result` | `TransactionResponse<T>` | Yes | Finalized transaction data (available when status is `completed`). |
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
**Example Active Transaction Data**
|
|
555
|
+
|
|
556
|
+
```js
|
|
557
|
+
{
|
|
558
|
+
"id": "17f76e4c-9a2a-4c34-afcb-b4868e609a96",
|
|
559
|
+
"metadata": {
|
|
560
|
+
"participants": [
|
|
561
|
+
"did:ethr:0x54b75d2a0925508682e65194cccb6f1e8eaafb2c"
|
|
562
|
+
],
|
|
563
|
+
"nodeUrl": "https://api-qa.eu.notabene.id",
|
|
564
|
+
"transactionType": "withdraw"
|
|
565
|
+
},
|
|
566
|
+
"status": "active",
|
|
567
|
+
"tx": {
|
|
568
|
+
//...
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
**Example Completed Transaction Data**
|
|
574
|
+
|
|
575
|
+
```js
|
|
576
|
+
{
|
|
577
|
+
"id": "17f76e4c-9a2a-4c34-afcb-b4868e609a96",
|
|
578
|
+
"metadata": {
|
|
579
|
+
"participants": [
|
|
580
|
+
"did:ethr:0x54b75d2a0925508682e65194cccb6f1e8eaafb2c" // DID of transaction participants
|
|
581
|
+
],
|
|
582
|
+
"nodeUrl": "https://api-qa.eu.notabene.dev",
|
|
583
|
+
"transactionType": "withdraw"
|
|
584
|
+
},
|
|
585
|
+
"status": "completed",
|
|
586
|
+
"result": { // the response returned from the embedded component when all information is successfully collected
|
|
587
|
+
"proof": {
|
|
588
|
+
//...
|
|
589
|
+
},
|
|
590
|
+
"txCreate": {
|
|
591
|
+
//...
|
|
592
|
+
},
|
|
593
|
+
"errors": [],
|
|
594
|
+
"status": "pending",
|
|
595
|
+
"valid": true,
|
|
596
|
+
"value": {
|
|
597
|
+
//...
|
|
598
|
+
},
|
|
599
|
+
"ivms101": {
|
|
600
|
+
//...
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
Once the host has retrieved the completed data, they can finalize the transaction by submitting it to the Notabene API.
|
|
608
|
+
|
|
433
609
|
## Error handling
|
|
434
610
|
|
|
435
611
|
If any error occurs, the `error` event is passed containing a message.
|
|
@@ -584,6 +760,13 @@ const options: TransactionOptions = {
|
|
|
584
760
|
VASPSearchControl.PENDING, // JS: 'pending'
|
|
585
761
|
], // Control searches for VASPs - Defaults to undefined
|
|
586
762
|
},
|
|
763
|
+
counterpartyAssist: { // Allows users to share a link to collect counterparty data
|
|
764
|
+
counterpartyTypes: [
|
|
765
|
+
PersonType.LEGAL, // JS: 'legal'
|
|
766
|
+
PersonType.NATURAL, // JS: 'natural'
|
|
767
|
+
PersonType.SELF, // JS: 'self'
|
|
768
|
+
],
|
|
769
|
+
}
|
|
587
770
|
};
|
|
588
771
|
const withdrawal = notabene.createWithdrawalAssist(tx, options);
|
|
589
772
|
```
|
package/dist/cjs/notabene.d.ts
CHANGED
|
@@ -303,10 +303,10 @@ export declare interface ComponentResponse {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
export declare interface ConnectionData<T extends ComponentRequest> {
|
|
306
|
-
tx: T;
|
|
307
|
-
authToken?: string;
|
|
308
|
-
txOptions?: TransactionOptions;
|
|
309
|
-
result?: TransactionResponse<T>;
|
|
306
|
+
readonly tx: T;
|
|
307
|
+
readonly authToken?: string;
|
|
308
|
+
readonly txOptions?: TransactionOptions;
|
|
309
|
+
readonly result?: TransactionResponse<T>;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
/**
|
|
@@ -317,21 +317,26 @@ export declare class ConnectionManager {
|
|
|
317
317
|
constructor(endpoint: string);
|
|
318
318
|
/**
|
|
319
319
|
* Creates a new encrypted connection
|
|
320
|
+
* @template T Type of component request
|
|
320
321
|
* @param data The component request data to encrypt and store
|
|
321
|
-
* @param participants
|
|
322
|
+
* @param metadata Connection metadata including participants and transaction type
|
|
322
323
|
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
323
324
|
*/
|
|
324
325
|
create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
|
|
325
326
|
/**
|
|
326
327
|
* Updates an existing connection with new encrypted data
|
|
328
|
+
* @template T Type of component request
|
|
327
329
|
* @param id Connection ID
|
|
328
330
|
* @param data New data to encrypt and store
|
|
329
331
|
* @param version Current version number
|
|
332
|
+
* @param status New connection status
|
|
333
|
+
* @param key Current encryption key
|
|
330
334
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
331
335
|
*/
|
|
332
336
|
update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number, status: ConnectionStatus, key: string): Promise<ConnectionResponse<T>>;
|
|
333
337
|
/**
|
|
334
338
|
* Retrieves and decrypts connection data
|
|
339
|
+
* @template T Type of component request
|
|
335
340
|
* @param id Connection ID
|
|
336
341
|
* @param key Encryption key from previous create/update operation
|
|
337
342
|
* @returns Promise resolving to connection details including decrypted data
|
|
@@ -340,14 +345,15 @@ export declare class ConnectionManager {
|
|
|
340
345
|
/**
|
|
341
346
|
* Closes a connection
|
|
342
347
|
* @param id Connection ID
|
|
348
|
+
* @returns Promise resolving when the connection is closed
|
|
343
349
|
*/
|
|
344
350
|
close(id: UUID): Promise<void>;
|
|
345
351
|
}
|
|
346
352
|
|
|
347
353
|
export declare interface ConnectionMetadata {
|
|
348
|
-
nodeUrl?: string;
|
|
349
|
-
participants: string[];
|
|
350
|
-
transactionType: TransactionType;
|
|
354
|
+
readonly nodeUrl?: string;
|
|
355
|
+
readonly participants: readonly string[];
|
|
356
|
+
readonly transactionType: TransactionType;
|
|
351
357
|
}
|
|
352
358
|
|
|
353
359
|
/**
|
|
@@ -365,21 +371,29 @@ export declare interface ConnectionRequest extends ComponentRequest {
|
|
|
365
371
|
}
|
|
366
372
|
|
|
367
373
|
export declare interface ConnectionResponse<T extends ComponentRequest> {
|
|
368
|
-
id: UUID;
|
|
369
|
-
version: number;
|
|
370
|
-
status: ConnectionStatus;
|
|
371
|
-
metadata: ConnectionMetadata;
|
|
372
|
-
data: ConnectionData<T>;
|
|
373
|
-
key: string;
|
|
374
|
+
readonly id: UUID;
|
|
375
|
+
readonly version: number;
|
|
376
|
+
readonly status: ConnectionStatus;
|
|
377
|
+
readonly metadata: ConnectionMetadata;
|
|
378
|
+
readonly data: ConnectionData<T>;
|
|
379
|
+
readonly key: string;
|
|
374
380
|
}
|
|
375
381
|
|
|
376
|
-
export declare
|
|
377
|
-
id: UUID;
|
|
378
|
-
metadata: ConnectionMetadata;
|
|
379
|
-
status:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
export declare type ConnectionResult<T extends ComponentRequest> = {
|
|
383
|
+
readonly id: UUID;
|
|
384
|
+
readonly metadata: ConnectionMetadata;
|
|
385
|
+
readonly status: 'closed';
|
|
386
|
+
} | {
|
|
387
|
+
readonly id: UUID;
|
|
388
|
+
readonly metadata: ConnectionMetadata;
|
|
389
|
+
readonly status: 'completed';
|
|
390
|
+
readonly result: TransactionResponse<T>;
|
|
391
|
+
} | {
|
|
392
|
+
readonly id: UUID;
|
|
393
|
+
readonly metadata: ConnectionMetadata;
|
|
394
|
+
readonly status: 'active';
|
|
395
|
+
readonly tx: T;
|
|
396
|
+
};
|
|
383
397
|
|
|
384
398
|
export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
|
|
385
399
|
|
|
@@ -666,7 +680,6 @@ export declare enum ErrorIdentifierCode {
|
|
|
666
680
|
*/
|
|
667
681
|
export declare type FieldOptions = boolean | string[] | {
|
|
668
682
|
optional: boolean;
|
|
669
|
-
transmit: boolean;
|
|
670
683
|
};
|
|
671
684
|
|
|
672
685
|
/**
|
|
@@ -678,6 +691,12 @@ export declare type FieldTypes = {
|
|
|
678
691
|
legalPerson?: LegalPersonFields;
|
|
679
692
|
};
|
|
680
693
|
|
|
694
|
+
/**
|
|
695
|
+
* Retrieves and processes connection refresh data
|
|
696
|
+
* @template T Type of component request
|
|
697
|
+
* @param refreshSource Source information for the refresh operation
|
|
698
|
+
* @returns Promise resolving to connection result with decrypted data
|
|
699
|
+
*/
|
|
681
700
|
export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: RefreshSource): Promise<ConnectionResult<T>>;
|
|
682
701
|
|
|
683
702
|
/**
|
|
@@ -1547,6 +1566,7 @@ export declare interface TransactionOptions {
|
|
|
1547
1566
|
fallbacks?: ProofTypes[];
|
|
1548
1567
|
deminimis?: ThresholdOptions;
|
|
1549
1568
|
};
|
|
1569
|
+
jurisdiction?: string;
|
|
1550
1570
|
allowedAgentTypes?: AgentType[];
|
|
1551
1571
|
allowedCounterpartyTypes?: PersonType[];
|
|
1552
1572
|
fields?: FieldTypes;
|
|
@@ -1727,6 +1747,7 @@ export declare interface VASP extends Agent {
|
|
|
1727
1747
|
logo?: URI;
|
|
1728
1748
|
website?: URI;
|
|
1729
1749
|
countryOfRegistration?: ISOCountryCode;
|
|
1750
|
+
jurisdictions?: string;
|
|
1730
1751
|
}
|
|
1731
1752
|
|
|
1732
1753
|
/**
|
package/dist/cjs/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.9.
|
|
13
|
+
"version": "2.9.3-next.3",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"build:dev": "yarn build && yarn dev",
|
|
54
54
|
"build:clean": "rimraf dist ts-out coverage temp",
|
|
55
55
|
"build": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs && yarn docs",
|
|
56
|
+
"build:no-docs": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs",
|
|
56
57
|
"lint": "eslint . --max-warnings 0",
|
|
57
58
|
"lint:fix": "yarn lint --fix --cache --no-warn-ignored",
|
|
58
59
|
"format": "prettier --write --cache .",
|
package/dist/esm/notabene.d.ts
CHANGED
|
@@ -303,10 +303,10 @@ export declare interface ComponentResponse {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
export declare interface ConnectionData<T extends ComponentRequest> {
|
|
306
|
-
tx: T;
|
|
307
|
-
authToken?: string;
|
|
308
|
-
txOptions?: TransactionOptions;
|
|
309
|
-
result?: TransactionResponse<T>;
|
|
306
|
+
readonly tx: T;
|
|
307
|
+
readonly authToken?: string;
|
|
308
|
+
readonly txOptions?: TransactionOptions;
|
|
309
|
+
readonly result?: TransactionResponse<T>;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
/**
|
|
@@ -317,21 +317,26 @@ export declare class ConnectionManager {
|
|
|
317
317
|
constructor(endpoint: string);
|
|
318
318
|
/**
|
|
319
319
|
* Creates a new encrypted connection
|
|
320
|
+
* @template T Type of component request
|
|
320
321
|
* @param data The component request data to encrypt and store
|
|
321
|
-
* @param participants
|
|
322
|
+
* @param metadata Connection metadata including participants and transaction type
|
|
322
323
|
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
323
324
|
*/
|
|
324
325
|
create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
|
|
325
326
|
/**
|
|
326
327
|
* Updates an existing connection with new encrypted data
|
|
328
|
+
* @template T Type of component request
|
|
327
329
|
* @param id Connection ID
|
|
328
330
|
* @param data New data to encrypt and store
|
|
329
331
|
* @param version Current version number
|
|
332
|
+
* @param status New connection status
|
|
333
|
+
* @param key Current encryption key
|
|
330
334
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
331
335
|
*/
|
|
332
336
|
update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number, status: ConnectionStatus, key: string): Promise<ConnectionResponse<T>>;
|
|
333
337
|
/**
|
|
334
338
|
* Retrieves and decrypts connection data
|
|
339
|
+
* @template T Type of component request
|
|
335
340
|
* @param id Connection ID
|
|
336
341
|
* @param key Encryption key from previous create/update operation
|
|
337
342
|
* @returns Promise resolving to connection details including decrypted data
|
|
@@ -340,14 +345,15 @@ export declare class ConnectionManager {
|
|
|
340
345
|
/**
|
|
341
346
|
* Closes a connection
|
|
342
347
|
* @param id Connection ID
|
|
348
|
+
* @returns Promise resolving when the connection is closed
|
|
343
349
|
*/
|
|
344
350
|
close(id: UUID): Promise<void>;
|
|
345
351
|
}
|
|
346
352
|
|
|
347
353
|
export declare interface ConnectionMetadata {
|
|
348
|
-
nodeUrl?: string;
|
|
349
|
-
participants: string[];
|
|
350
|
-
transactionType: TransactionType;
|
|
354
|
+
readonly nodeUrl?: string;
|
|
355
|
+
readonly participants: readonly string[];
|
|
356
|
+
readonly transactionType: TransactionType;
|
|
351
357
|
}
|
|
352
358
|
|
|
353
359
|
/**
|
|
@@ -365,21 +371,29 @@ export declare interface ConnectionRequest extends ComponentRequest {
|
|
|
365
371
|
}
|
|
366
372
|
|
|
367
373
|
export declare interface ConnectionResponse<T extends ComponentRequest> {
|
|
368
|
-
id: UUID;
|
|
369
|
-
version: number;
|
|
370
|
-
status: ConnectionStatus;
|
|
371
|
-
metadata: ConnectionMetadata;
|
|
372
|
-
data: ConnectionData<T>;
|
|
373
|
-
key: string;
|
|
374
|
+
readonly id: UUID;
|
|
375
|
+
readonly version: number;
|
|
376
|
+
readonly status: ConnectionStatus;
|
|
377
|
+
readonly metadata: ConnectionMetadata;
|
|
378
|
+
readonly data: ConnectionData<T>;
|
|
379
|
+
readonly key: string;
|
|
374
380
|
}
|
|
375
381
|
|
|
376
|
-
export declare
|
|
377
|
-
id: UUID;
|
|
378
|
-
metadata: ConnectionMetadata;
|
|
379
|
-
status:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
export declare type ConnectionResult<T extends ComponentRequest> = {
|
|
383
|
+
readonly id: UUID;
|
|
384
|
+
readonly metadata: ConnectionMetadata;
|
|
385
|
+
readonly status: 'closed';
|
|
386
|
+
} | {
|
|
387
|
+
readonly id: UUID;
|
|
388
|
+
readonly metadata: ConnectionMetadata;
|
|
389
|
+
readonly status: 'completed';
|
|
390
|
+
readonly result: TransactionResponse<T>;
|
|
391
|
+
} | {
|
|
392
|
+
readonly id: UUID;
|
|
393
|
+
readonly metadata: ConnectionMetadata;
|
|
394
|
+
readonly status: 'active';
|
|
395
|
+
readonly tx: T;
|
|
396
|
+
};
|
|
383
397
|
|
|
384
398
|
export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
|
|
385
399
|
|
|
@@ -666,7 +680,6 @@ export declare enum ErrorIdentifierCode {
|
|
|
666
680
|
*/
|
|
667
681
|
export declare type FieldOptions = boolean | string[] | {
|
|
668
682
|
optional: boolean;
|
|
669
|
-
transmit: boolean;
|
|
670
683
|
};
|
|
671
684
|
|
|
672
685
|
/**
|
|
@@ -678,6 +691,12 @@ export declare type FieldTypes = {
|
|
|
678
691
|
legalPerson?: LegalPersonFields;
|
|
679
692
|
};
|
|
680
693
|
|
|
694
|
+
/**
|
|
695
|
+
* Retrieves and processes connection refresh data
|
|
696
|
+
* @template T Type of component request
|
|
697
|
+
* @param refreshSource Source information for the refresh operation
|
|
698
|
+
* @returns Promise resolving to connection result with decrypted data
|
|
699
|
+
*/
|
|
681
700
|
export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: RefreshSource): Promise<ConnectionResult<T>>;
|
|
682
701
|
|
|
683
702
|
/**
|
|
@@ -1547,6 +1566,7 @@ export declare interface TransactionOptions {
|
|
|
1547
1566
|
fallbacks?: ProofTypes[];
|
|
1548
1567
|
deminimis?: ThresholdOptions;
|
|
1549
1568
|
};
|
|
1569
|
+
jurisdiction?: string;
|
|
1550
1570
|
allowedAgentTypes?: AgentType[];
|
|
1551
1571
|
allowedCounterpartyTypes?: PersonType[];
|
|
1552
1572
|
fields?: FieldTypes;
|
|
@@ -1727,6 +1747,7 @@ export declare interface VASP extends Agent {
|
|
|
1727
1747
|
logo?: URI;
|
|
1728
1748
|
website?: URI;
|
|
1729
1749
|
countryOfRegistration?: ISOCountryCode;
|
|
1750
|
+
jurisdictions?: string;
|
|
1730
1751
|
}
|
|
1731
1752
|
|
|
1732
1753
|
/**
|
package/dist/esm/notabene.js
CHANGED
|
@@ -338,8 +338,9 @@ class S {
|
|
|
338
338
|
}
|
|
339
339
|
/**
|
|
340
340
|
* Creates a new encrypted connection
|
|
341
|
+
* @template T Type of component request
|
|
341
342
|
* @param data The component request data to encrypt and store
|
|
342
|
-
* @param participants
|
|
343
|
+
* @param metadata Connection metadata including participants and transaction type
|
|
343
344
|
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
344
345
|
*/
|
|
345
346
|
async create(e, n) {
|
|
@@ -367,9 +368,12 @@ class S {
|
|
|
367
368
|
}
|
|
368
369
|
/**
|
|
369
370
|
* Updates an existing connection with new encrypted data
|
|
371
|
+
* @template T Type of component request
|
|
370
372
|
* @param id Connection ID
|
|
371
373
|
* @param data New data to encrypt and store
|
|
372
374
|
* @param version Current version number
|
|
375
|
+
* @param status New connection status
|
|
376
|
+
* @param key Current encryption key
|
|
373
377
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
374
378
|
*/
|
|
375
379
|
async update(e, n, s, r, i) {
|
|
@@ -398,6 +402,7 @@ class S {
|
|
|
398
402
|
}
|
|
399
403
|
/**
|
|
400
404
|
* Retrieves and decrypts connection data
|
|
405
|
+
* @template T Type of component request
|
|
401
406
|
* @param id Connection ID
|
|
402
407
|
* @param key Encryption key from previous create/update operation
|
|
403
408
|
* @returns Promise resolving to connection details including decrypted data
|
|
@@ -424,6 +429,7 @@ class S {
|
|
|
424
429
|
/**
|
|
425
430
|
* Closes a connection
|
|
426
431
|
* @param id Connection ID
|
|
432
|
+
* @returns Promise resolving when the connection is closed
|
|
427
433
|
*/
|
|
428
434
|
async close(e) {
|
|
429
435
|
const n = await fetch(`${this.endpoint}/${e}`, {
|
package/dist/esm/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.9.
|
|
13
|
+
"version": "2.9.3-next.3",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"build:dev": "yarn build && yarn dev",
|
|
54
54
|
"build:clean": "rimraf dist ts-out coverage temp",
|
|
55
55
|
"build": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs && yarn docs",
|
|
56
|
+
"build:no-docs": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs",
|
|
56
57
|
"lint": "eslint . --max-warnings 0",
|
|
57
58
|
"lint:fix": "yarn lint --fix --cache --no-warn-ignored",
|
|
58
59
|
"format": "prettier --write --cache .",
|
package/dist/notabene.d.ts
CHANGED
|
@@ -303,10 +303,10 @@ export declare interface ComponentResponse {
|
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
export declare interface ConnectionData<T extends ComponentRequest> {
|
|
306
|
-
tx: T;
|
|
307
|
-
authToken?: string;
|
|
308
|
-
txOptions?: TransactionOptions;
|
|
309
|
-
result?: TransactionResponse<T>;
|
|
306
|
+
readonly tx: T;
|
|
307
|
+
readonly authToken?: string;
|
|
308
|
+
readonly txOptions?: TransactionOptions;
|
|
309
|
+
readonly result?: TransactionResponse<T>;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
/**
|
|
@@ -317,21 +317,26 @@ export declare class ConnectionManager {
|
|
|
317
317
|
constructor(endpoint: string);
|
|
318
318
|
/**
|
|
319
319
|
* Creates a new encrypted connection
|
|
320
|
+
* @template T Type of component request
|
|
320
321
|
* @param data The component request data to encrypt and store
|
|
321
|
-
* @param participants
|
|
322
|
+
* @param metadata Connection metadata including participants and transaction type
|
|
322
323
|
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
323
324
|
*/
|
|
324
325
|
create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
|
|
325
326
|
/**
|
|
326
327
|
* Updates an existing connection with new encrypted data
|
|
328
|
+
* @template T Type of component request
|
|
327
329
|
* @param id Connection ID
|
|
328
330
|
* @param data New data to encrypt and store
|
|
329
331
|
* @param version Current version number
|
|
332
|
+
* @param status New connection status
|
|
333
|
+
* @param key Current encryption key
|
|
330
334
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
331
335
|
*/
|
|
332
336
|
update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number, status: ConnectionStatus, key: string): Promise<ConnectionResponse<T>>;
|
|
333
337
|
/**
|
|
334
338
|
* Retrieves and decrypts connection data
|
|
339
|
+
* @template T Type of component request
|
|
335
340
|
* @param id Connection ID
|
|
336
341
|
* @param key Encryption key from previous create/update operation
|
|
337
342
|
* @returns Promise resolving to connection details including decrypted data
|
|
@@ -340,14 +345,15 @@ export declare class ConnectionManager {
|
|
|
340
345
|
/**
|
|
341
346
|
* Closes a connection
|
|
342
347
|
* @param id Connection ID
|
|
348
|
+
* @returns Promise resolving when the connection is closed
|
|
343
349
|
*/
|
|
344
350
|
close(id: UUID): Promise<void>;
|
|
345
351
|
}
|
|
346
352
|
|
|
347
353
|
export declare interface ConnectionMetadata {
|
|
348
|
-
nodeUrl?: string;
|
|
349
|
-
participants: string[];
|
|
350
|
-
transactionType: TransactionType;
|
|
354
|
+
readonly nodeUrl?: string;
|
|
355
|
+
readonly participants: readonly string[];
|
|
356
|
+
readonly transactionType: TransactionType;
|
|
351
357
|
}
|
|
352
358
|
|
|
353
359
|
/**
|
|
@@ -365,21 +371,29 @@ export declare interface ConnectionRequest extends ComponentRequest {
|
|
|
365
371
|
}
|
|
366
372
|
|
|
367
373
|
export declare interface ConnectionResponse<T extends ComponentRequest> {
|
|
368
|
-
id: UUID;
|
|
369
|
-
version: number;
|
|
370
|
-
status: ConnectionStatus;
|
|
371
|
-
metadata: ConnectionMetadata;
|
|
372
|
-
data: ConnectionData<T>;
|
|
373
|
-
key: string;
|
|
374
|
+
readonly id: UUID;
|
|
375
|
+
readonly version: number;
|
|
376
|
+
readonly status: ConnectionStatus;
|
|
377
|
+
readonly metadata: ConnectionMetadata;
|
|
378
|
+
readonly data: ConnectionData<T>;
|
|
379
|
+
readonly key: string;
|
|
374
380
|
}
|
|
375
381
|
|
|
376
|
-
export declare
|
|
377
|
-
id: UUID;
|
|
378
|
-
metadata: ConnectionMetadata;
|
|
379
|
-
status:
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
382
|
+
export declare type ConnectionResult<T extends ComponentRequest> = {
|
|
383
|
+
readonly id: UUID;
|
|
384
|
+
readonly metadata: ConnectionMetadata;
|
|
385
|
+
readonly status: 'closed';
|
|
386
|
+
} | {
|
|
387
|
+
readonly id: UUID;
|
|
388
|
+
readonly metadata: ConnectionMetadata;
|
|
389
|
+
readonly status: 'completed';
|
|
390
|
+
readonly result: TransactionResponse<T>;
|
|
391
|
+
} | {
|
|
392
|
+
readonly id: UUID;
|
|
393
|
+
readonly metadata: ConnectionMetadata;
|
|
394
|
+
readonly status: 'active';
|
|
395
|
+
readonly tx: T;
|
|
396
|
+
};
|
|
383
397
|
|
|
384
398
|
export declare type ConnectionStatus = 'active' | 'completed' | 'closed';
|
|
385
399
|
|
|
@@ -666,7 +680,6 @@ export declare enum ErrorIdentifierCode {
|
|
|
666
680
|
*/
|
|
667
681
|
export declare type FieldOptions = boolean | string[] | {
|
|
668
682
|
optional: boolean;
|
|
669
|
-
transmit: boolean;
|
|
670
683
|
};
|
|
671
684
|
|
|
672
685
|
/**
|
|
@@ -678,6 +691,12 @@ export declare type FieldTypes = {
|
|
|
678
691
|
legalPerson?: LegalPersonFields;
|
|
679
692
|
};
|
|
680
693
|
|
|
694
|
+
/**
|
|
695
|
+
* Retrieves and processes connection refresh data
|
|
696
|
+
* @template T Type of component request
|
|
697
|
+
* @param refreshSource Source information for the refresh operation
|
|
698
|
+
* @returns Promise resolving to connection result with decrypted data
|
|
699
|
+
*/
|
|
681
700
|
export declare function getRefreshResult<T extends ComponentRequest>(refreshSource: RefreshSource): Promise<ConnectionResult<T>>;
|
|
682
701
|
|
|
683
702
|
/**
|
|
@@ -1547,6 +1566,7 @@ export declare interface TransactionOptions {
|
|
|
1547
1566
|
fallbacks?: ProofTypes[];
|
|
1548
1567
|
deminimis?: ThresholdOptions;
|
|
1549
1568
|
};
|
|
1569
|
+
jurisdiction?: string;
|
|
1550
1570
|
allowedAgentTypes?: AgentType[];
|
|
1551
1571
|
allowedCounterpartyTypes?: PersonType[];
|
|
1552
1572
|
fields?: FieldTypes;
|
|
@@ -1727,6 +1747,7 @@ export declare interface VASP extends Agent {
|
|
|
1727
1747
|
logo?: URI;
|
|
1728
1748
|
website?: URI;
|
|
1729
1749
|
countryOfRegistration?: ISOCountryCode;
|
|
1750
|
+
jurisdictions?: string;
|
|
1730
1751
|
}
|
|
1731
1752
|
|
|
1732
1753
|
/**
|
package/dist/notabene.js
CHANGED
|
@@ -338,8 +338,9 @@ class S {
|
|
|
338
338
|
}
|
|
339
339
|
/**
|
|
340
340
|
* Creates a new encrypted connection
|
|
341
|
+
* @template T Type of component request
|
|
341
342
|
* @param data The component request data to encrypt and store
|
|
342
|
-
* @param participants
|
|
343
|
+
* @param metadata Connection metadata including participants and transaction type
|
|
343
344
|
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
344
345
|
*/
|
|
345
346
|
async create(e, n) {
|
|
@@ -367,9 +368,12 @@ class S {
|
|
|
367
368
|
}
|
|
368
369
|
/**
|
|
369
370
|
* Updates an existing connection with new encrypted data
|
|
371
|
+
* @template T Type of component request
|
|
370
372
|
* @param id Connection ID
|
|
371
373
|
* @param data New data to encrypt and store
|
|
372
374
|
* @param version Current version number
|
|
375
|
+
* @param status New connection status
|
|
376
|
+
* @param key Current encryption key
|
|
373
377
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
374
378
|
*/
|
|
375
379
|
async update(e, n, s, r, i) {
|
|
@@ -398,6 +402,7 @@ class S {
|
|
|
398
402
|
}
|
|
399
403
|
/**
|
|
400
404
|
* Retrieves and decrypts connection data
|
|
405
|
+
* @template T Type of component request
|
|
401
406
|
* @param id Connection ID
|
|
402
407
|
* @param key Encryption key from previous create/update operation
|
|
403
408
|
* @returns Promise resolving to connection details including decrypted data
|
|
@@ -424,6 +429,7 @@ class S {
|
|
|
424
429
|
/**
|
|
425
430
|
* Closes a connection
|
|
426
431
|
* @param id Connection ID
|
|
432
|
+
* @returns Promise resolving when the connection is closed
|
|
427
433
|
*/
|
|
428
434
|
async close(e) {
|
|
429
435
|
const n = await fetch(`${this.endpoint}/${e}`, {
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"author": "Notabene <developers@notabene.id>",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"packageManager": "yarn@4.5.1",
|
|
13
|
-
"version": "2.9.
|
|
13
|
+
"version": "2.9.3-next.3",
|
|
14
14
|
"source": "src/notabene.ts",
|
|
15
15
|
"main": "dist/cjs/notabene.cjs",
|
|
16
16
|
"module": "dist/esm/notabene.js",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"build:dev": "yarn build && yarn dev",
|
|
54
54
|
"build:clean": "rimraf dist ts-out coverage temp",
|
|
55
55
|
"build": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs && yarn docs",
|
|
56
|
+
"build:no-docs": "vite build && yarn typecheck && api-extractor run --local && node scripts/copy-types.mjs",
|
|
56
57
|
"lint": "eslint . --max-warnings 0",
|
|
57
58
|
"lint:fix": "yarn lint --fix --cache --no-warn-ignored",
|
|
58
59
|
"format": "prettier --write --cache .",
|
package/src/types.ts
CHANGED
|
@@ -301,6 +301,7 @@ export interface VASP extends Agent {
|
|
|
301
301
|
logo?: URI;
|
|
302
302
|
website?: URI;
|
|
303
303
|
countryOfRegistration?: ISOCountryCode;
|
|
304
|
+
jurisdictions?: string;
|
|
304
305
|
}
|
|
305
306
|
|
|
306
307
|
/**
|
|
@@ -757,7 +758,6 @@ export type FieldOptions =
|
|
|
757
758
|
| string[] // fields to show
|
|
758
759
|
| {
|
|
759
760
|
optional: boolean; // Shown but optional
|
|
760
|
-
transmit: boolean; // Transmit as part of IVMS 101 to counterparty
|
|
761
761
|
};
|
|
762
762
|
|
|
763
763
|
/**
|
|
@@ -850,6 +850,7 @@ export interface TransactionOptions {
|
|
|
850
850
|
fallbacks?: ProofTypes[];
|
|
851
851
|
deminimis?: ThresholdOptions;
|
|
852
852
|
};
|
|
853
|
+
jurisdiction?: string;
|
|
853
854
|
allowedAgentTypes?: AgentType[]; // Defaults to All
|
|
854
855
|
allowedCounterpartyTypes?: PersonType[]; // Defaults to All
|
|
855
856
|
fields?: FieldTypes;
|
package/src/utils/connections.ts
CHANGED
|
@@ -9,35 +9,54 @@ import { seal, unseal } from './encryption';
|
|
|
9
9
|
|
|
10
10
|
export type TransactionType = 'withdraw' | 'deposit';
|
|
11
11
|
export type ConnectionStatus = 'active' | 'completed' | 'closed';
|
|
12
|
+
|
|
12
13
|
export interface ConnectionData<T extends ComponentRequest> {
|
|
13
|
-
tx: T;
|
|
14
|
-
authToken?: string;
|
|
15
|
-
txOptions?: TransactionOptions;
|
|
16
|
-
result?: TransactionResponse<T>;
|
|
14
|
+
readonly tx: T;
|
|
15
|
+
readonly authToken?: string;
|
|
16
|
+
readonly txOptions?: TransactionOptions;
|
|
17
|
+
readonly result?: TransactionResponse<T>;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
export interface ConnectionMetadata {
|
|
20
|
-
nodeUrl?: string;
|
|
21
|
-
participants: string[];
|
|
22
|
-
transactionType: TransactionType;
|
|
21
|
+
readonly nodeUrl?: string;
|
|
22
|
+
readonly participants: readonly string[];
|
|
23
|
+
readonly transactionType: TransactionType;
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
export interface ConnectionResponse<T extends ComponentRequest> {
|
|
25
|
-
id: UUID;
|
|
26
|
-
version: number;
|
|
27
|
-
status: ConnectionStatus;
|
|
28
|
-
metadata: ConnectionMetadata;
|
|
29
|
-
data: ConnectionData<T>;
|
|
30
|
-
key: string;
|
|
27
|
+
readonly id: UUID;
|
|
28
|
+
readonly version: number;
|
|
29
|
+
readonly status: ConnectionStatus;
|
|
30
|
+
readonly metadata: ConnectionMetadata;
|
|
31
|
+
readonly data: ConnectionData<T>;
|
|
32
|
+
readonly key: string;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
export type ConnectionResult<T extends ComponentRequest> =
|
|
36
|
+
| {
|
|
37
|
+
readonly id: UUID;
|
|
38
|
+
readonly metadata: ConnectionMetadata;
|
|
39
|
+
readonly status: 'closed';
|
|
40
|
+
}
|
|
41
|
+
| {
|
|
42
|
+
readonly id: UUID;
|
|
43
|
+
readonly metadata: ConnectionMetadata;
|
|
44
|
+
readonly status: 'completed';
|
|
45
|
+
readonly result: TransactionResponse<T>;
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
readonly id: UUID;
|
|
49
|
+
readonly metadata: ConnectionMetadata;
|
|
50
|
+
readonly status: 'active';
|
|
51
|
+
readonly tx: T;
|
|
52
|
+
};
|
|
40
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves and processes connection refresh data
|
|
56
|
+
* @template T Type of component request
|
|
57
|
+
* @param refreshSource Source information for the refresh operation
|
|
58
|
+
* @returns Promise resolving to connection result with decrypted data
|
|
59
|
+
*/
|
|
41
60
|
export async function getRefreshResult<T extends ComponentRequest>(
|
|
42
61
|
refreshSource: RefreshSource,
|
|
43
62
|
): Promise<ConnectionResult<T>> {
|
|
@@ -99,8 +118,9 @@ export class ConnectionManager {
|
|
|
99
118
|
|
|
100
119
|
/**
|
|
101
120
|
* Creates a new encrypted connection
|
|
121
|
+
* @template T Type of component request
|
|
102
122
|
* @param data The component request data to encrypt and store
|
|
103
|
-
* @param participants
|
|
123
|
+
* @param metadata Connection metadata including participants and transaction type
|
|
104
124
|
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
105
125
|
*/
|
|
106
126
|
async create<T extends ComponentRequest>(
|
|
@@ -143,9 +163,12 @@ export class ConnectionManager {
|
|
|
143
163
|
|
|
144
164
|
/**
|
|
145
165
|
* Updates an existing connection with new encrypted data
|
|
166
|
+
* @template T Type of component request
|
|
146
167
|
* @param id Connection ID
|
|
147
168
|
* @param data New data to encrypt and store
|
|
148
169
|
* @param version Current version number
|
|
170
|
+
* @param status New connection status
|
|
171
|
+
* @param key Current encryption key
|
|
149
172
|
* @returns Promise resolving to updated connection details including new encryption key
|
|
150
173
|
*/
|
|
151
174
|
async update<T extends ComponentRequest>(
|
|
@@ -192,6 +215,7 @@ export class ConnectionManager {
|
|
|
192
215
|
|
|
193
216
|
/**
|
|
194
217
|
* Retrieves and decrypts connection data
|
|
218
|
+
* @template T Type of component request
|
|
195
219
|
* @param id Connection ID
|
|
196
220
|
* @param key Encryption key from previous create/update operation
|
|
197
221
|
* @returns Promise resolving to connection details including decrypted data
|
|
@@ -233,6 +257,7 @@ export class ConnectionManager {
|
|
|
233
257
|
/**
|
|
234
258
|
* Closes a connection
|
|
235
259
|
* @param id Connection ID
|
|
260
|
+
* @returns Promise resolving when the connection is closed
|
|
236
261
|
*/
|
|
237
262
|
async close(id: UUID): Promise<void> {
|
|
238
263
|
const response = await fetch(`${this.endpoint}/${id}`, {
|
package/src/utils/encryption.ts
CHANGED
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export interface Sealed {
|
|
5
5
|
/** Base64-encoded ciphertext combined with initialization vector (IV) */
|
|
6
|
-
ciphertext: string;
|
|
6
|
+
readonly ciphertext: string;
|
|
7
7
|
/** Base64-encoded encryption key */
|
|
8
|
-
key: string;
|
|
8
|
+
readonly key: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Encrypts an object using AES-GCM encryption.
|
|
13
13
|
* @template T Type of data to encrypt
|
|
14
14
|
* @param data Data to encrypt
|
|
15
|
+
* @param existingKey Optional existing key to use for encryption
|
|
15
16
|
* @returns Promise resolving to a Sealed object containing ciphertext and key
|
|
16
17
|
*/
|
|
17
18
|
export async function seal<T>(data: T, existingKey?: string): Promise<Sealed> {
|
|
@@ -56,7 +57,6 @@ export async function seal<T>(data: T, existingKey?: string): Promise<Sealed> {
|
|
|
56
57
|
* @param sealed Sealed object containing ciphertext and key
|
|
57
58
|
* @returns Promise resolving to the original decrypted data
|
|
58
59
|
*/
|
|
59
|
-
|
|
60
60
|
export async function unseal<T>({ ciphertext, key }: Sealed): Promise<T> {
|
|
61
61
|
// Split the IV and the ciphertext
|
|
62
62
|
const [ivBase64, ciphertextBase64] = ciphertext.split('-');
|
|
@@ -91,7 +91,11 @@ export async function unseal<T>({ ciphertext, key }: Sealed): Promise<T> {
|
|
|
91
91
|
return JSON.parse(decoder.decode(plaintextBuffer));
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Converts an ArrayBuffer to a Base64 string
|
|
96
|
+
* @param buffer The ArrayBuffer to convert
|
|
97
|
+
* @returns Base64 encoded string
|
|
98
|
+
*/
|
|
95
99
|
function arrayBufferToBase64(buffer: ArrayBuffer): string {
|
|
96
100
|
const uint8Array = new Uint8Array(buffer);
|
|
97
101
|
let binary = '';
|
|
@@ -101,8 +105,11 @@ function arrayBufferToBase64(buffer: ArrayBuffer): string {
|
|
|
101
105
|
return btoa(binary);
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Converts a Base64 string to a Uint8Array
|
|
110
|
+
* @param base64 The Base64 string to convert
|
|
111
|
+
* @returns Uint8Array containing the decoded data
|
|
112
|
+
*/
|
|
106
113
|
function base64ToUint8Array(base64: string): Uint8Array {
|
|
107
114
|
const binary = atob(base64);
|
|
108
115
|
const buffer = new Uint8Array(binary.length);
|