@sparkvault/sdk-js 10.0.1 → 11.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 +9 -4
- package/dist/api-base.d.ts +46 -11
- package/dist/config.d.ts +5 -3
- package/dist/entropy/index.d.ts +0 -1
- package/dist/entropy/types.d.ts +1 -1
- package/dist/errors.d.ts +18 -2
- package/dist/folders/index.d.ts +3 -1
- package/dist/http.d.ts +11 -6
- package/dist/index.cjs +8207 -7265
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +510 -297
- package/dist/index.mjs +8206 -7266
- package/dist/index.mjs.map +1 -1
- package/dist/ingots/fetch-download.d.ts +48 -0
- package/dist/ingots/index.d.ts +29 -14
- package/dist/ingots/types.d.ts +98 -43
- package/dist/notify/types.d.ts +7 -2
- package/dist/products/identity/api.d.ts +30 -14
- package/dist/products/identity/handlers/index.d.ts +1 -1
- package/dist/products/identity/handlers/passkey-handler.d.ts +4 -13
- package/dist/products/identity/handlers/sparklink-handler.d.ts +0 -1
- package/dist/products/identity/index.d.ts +23 -6
- package/dist/products/identity/inline-container.d.ts +13 -26
- package/dist/products/identity/modal.d.ts +16 -42
- package/dist/products/identity/renderer.d.ts +31 -10
- package/dist/products/identity/types.d.ts +17 -5
- package/dist/products/identity/types.test-d.d.ts +21 -0
- package/dist/products/identity/utils.d.ts +9 -16
- package/dist/products/identity/views/base.d.ts +4 -21
- package/dist/products/identity/views/identity-input.d.ts +4 -2
- package/dist/products/index.d.ts +1 -1
- package/dist/products/notify/index.d.ts +29 -19
- package/dist/products/notify/types.d.ts +74 -37
- package/dist/products/notify/types.test-d.d.ts +1 -0
- package/dist/request-path.d.ts +44 -0
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/dist/ui/chrome.d.ts +16 -0
- package/dist/ui/ds-tokens.d.ts +58 -0
- package/dist/ui/inline-shell.d.ts +19 -0
- package/dist/ui/modal-shell.d.ts +36 -0
- package/dist/ui/target.d.ts +6 -0
- package/dist/vaults/index.d.ts +11 -6
- package/dist/vaults/upload/api.d.ts +21 -9
- package/dist/vaults/upload/chrome.d.ts +8 -22
- package/dist/vaults/upload/container.d.ts +0 -8
- package/dist/vaults/upload/index.d.ts +1 -1
- package/dist/vaults/upload/inline-container.d.ts +13 -42
- package/dist/vaults/upload/modal.d.ts +14 -33
- package/dist/vaults/upload/renderer.d.ts +0 -1
- package/dist/vaults/upload/styles.d.ts +4 -2
- package/dist/vaults/upload/types.d.ts +2 -2
- package/package.json +2 -2
- package/dist/utils/base64url.d.ts +0 -52
|
@@ -1,47 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Identity Modal Container
|
|
3
3
|
*
|
|
4
|
-
* Single responsibility:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Single responsibility: the identity dialog's chrome (branded header, body,
|
|
5
|
+
* footer) inside the SDK's shared modal shell, which owns the dialog
|
|
6
|
+
* behaviour (dismissal, scroll lock, focus). Does NOT handle content
|
|
7
|
+
* rendering - that's the Renderer's job.
|
|
7
8
|
*/
|
|
8
9
|
import type { SdkConfigBranding } from './types';
|
|
9
10
|
import type { Container } from './container';
|
|
10
|
-
export interface ModalOptions {
|
|
11
|
-
branding: SdkConfigBranding;
|
|
12
|
-
/** Enable backdrop blur (default: true) */
|
|
13
|
-
backdropBlur?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export interface ModalContainerElements {
|
|
16
|
-
overlay: HTMLDivElement;
|
|
17
|
-
modal: HTMLDivElement;
|
|
18
|
-
header: HTMLDivElement;
|
|
19
|
-
body: HTMLDivElement;
|
|
20
|
-
footer: HTMLDivElement;
|
|
21
|
-
}
|
|
22
11
|
export declare class ModalContainer implements Container {
|
|
23
|
-
private
|
|
12
|
+
private shell;
|
|
13
|
+
private body;
|
|
14
|
+
private header;
|
|
24
15
|
private onCloseCallback;
|
|
25
|
-
private keydownHandler;
|
|
26
|
-
private overlayClickHandler;
|
|
27
|
-
private closeBtnClickHandler;
|
|
28
|
-
private closeBtn;
|
|
29
|
-
private backdropBlur;
|
|
30
16
|
private effectiveTheme;
|
|
31
|
-
private headerElement;
|
|
32
17
|
private floatingCloseBtn;
|
|
33
|
-
private floatingCloseHandler;
|
|
34
18
|
/**
|
|
35
|
-
* Create and show the modal immediately with loading state
|
|
36
|
-
*
|
|
37
|
-
* This provides instant visual feedback to the user.
|
|
19
|
+
* Create and show the modal immediately with loading state, in default
|
|
20
|
+
* branding until the real config loads, so the user gets instant feedback.
|
|
38
21
|
*/
|
|
39
22
|
createLoading(options: {
|
|
40
23
|
backdropBlur?: boolean;
|
|
41
|
-
}, onClose: () => void):
|
|
24
|
+
}, onClose: () => void): void;
|
|
42
25
|
/**
|
|
43
|
-
* Update the
|
|
44
|
-
*
|
|
26
|
+
* Update the header and styles with the real branding once the SDK config
|
|
27
|
+
* loads.
|
|
45
28
|
*/
|
|
46
29
|
updateBranding(branding: SdkConfigBranding): void;
|
|
47
30
|
/**
|
|
@@ -51,15 +34,10 @@ export declare class ModalContainer implements Container {
|
|
|
51
34
|
*/
|
|
52
35
|
setMinimalChrome(enabled: boolean): void;
|
|
53
36
|
/**
|
|
54
|
-
* Update the backdrop blur setting
|
|
55
|
-
*
|
|
37
|
+
* Update the backdrop blur setting with the resolved value (client
|
|
38
|
+
* override > server config > default).
|
|
56
39
|
*/
|
|
57
40
|
updateBackdropBlur(enabled: boolean): void;
|
|
58
|
-
/**
|
|
59
|
-
* Create and show the modal container.
|
|
60
|
-
* Returns the container elements for the renderer to populate.
|
|
61
|
-
*/
|
|
62
|
-
create(options: ModalOptions, onClose: () => void): ModalContainerElements;
|
|
63
41
|
private createHeader;
|
|
64
42
|
private handleClose;
|
|
65
43
|
/**
|
|
@@ -71,12 +49,8 @@ export declare class ModalContainer implements Container {
|
|
|
71
49
|
*/
|
|
72
50
|
isOpen(): boolean;
|
|
73
51
|
/**
|
|
74
|
-
* Destroy the modal
|
|
52
|
+
* Destroy the modal; the shell removes its listeners, releases the scroll
|
|
53
|
+
* lock and returns focus.
|
|
75
54
|
*/
|
|
76
55
|
destroy(): void;
|
|
77
56
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Escape HTML to prevent XSS.
|
|
80
|
-
* Used for any user-provided content rendered in the modal.
|
|
81
|
-
*/
|
|
82
|
-
export declare function escapeHtml(str: string): string;
|
|
@@ -206,6 +206,15 @@ export declare class IdentityRenderer {
|
|
|
206
206
|
* User clicked "Back" or cancelled registration after being prompted.
|
|
207
207
|
*/
|
|
208
208
|
private handlePasskeyRegistrationSkip;
|
|
209
|
+
/**
|
|
210
|
+
* Leave for the social provider. The renderer runs on the Identity origin's
|
|
211
|
+
* sign-in page, and the round trip returns to that same page — query intact,
|
|
212
|
+
* because the query carries the destination the page was opened for (the
|
|
213
|
+
* popup's `origin`, or the redirect mode's handoff parameters), which the
|
|
214
|
+
* page re-gates before releasing the result. The state stored here is what
|
|
215
|
+
* the returning page's `#token` must answer; it is drawn from the Entropy
|
|
216
|
+
* service through the Identity origin, the page's own.
|
|
217
|
+
*/
|
|
209
218
|
private handleSocialLogin;
|
|
210
219
|
private normalizeError;
|
|
211
220
|
/**
|
|
@@ -286,32 +295,44 @@ export declare class IdentityRenderer {
|
|
|
286
295
|
private openSparkLinkWebSocket;
|
|
287
296
|
/**
|
|
288
297
|
* Set up WebSocket message handler for SparkLink verification results.
|
|
289
|
-
* Handles: sparklink_verified, sparklink_failed,
|
|
298
|
+
* Handles: sparklink_verified, sparklink_second_factor, sparklink_failed,
|
|
299
|
+
* sparklink_resent.
|
|
290
300
|
*/
|
|
291
301
|
private setupSparkLinkWsHandler;
|
|
292
302
|
/**
|
|
293
|
-
*
|
|
303
|
+
* Act on what the SparkLink click produced, from either channel (WebSocket
|
|
304
|
+
* push or kindling reclaim).
|
|
294
305
|
*
|
|
295
|
-
*
|
|
296
|
-
* redirect URL) before attempting top-level
|
|
297
|
-
* is the source of truth for what
|
|
298
|
-
* the SDK's window.location.href call is a fallback for hosts that
|
|
299
|
-
*
|
|
306
|
+
* A completed login runs the post-login pipeline, which hands the host the
|
|
307
|
+
* full result (including any redirect URL) before attempting top-level
|
|
308
|
+
* navigation — the host page is the source of truth for what happens next;
|
|
309
|
+
* the SDK's window.location.href call is a fallback for hosts that delegate
|
|
310
|
+
* navigation entirely to the SDK. A login held at the second-factor gate
|
|
311
|
+
* opens the two-factor view, exactly as after an emailed code.
|
|
312
|
+
*/
|
|
313
|
+
private applySparkLinkOutcome;
|
|
314
|
+
/**
|
|
315
|
+
* The push delivered the click's result, but the click also persisted a
|
|
316
|
+
* fallback copy for the kindling reclaim. Burn it so neither a completed
|
|
317
|
+
* login nor a pending challenge stays claimable. Best-effort,
|
|
318
|
+
* fire-and-forget; must run before cleanup clears the kindling.
|
|
300
319
|
*/
|
|
301
|
-
private
|
|
320
|
+
private burnSparkLinkFallback;
|
|
321
|
+
/** End the SparkLink wait on a failed or unusable result. */
|
|
322
|
+
private failSparkLink;
|
|
302
323
|
/**
|
|
303
324
|
* Arm the WebSocket-loss fallback for the waiting screen.
|
|
304
325
|
*
|
|
305
326
|
* While waiting for the emailed link, the socket can be dropped when the tab
|
|
306
327
|
* is suspended (mobile: the user leaves to the mail app). On refocus, if the
|
|
307
|
-
* socket is no longer open, reclaim the
|
|
328
|
+
* socket is no longer open, reclaim the click's result once by kindling. A
|
|
308
329
|
* single ~2s retry covers returning before the server finished writing it.
|
|
309
330
|
* Deliberately NOT a polling loop — it fires only on refocus, and only when
|
|
310
331
|
* the socket is actually gone.
|
|
311
332
|
*/
|
|
312
333
|
private armSparkLinkRefocusClaim;
|
|
313
334
|
/**
|
|
314
|
-
* Reclaim the
|
|
335
|
+
* Reclaim the click's result by kindling. Single attempt; if still pending
|
|
315
336
|
* and allowRetry, schedule exactly one ~2s retry, then stop (the next refocus
|
|
316
337
|
* or Resend can try again).
|
|
317
338
|
*/
|
|
@@ -220,12 +220,10 @@ export interface SdkConfig {
|
|
|
220
220
|
/** WebSocket domain for SparkLink push notifications (e.g., 'ws.sparkvault.com') */
|
|
221
221
|
wsDomain?: string;
|
|
222
222
|
/** Cross-domain SSO posture. `enabled`: this account participates in silent
|
|
223
|
-
* SSO.
|
|
224
|
-
*
|
|
225
|
-
* SDK does not currently branch on either flag. */
|
|
223
|
+
* SSO. Informational: the server enforces it on its SSO endpoints, and the
|
|
224
|
+
* SDK does not branch on it. */
|
|
226
225
|
sso?: {
|
|
227
226
|
enabled: boolean;
|
|
228
|
-
forced: boolean;
|
|
229
227
|
};
|
|
230
228
|
}
|
|
231
229
|
/** Method metadata for SDK rendering (static lookup) */
|
|
@@ -348,8 +346,22 @@ export interface SecondFactorVerifyResponse {
|
|
|
348
346
|
/** Backup-identifier nudge hint (snake_case from the API). */
|
|
349
347
|
recommendations?: RawRecommendation[];
|
|
350
348
|
}
|
|
349
|
+
/**
|
|
350
|
+
* What a SparkLink click produced for the sign-in waiting on it — pushed over
|
|
351
|
+
* the WebSocket, or reclaimed by kindling when the socket was lost. Either the
|
|
352
|
+
* login completed, or it is held at the second-factor gate and the SDK
|
|
353
|
+
* collects the code in its two-factor view.
|
|
354
|
+
*/
|
|
355
|
+
export type SparkLinkOutcome = {
|
|
356
|
+
kind: 'verified';
|
|
357
|
+
result: VerifyResult;
|
|
358
|
+
} | {
|
|
359
|
+
kind: 'second_factor';
|
|
360
|
+
ticket: string;
|
|
361
|
+
methods: string[];
|
|
362
|
+
};
|
|
363
|
+
/** The send's answer: never the link itself, which only the email carries. */
|
|
351
364
|
export interface SparkLinkSendResponse {
|
|
352
|
-
sparkId: string;
|
|
353
365
|
expiresAt: number;
|
|
354
366
|
/** Login-ceremony handle for the WebSocket-loss fallback claim (see api.consumeSparkLinkResult). */
|
|
355
367
|
kindling?: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity wire-contract assertions — COMPILE-TIME ONLY.
|
|
3
|
+
*
|
|
4
|
+
* These types have no runtime, so a unit test can never catch them drifting from
|
|
5
|
+
* the server: the transpiler strips them and every assertion passes. This file is
|
|
6
|
+
* the gate instead — `tsc --noEmit` (`pnpm typecheck`) fails the moment a
|
|
7
|
+
* declared shape stops matching what the Identity product actually answers.
|
|
8
|
+
*
|
|
9
|
+
* It is deliberately NOT a `*.test.ts`: that suffix is excluded from `tsconfig`,
|
|
10
|
+
* which would put these assertions exactly where the compiler cannot see them.
|
|
11
|
+
* Nothing imports this module, so it never reaches the bundle.
|
|
12
|
+
*/
|
|
13
|
+
import type { SparkLinkSendResponse } from './types';
|
|
14
|
+
/** Fails to compile unless `T` resolves to exactly `true`. */
|
|
15
|
+
type Assert<T extends true> = T;
|
|
16
|
+
/** Invariant type equality: `A` and `B` must be the SAME type, not merely mutually assignable. */
|
|
17
|
+
type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
|
|
18
|
+
export type IdentityWireContract = [
|
|
19
|
+
Assert<Equals<keyof SparkLinkSendResponse, 'expiresAt' | 'kindling'>>
|
|
20
|
+
];
|
|
21
|
+
export {};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Identity Module Utilities
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The encoding, validation and cookie helpers the identity renderer, API
|
|
5
|
+
* client and module share.
|
|
6
6
|
*/
|
|
7
7
|
export { CooldownTimer, ExpirationTimer } from './utils/cooldown-timer';
|
|
8
8
|
export type { CooldownTimerConfig, ExpirationTimerConfig } from './utils/cooldown-timer';
|
|
9
|
-
export { arrayBufferToBase64url, base64urlToArrayBuffer, base64urlToString, } from '../../utils/base64url';
|
|
10
9
|
import type { ResolvedConfig } from '../../config';
|
|
11
10
|
import type { VerifyOptions } from './types';
|
|
11
|
+
/** base64url of an ArrayBuffer: the shape WebAuthn and WebCrypto hand back. */
|
|
12
|
+
export declare function arrayBufferToBase64url(buffer: ArrayBuffer): string;
|
|
12
13
|
/**
|
|
13
14
|
* Extract the root (registrable) domain from a hostname for cross-subdomain cookies.
|
|
14
15
|
* Returns the domain prefixed with a dot (e.g., ".client.com") or null when
|
|
@@ -35,20 +36,12 @@ export declare function getCookie(name: string): string | null;
|
|
|
35
36
|
*/
|
|
36
37
|
export declare function setCookie(name: string, value: string, days: number): void;
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
39
|
+
* This page as a navigation return target: origin, path, and query — the query
|
|
40
|
+
* carries the page's own state (app routing, or the sign-in page's validated
|
|
41
|
+
* destination) — without the fragment, which is the channel a result returns
|
|
42
|
+
* in.
|
|
40
43
|
*/
|
|
41
|
-
export declare function
|
|
42
|
-
/**
|
|
43
|
-
* Generate a PKCE code_verifier (RFC 7636): 32 random bytes, base64url —
|
|
44
|
-
* 43 URL-safe characters.
|
|
45
|
-
*/
|
|
46
|
-
export declare function generateCodeVerifier(): string;
|
|
47
|
-
/**
|
|
48
|
-
* Compute the S256 PKCE code_challenge for a verifier:
|
|
49
|
-
* base64url(SHA-256(verifier)).
|
|
50
|
-
*/
|
|
51
|
-
export declare function computeS256Challenge(codeVerifier: string): Promise<string>;
|
|
44
|
+
export declare function currentPageReturnUrl(): string;
|
|
52
45
|
/** Extra query params for the redirect sign-in mode. */
|
|
53
46
|
export interface SigninUrlRedirectExtras {
|
|
54
47
|
redirectUri: string;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Shared interfaces and helpers for all view components.
|
|
5
5
|
*/
|
|
6
|
-
import { escapeHtml } from '../modal';
|
|
7
6
|
/**
|
|
8
7
|
* Base interface for all view components.
|
|
9
8
|
* Each view must implement render() to return its DOM element.
|
|
@@ -33,30 +32,14 @@ export declare function clearChildren(element: HTMLElement): void;
|
|
|
33
32
|
*/
|
|
34
33
|
export declare function errorMessage(message: string): HTMLDivElement;
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
35
|
+
* An email address in its canonical form, or null when the platform cannot
|
|
36
|
+
* deliver to it: the platform's one email grammar
|
|
37
|
+
* (`@sparkvault/app-sdk/email-address`), which the Identity Product reads an
|
|
38
|
+
* address by, so a field refuses exactly what the server would.
|
|
38
39
|
*/
|
|
39
40
|
export declare function validateEmail(email: string): string | null;
|
|
40
|
-
/**
|
|
41
|
-
* Validate phone number format.
|
|
42
|
-
* Accepts various formats, returns E.164 format (+1XXXXXXXXXX) or null if invalid.
|
|
43
|
-
*/
|
|
44
|
-
export declare function validatePhone(phone: string): string | null;
|
|
45
|
-
/**
|
|
46
|
-
* Format phone number for display as user types.
|
|
47
|
-
* Formats US numbers as (XXX) XXX-XXXX.
|
|
48
|
-
*/
|
|
49
|
-
export declare function formatPhoneDisplay(phone: string): string;
|
|
50
|
-
/**
|
|
51
|
-
* Detect if input looks like a phone number (starts with digit or +).
|
|
52
|
-
*/
|
|
53
|
-
export declare function looksLikePhone(input: string): boolean;
|
|
54
41
|
/**
|
|
55
42
|
* Validate OTP code format.
|
|
56
43
|
* Returns sanitized code or null if invalid.
|
|
57
44
|
*/
|
|
58
45
|
export declare function validateOtpCode(code: string): string | null;
|
|
59
|
-
/**
|
|
60
|
-
* Re-export escapeHtml for convenience.
|
|
61
|
-
*/
|
|
62
|
-
export { escapeHtml };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Identity Input View
|
|
3
3
|
*
|
|
4
|
-
* Collects and validates the user's email or phone number
|
|
5
|
-
*
|
|
4
|
+
* Collects and validates the user's email or phone number: reads the input as
|
|
5
|
+
* one or the other by the platform's rules (`@sparkvault/app-sdk/phone` and
|
|
6
|
+
* `@sparkvault/app-sdk/email-address`), and formats a phone-only field as the
|
|
7
|
+
* number is typed.
|
|
6
8
|
*/
|
|
7
9
|
import type { View } from './base';
|
|
8
10
|
export type IdentityType = 'email' | 'phone';
|
package/dist/products/index.d.ts
CHANGED
|
@@ -29,4 +29,4 @@ export { NotifyProductModule, NOTIFY_PRESETS, buildNotifyPresetSend } from './no
|
|
|
29
29
|
export type { VerifyOptions, AttachOptions, VerifyResult, TokenClaims, AuthMethod, AuthContext, Theme, SdkConfig, SdkConfigBranding, MethodId, MethodMetadata, } from './identity';
|
|
30
30
|
export { METHOD_REGISTRY, getMethodMetadata, enrichMethods } from './identity';
|
|
31
31
|
export { IdentityApi, IdentityApiError } from './identity';
|
|
32
|
-
export type { NotifyChannel, NotifyDeliveryMode, NotifyVerificationLevel, NotifyInteraction, NotifyPresetCategory, NotifyCategory, NotifyPresetName, NotifyPreset, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifyIngotRef, NotifySendPolicy, NotifyEscalation, CreateNotifySendOptions, NotifySendResult, NotifyInboxView, NotifyInboxMarkState, NotifyInboxBulkMarkState, NotifyInboxRow, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, NotifySendStatusRecipient, NotifySendStatusCounts, NotifySendState, NotifySendSummary, ListNotifySendsOptions, ListNotifySendsResponse, NotifyRecallMode, RecallNotifySendOptions, RecallNotifySendResponse, NotifyReceipt, NotifyReceiptEventType,
|
|
32
|
+
export type { NotifyChannel, NotifyDeliveryMode, NotifyVerificationLevel, NotifyInteraction, NotifyPresetCategory, NotifyCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyPreset, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifyIngotRef, NotifySendPolicy, NotifyEscalation, CreateNotifySendOptions, NotifySendResult, NotifyInboxView, NotifyInboxMarkState, NotifyInboxBulkMarkState, NotifyInboxRow, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, NotifySendStatusRecipient, NotifySendStatusCounts, NotifySendState, NotifySendSummary, ListNotifySendsOptions, ListNotifySendsResponse, NotifyRecallMode, RecallNotifySendOptions, RecallNotifySendResponse, NotifyReceipt, NotifyReceiptEventType, NotifySendReceipt, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigHistory, NotifyConfigSecurity, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigPatch, NotifyConfigOverrides, NotifyConfigResponse, } from './notify';
|
|
@@ -18,9 +18,10 @@
|
|
|
18
18
|
* and metadata.
|
|
19
19
|
*/
|
|
20
20
|
import { HttpClient } from '../../http';
|
|
21
|
-
import type { CreateNotifySendOptions, NotifySendResult, NotifyPreset, NotifyPresetName, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, ListNotifySendsOptions, ListNotifySendsResponse, RecallNotifySendOptions, RecallNotifySendResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfigPatch, NotifyConfigResponse } from './types';
|
|
21
|
+
import type { CreateNotifySendOptions, NotifySendResult, NotifyPreset, NotifyPresetName, NotifyPresetSendOptions, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, ListNotifySendsOptions, ListNotifySendsResponse, RecallNotifySendOptions, RecallNotifySendResponse, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfigPatch, NotifyConfigResponse } from './types';
|
|
22
22
|
/**
|
|
23
|
-
* The five secure-by-default preset bundles
|
|
23
|
+
* The five secure-by-default preset bundles: the server's own table, in this
|
|
24
|
+
* SDK's camelCase shape.
|
|
24
25
|
*
|
|
25
26
|
* There is no preset endpoint — presets are a merge over the one send contract,
|
|
26
27
|
* so they are applied client-side and produce an ordinary `send` request. Caller
|
|
@@ -29,6 +30,9 @@ import type { CreateNotifySendOptions, NotifySendResult, NotifyPreset, NotifyPre
|
|
|
29
30
|
*
|
|
30
31
|
* `alert` is the only plaintext preset: a non-confidential ping is read at a
|
|
31
32
|
* glance rather than behind a tap-to-view link. The other four seal.
|
|
33
|
+
* `approval` and `signatureRequest` verify at `identifier`: pass
|
|
34
|
+
* `policy: { verificationLevel: 'passkey' }` explicitly when the audience is
|
|
35
|
+
* known to be enrolled.
|
|
32
36
|
*/
|
|
33
37
|
export declare const NOTIFY_PRESETS: Readonly<Record<NotifyPresetName, NotifyPreset>>;
|
|
34
38
|
/**
|
|
@@ -36,7 +40,7 @@ export declare const NOTIFY_PRESETS: Readonly<Record<NotifyPresetName, NotifyPre
|
|
|
36
40
|
* options. Exported so a caller can inspect (or further adjust) what a preset
|
|
37
41
|
* would send before sending it.
|
|
38
42
|
*/
|
|
39
|
-
export declare function buildNotifyPresetSend(preset: NotifyPresetName, options:
|
|
43
|
+
export declare function buildNotifyPresetSend(preset: NotifyPresetName, options: NotifyPresetSendOptions): CreateNotifySendOptions;
|
|
40
44
|
export declare class NotifyProductModule {
|
|
41
45
|
private readonly http;
|
|
42
46
|
constructor(http: HttpClient);
|
|
@@ -56,6 +60,16 @@ export declare class NotifyProductModule {
|
|
|
56
60
|
* title: 'Invoice ready',
|
|
57
61
|
* category: 'transactional',
|
|
58
62
|
* });
|
|
63
|
+
*
|
|
64
|
+
* @example Send a stored file — the unsealed vault proves you hold its key
|
|
65
|
+
* const vault = await sv.vaults.unseal('vlt_abc', process.env.CONTRACTS_DVAK);
|
|
66
|
+
* await sv.products.notify.send({
|
|
67
|
+
* sendId: `contract:${contract.id}`,
|
|
68
|
+
* recipients: [{ email: counterparty.email }],
|
|
69
|
+
* ingot: { ingotId: contract.ingotId, vault },
|
|
70
|
+
* title: 'Your signed contract',
|
|
71
|
+
* category: 'transactional',
|
|
72
|
+
* });
|
|
59
73
|
*/
|
|
60
74
|
send(options: CreateNotifySendOptions): Promise<NotifySendResult>;
|
|
61
75
|
/**
|
|
@@ -70,15 +84,15 @@ export declare class NotifyProductModule {
|
|
|
70
84
|
* title: 'Export complete',
|
|
71
85
|
* });
|
|
72
86
|
*/
|
|
73
|
-
sendAlert(options:
|
|
87
|
+
sendAlert(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
74
88
|
/** Confidential content revealed after the recipient proves their identifier. */
|
|
75
|
-
sendSecureMessage(options:
|
|
89
|
+
sendSecureMessage(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
76
90
|
/** Two-way thread: identifier-verified reveal plus an encrypted reply. */
|
|
77
|
-
sendConversation(options:
|
|
91
|
+
sendConversation(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
78
92
|
/** High-stakes approve/deny — identifier-verified, with `action_hash` binding. */
|
|
79
|
-
sendApproval(options:
|
|
93
|
+
sendApproval(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
80
94
|
/** Signature-on-delivery — identifier-verified, with `action_hash` binding. */
|
|
81
|
-
sendSignatureRequest(options:
|
|
95
|
+
sendSignatureRequest(options: NotifyPresetSendOptions): Promise<NotifySendResult>;
|
|
82
96
|
/**
|
|
83
97
|
* Read one recipient's metadata-only feed, newest first. Rows are pointers: a
|
|
84
98
|
* sealed row carries only `sparklink_code`, never the content.
|
|
@@ -180,16 +194,12 @@ export declare class NotifyProductModule {
|
|
|
180
194
|
getSendStatus(sendId: string): Promise<NotifySendStatus>;
|
|
181
195
|
/**
|
|
182
196
|
* The account's verified-interaction receipts (portable, JWKS-verifiable
|
|
183
|
-
* proofs), newest first.
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* bounded query with real pagination. `legacy_scan` appears only for an account
|
|
187
|
-
* whose receipts all predate that index; it filters the account audit log, so
|
|
188
|
-
* it can hand back EMPTY pages that are nowhere near the end. On EITHER source,
|
|
189
|
-
* follow the cursor until it is null before concluding there are none.
|
|
197
|
+
* proofs), newest first, with real pagination. An `interaction` filter can
|
|
198
|
+
* hand back a short or empty page while more follow, so follow `cursor` until
|
|
199
|
+
* it is null before concluding there are none.
|
|
190
200
|
*
|
|
191
201
|
* @example
|
|
192
|
-
* const { receipts, cursor
|
|
202
|
+
* const { receipts, cursor } = await sv.products.notify.listReceipts({ interaction: 'approve' });
|
|
193
203
|
*/
|
|
194
204
|
listReceipts(options?: ListNotifyReceiptsOptions): Promise<ListNotifyReceiptsResponse>;
|
|
195
205
|
/**
|
|
@@ -220,8 +230,8 @@ export declare class NotifyProductModule {
|
|
|
220
230
|
*/
|
|
221
231
|
getConfig(): Promise<NotifyConfigResponse>;
|
|
222
232
|
/**
|
|
223
|
-
* Merge a partial patch onto the account's config overrides.
|
|
224
|
-
*
|
|
233
|
+
* Merge a partial patch onto the account's config overrides. Unknown keys are
|
|
234
|
+
* rejected before any write.
|
|
225
235
|
*
|
|
226
236
|
* Delete a category by storing an explicit `null` TOMBSTONE — that is what keeps
|
|
227
237
|
* a seeded default from re-appearing on the next merge. The reserved `security`
|
|
@@ -246,4 +256,4 @@ export declare class NotifyProductModule {
|
|
|
246
256
|
*/
|
|
247
257
|
updateConfig(patch: NotifyConfigPatch): Promise<NotifyConfigResponse>;
|
|
248
258
|
}
|
|
249
|
-
export type { NotifyChannel, NotifyDeliveryMode, NotifyVerificationLevel, NotifyInteraction, NotifyPresetCategory, NotifyCategory, NotifyPresetName, NotifyPreset, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifyIngotRef, NotifySendPolicy, NotifyEscalation, CreateNotifySendOptions, NotifySendResult, NotifyInboxView, NotifyInboxMarkState, NotifyInboxBulkMarkState, NotifyInboxRow, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, NotifySendStatusRecipient, NotifySendStatusCounts, NotifySendState, NotifySendSummary, ListNotifySendsOptions, ListNotifySendsResponse, NotifyRecallMode, RecallNotifySendOptions, RecallNotifySendResponse, NotifyReceipt, NotifyReceiptEventType,
|
|
259
|
+
export type { NotifyChannel, NotifyDeliveryMode, NotifyVerificationLevel, NotifyInteraction, NotifyPresetCategory, NotifyCategory, NotifyPresetName, NotifyPresetSendOptions, NotifyPreset, NotifyRecipient, NotifyRecipientRef, NotifySendContent, NotifyIngotRef, NotifySendPolicy, NotifyEscalation, CreateNotifySendOptions, NotifySendResult, NotifyInboxView, NotifyInboxMarkState, NotifyInboxBulkMarkState, NotifyInboxRow, ListNotifyInboxOptions, ListNotifyInboxResponse, MarkNotifyInboxStateOptions, MarkNotifyInboxStateResponse, MarkNotifyInboxAllOptions, MarkNotifyInboxAllResponse, NotifySendStatus, NotifySendStatusRecipient, NotifySendStatusCounts, NotifySendState, NotifySendSummary, ListNotifySendsOptions, ListNotifySendsResponse, NotifyRecallMode, RecallNotifySendOptions, RecallNotifySendResponse, NotifyReceipt, NotifyReceiptEventType, NotifySendReceipt, ListNotifyReceiptsOptions, ListNotifyReceiptsResponse, NotifySendReceiptsResponse, NotifyConfig, NotifyConfigCategory, NotifyConfigDelivery, NotifyConfigRealtimeFallbackDelay, NotifyConfigReliability, NotifyConfigHistory, NotifyConfigSecurity, NotifyConfigEvents, NotifyConfigEventsRead, NotifyConfigPatch, NotifyConfigOverrides, NotifyConfigResponse, } from './types';
|