@bsv/message-box-client 1.1.10 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/cjs/package.json +4 -4
  2. package/dist/cjs/src/MessageBoxClient.js +747 -129
  3. package/dist/cjs/src/MessageBoxClient.js.map +1 -1
  4. package/dist/cjs/src/PeerPayClient.js +61 -28
  5. package/dist/cjs/src/PeerPayClient.js.map +1 -1
  6. package/dist/cjs/src/Utils/logger.js +22 -21
  7. package/dist/cjs/src/Utils/logger.js.map +1 -1
  8. package/dist/cjs/src/types/permissions.js +6 -0
  9. package/dist/cjs/src/types/permissions.js.map +1 -0
  10. package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
  11. package/dist/esm/src/MessageBoxClient.js +636 -57
  12. package/dist/esm/src/MessageBoxClient.js.map +1 -1
  13. package/dist/esm/src/PeerPayClient.js +1 -1
  14. package/dist/esm/src/PeerPayClient.js.map +1 -1
  15. package/dist/esm/src/Utils/logger.js +17 -19
  16. package/dist/esm/src/Utils/logger.js.map +1 -1
  17. package/dist/esm/src/types/permissions.js +5 -0
  18. package/dist/esm/src/types/permissions.js.map +1 -0
  19. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  20. package/dist/types/src/MessageBoxClient.d.ts +235 -24
  21. package/dist/types/src/MessageBoxClient.d.ts.map +1 -1
  22. package/dist/types/src/PeerPayClient.d.ts.map +1 -1
  23. package/dist/types/src/Utils/logger.d.ts +5 -8
  24. package/dist/types/src/Utils/logger.d.ts.map +1 -1
  25. package/dist/types/src/types/permissions.d.ts +75 -0
  26. package/dist/types/src/types/permissions.d.ts.map +1 -0
  27. package/dist/types/src/types.d.ts +80 -2
  28. package/dist/types/src/types.d.ts.map +1 -1
  29. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  30. package/dist/umd/bundle.js +1 -1
  31. package/package.json +4 -4
  32. package/src/MessageBoxClient.ts +781 -68
  33. package/src/PeerPayClient.ts +11 -11
  34. package/src/Utils/logger.ts +17 -19
  35. package/src/types/permissions.ts +81 -0
  36. package/src/types.ts +87 -2
@@ -21,16 +21,10 @@
21
21
  * @author Project Babbage
22
22
  * @license Open BSV License
23
23
  */
24
- import { AuthFetch, BEEF, LockingScript, HexString } from '@bsv/sdk';
24
+ import { AuthFetch, PubKeyHex } from '@bsv/sdk';
25
25
  import { AuthSocketClient } from '@bsv/authsocket-client';
26
- import { AcknowledgeMessageParams, ListMessagesParams, MessageBoxClientOptions, PeerMessage, SendMessageParams, SendMessageResponse } from './types.js';
27
- interface AdvertisementToken {
28
- host: string;
29
- txid: HexString;
30
- outputIndex: number;
31
- lockingScript: LockingScript;
32
- beef: BEEF;
33
- }
26
+ import { AcknowledgeMessageParams, AdvertisementToken, ListMessagesParams, MessageBoxClientOptions, PeerMessage, SendMessageParams, SendMessageResponse, DeviceRegistrationParams, DeviceRegistrationResponse, RegisteredDevice } from './types.js';
27
+ import { SetMessageBoxPermissionParams, GetMessageBoxPermissionParams, MessageBoxPermission, MessageBoxQuote, ListPermissionsParams, GetQuoteParams } from './types/permissions.js';
34
28
  /**
35
29
  * @class MessageBoxClient
36
30
  * @description
@@ -72,7 +66,7 @@ export declare class MessageBoxClient {
72
66
  * @constructor
73
67
  * @param {Object} options - Initialization options for the MessageBoxClient.
74
68
  * @param {string} [options.host] - The base URL of the MessageBox server. If omitted, defaults to mainnet/testnet hosts.
75
- * @param {WalletClient} options.walletClient - Wallet instance used for authentication, signing, and encryption.
69
+ * @param {WalletInterface} options.walletClient - Wallet instance used for authentication, signing, and encryption.
76
70
  * @param {boolean} [options.enableLogging=false] - Whether to enable detailed debug logging to the console.
77
71
  * @param {'local' | 'mainnet' | 'testnet'} [options.networkPreset='mainnet'] - Overlay network preset used for routing and advertisement lookup.
78
72
  *
@@ -97,6 +91,7 @@ export declare class MessageBoxClient {
97
91
  * @method init
98
92
  * @async
99
93
  * @param {string} [targetHost] - Optional host to set or override the default host.
94
+ * @param {string} [originator] - Optional originator to use with walletClient.
100
95
  * @returns {Promise<void>}
101
96
  *
102
97
  * @description
@@ -115,7 +110,7 @@ export declare class MessageBoxClient {
115
110
  * await client.init()
116
111
  * await client.sendMessage({ recipient, messageBox: 'inbox', body: 'Hello' })
117
112
  */
118
- init(targetHost?: string): Promise<void>;
113
+ init(targetHost?: string, originator?: string): Promise<void>;
119
114
  /**
120
115
  * @method assertInitialized
121
116
  * @private
@@ -138,12 +133,13 @@ export declare class MessageBoxClient {
138
133
  getJoinedRooms(): Set<string>;
139
134
  /**
140
135
  * @method getIdentityKey
136
+ * @param {string} [originator] - Optional originator to use for identity key lookup
141
137
  * @returns {Promise<string>} The identity public key of the user
142
138
  * @description
143
139
  * Returns the client's identity key, used for signing, encryption, and addressing.
144
140
  * If not already loaded, it will fetch and cache it.
145
141
  */
146
- getIdentityKey(): Promise<string>;
142
+ getIdentityKey(originator?: string): Promise<string>;
147
143
  /**
148
144
  * @property testSocket
149
145
  * @readonly
@@ -158,6 +154,7 @@ export declare class MessageBoxClient {
158
154
  get testSocket(): ReturnType<typeof AuthSocketClient> | undefined;
159
155
  /**
160
156
  * @method initializeConnection
157
+ * @param {string} [originator] - Optional originator to use for authentication.
161
158
  * @async
162
159
  * @returns {Promise<void>}
163
160
  * @description
@@ -179,11 +176,12 @@ export declare class MessageBoxClient {
179
176
  * await mb.initializeConnection()
180
177
  * // WebSocket is now ready for use
181
178
  */
182
- initializeConnection(): Promise<void>;
179
+ initializeConnection(originator?: string): Promise<void>;
183
180
  /**
184
181
  * @method resolveHostForRecipient
185
182
  * @async
186
183
  * @param {string} identityKey - The public identity key of the intended recipient.
184
+ * @param {string} [originator] - The originator to use for the WalletClient.
187
185
  * @returns {Promise<string>} - A fully qualified host URL for the recipient's MessageBox server.
188
186
  *
189
187
  * @description
@@ -198,7 +196,7 @@ export declare class MessageBoxClient {
198
196
  * @example
199
197
  * const host = await resolveHostForRecipient('028d...') // → returns either overlay host or this.host
200
198
  */
201
- resolveHostForRecipient(identityKey: string): Promise<string>;
199
+ resolveHostForRecipient(identityKey: string, originator?: string): Promise<string>;
202
200
  /**
203
201
  * Core lookup: ask the LookupResolver (optionally filtered by host),
204
202
  * decode every PushDrop output, and collect all the host URLs you find.
@@ -207,7 +205,7 @@ export declare class MessageBoxClient {
207
205
  * @param host? if passed, only look for adverts anointed at that host
208
206
  * @returns 0-length array if nothing valid was found
209
207
  */
210
- queryAdvertisements(identityKey?: string, host?: string): Promise<AdvertisementToken[]>;
208
+ queryAdvertisements(identityKey?: string, host?: string, originator?: string): Promise<AdvertisementToken[]>;
211
209
  /**
212
210
  * @method joinRoom
213
211
  * @async
@@ -256,9 +254,10 @@ export declare class MessageBoxClient {
256
254
  * onMessage: (msg) => console.log('Received live message:', msg)
257
255
  * })
258
256
  */
259
- listenForLiveMessages({ onMessage, messageBox }: {
257
+ listenForLiveMessages({ onMessage, messageBox, originator }: {
260
258
  onMessage: (message: PeerMessage) => void;
261
259
  messageBox: string;
260
+ originator?: string;
262
261
  }): Promise<void>;
263
262
  /**
264
263
  * @method sendLiveMessage
@@ -289,7 +288,7 @@ export declare class MessageBoxClient {
289
288
  * body: { amount: 1000 }
290
289
  * })
291
290
  */
292
- sendLiveMessage({ recipient, messageBox, body, messageId, skipEncryption }: SendMessageParams): Promise<SendMessageResponse>;
291
+ sendLiveMessage({ recipient, messageBox, body, messageId, skipEncryption, checkPermissions, originator }: SendMessageParams): Promise<SendMessageResponse>;
293
292
  /**
294
293
  * @method leaveRoom
295
294
  * @async
@@ -347,7 +346,7 @@ export declare class MessageBoxClient {
347
346
  * body: { type: 'ping' }
348
347
  * })
349
348
  */
350
- sendMessage(message: SendMessageParams, overrideHost?: string): Promise<SendMessageResponse>;
349
+ sendMessage(message: SendMessageParams, overrideHost?: string, originator?: string): Promise<SendMessageResponse>;
351
350
  /**
352
351
  * @method anointHost
353
352
  * @async
@@ -371,13 +370,14 @@ export declare class MessageBoxClient {
371
370
  * @example
372
371
  * const { txid } = await client.anointHost('https://my-messagebox.io')
373
372
  */
374
- anointHost(host: string): Promise<{
373
+ anointHost(host: string, originator?: string): Promise<{
375
374
  txid: string;
376
375
  }>;
377
376
  /**
378
377
  * @method revokeHostAdvertisement
379
378
  * @async
380
379
  * @param {AdvertisementToken} advertisementToken - The advertisement token containing the messagebox host to revoke.
380
+ * @param {string} [originator] - Optional originator to use with walletClient.
381
381
  * @returns {Promise<{ txid: string }>} - The transaction ID of the revocation broadcast to the overlay network.
382
382
  *
383
383
  * @description
@@ -387,7 +387,7 @@ export declare class MessageBoxClient {
387
387
  * @example
388
388
  * const { txid } = await client.revokeHost('https://my-messagebox.io')
389
389
  */
390
- revokeHostAdvertisement(advertisementToken: AdvertisementToken): Promise<{
390
+ revokeHostAdvertisement(advertisementToken: AdvertisementToken, originator?: string): Promise<{
391
391
  txid: string;
392
392
  }>;
393
393
  /**
@@ -402,9 +402,16 @@ export declare class MessageBoxClient {
402
402
  *
403
403
  * Each message is:
404
404
  * - Parsed and, if encrypted, decrypted using AES-256-GCM via BRC-2-compliant ECDH key derivation and symmetric encryption.
405
+ * - Automatically processed for payments: if the message includes recipient fee payments, they are internalized using `walletClient.internalizeAction()`.
405
406
  * - Returned as a normalized `PeerMessage` with readable string body content.
406
407
  *
407
- * Decryption automatically derives a shared secret using the sender’s identity key and the receiver’s child private key.
408
+ * Payment Processing:
409
+ * - Detects messages that include payment data (from paid message delivery).
410
+ * - Automatically internalizes recipient payment outputs, allowing you to receive payments without additional API calls.
411
+ * - Only recipient payments are stored with messages - delivery fees are already processed by the server.
412
+ * - Continues processing messages even if payment internalization fails.
413
+ *
414
+ * Decryption automatically derives a shared secret using the sender's identity key and the receiver's child private key.
408
415
  * If the sender is the same as the recipient, the `counterparty` is set to `'self'`.
409
416
  *
410
417
  * @throws {Error} If no messageBox is specified, the request fails, or the server returns an error.
@@ -412,8 +419,9 @@ export declare class MessageBoxClient {
412
419
  * @example
413
420
  * const messages = await client.listMessages({ messageBox: 'inbox' })
414
421
  * messages.forEach(msg => console.log(msg.sender, msg.body))
422
+ * // Payments included with messages are automatically received
415
423
  */
416
- listMessages({ messageBox, host }: ListMessagesParams): Promise<PeerMessage[]>;
424
+ listMessages({ messageBox, host, originator }: ListMessagesParams): Promise<PeerMessage[]>;
417
425
  /**
418
426
  * @method acknowledgeMessage
419
427
  * @async
@@ -435,7 +443,210 @@ export declare class MessageBoxClient {
435
443
  * @example
436
444
  * await client.acknowledgeMessage({ messageIds: ['msg123', 'msg456'] })
437
445
  */
438
- acknowledgeMessage({ messageIds, host }: AcknowledgeMessageParams): Promise<string>;
446
+ acknowledgeMessage({ messageIds, host, originator }: AcknowledgeMessageParams): Promise<string>;
447
+ /**
448
+ * @method setMessageBoxPermission
449
+ * @async
450
+ * @param {SetMessageBoxPermissionParams} params - Permission configuration
451
+ * @param {string} [overrideHost] - Optional host override
452
+ * @returns {Promise<void>} Permission status after setting
453
+ *
454
+ * @description
455
+ * Sets permission for receiving messages in a specific messageBox.
456
+ * Can set sender-specific permissions or box-wide defaults.
457
+ *
458
+ * @example
459
+ * // Set box-wide default: allow notifications for 10 sats
460
+ * await client.setMessageBoxPermission({ messageBox: 'notifications', recipientFee: 10 })
461
+ *
462
+ * // Block specific sender
463
+ * await client.setMessageBoxPermission({
464
+ * messageBox: 'notifications',
465
+ * sender: '03abc123...',
466
+ * recipientFee: -1
467
+ * })
468
+ */
469
+ setMessageBoxPermission(params: SetMessageBoxPermissionParams, overrideHost?: string): Promise<void>;
470
+ /**
471
+ * @method getMessageBoxPermission
472
+ * @async
473
+ * @param {GetMessageBoxPermissionParams} params - Permission query parameters
474
+ * @param {string} [overrideHost] - Optional host override
475
+ * @returns {Promise<MessageBoxPermission | null>} Permission data (null if not set)
476
+ *
477
+ * @description
478
+ * Gets current permission data for a sender/messageBox combination.
479
+ * Returns null if no permission is set.
480
+ *
481
+ * @example
482
+ * const status = await client.getMessageBoxPermission({
483
+ * recipient: '03def456...',
484
+ * messageBox: 'notifications',
485
+ * sender: '03abc123...'
486
+ * })
487
+ */
488
+ getMessageBoxPermission(params: GetMessageBoxPermissionParams, overrideHost?: string): Promise<MessageBoxPermission | null>;
489
+ /**
490
+ * @method getMessageBoxQuote
491
+ * @async
492
+ * @param {GetQuoteParams} params - Quote request parameters
493
+ * @returns {Promise<MessageBoxQuote>} Fee quote and permission status
494
+ *
495
+ * @description
496
+ * Gets a fee quote for sending a message, including delivery and recipient fees.
497
+ *
498
+ * @example
499
+ * const quote = await client.getMessageBoxQuote({
500
+ * recipient: '03def456...',
501
+ * messageBox: 'notifications'
502
+ * })
503
+ */
504
+ getMessageBoxQuote(params: GetQuoteParams, overrideHost?: string): Promise<MessageBoxQuote>;
505
+ /**
506
+ * @method listMessageBoxPermissions
507
+ * @async
508
+ * @param {ListPermissionsParams} [params] - Optional filtering and pagination parameters
509
+ * @returns {Promise<MessageBoxPermission[]>} List of current permissions
510
+ *
511
+ * @description
512
+ * Lists permissions for the authenticated user's messageBoxes with optional pagination.
513
+ *
514
+ * @example
515
+ * // List all permissions
516
+ * const all = await client.listMessageBoxPermissions()
517
+ *
518
+ * // List only notification permissions with pagination
519
+ * const notifications = await client.listMessageBoxPermissions({
520
+ * messageBox: 'notifications',
521
+ * limit: 50,
522
+ * offset: 0
523
+ * })
524
+ */
525
+ listMessageBoxPermissions(params?: ListPermissionsParams, overrideHost?: string): Promise<MessageBoxPermission[]>;
526
+ /**
527
+ * @method allowNotificationsFromPeer
528
+ * @async
529
+ * @param {PubKeyHex} identityKey - Sender's identity key to allow
530
+ * @param {number} [recipientFee=0] - Fee to charge (0 for always allow)
531
+ * @param {string} [overrideHost] - Optional host override
532
+ * @returns {Promise<void>} Permission status after allowing
533
+ *
534
+ * @description
535
+ * Convenience method to allow notifications from a specific peer.
536
+ *
537
+ * @example
538
+ * await client.allowNotificationsFromPeer('03abc123...') // Always allow
539
+ * await client.allowNotificationsFromPeer('03def456...', 5) // Allow for 5 sats
540
+ */
541
+ allowNotificationsFromPeer(identityKey: PubKeyHex, recipientFee?: number, overrideHost?: string): Promise<void>;
542
+ /**
543
+ * @method denyNotificationsFromPeer
544
+ * @async
545
+ * @param {PubKeyHex} identityKey - Sender's identity key to block
546
+ * @returns {Promise<void>} Permission status after denying
547
+ *
548
+ * @description
549
+ * Convenience method to block notifications from a specific peer.
550
+ *
551
+ * @example
552
+ * await client.denyNotificationsFromPeer('03spam123...')
553
+ */
554
+ denyNotificationsFromPeer(identityKey: PubKeyHex, overrideHost?: string): Promise<void>;
555
+ /**
556
+ * @method checkPeerNotificationStatus
557
+ * @async
558
+ * @param {PubKeyHex} identityKey - Sender's identity key to check
559
+ * @returns {Promise<MessageBoxPermission>} Current permission status
560
+ *
561
+ * @description
562
+ * Convenience method to check notification permission for a specific peer.
563
+ *
564
+ * @example
565
+ * const status = await client.checkPeerNotificationStatus('03abc123...')
566
+ * console.log(status.allowed) // true/false
567
+ */
568
+ checkPeerNotificationStatus(identityKey: PubKeyHex, overrideHost?: string): Promise<MessageBoxPermission | null>;
569
+ /**
570
+ * @method listPeerNotifications
571
+ * @async
572
+ * @returns {Promise<MessageBoxPermission[]>} List of notification permissions
573
+ *
574
+ * @description
575
+ * Convenience method to list all notification permissions.
576
+ *
577
+ * @example
578
+ * const notifications = await client.listPeerNotifications()
579
+ */
580
+ listPeerNotifications(overrideHost?: string): Promise<MessageBoxPermission[]>;
581
+ /**
582
+ * @method sendNotification
583
+ * @async
584
+ * @param {PubKeyHex} recipient - Recipient's identity key
585
+ * @param {string | object} body - Notification content
586
+ * @param {string} [overrideHost] - Optional host override
587
+ * @returns {Promise<SendMessageResponse>} Send result
588
+ *
589
+ * @description
590
+ * Convenience method to send a notification with automatic quote fetching and payment handling.
591
+ * Automatically determines the required payment amount and creates the payment if needed.
592
+ *
593
+ * @example
594
+ * // Send notification (auto-determines payment needed)
595
+ * await client.sendNotification('03def456...', 'Hello!')
596
+ *
597
+ * // Send with maximum payment limit for safety
598
+ * await client.sendNotification('03def456...', { title: 'Alert', body: 'Important update' }, 50)
599
+ */
600
+ sendNotification(recipient: PubKeyHex, body: string | object, overrideHost?: string): Promise<SendMessageResponse>;
601
+ /**
602
+ * Register a device for FCM push notifications.
603
+ *
604
+ * @async
605
+ * @param {DeviceRegistrationParams} params - Device registration parameters
606
+ * @param {string} [overrideHost] - Optional host override
607
+ * @returns {Promise<DeviceRegistrationResponse>} Registration response
608
+ *
609
+ * @description
610
+ * Registers a device with the message box server to receive FCM push notifications.
611
+ * The FCM token is obtained from Firebase SDK on the client side.
612
+ *
613
+ * @example
614
+ * const result = await client.registerDevice({
615
+ * fcmToken: 'eBo8F...',
616
+ * platform: 'ios',
617
+ * deviceId: 'iPhone15Pro'
618
+ * })
619
+ */
620
+ registerDevice(params: DeviceRegistrationParams, overrideHost?: string): Promise<DeviceRegistrationResponse>;
621
+ /**
622
+ * List all registered devices for push notifications.
623
+ *
624
+ * @async
625
+ * @param {string} [overrideHost] - Optional host override
626
+ * @returns {Promise<RegisteredDevice[]>} Array of registered devices
627
+ *
628
+ * @description
629
+ * Retrieves all devices registered by the authenticated user for FCM push notifications.
630
+ * Only shows devices belonging to the current user (authenticated via AuthFetch).
631
+ *
632
+ * @example
633
+ * const devices = await client.listRegisteredDevices()
634
+ * console.log(`Found ${devices.length} registered devices`)
635
+ * devices.forEach(device => {
636
+ * console.log(`Device: ${device.platform} - ${device.fcmToken}`)
637
+ * })
638
+ */
639
+ listRegisteredDevices(overrideHost?: string): Promise<RegisteredDevice[]>;
640
+ private static getStatusFromFee;
641
+ /**
642
+ * Creates payment transaction for message delivery fees
643
+ * TODO: Consider consolidating payment generating logic with a util PeerPayClient can use as well.
644
+ * @private
645
+ * @param {string} recipient - Recipient identity key
646
+ * @param {MessageBoxQuote} quote - Fee quote with delivery and recipient fees
647
+ * @param {string} description - Description for the payment transaction
648
+ * @returns {Promise<Payment>} Payment transaction data
649
+ */
650
+ private createMessagePayment;
439
651
  }
440
- export {};
441
652
  //# sourceMappingURL=MessageBoxClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file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,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB5D;;;;;;;;;;OAUG;IACG,qBAAqB,CAAC,EAC1B,SAAS,EACV,EAAE;QAAE,SAAS,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBpE;;;;;;;;;;OAUG;IACG,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IA8B3D;;;;;;;;;OASG;IACG,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAoD5D;;;;;;;OAOG;IACG,oBAAoB,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;CAazD"}
@@ -1,9 +1,6 @@
1
- export declare class Logger {
2
- private static isEnabled;
3
- static enable(): void;
4
- static disable(): void;
5
- static log(...args: unknown[]): void;
6
- static warn(...args: unknown[]): void;
7
- static error(...args: unknown[]): void;
8
- }
1
+ export declare function enable(): void;
2
+ export declare function disable(): void;
3
+ export declare function log(...args: unknown[]): void;
4
+ export declare function warn(...args: unknown[]): void;
5
+ export declare function error(...args: unknown[]): void;
9
6
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/Utils/logger.ts"],"names":[],"mappings":"AAAA,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAQ;IAEhC,MAAM,CAAC,MAAM,IAAK,IAAI;IAItB,MAAM,CAAC,OAAO,IAAK,IAAI;IAIvB,MAAM,CAAC,GAAG,CAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMrC,MAAM,CAAC,IAAI,CAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMtC,MAAM,CAAC,KAAK,CAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAGxC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../../src/Utils/logger.ts"],"names":[],"mappings":"AAEA,wBAAgB,MAAM,IAAK,IAAI,CAE9B;AAED,wBAAgB,OAAO,IAAK,IAAI,CAE/B;AAED,wBAAgB,GAAG,CAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI7C;AAED,wBAAgB,IAAI,CAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI9C;AAED,wBAAgB,KAAK,CAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAE/C"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Permission and fee management types for MessageBox system
3
+ */
4
+ import { PubKeyHex } from '@bsv/sdk';
5
+ /**
6
+ * Parameters for setting message box permissions
7
+ */
8
+ export interface SetMessageBoxPermissionParams {
9
+ /** The messageBox type (e.g., 'notifications', 'inbox') */
10
+ messageBox: string;
11
+ /** Optional sender - if omitted, sets box-wide default */
12
+ sender?: string;
13
+ /** Recipient fee: -1=block all, 0=always allow, >0=satoshi amount required */
14
+ recipientFee: number;
15
+ }
16
+ /**
17
+ * Parameters for getting message box permissions
18
+ */
19
+ export interface GetMessageBoxPermissionParams {
20
+ /** The recipient's identity key */
21
+ recipient: string;
22
+ /** The messageBox type */
23
+ messageBox: string;
24
+ /** Optional sender - if omitted, gets box-wide default */
25
+ sender?: string;
26
+ }
27
+ /**
28
+ * Permission response from server
29
+ */
30
+ export interface MessageBoxPermission {
31
+ /** Sender identity key (null for box-wide defaults) */
32
+ sender: string | null;
33
+ /** MessageBox type */
34
+ messageBox: string;
35
+ /** Recipient fee setting */
36
+ recipientFee: number;
37
+ /** Permission status derived from recipientFee */
38
+ status: 'always_allow' | 'blocked' | 'payment_required';
39
+ /** Creation timestamp */
40
+ createdAt: string;
41
+ /** Last update timestamp */
42
+ updatedAt: string;
43
+ }
44
+ /**
45
+ * Fee quote response
46
+ */
47
+ export interface MessageBoxQuote {
48
+ /** Server delivery fee */
49
+ deliveryFee: number;
50
+ /** Recipient fee */
51
+ recipientFee: number;
52
+ /** Delivery agent identity key */
53
+ deliveryAgentIdentityKey: PubKeyHex;
54
+ }
55
+ /**
56
+ * Parameters for listing permissions
57
+ */
58
+ export interface ListPermissionsParams {
59
+ /** Optional messageBox filter */
60
+ messageBox?: string;
61
+ /** Optional pagination limit */
62
+ limit?: number;
63
+ /** Optional pagination offset */
64
+ offset?: number;
65
+ }
66
+ /**
67
+ * Parameters for getting fee quote
68
+ */
69
+ export interface GetQuoteParams {
70
+ /** Recipient identity key */
71
+ recipient: string;
72
+ /** MessageBox type */
73
+ messageBox: string;
74
+ }
75
+ //# sourceMappingURL=permissions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../../../src/types/permissions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAA;IAClB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,YAAY,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,CAAA;IACpB,kDAAkD;IAClD,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,kBAAkB,CAAA;IACvD,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,0BAA0B;IAC1B,WAAW,EAAE,MAAM,CAAA;IACnB,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,kCAAkC;IAClC,wBAAwB,EAAE,SAAS,CAAA;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iCAAiC;IACjC,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAA;CACnB"}
@@ -1,4 +1,4 @@
1
- import { Base64String, WalletClient } from '@bsv/sdk';
1
+ import { AtomicBEEF, Base64String, BasketStringUnder300Bytes, BEEF, BooleanDefaultTrue, DescriptionString5to50Bytes, HexString, LabelStringUnder300Bytes, LockingScript, OutputTagStringUnder300Bytes, PositiveIntegerOrZero, PubKeyHex, WalletInterface } from '@bsv/sdk';
2
2
  /**
3
3
  * Configuration options for initializing a MessageBoxClient.
4
4
  */
@@ -7,7 +7,7 @@ export interface MessageBoxClientOptions {
7
7
  * Wallet instance used for auth, identity, and encryption.
8
8
  * If not provided, a new WalletClient will be created.
9
9
  */
10
- walletClient?: WalletClient;
10
+ walletClient?: WalletInterface;
11
11
  /**
12
12
  * Base URL of the MessageBox server.
13
13
  * @default 'https://messagebox.babbage.systems'
@@ -23,6 +23,10 @@ export interface MessageBoxClientOptions {
23
23
  * @default 'local'
24
24
  */
25
25
  networkPreset?: 'local' | 'mainnet' | 'testnet';
26
+ /**
27
+ * Originator of the message box client.
28
+ */
29
+ originator?: string;
26
30
  }
27
31
  /**
28
32
  * Represents a decrypted message received from a MessageBox.
@@ -56,6 +60,9 @@ export interface SendMessageParams {
56
60
  body: string | object;
57
61
  messageId?: string;
58
62
  skipEncryption?: boolean;
63
+ /** Optional: Enable permission and fee checking (default: false for backwards compatibility) */
64
+ checkPermissions?: boolean;
65
+ originator?: string;
59
66
  }
60
67
  /**
61
68
  * Server response structure for successful message delivery.
@@ -73,20 +80,24 @@ export interface SendMessageResponse {
73
80
  *
74
81
  * @property {string[]} messageIds - An array of message IDs to acknowledge.
75
82
  * @property {string} [host] - Optional host URL where the messages originated.
83
+ * @property {string} [originator] - Optional originator of the message box client.
76
84
  */
77
85
  export interface AcknowledgeMessageParams {
78
86
  messageIds: string[];
79
87
  host?: string;
88
+ originator?: string;
80
89
  }
81
90
  /**
82
91
  * Parameters for listing messages in a message box.
83
92
  *
84
93
  * @property messageBox - The identifier of the message box to retrieve messages from.
85
94
  * @property host - (Optional) The host URL to connect to for retrieving messages.
95
+ * @property originator - (Optional) The originator of the message box client.
86
96
  */
87
97
  export interface ListMessagesParams {
88
98
  messageBox: string;
89
99
  host?: string;
100
+ originator?: string;
90
101
  }
91
102
  /**
92
103
  * Encapsulates an AES-256-GCM encrypted message body.
@@ -96,4 +107,71 @@ export interface ListMessagesParams {
96
107
  export interface EncryptedMessage {
97
108
  encryptedMessage: Base64String;
98
109
  }
110
+ export interface AdvertisementToken {
111
+ host: string;
112
+ txid: HexString;
113
+ outputIndex: number;
114
+ lockingScript: LockingScript;
115
+ beef: BEEF;
116
+ }
117
+ export interface Payment {
118
+ tx: AtomicBEEF;
119
+ outputs: Array<{
120
+ outputIndex: PositiveIntegerOrZero;
121
+ protocol: 'wallet payment' | 'basket insertion';
122
+ paymentRemittance?: {
123
+ derivationPrefix: Base64String;
124
+ derivationSuffix: Base64String;
125
+ senderIdentityKey: PubKeyHex;
126
+ };
127
+ insertionRemittance?: {
128
+ basket: BasketStringUnder300Bytes;
129
+ customInstructions?: string;
130
+ tags?: OutputTagStringUnder300Bytes[];
131
+ };
132
+ }>;
133
+ description: DescriptionString5to50Bytes;
134
+ labels?: LabelStringUnder300Bytes[];
135
+ seekPermission?: BooleanDefaultTrue;
136
+ }
137
+ /**
138
+ * Device registration parameters for FCM notifications
139
+ */
140
+ export interface DeviceRegistrationParams {
141
+ /** FCM token from Firebase SDK */
142
+ fcmToken: string;
143
+ /** Optional device identifier */
144
+ deviceId?: string;
145
+ /** Optional platform type */
146
+ platform?: 'ios' | 'android' | 'web';
147
+ }
148
+ /**
149
+ * Device registration response
150
+ */
151
+ export interface DeviceRegistrationResponse {
152
+ status: string;
153
+ message: string;
154
+ deviceId: number;
155
+ }
156
+ /**
157
+ * Registered device information
158
+ */
159
+ export interface RegisteredDevice {
160
+ id: number;
161
+ deviceId: string | null;
162
+ platform: string | null;
163
+ fcmToken: string;
164
+ active: boolean;
165
+ createdAt: string;
166
+ updatedAt: string;
167
+ lastUsed: string;
168
+ }
169
+ /**
170
+ * Response from listing registered devices
171
+ */
172
+ export interface ListDevicesResponse {
173
+ status: string;
174
+ devices: RegisteredDevice[];
175
+ description?: string;
176
+ }
99
177
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAErD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAA;IAE3B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAAA;CAChD;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,G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