@ping-app/ping-openmls-sdk 0.10.0 → 0.10.1

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/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import { M as MessageEnvelope, S as Storage, T as Transport, E as ExpectedOwner,
2
2
  export { u as AddMemberStatus, v as AddMemberVerdict, B as BufferOverflow, w as Bytes, x as CatchupSnapshotEntry, y as ConversationRemoval, z as ConversationUpdate, F as DeviceInfo, G as DeviceRemovalFailure, D as DiscoveredDevice, J as HistoryAppEvent, N as Hlc, O as IdentityRotationFailure, Q as LogGap, V as MessageKind, W as OverflowReason, X as SenderRole, Y as StrandReason, Z as StrandedConversation, _ as WelcomeFailure, $ as WelcomeFailureReason } from './types-B1GFwNXa.cjs';
3
3
  export { IndexedDbStorage } from './storage/indexeddb.cjs';
4
4
  export { WebSocketTransport } from './transport/websocket.cjs';
5
- export { NotificationPreviewOptions, NotificationPreviewSession, openNotificationPreview } from './notification-preview.cjs';
5
+ export { MAX_PREVIEW_PREREQUISITES, NotificationPreviewOptions, NotificationPreviewSession, openNotificationPreview } from './notification-preview.cjs';
6
6
 
7
7
  /**
8
8
  * Ping wire contract version. Bumped on incompatible profile changes.
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { M as MessageEnvelope, S as Storage, T as Transport, E as ExpectedOwner,
2
2
  export { u as AddMemberStatus, v as AddMemberVerdict, B as BufferOverflow, w as Bytes, x as CatchupSnapshotEntry, y as ConversationRemoval, z as ConversationUpdate, F as DeviceInfo, G as DeviceRemovalFailure, D as DiscoveredDevice, J as HistoryAppEvent, N as Hlc, O as IdentityRotationFailure, Q as LogGap, V as MessageKind, W as OverflowReason, X as SenderRole, Y as StrandReason, Z as StrandedConversation, _ as WelcomeFailure, $ as WelcomeFailureReason } from './types-B1GFwNXa.js';
3
3
  export { IndexedDbStorage } from './storage/indexeddb.js';
4
4
  export { WebSocketTransport } from './transport/websocket.js';
5
- export { NotificationPreviewOptions, NotificationPreviewSession, openNotificationPreview } from './notification-preview.js';
5
+ export { MAX_PREVIEW_PREREQUISITES, NotificationPreviewOptions, NotificationPreviewSession, openNotificationPreview } from './notification-preview.js';
6
6
 
7
7
  /**
8
8
  * Ping wire contract version. Bumped on incompatible profile changes.
package/dist/index.js CHANGED
@@ -609,6 +609,7 @@ function reserveLinearMemory(memory) {
609
609
  }
610
610
 
611
611
  // src/notification-preview.ts
612
+ var MAX_PREVIEW_PREREQUISITES = 64;
612
613
  async function openNotificationPreview(opts) {
613
614
  const now = opts.now ?? (() => Date.now());
614
615
  const scoped = opts.accountNamespace !== void 0 && opts.accountNamespace.length > 0 ? scopeStorage(opts.storage, opts.accountNamespace) : opts.storage;
@@ -633,6 +634,16 @@ async function openNotificationPreview(opts) {
633
634
  const result = client.previewEnvelope(envelope, now());
634
635
  return result ?? null;
635
636
  },
637
+ async previewEnvelopeWithPrerequisites(prerequisites, envelope) {
638
+ if (closed) throw new Error("notification-preview session is closed");
639
+ assertPrerequisiteCount(prerequisites);
640
+ const result = client.previewEnvelopeWithPrerequisites(
641
+ prerequisites,
642
+ envelope,
643
+ now()
644
+ );
645
+ return result ?? null;
646
+ },
636
647
  close() {
637
648
  if (closed) return;
638
649
  closed = true;
@@ -640,6 +651,16 @@ async function openNotificationPreview(opts) {
640
651
  }
641
652
  };
642
653
  }
654
+ function assertPrerequisiteCount(prerequisites) {
655
+ if (!Array.isArray(prerequisites)) {
656
+ throw new Error("notification-preview prerequisites must be an array");
657
+ }
658
+ if (prerequisites.length > MAX_PREVIEW_PREREQUISITES) {
659
+ throw new Error(
660
+ `notification-preview takes at most ${MAX_PREVIEW_PREREQUISITES} prerequisite envelopes`
661
+ );
662
+ }
663
+ }
643
664
  function readOnlyStorage(storage) {
644
665
  const refuse = (op) => Promise.reject(
645
666
  new Error(`notification-preview storage is read-only (attempted ${op})`)
@@ -2690,6 +2711,7 @@ export {
2690
2711
  HPKE_PQ_ENC_BYTES,
2691
2712
  HPKE_PQ_PUBLIC_KEY_BYTES,
2692
2713
  IndexedDbStorage,
2714
+ MAX_PREVIEW_PREREQUISITES,
2693
2715
  MessagingClient,
2694
2716
  MessagingClientClosedError,
2695
2717
  NOT_PERMITTED_PREFIX,