@notabene/javascript-sdk 2.8.0-next.4 → 2.8.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/notabene.cjs +1 -1
- package/dist/cjs/notabene.d.ts +57 -0
- package/dist/cjs/package.json +1 -1
- package/dist/esm/notabene.d.ts +57 -0
- package/dist/esm/notabene.js +282 -137
- package/dist/esm/package.json +1 -1
- package/dist/notabene.d.ts +57 -0
- package/dist/notabene.js +282 -137
- package/package.json +1 -1
- package/src/notabene.ts +7 -0
- package/src/utils/__tests__/connections.test.ts +284 -0
- package/src/utils/__tests__/encryption.test.ts +79 -0
- package/src/utils/connections.ts +174 -0
- package/src/utils/encryption.ts +111 -0
package/dist/notabene.d.ts
CHANGED
|
@@ -290,6 +290,53 @@ export declare interface ComponentResponse {
|
|
|
290
290
|
errors: ValidationError[];
|
|
291
291
|
}
|
|
292
292
|
|
|
293
|
+
export declare interface ConnectionData<T extends ComponentRequest> {
|
|
294
|
+
tx: T;
|
|
295
|
+
authToken?: string;
|
|
296
|
+
txOptions?: TransactionOptions;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Manages encrypted connections using Cloudflare Durable Objects
|
|
301
|
+
*/
|
|
302
|
+
export declare class ConnectionManager {
|
|
303
|
+
private endpoint;
|
|
304
|
+
constructor(endpoint: string);
|
|
305
|
+
/**
|
|
306
|
+
* Creates a new encrypted connection
|
|
307
|
+
* @param data The component request data to encrypt and store
|
|
308
|
+
* @param participants Array of participant identifiers
|
|
309
|
+
* @returns Promise resolving to connection details including ID, version, and encryption key
|
|
310
|
+
*/
|
|
311
|
+
create<T extends ComponentRequest>(data: ConnectionData<T>, metadata: ConnectionMetadata): Promise<ConnectionResponse<T>>;
|
|
312
|
+
/**
|
|
313
|
+
* Updates an existing connection with new encrypted data
|
|
314
|
+
* @param id Connection ID
|
|
315
|
+
* @param data New data to encrypt and store
|
|
316
|
+
* @param version Current version number
|
|
317
|
+
* @returns Promise resolving to updated connection details including new encryption key
|
|
318
|
+
*/
|
|
319
|
+
update<T extends ComponentRequest>(id: UUID, data: ConnectionData<T>, version: number): Promise<ConnectionResponse<T>>;
|
|
320
|
+
/**
|
|
321
|
+
* Retrieves and decrypts connection data
|
|
322
|
+
* @param id Connection ID
|
|
323
|
+
* @param key Encryption key from previous create/update operation
|
|
324
|
+
* @returns Promise resolving to connection details including decrypted data
|
|
325
|
+
*/
|
|
326
|
+
get<T extends ComponentRequest>(id: UUID, key: string): Promise<ConnectionResponse<T>>;
|
|
327
|
+
/**
|
|
328
|
+
* Closes a connection
|
|
329
|
+
* @param id Connection ID
|
|
330
|
+
*/
|
|
331
|
+
close(id: UUID): Promise<void>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
export declare interface ConnectionMetadata {
|
|
335
|
+
nodeUrl?: string;
|
|
336
|
+
participants: string[];
|
|
337
|
+
transactionType: TransactionType;
|
|
338
|
+
}
|
|
339
|
+
|
|
293
340
|
/**
|
|
294
341
|
* An object representing options for a Connection Request
|
|
295
342
|
* @public
|
|
@@ -304,6 +351,14 @@ export declare interface ConnectionRequest extends ComponentRequest {
|
|
|
304
351
|
asset: TransactionAsset;
|
|
305
352
|
}
|
|
306
353
|
|
|
354
|
+
export declare interface ConnectionResponse<T extends ComponentRequest> {
|
|
355
|
+
id: UUID;
|
|
356
|
+
version: number;
|
|
357
|
+
metadata: ConnectionMetadata;
|
|
358
|
+
data: ConnectionData<T>;
|
|
359
|
+
key: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
307
362
|
/**
|
|
308
363
|
* The counterparty of a transaction.
|
|
309
364
|
* @public
|
|
@@ -1458,6 +1513,8 @@ export declare interface TransactionResponse<V> extends ComponentResponse {
|
|
|
1458
1513
|
txUpdate?: V1Transaction;
|
|
1459
1514
|
}
|
|
1460
1515
|
|
|
1516
|
+
export declare type TransactionType = 'withdraw' | 'deposit';
|
|
1517
|
+
|
|
1461
1518
|
/**
|
|
1462
1519
|
* Transfer Path
|
|
1463
1520
|
* Represents the path of intermediary VASPs in a transfer
|