@sparkvault/sdk-js 8.14.0 → 9.0.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.
package/README.md CHANGED
@@ -32,14 +32,20 @@ The official SparkVault JavaScript SDK for browser applications. Add passwordles
32
32
 
33
33
  ```bash
34
34
  npm install @sparkvault/sdk-js
35
- # or
36
- yarn add @sparkvault/sdk-js
35
+ ```
36
+
37
+ Both module systems resolve to a working entry through the package's `exports` map:
38
+
39
+ ```js
40
+ import SparkVault from '@sparkvault/sdk-js'; // ESM → dist/index.mjs
41
+ const { SparkVault } = require('@sparkvault/sdk-js'); // CJS → dist/index.cjs
37
42
  ```
38
43
 
39
44
  **Bundle Formats:**
40
- - `sparkvault.js` — UMD bundle for browsers (recommended)
41
- - `sparkvault.esm.js` — ES modules for modern bundlers
42
- - `sparkvault.cjs.js` — CommonJS for Node.js
45
+ - `dist/index.mjs` — ES module, resolved by `import`
46
+ - `dist/index.cjs` — CommonJS, resolved by `require`
47
+ - `dist/sparkvault.js` — UMD bundle for a browser `<script>` tag (also served from the CDN)
48
+ - `dist/index.d.ts` — bundled TypeScript declarations
43
49
 
44
50
  ### Caching & version pinning
45
51
 
@@ -240,6 +246,8 @@ await fetch('/api/auth/login', {
240
246
  | `email` | `string` | Pre-fill email address (mutually exclusive with phone) |
241
247
  | `phone` | `string` | Pre-fill phone in E.164 format, e.g. `"+14155551234"` |
242
248
  | `backdropBlur` | `boolean` | Override backdrop blur setting from app config |
249
+ | `flow` | `"auto" \| "popup" \| "redirect"` | `"auto"` (default) and `"popup"` open the popup; `"redirect"` navigates the tab to the sign-in page instead (its return leg is `handleRedirectResult()`) |
250
+ | `prompt` | `"select_account"` | Always show the sign-in page's account chooser instead of silently continuing as the current account — the affordance for a "switch account" button. Any other value is ignored. |
243
251
  | `onCancel` | `function` | Callback when the person closes the popup without signing in |
244
252
  | `onSuccess` | `function` | Callback on success (before promise resolves) |
245
253
  | `onError` | `function` | Callback on error (before promise rejects) |
package/dist/config.d.ts CHANGED
@@ -24,10 +24,12 @@ export interface SparkVaultConfig {
24
24
  /** Request timeout in milliseconds (default: 30000) */
25
25
  timeout?: number;
26
26
  /**
27
- * Preload Identity configuration on SDK init (default: true).
28
- * When enabled, the /config call is made immediately when the SDK initializes,
29
- * so verify() opens instantly without waiting for the config fetch.
30
- * Set to false to defer config loading until verify() is called.
27
+ * Preload Identity configuration on SDK init (default: true in a browser,
28
+ * false off-DOM). When enabled, the /config call is made immediately when the
29
+ * SDK initializes, so verify() opens instantly without waiting for the config
30
+ * fetch. It buys nothing in a server process — there is no dialog to open —
31
+ * so a Node host does not pay for a network call it will never use.
32
+ * Set explicitly to override in either direction.
31
33
  */
32
34
  preloadConfig?: boolean;
33
35
  /** Enable backdrop blur on dialogs (default: true) */
@@ -196,7 +196,9 @@ function resolveConfig(config) {
196
196
  getAccessToken: config.getAccessToken,
197
197
  apiKey: config.apiKey,
198
198
  clientId: config.clientId,
199
- preloadConfig: config.preloadConfig !== false, // Default: true
199
+ // Preloading warms a dialog that only a browser can open; default it off
200
+ // where there is no DOM so server hosts make no init-time network call.
201
+ preloadConfig: config.preloadConfig ?? typeof window !== 'undefined',
200
202
  backdropBlur: config.backdropBlur !== false, // Default: true
201
203
  allowedDownloadHostPatterns: config.allowedDownloadHostPatterns ?? DEFAULT_ALLOWED_DOWNLOAD_HOST_PATTERNS,
202
204
  };
@@ -866,6 +868,12 @@ function buildSigninUrl(config, options, extras) {
866
868
  params.set('mode', 'simple');
867
869
  params.set('session', authContext.simpleMode.sessionId);
868
870
  }
871
+ // `prompt` is validated here, the single serialization point: only the exact
872
+ // literal reaches the sign-in page; anything else is silently dropped, so a
873
+ // plain-JS caller passing junk degrades to the default behavior.
874
+ if (options.prompt === 'select_account') {
875
+ params.set('prompt', 'select_account');
876
+ }
869
877
  if (extras) {
870
878
  params.set('redirect_uri', extras.redirectUri);
871
879
  params.set('state', extras.state);
@@ -969,11 +977,15 @@ class IdentityApi extends SparkVaultApi {
969
977
  * If preload fails, getConfig() will clear the cache and retry.
970
978
  */
971
979
  preloadConfig() {
972
- if (!this.configCache) {
973
- // Fire and forget - errors are handled when getConfig() is awaited.
974
- // If this fails, getConfig() clears the cache and retries.
975
- this.configCache = this.request('GET', '/config');
980
+ if (this.configCache) {
981
+ return;
976
982
  }
983
+ const pending = this.request('GET', '/config');
984
+ this.configCache = pending;
985
+ // Nobody awaits a background preload, and an unawaited rejection aborts the
986
+ // whole Node process. Attach a terminal handler so the failure stays parked
987
+ // on the cached promise, which getConfig() re-raises to its caller on demand.
988
+ pending.catch(() => { });
977
989
  }
978
990
  /**
979
991
  * Check if config has been preloaded and is ready.
@@ -8566,17 +8578,67 @@ const PORTAL_SECTIONS = ['home', 'identity', 'security', 'sessions', 'sites'];
8566
8578
  // listener but not sessionStorage) is what lets the next load self-heal.
8567
8579
  const PENDING_KEY = 'sv_signin_pending';
8568
8580
  const PENDING_TTL_MS = 10 * 60 * 1000;
8569
- /** True when the pending marker is present and still within its TTL. */
8570
- function hasFreshPendingMarker() {
8581
+ // One-shot: the identifier the recovery bounce is re-minting for. Written only
8582
+ // by the recovery bounce; the return leg consumes it to verify the redeemed
8583
+ // result is for that same account (see consumeHandoffFragment).
8584
+ const RECOVERY_HINT_KEY = 'sv_recovery_hint';
8585
+ /**
8586
+ * Normalize an identifier for equality, mirroring the server: trim, and
8587
+ * lowercase emails (a value containing '@'). Phones compare trimmed-exact.
8588
+ */
8589
+ function normalizeIdentity(value) {
8590
+ const trimmed = value.trim();
8591
+ return trimmed.includes('@') ? trimmed.toLowerCase() : trimmed;
8592
+ }
8593
+ /**
8594
+ * Read and parse the pending marker — JSON `{ at, hint }`, where `hint` is the
8595
+ * email or phone the sign-in was started with (null when the flow collects the
8596
+ * identifier itself). A bare-timestamp value is accepted as `{ at, hint: null }`:
8597
+ * markers live at most 10 minutes in sessionStorage, so any such value
8598
+ * disappears within one deploy window of this parser going live — the fallback
8599
+ * is bounded and never grows. Anything unreadable yields null.
8600
+ */
8601
+ function readPendingMarker() {
8571
8602
  let raw = null;
8572
8603
  try {
8573
8604
  raw = sessionStorage.getItem(PENDING_KEY);
8574
8605
  }
8575
8606
  catch {
8576
- return false;
8607
+ return null;
8608
+ }
8609
+ if (!raw) {
8610
+ return null;
8611
+ }
8612
+ let at = NaN;
8613
+ let hint = null;
8614
+ try {
8615
+ const parsed = JSON.parse(raw);
8616
+ if (typeof parsed === 'object' && parsed !== null) {
8617
+ const marker = parsed;
8618
+ if (typeof marker.at === 'number') {
8619
+ at = marker.at;
8620
+ }
8621
+ if (typeof marker.hint === 'string' && marker.hint) {
8622
+ hint = marker.hint;
8623
+ }
8624
+ }
8625
+ else if (typeof parsed === 'number') {
8626
+ // A bare timestamp parses as a JSON number.
8627
+ at = parsed;
8628
+ }
8577
8629
  }
8578
- const at = raw ? Number(raw) : NaN;
8579
- return Number.isFinite(at) && Date.now() - at < PENDING_TTL_MS;
8630
+ catch {
8631
+ at = Number(raw);
8632
+ }
8633
+ return Number.isFinite(at) ? { at, hint } : null;
8634
+ }
8635
+ /** True while a marker is within the self-heal TTL. */
8636
+ function isFreshPendingMarker(marker) {
8637
+ return marker !== null && Date.now() - marker.at < PENDING_TTL_MS;
8638
+ }
8639
+ /** True when the pending marker is present and still within its TTL. */
8640
+ function hasFreshPendingMarker() {
8641
+ return isFreshPendingMarker(readPendingMarker());
8580
8642
  }
8581
8643
  /**
8582
8644
  * Whether `handleRedirectResult()` has anything to do on this load — a returned
@@ -8846,7 +8908,8 @@ class IdentityModule {
8846
8908
  // the backgrounded opener tab, killing the postMessage listener),
8847
8909
  // handleRedirectResult() can silently self-heal on the next load from
8848
8910
  // the SSO session the popup login established.
8849
- this.markSignInPending();
8911
+ const pendingHint = mergedOptions.email || mergedOptions.phone || null;
8912
+ this.markSignInPending(pendingHint);
8850
8913
  this.launcher = new DialogLauncher(this.config, this.api, mergedOptions, {
8851
8914
  onSuccess: (result) => { this.clearSignInPending(); hostCallbacks.onSuccess(result); },
8852
8915
  onError: (error) => { this.clearSignInPending(); hostCallbacks.onError(error); },
@@ -8855,7 +8918,7 @@ class IdentityModule {
8855
8918
  // no-result end retires the marker (no spurious bounce on a reload
8856
8919
  // while the retry alert is up); "Try again" re-arms it.
8857
8920
  onPopupClosedUnresolved: () => this.clearSignInPending(),
8858
- onPopupReopened: () => this.markSignInPending(),
8921
+ onPopupReopened: () => this.markSignInPending(pendingHint),
8859
8922
  // COOP-severed popup: postMessage can never deliver, so switch this tab
8860
8923
  // to the redirect flow (returns via handleRedirectResult). The pending
8861
8924
  // marker stays armed — the returned #sv_code fragment retires it.
@@ -8893,6 +8956,7 @@ class IdentityModule {
8893
8956
  email: options.email,
8894
8957
  phone: options.phone,
8895
8958
  authContext: options.authContext,
8959
+ prompt: options.prompt,
8896
8960
  onSuccess: options.onSuccess,
8897
8961
  onError: options.onError,
8898
8962
  onCancel: options.onCancel,
@@ -9008,8 +9072,9 @@ class IdentityModule {
9008
9072
  }
9009
9073
  // No returned result. If a sign-in was in flight and its result never
9010
9074
  // arrived, self-heal once from the SSO session (mobile opener-tab discard).
9011
- if (this.consumeSignInPending()) {
9012
- await this.startRecoveryBounce();
9075
+ const pending = this.consumeSignInPending();
9076
+ if (pending.fresh) {
9077
+ await this.startRecoveryBounce(pending.hint);
9013
9078
  }
9014
9079
  return null;
9015
9080
  }
@@ -9026,9 +9091,11 @@ class IdentityModule {
9026
9091
  // (and a StrictMode double-invocation finds an empty hash and no-ops).
9027
9092
  let expectedState = null;
9028
9093
  let codeVerifier = null;
9094
+ let expectedRecoveryIdentity = null;
9029
9095
  try {
9030
9096
  expectedState = sessionStorage.getItem('sv_oauth_state');
9031
9097
  codeVerifier = sessionStorage.getItem('sv_pkce_verifier');
9098
+ expectedRecoveryIdentity = sessionStorage.getItem(RECOVERY_HINT_KEY);
9032
9099
  this.clearOneShotAuthState();
9033
9100
  }
9034
9101
  catch {
@@ -9058,6 +9125,18 @@ class IdentityModule {
9058
9125
  sessionId: raw.session_id ?? undefined,
9059
9126
  refreshToken: raw.refresh_token ?? undefined,
9060
9127
  };
9128
+ // A recovery bounce carries the identifier the interrupted sign-in was
9129
+ // addressing, but /sso treats a hint matching no hub session like no hint
9130
+ // at all (anti-oracle) — so the bounce can come back holding a DIFFERENT
9131
+ // single-eligible account. The client is the one place that knows which
9132
+ // account the person was signing in to: a mismatched result is discarded,
9133
+ // never handed to the host (a wrong-account handoff). Silent — no
9134
+ // onError — falling through to interactive sign-in, matching the recovery
9135
+ // flow's non-oracle posture.
9136
+ if (expectedRecoveryIdentity &&
9137
+ normalizeIdentity(expectedRecoveryIdentity) !== normalizeIdentity(result.identity)) {
9138
+ return null;
9139
+ }
9061
9140
  options.onSuccess?.(result);
9062
9141
  return result;
9063
9142
  }
@@ -9076,11 +9155,41 @@ class IdentityModule {
9076
9155
  * so a hostile/degraded environment simply never recovers rather than
9077
9156
  * erroring.
9078
9157
  */
9079
- async startRecoveryBounce() {
9080
- const nav = await this.prepareHandoffNavigation(`${this.config.identityBaseUrl}/${this.config.accountId}/sso`);
9158
+ async startRecoveryBounce(loginHint) {
9159
+ const sso = new URL(`${this.config.identityBaseUrl}/${this.config.accountId}/sso`);
9160
+ // With several hub sessions, login_hint tells /sso which account the
9161
+ // interrupted sign-in was addressing, so recovery never re-mints another.
9162
+ // Also stash it one-shot: a hint matching no hub session deliberately
9163
+ // behaves server-side like no hint at all (anti-oracle), so the return leg
9164
+ // must verify the redeemed identity is the one this sign-in was for.
9165
+ try {
9166
+ if (loginHint) {
9167
+ sessionStorage.setItem(RECOVERY_HINT_KEY, loginHint);
9168
+ }
9169
+ else {
9170
+ sessionStorage.removeItem(RECOVERY_HINT_KEY);
9171
+ }
9172
+ }
9173
+ catch {
9174
+ // No storage → prepareHandoffNavigation bails below; nothing to verify.
9175
+ }
9176
+ if (loginHint) {
9177
+ sso.searchParams.set('login_hint', loginHint);
9178
+ }
9179
+ const nav = await this.prepareHandoffNavigation(sso.toString());
9081
9180
  if (nav) {
9082
9181
  window.location.assign(nav);
9083
9182
  }
9183
+ else {
9184
+ // The bounce never left (no storage or WebCrypto) — retire the stash so
9185
+ // it cannot linger into an unrelated later return leg.
9186
+ try {
9187
+ sessionStorage.removeItem(RECOVERY_HINT_KEY);
9188
+ }
9189
+ catch {
9190
+ // Storage disabled: nothing was persisted, nothing to clear.
9191
+ }
9192
+ }
9084
9193
  }
9085
9194
  /**
9086
9195
  * Explicit `flow: 'redirect'` — navigate this tab to the interactive sign-in
@@ -9140,9 +9249,16 @@ class IdentityModule {
9140
9249
  url.searchParams.set('code_challenge', codeChallenge);
9141
9250
  return url.toString();
9142
9251
  }
9143
- markSignInPending() {
9252
+ /**
9253
+ * Arm the self-heal marker for an in-flight sign-in. `hint` is the identifier
9254
+ * (email or phone) the sign-in was started with, when the caller supplied
9255
+ * one — the recovery bounce forwards it as the /sso `login_hint`, so with
9256
+ * several hub sessions recovery re-mints the account this sign-in was for,
9257
+ * never a different one.
9258
+ */
9259
+ markSignInPending(hint) {
9144
9260
  try {
9145
- sessionStorage.setItem(PENDING_KEY, String(Date.now()));
9261
+ sessionStorage.setItem(PENDING_KEY, JSON.stringify({ at: Date.now(), hint }));
9146
9262
  }
9147
9263
  catch {
9148
9264
  // No storage → no self-heal; the popup still delivers when it can.
@@ -9156,11 +9272,16 @@ class IdentityModule {
9156
9272
  // Nothing to clear.
9157
9273
  }
9158
9274
  }
9159
- /** True once (then cleared) if a recent sign-in is still awaiting its result. */
9275
+ /**
9276
+ * Consume the pending marker: `fresh` is true once (then cleared) if a recent
9277
+ * sign-in is still awaiting its result; `hint` is the identifier that sign-in
9278
+ * carried, for the recovery bounce's `login_hint`.
9279
+ */
9160
9280
  consumeSignInPending() {
9161
- const fresh = hasFreshPendingMarker();
9281
+ const marker = readPendingMarker();
9282
+ const fresh = isFreshPendingMarker(marker);
9162
9283
  this.clearSignInPending();
9163
- return fresh;
9284
+ return { fresh, hint: fresh ? marker.hint : null };
9164
9285
  }
9165
9286
  /** Remove the result fragment from the URL bar (and history entry). */
9166
9287
  clearUrlFragment() {
@@ -9168,11 +9289,12 @@ class IdentityModule {
9168
9289
  window.history.replaceState(window.history.state, document.title, `${window.location.pathname}${window.location.search}`);
9169
9290
  }
9170
9291
  }
9171
- /** Drop the one-shot PKCE state/verifier a redirect bounce staged. */
9292
+ /** Drop the one-shot PKCE state/verifier (+ recovery hint) a bounce staged. */
9172
9293
  clearOneShotAuthState() {
9173
9294
  try {
9174
9295
  sessionStorage.removeItem('sv_oauth_state');
9175
9296
  sessionStorage.removeItem('sv_pkce_verifier');
9297
+ sessionStorage.removeItem(RECOVERY_HINT_KEY);
9176
9298
  }
9177
9299
  catch {
9178
9300
  // Storage disabled: nothing was persisted, nothing to clear.
@@ -9309,8 +9431,9 @@ class IdentityModule {
9309
9431
  *
9310
9432
  * The counterpart to `sv.notify`: where that module is session-scoped and reads
9311
9433
  * only the signed-in person's OWN inbox, this one is the account-scoped product
9312
- * surface a tenant's BACKEND drives — send, sender-side inbox reads and state,
9313
- * send status, receipts, and the account's Notify config. Every method maps to
9434
+ * surface a tenant's BACKEND drives — send, send history, recall, sender-side
9435
+ * inbox reads and state, send status, receipts, and the account's Notify config.
9436
+ * Every method maps to
9314
9437
  * `/v1/products/notify/*` and is authorized by the caller's account, so the
9315
9438
  * recipient is supplied explicitly rather than derived from a session.
9316
9439
  *
@@ -9362,15 +9485,22 @@ const NOTIFY_PRESETS = Object.freeze({
9362
9485
  channels: ['in_app', 'push', 'web_push', 'email'],
9363
9486
  policy: { verificationLevel: 'identifier', interaction: 'reply' },
9364
9487
  },
9488
+ // `approval` and `signatureRequest` verify at `identifier`, not `passkey`: a
9489
+ // passkey-level grant is only satisfiable by a recipient who ALREADY has a
9490
+ // passkey registered with SparkVault, and the recipient ceremony cannot enrol
9491
+ // one mid-flight — a passkey default strands every first-time raw-email
9492
+ // recipient on a request they can never answer. Pass
9493
+ // `policy: { verificationLevel: 'passkey' }` explicitly when the audience is
9494
+ // known to be enrolled.
9365
9495
  approval: {
9366
9496
  category: 'approval',
9367
9497
  channels: ['in_app', 'push', 'web_push', 'email'],
9368
- policy: { verificationLevel: 'passkey', interaction: 'approve' },
9498
+ policy: { verificationLevel: 'identifier', interaction: 'approve' },
9369
9499
  },
9370
9500
  signatureRequest: {
9371
9501
  category: 'signature',
9372
9502
  channels: ['in_app', 'push', 'web_push', 'email'],
9373
- policy: { verificationLevel: 'passkey', interaction: 'sign' },
9503
+ policy: { verificationLevel: 'identifier', interaction: 'sign' },
9374
9504
  },
9375
9505
  });
9376
9506
  /**
@@ -9460,11 +9590,11 @@ class NotifyProductModule {
9460
9590
  async sendConversation(options) {
9461
9591
  return this.send(buildNotifyPresetSend('conversation', options));
9462
9592
  }
9463
- /** High-stakes approve/deny — passkey-verified, with `action_hash` binding. */
9593
+ /** High-stakes approve/deny — identifier-verified, with `action_hash` binding. */
9464
9594
  async sendApproval(options) {
9465
9595
  return this.send(buildNotifyPresetSend('approval', options));
9466
9596
  }
9467
- /** Signature-on-delivery — passkey-verified, with `action_hash` binding. */
9597
+ /** Signature-on-delivery — identifier-verified, with `action_hash` binding. */
9468
9598
  async sendSignatureRequest(options) {
9469
9599
  return this.send(buildNotifyPresetSend('signatureRequest', options));
9470
9600
  }
@@ -9550,6 +9680,76 @@ class NotifyProductModule {
9550
9680
  });
9551
9681
  return response.data;
9552
9682
  }
9683
+ // ── Send history & recall ───────────────────────────────────────────────────
9684
+ /**
9685
+ * The account's send history, newest first — what you sent, to how many, and
9686
+ * how it landed.
9687
+ *
9688
+ * Metadata only by construction: the history index does not project the
9689
+ * audience, so no recipient contact or SparkLink pointer can travel here. Take
9690
+ * `getSendStatus(sendId)` for the per-recipient detail.
9691
+ *
9692
+ * Real pagination: a null `cursor` means the end of the account's history.
9693
+ *
9694
+ * @example
9695
+ * let cursor: string | undefined;
9696
+ * do {
9697
+ * const page = await sv.products.notify.listSends({ cursor, limit: 50 });
9698
+ * for (const send of page.sends) {
9699
+ * console.log(send.created_at, send.title, send.state,
9700
+ * `${send.delivered_count ?? '?'} / ${send.recipient_count ?? '?'}`);
9701
+ * }
9702
+ * cursor = page.cursor ?? undefined;
9703
+ * } while (cursor);
9704
+ */
9705
+ async listSends(options = {}) {
9706
+ const query = buildQuery$3({ limit: options.limit, cursor: options.cursor });
9707
+ const response = await this.http.get(`${BASE_PATH}/sends${query}`);
9708
+ return response.data;
9709
+ }
9710
+ /**
9711
+ * Recall a sealed send: revoke the single-use SparkLink grants it minted, so
9712
+ * the content can no longer be revealed.
9713
+ *
9714
+ * `mode: 'grant'` (the default) drops access and leaves the content intact.
9715
+ * `mode: 'content'` hard-burns the sealed spark so it is unreadable for
9716
+ * everyone — spark-backed sends only, since an ingot send merely references the
9717
+ * owner's durable vault content.
9718
+ *
9719
+ * Idempotent: a grant already revoked (or already consumed) counts as recalled,
9720
+ * so a repeated call converges rather than accumulating failures. One
9721
+ * recipient's failure never stops the rest — the response reports every one.
9722
+ *
9723
+ * PLAINTEXT SENDS CANNOT BE RECALLED (400): they delivered their body inline,
9724
+ * in the clear, and minted no grant. There is nothing to revoke, and saying
9725
+ * otherwise would be a lie about the one thing you are asking.
9726
+ *
9727
+ * @example
9728
+ * // Whole audience, access only
9729
+ * await sv.products.notify.recallSend(send.send_id);
9730
+ *
9731
+ * // One recipient, burn the content for everyone
9732
+ * const { recalled, failed } = await sv.products.notify.recallSend(send.send_id, {
9733
+ * recipientIds: [user.svid],
9734
+ * mode: 'content',
9735
+ * });
9736
+ */
9737
+ async recallSend(sendId, options = {}) {
9738
+ requireSendId(sendId);
9739
+ if (options.recipientIds !== undefined) {
9740
+ if (!Array.isArray(options.recipientIds) || options.recipientIds.length === 0) {
9741
+ throw new ValidationError('recipientIds must be a non-empty array; omit it entirely to recall the whole audience', { field: 'recipientIds', received: options.recipientIds });
9742
+ }
9743
+ }
9744
+ if (options.mode !== undefined && options.mode !== 'grant' && options.mode !== 'content') {
9745
+ throw new ValidationError("mode must be 'grant' or 'content'", {
9746
+ field: 'mode',
9747
+ received: options.mode,
9748
+ });
9749
+ }
9750
+ const response = await this.http.post(`${BASE_PATH}/sends/${encodeURIComponent(sendId)}/recall`, { recipient_ids: options.recipientIds, mode: options.mode });
9751
+ return response.data;
9752
+ }
9553
9753
  // ── Status & receipts ───────────────────────────────────────────────────────
9554
9754
  /**
9555
9755
  * The sender's per-recipient delivery rollup for one send: who it reached and
@@ -9567,13 +9767,14 @@ class NotifyProductModule {
9567
9767
  * The account's verified-interaction receipts (portable, JWKS-verifiable
9568
9768
  * proofs), newest first. Follow `cursor` to page.
9569
9769
  *
9570
- * A page can come back SHORT of `limit` — even EMPTY — yet still carry a
9571
- * non-null cursor: the receipt-subtype and `interaction` filters are applied
9572
- * after the key query, so a page of non-matching rows yields no receipts and a
9573
- * live cursor. Follow the cursor; never treat a short or empty page as the end.
9770
+ * `source` says which store answered. `receipt_index` is the normal path — a
9771
+ * bounded query with real pagination. `legacy_scan` appears only for an account
9772
+ * whose receipts all predate that index; it filters the account audit log, so
9773
+ * it can hand back EMPTY pages that are nowhere near the end. On EITHER source,
9774
+ * follow the cursor until it is null before concluding there are none.
9574
9775
  *
9575
9776
  * @example
9576
- * const { receipts, cursor } = await sv.products.notify.listReceipts({ interaction: 'approve' });
9777
+ * const { receipts, cursor, source } = await sv.products.notify.listReceipts({ interaction: 'approve' });
9577
9778
  */
9578
9779
  async listReceipts(options = {}) {
9579
9780
  const query = buildQuery$3({
@@ -9626,12 +9827,21 @@ class NotifyProductModule {
9626
9827
  * a seeded default from re-appearing on the next merge. The reserved `security`
9627
9828
  * category can neither be removed nor made optional.
9628
9829
  *
9830
+ * The `events` section configures the outbound event webhook: `webhook_url`
9831
+ * must be https on a public host, and `secret` (16-256 chars) signs every event
9832
+ * body as `X-SparkVault-Signature: hex(HMAC-SHA256(secret, rawBody))`. The
9833
+ * secret is WRITE-ONLY — reads report `events.secret_set`, never the value.
9834
+ *
9629
9835
  * @example
9630
9836
  * await sv.products.notify.updateConfig({
9631
9837
  * categories: {
9632
9838
  * weekly_newsletter: { label: 'Weekly newsletter', required: false },
9633
9839
  * marketing: null, // tombstone — remove the seeded default
9634
9840
  * },
9841
+ * events: {
9842
+ * webhook_url: 'https://api.example.com/hooks/sparkvault',
9843
+ * secret: process.env.SPARKVAULT_EVENT_SECRET,
9844
+ * },
9635
9845
  * });
9636
9846
  */
9637
9847
  async updateConfig(patch) {
@@ -14587,7 +14797,7 @@ class SparkVault {
14587
14797
  }
14588
14798
  /** Get the SDK version */
14589
14799
  static get version() {
14590
- return '__VERSION__';
14800
+ return '9.0.0';
14591
14801
  }
14592
14802
  }
14593
14803
  if (typeof window !== 'undefined') {
@@ -14623,4 +14833,4 @@ exports.buildNotifyPresetSend = buildNotifyPresetSend;
14623
14833
  exports.default = SparkVault;
14624
14834
  exports.logger = logger;
14625
14835
  exports.setDebugMode = setDebugMode;
14626
- //# sourceMappingURL=sparkvault.cjs.js.map
14836
+ //# sourceMappingURL=index.cjs.map