@notabene/javascript-sdk 2.9.2 → 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 CHANGED
@@ -303,6 +303,10 @@ const withdrawal = notabene.createWithdrawalAssist({
303
303
  currency: 'USD', // ISO currency code
304
304
  price: 1700.12, // Asset price
305
305
  },
306
+ customer: {
307
+ name: 'John Smith',
308
+ email: "john.smith@domain.com",
309
+ },
306
310
  });
307
311
  ```
308
312
 
@@ -312,6 +316,7 @@ const withdrawal = notabene.createWithdrawalAssist({
312
316
  - `destination`: The destination or blockchain address for the withdrawal. See [Destination](#destination)
313
317
  - `amountDecimal`: The amount to transfer in decimal format. See [Transaction Amount](#transaction-amount)
314
318
  - `assetPrice`: Optional price information in a fiat currency. See [Asset Price](#asset-price)
319
+ - `customer`: Optional Customer object containing their name and email
315
320
 
316
321
  If any of the required parameters are missing the component will just show the Notabene badge.
317
322
 
@@ -329,6 +334,10 @@ const withdrawal = notabene.createWithdrawalAssist(
329
334
  currency: 'USD', // ISO currency code
330
335
  price: 1700.12, // Asset price
331
336
  },
337
+ customer: {
338
+ name: 'John Smith',
339
+ email: "john.smith@domain.com",
340
+ },
332
341
  },
333
342
  {
334
343
  proofs: {
@@ -348,6 +357,10 @@ See [Transaction Options](#transaction-options)
348
357
 
349
358
  The Connect Wallet component helps you collect and verify the address of your users self-hosted wallet in one go.
350
359
 
360
+ ### Parameters
361
+
362
+ - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
363
+
351
364
  ```js
352
365
  const connect = notabene.createConnectWallet({
353
366
  asset: 'ETH',
@@ -356,31 +369,6 @@ const connect = notabene.createConnectWallet({
356
369
  const { proof, txCreate } = await connect.openModal();
357
370
  ```
358
371
 
359
- ### Parameters
360
-
361
- - `asset`: The cryptocurrency or token being transferred. See [Asset Specification](#asset-specification)
362
-
363
- ### Configuration Options
364
-
365
- Include configuration Options as a second optional parameter:
366
-
367
- ```js
368
- const connect = notabene.createConnectWallet(
369
- {
370
- asset: 'ETH',
371
- },
372
- {
373
- proofs: {
374
- microTransfer: {
375
- destination: '0x...',
376
- amountSubunits: '12344',
377
- timeout: 86440,
378
- },
379
- },
380
- },
381
- );
382
- ```
383
-
384
372
  ## Deposit Request
385
373
 
386
374
  The Deposit Request lets your customers request deposits that are fully Travel Rule compliant.
@@ -436,11 +424,11 @@ If any of the required parameters are missing the component will just show the N
436
424
 
437
425
  ---
438
426
 
439
- ## Counterparty Assist
427
+ ## Counterparty Handoff
440
428
 
441
- The **Counterparty Assist** feature enables handoff of data collection to a counterparty or to another device by sharing a secure link. This facilitates more accurate and complete data collection, particularly when the counterparty is able to provide the required information directly.
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.
442
430
 
443
- This feature can be enabled globally for all counterparty types or selectively for specific types.
431
+ This feature does not function as a standalone component. Instead, it augments the Withdrawal and Deposit flows when configured.
444
432
 
445
433
  ### Use Cases
446
434
 
@@ -454,33 +442,27 @@ During the address verification step, users can share a link to complete self-ho
454
442
 
455
443
  ### Counterparty Assist Configuration
456
444
 
457
- You can enable **Counterparty Assist** via the `counterpartyAssist` configuration field in one of the following ways:
445
+ You can enable **Counterparty Assist** by specifying the counterparty types you want the feature to apply to using the counterpartyAssist configuration field.
458
446
 
459
- - `true`: Enable for all counterparty types (`self`, `natural`, and `legal`)
460
- - `false`: Disable the feature entirely
447
+ - `false`: Disable the feature explicitly
448
+ - `undefined` (not configured): Feature is disabled by default
461
449
  - `{ counterpartyTypes: [PersonType.SELF, PersonType.NATURAL, PersonType.LEGAL] }`: Enable for specific counterparty types
462
450
 
463
451
  **Example Config**
464
452
 
465
- ```ts
453
+ ```js
466
454
  import Notabene, {
467
455
  PersonType,
468
456
  } from '@notabene/javascript-sdk';
469
457
 
470
- // Counterparty assist is enabled for all counterparty types
471
- const optionsAllEnabled: TransactionOptions = {
472
- ...
473
- counterpartyAssist: true, // 'self', 'natural', and 'legal' enabled
474
- };
475
-
476
458
  // Counterparty assist is enabled for specific counterparty types
477
459
  const options: TransactionOptions = {
478
460
  ...
479
461
  counterpartyAssist: {
480
462
  counterpartyTypes: [
481
- PersonType.LEGAL, // JS: 'legal'
463
+ PersonType.LEGAL, // JS: 'legal'
482
464
  PersonType.NATURAL, // JS: 'natural'
483
- PersonType.SELF, // JS: 'self'
465
+ PersonType.SELF, // JS: 'self'
484
466
  ],
485
467
  }
486
468
  };
@@ -503,7 +485,7 @@ When a third party completes their step after following the shared link, the hos
503
485
 
504
486
  **Example Response**
505
487
 
506
- ```json
488
+ ```js
507
489
  {
508
490
  type: CMType.COMPLETE, // 'complete'
509
491
  response: { // transaciton data + refresh source
@@ -549,7 +531,7 @@ To simplify retrieval and decryption, we provide an asynchronous [`getRefreshRes
549
531
 
550
532
  **Example**
551
533
 
552
- ```ts
534
+ ```js
553
535
  import { getRefreshResult } from "@notabene/javascript-sdk";
554
536
 
555
537
  const transaction = await getRefreshResult({
@@ -571,7 +553,7 @@ const transaction = await getRefreshResult({
571
553
 
572
554
  **Example Active Transaction Data**
573
555
 
574
- ```json
556
+ ```js
575
557
  {
576
558
  "id": "17f76e4c-9a2a-4c34-afcb-b4868e609a96",
577
559
  "metadata": {
@@ -583,14 +565,14 @@ const transaction = await getRefreshResult({
583
565
  },
584
566
  "status": "active",
585
567
  "tx": {
586
- ...
568
+ //...
587
569
  }
588
570
  }
589
571
  ```
590
572
 
591
573
  **Example Completed Transaction Data**
592
574
 
593
- ```json
575
+ ```js
594
576
  {
595
577
  "id": "17f76e4c-9a2a-4c34-afcb-b4868e609a96",
596
578
  "metadata": {
@@ -603,19 +585,19 @@ const transaction = await getRefreshResult({
603
585
  "status": "completed",
604
586
  "result": { // the response returned from the embedded component when all information is successfully collected
605
587
  "proof": {
606
- ...
588
+ //...
607
589
  },
608
590
  "txCreate": {
609
- ...
591
+ //...
610
592
  },
611
593
  "errors": [],
612
594
  "status": "pending",
613
595
  "valid": true,
614
596
  "value": {
615
- ...
597
+ //...
616
598
  },
617
599
  "ivms101": {
618
- ...
600
+ //...
619
601
  }
620
602
  }
621
603
  }
@@ -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 Array of participant identifiers
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 interface ConnectionResult<T extends ComponentRequest> {
377
- id: UUID;
378
- metadata: ConnectionMetadata;
379
- status: ConnectionStatus;
380
- tx?: T;
381
- result?: TransactionResponse<T>;
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
  /**
@@ -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.2",
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 .",
@@ -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 Array of participant identifiers
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 interface ConnectionResult<T extends ComponentRequest> {
377
- id: UUID;
378
- metadata: ConnectionMetadata;
379
- status: ConnectionStatus;
380
- tx?: T;
381
- result?: TransactionResponse<T>;
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
  /**
@@ -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 Array of participant identifiers
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}`, {
@@ -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.2",
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 .",
@@ -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 Array of participant identifiers
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 interface ConnectionResult<T extends ComponentRequest> {
377
- id: UUID;
378
- metadata: ConnectionMetadata;
379
- status: ConnectionStatus;
380
- tx?: T;
381
- result?: TransactionResponse<T>;
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 Array of participant identifiers
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.2",
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;
@@ -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 interface ConnectionResult<T extends ComponentRequest> {
34
- id: UUID;
35
- metadata: ConnectionMetadata;
36
- status: ConnectionStatus;
37
- tx?: T;
38
- result?: TransactionResponse<T>;
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 Array of participant identifiers
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}`, {
@@ -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
- // Utility function to convert ArrayBuffer to Base64
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
- // Utility function to convert Base64 to ArrayBuffer
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);