@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.
Files changed (54) hide show
  1. package/README.md +9 -4
  2. package/dist/api-base.d.ts +46 -11
  3. package/dist/config.d.ts +5 -3
  4. package/dist/entropy/index.d.ts +0 -1
  5. package/dist/entropy/types.d.ts +1 -1
  6. package/dist/errors.d.ts +18 -2
  7. package/dist/folders/index.d.ts +3 -1
  8. package/dist/http.d.ts +11 -6
  9. package/dist/index.cjs +8207 -7265
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +510 -297
  12. package/dist/index.mjs +8206 -7266
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/ingots/fetch-download.d.ts +48 -0
  15. package/dist/ingots/index.d.ts +29 -14
  16. package/dist/ingots/types.d.ts +98 -43
  17. package/dist/notify/types.d.ts +7 -2
  18. package/dist/products/identity/api.d.ts +30 -14
  19. package/dist/products/identity/handlers/index.d.ts +1 -1
  20. package/dist/products/identity/handlers/passkey-handler.d.ts +4 -13
  21. package/dist/products/identity/handlers/sparklink-handler.d.ts +0 -1
  22. package/dist/products/identity/index.d.ts +23 -6
  23. package/dist/products/identity/inline-container.d.ts +13 -26
  24. package/dist/products/identity/modal.d.ts +16 -42
  25. package/dist/products/identity/renderer.d.ts +31 -10
  26. package/dist/products/identity/types.d.ts +17 -5
  27. package/dist/products/identity/types.test-d.d.ts +21 -0
  28. package/dist/products/identity/utils.d.ts +9 -16
  29. package/dist/products/identity/views/base.d.ts +4 -21
  30. package/dist/products/identity/views/identity-input.d.ts +4 -2
  31. package/dist/products/index.d.ts +1 -1
  32. package/dist/products/notify/index.d.ts +29 -19
  33. package/dist/products/notify/types.d.ts +74 -37
  34. package/dist/products/notify/types.test-d.d.ts +1 -0
  35. package/dist/request-path.d.ts +44 -0
  36. package/dist/sparkvault.js +1 -1
  37. package/dist/sparkvault.js.map +1 -1
  38. package/dist/ui/chrome.d.ts +16 -0
  39. package/dist/ui/ds-tokens.d.ts +58 -0
  40. package/dist/ui/inline-shell.d.ts +19 -0
  41. package/dist/ui/modal-shell.d.ts +36 -0
  42. package/dist/ui/target.d.ts +6 -0
  43. package/dist/vaults/index.d.ts +11 -6
  44. package/dist/vaults/upload/api.d.ts +21 -9
  45. package/dist/vaults/upload/chrome.d.ts +8 -22
  46. package/dist/vaults/upload/container.d.ts +0 -8
  47. package/dist/vaults/upload/index.d.ts +1 -1
  48. package/dist/vaults/upload/inline-container.d.ts +13 -42
  49. package/dist/vaults/upload/modal.d.ts +14 -33
  50. package/dist/vaults/upload/renderer.d.ts +0 -1
  51. package/dist/vaults/upload/styles.d.ts +4 -2
  52. package/dist/vaults/upload/types.d.ts +2 -2
  53. package/package.json +2 -2
  54. package/dist/utils/base64url.d.ts +0 -52
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Chrome pieces both SDK widgets draw the same way.
3
+ */
4
+ /**
5
+ * The "Secured by SparkVault" footer. The link reads in the surrounding text's
6
+ * colour, set inline so a host page's link styles cannot restyle it.
7
+ *
8
+ * @param classPrefix - The widget's CSS class prefix (`sv`, `svu`)
9
+ */
10
+ export declare function createSecuredByFooter(classPrefix: string): HTMLDivElement;
11
+ /**
12
+ * The logo for a theme: the variant drawn for it, else the other one.
13
+ *
14
+ * @returns The logo URL, or null when the branding has none
15
+ */
16
+ export declare function pickLogo(dark: boolean, lightLogo: string | null, darkLogo: string | null): string | null;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Design-system values for the SDK's widgets.
3
+ *
4
+ * The identity dialog and the vault upload widget are product-register
5
+ * SparkVault surfaces, so they paint with the design system's palette
6
+ * (packages/design-system/tokens): Action Blue for interaction on slate
7
+ * neutrals. The published bundle cannot read those CSS files, so the values
8
+ * the widgets use are mirrored here, each naming the token it mirrors.
9
+ * tests/ds-tokens.test.ts holds every value to the design system's own, and
10
+ * refuses a hex color anywhere else in the SDK's source (provider logos keep
11
+ * their owners' colors) and an rgba() whose color is not the design system's.
12
+ */
13
+ /** The design-system token each mirrored value is. */
14
+ export declare const DS_TOKEN_SOURCES: Readonly<{
15
+ readonly white: "--color-white";
16
+ readonly slate50: "--color-slate-50";
17
+ readonly slate100: "--color-slate-100";
18
+ readonly slate200: "--color-slate-200";
19
+ readonly slate300: "--color-slate-300";
20
+ readonly slate500: "--color-slate-500";
21
+ readonly slate600: "--color-slate-600";
22
+ readonly slate900: "--color-slate-900";
23
+ readonly slate950: "--color-slate-950";
24
+ readonly action: "--color-action";
25
+ readonly actionHover: "--color-action-hover";
26
+ readonly actionBg: "--color-action-bg";
27
+ readonly btnDanger: "--color-btn-danger";
28
+ readonly btnDangerHover: "--color-btn-danger-hover";
29
+ readonly success: "--color-success";
30
+ readonly success500: "--color-success-500";
31
+ readonly error: "--color-error";
32
+ readonly error500: "--color-error-500";
33
+ readonly errorBg: "--color-error-bg";
34
+ readonly errorText: "--color-error-text";
35
+ readonly warning: "--color-warning";
36
+ readonly warning500: "--color-warning-500";
37
+ readonly infoBg: "--color-info-bg";
38
+ readonly info500: "--color-info-500";
39
+ readonly modalOverlay: "--color-modal-overlay";
40
+ readonly darkText: "--dark-text";
41
+ readonly darkTextMuted: "--dark-text-muted";
42
+ readonly darkHairline: "--dark-hairline";
43
+ readonly darkCard: "--dark-card";
44
+ readonly shadowSm: "--shadow-sm";
45
+ readonly shadowMd: "--shadow-md";
46
+ readonly shadowPopover: "--shadow-popover";
47
+ }>;
48
+ export type DsToken = keyof typeof DS_TOKEN_SOURCES;
49
+ /** The design system's values for {@link DS_TOKEN_SOURCES}. */
50
+ export declare const DS: Readonly<Record<DsToken, string>>;
51
+ /**
52
+ * A design-system color at an opacity.
53
+ *
54
+ * @param hex - A six-digit `#rrggbb` value from {@link DS}
55
+ * @param alpha - Opacity, 0 to 1
56
+ * @returns The color as `rgba(r, g, b, alpha)`
57
+ */
58
+ export declare function withAlpha(hex: string, alpha: number): string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Inline shell shared by the SDK's widgets (identity and upload): the surface
3
+ * a widget renders into when it is embedded in a host page element instead of
4
+ * opened as a dialog. It takes the target over (clearing what it held), holds a
5
+ * body for the widget's views and an optional footer, and leaves the target
6
+ * empty when destroyed.
7
+ */
8
+ export interface InlineShellOptions {
9
+ containerClassName: string;
10
+ bodyClassName: string;
11
+ /** The footer to show under the body, or null for none. */
12
+ footer: HTMLElement | null;
13
+ }
14
+ export declare class InlineShell {
15
+ readonly container: HTMLDivElement;
16
+ readonly body: HTMLDivElement;
17
+ constructor(target: HTMLElement, options: InlineShellOptions);
18
+ destroy(): void;
19
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Modal shell shared by the SDK's widgets (identity and upload).
3
+ *
4
+ * One dialog behaviour for both: an overlay labelled as a modal dialog that
5
+ * dismisses on its backdrop and on Escape, a page scroll lock held for as long
6
+ * as any shell is open (and the page's own overflow given back when the last
7
+ * one closes), focus moved into the dialog on open and returned to whatever
8
+ * had it on close, and every listener removed on teardown. Each widget builds
9
+ * its own header, body and footer inside `modal`.
10
+ */
11
+ export interface ModalShellOptions {
12
+ /** id of the overlay element. */
13
+ overlayId: string;
14
+ /** id of the dialog element inside the overlay. */
15
+ modalId: string;
16
+ /** The widget's CSS class prefix: `${prefix}-overlay`, `${prefix}-blur`, `${prefix}-modal`. */
17
+ classPrefix: string;
18
+ /** id of the element that titles the dialog (aria-labelledby). */
19
+ titleId: string;
20
+ backdropBlur: boolean;
21
+ /** Called on a backdrop click or Escape. */
22
+ onDismiss: () => void;
23
+ }
24
+ export declare class ModalShell {
25
+ readonly overlay: HTMLDivElement;
26
+ readonly modal: HTMLDivElement;
27
+ private readonly blurClass;
28
+ private readonly opener;
29
+ private readonly onOverlayClick;
30
+ private readonly onKeydown;
31
+ private open;
32
+ constructor(options: ModalShellOptions);
33
+ setBackdropBlur(enabled: boolean): void;
34
+ /** Remove the dialog, release the scroll lock, and return focus to the opener. */
35
+ destroy(): void;
36
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The element a widget renders into when embedded: a CSS selector or an element.
3
+ *
4
+ * @throws ValidationError when the selector matches nothing, or the target is neither
5
+ */
6
+ export declare function resolveTarget(target: string | HTMLElement): HTMLElement;
@@ -105,9 +105,7 @@ export declare class VaultsModule {
105
105
  * Requires the vault's exact name as confirmation, matched case-sensitively.
106
106
  * The name is sent base64(UTF-8) as the `X-Confirm-Name-B64` header so a vault
107
107
  * named with any Unicode (emoji, CJK, the U+202F in macOS-style names) is
108
- * deletable — an HTTP header value cannot carry non-latin1 characters. The
109
- * legacy raw `X-Confirm-Name` header is included only for latin1 names, so
110
- * older API servers keep working.
108
+ * deletable — an HTTP header value cannot carry non-latin1 characters.
111
109
  *
112
110
  * @example
113
111
  * await sv.vaults.delete('vlt_abc', 'My Vault');
@@ -137,10 +135,18 @@ export declare class VaultsModule {
137
135
  /**
138
136
  * Update a vault's sharing configuration (without changing enabled state).
139
137
  *
138
+ * Making every ingot public publishes each file to anyone holding its URL,
139
+ * so the API accepts `allIngotsPublic: true` only with a read-write VAT for
140
+ * the vault: pass the unsealed vault for that change.
141
+ *
140
142
  * @example
141
- * await sv.vaults.updateSharingConfig('vlt_abc', { allIngotsPublic: true });
143
+ * await sv.vaults.updateSharingConfig('vlt_abc', { sessionLengthSeconds: 1800 });
144
+ *
145
+ * @example Make every ingot public
146
+ * const unsealed = await sv.vaults.unseal('vlt_abc', vmk);
147
+ * await sv.vaults.updateSharingConfig('vlt_abc', { allIngotsPublic: true }, unsealed);
142
148
  */
143
- updateSharingConfig(vaultId: string, config: VaultSharingOptions): Promise<VaultSharingConfig>;
149
+ updateSharingConfig(vaultId: string, config: VaultSharingOptions, vault?: UnsealedVault): Promise<VaultSharingConfig>;
144
150
  /**
145
151
  * Get a vault's access-log retention window.
146
152
  *
@@ -198,7 +204,6 @@ export declare class VaultsModule {
198
204
  */
199
205
  updateUploadConfig(vaultId: string, config: UpdateVaultUploadOptions): Promise<VaultUploadSettings>;
200
206
  private toggleUploadChannel;
201
- private normalizeVaultId;
202
207
  private validateCreateOptions;
203
208
  }
204
209
  export type { CreateVaultOptions, Vault, UnsealedVault, VaultSummary, VaultPage, ListVaultsOptions, VaultDetail, UpdatedVault, VaultSharingConfig, VaultSharingOptions, AccessLogRetention, VaultUploadSettings, UpdateVaultUploadOptions, } from './types';
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * API client for vault upload operations.
5
5
  */
6
- import type { ResolvedConfig } from '../../config';
6
+ import { type ResolvedConfig } from '../../config';
7
7
  import { SparkVaultApi } from '../../api-base';
8
8
  import { SparkVaultError } from '../../errors';
9
- import type { VaultUploadConfig } from './types';
9
+ import type { VaultUploadConfig, VaultUploadInfoResponse } from './types';
10
10
  /**
11
11
  * Error class for upload API errors. Inherits `code` and `statusCode` from
12
12
  * SparkVaultError — no duplicate `httpStatus` field.
@@ -14,6 +14,8 @@ import type { VaultUploadConfig } from './types';
14
14
  export declare class UploadApiError extends SparkVaultError {
15
15
  constructor(message: string, code: string, statusCode: number, details?: Record<string, unknown>);
16
16
  }
17
+ /** The widget's upload configuration, read from a vault's upload info answer. */
18
+ export declare function mapVaultUploadInfo(wire: VaultUploadInfoResponse): VaultUploadConfig;
17
19
  export declare class UploadApi extends SparkVaultApi {
18
20
  private readonly config;
19
21
  /**
@@ -28,9 +30,17 @@ export declare class UploadApi extends SparkVaultApi {
28
30
  constructor(config: ResolvedConfig);
29
31
  protected makeError(message: string, code: string, statusCode: number, details?: Record<string, unknown>): UploadApiError;
30
32
  /**
31
- * Issue a request and unwrap the standard `{ data, meta }` envelope.
33
+ * Issue a request to a Core route and unwrap the standard `{ data, meta }`
34
+ * envelope.
32
35
  */
33
36
  private request;
37
+ /**
38
+ * The vault id an upload route names, refused before any request when it is
39
+ * not a SparkVault resource id: the id comes from the host page's widget
40
+ * options, and a value carrying '/' or a dot-segment must never re-target
41
+ * the request.
42
+ */
43
+ private requireVaultId;
34
44
  /**
35
45
  * Get vault upload info (public endpoint), fetched at most once per vault.
36
46
  *
@@ -55,6 +65,7 @@ export declare class UploadApi extends SparkVaultApi {
55
65
  initiateUpload(vaultId: string, filename: string, sizeBytes: number, contentType: string, token?: string, folder?: string): Promise<{
56
66
  forgeUrl: string;
57
67
  ingotId: string;
68
+ requestId: string | null;
58
69
  }>;
59
70
  /**
60
71
  * Upload a file to Forge over the TUS resumable protocol (v1.0.0).
@@ -138,13 +149,14 @@ export declare class UploadApi extends SparkVaultApi {
138
149
  */
139
150
  private headUploadOffset;
140
151
  /**
141
- * Issue one bodyless TUS request — the single transport behind every
142
- * non-chunk call this client makes (resume HEAD, finalization PATCH).
152
+ * Issue one bodyless TUS request: the single transport behind every
153
+ * non-chunk call this client makes (session create, resume HEAD,
154
+ * finalization PATCH).
143
155
  *
144
- * Uses raw `fetch` rather than the JSON envelope helper: TUS responses carry
145
- * an empty body and surface state in headers. Honors the session abort
146
- * signal and request timeout like every other client call, and resolves only
147
- * on a 2xx so no caller has to re-check `response.ok`.
156
+ * Uses the raw response rather than the JSON envelope helper: TUS responses
157
+ * carry an empty body and surface state in headers. Runs through the one SDK
158
+ * transport (session close signal, deadline, failure classification) and
159
+ * resolves only on a 2xx so no caller has to re-check `response.ok`.
148
160
  *
149
161
  * @param check - Which caller this request serves; shapes the failure copy.
150
162
  */
@@ -1,35 +1,21 @@
1
1
  /**
2
2
  * Upload Widget Chrome
3
3
  *
4
- * Shared DOM builders for the branded chrome both upload containers render:
5
- * brand header, "Secured by SparkVault" footer, and the Triple Zero-Trust
6
- * security sidebar. One canonical copy — any branding/marketing/security-text
7
- * change lands here and reaches modal and inline modes alike.
4
+ * DOM builders for the upload dialog's branded chrome: the brand header and
5
+ * the Triple Zero-Trust security sidebar. The "Secured by SparkVault" footer
6
+ * is the SDK's shared one (ui/chrome.ts).
8
7
  */
9
8
  import type { UploadBranding } from './types';
10
9
  export interface BrandHeaderOptions {
11
10
  branding: UploadBranding;
12
11
  /** Pick the dark-mode logo variant when available. */
13
12
  isDarkMode: boolean;
14
- /** Render the close (×) button and wire `onClose` to its click. */
15
- withCloseButton: boolean;
16
- /**
17
- * id for the title node (logo screen-reader text or company name). The
18
- * modal passes its `aria-labelledby` target id; inline omits it so a page
19
- * embedding both never produces duplicate DOM ids.
20
- */
21
- titleId?: string;
13
+ /** id for the title node (logo screen-reader text or company name): the dialog's aria-labelledby target. */
14
+ titleId: string;
15
+ /** Wired to the close (×) button's click. */
22
16
  onClose: () => void;
23
17
  }
24
- /**
25
- * Build the branded header. Returns the close button (when rendered) so the
26
- * container can detach `onClose` in its destroy() cleanup.
27
- */
28
- export declare function createBrandHeader(options: BrandHeaderOptions): {
29
- header: HTMLDivElement;
30
- closeBtn: HTMLButtonElement | null;
31
- };
32
- /** Build the "Secured by SparkVault" footer. */
33
- export declare function createFooter(): HTMLDivElement;
18
+ /** Build the dialog's branded header, with its close button. */
19
+ export declare function createBrandHeader(options: BrandHeaderOptions): HTMLDivElement;
34
20
  /** Build the Triple Zero-Trust security sidebar shown during dark states. */
35
21
  export declare function createSecuritySidebar(branding: UploadBranding): HTMLDivElement;
@@ -38,14 +38,6 @@ export interface UploadContainer {
38
38
  * Get the body element where views are rendered.
39
39
  */
40
40
  getBody(): HTMLDivElement | null;
41
- /**
42
- * Get the sidebar element for security info (optional).
43
- */
44
- getSidebar(): HTMLDivElement | null;
45
- /**
46
- * Show or hide the security sidebar.
47
- */
48
- toggleSidebar(show: boolean): void;
49
41
  /**
50
42
  * Check if the container is currently active.
51
43
  */
@@ -65,7 +65,7 @@ export declare class VaultUploadModule {
65
65
  */
66
66
  close(): void;
67
67
  /**
68
- * Resolve target to an HTMLElement and create inline container.
68
+ * The inline container for an embedded upload.
69
69
  */
70
70
  private createInlineContainer;
71
71
  /** Open the upload widget as a popup. Equivalent to `upload(options)`. */
@@ -1,74 +1,45 @@
1
1
  /**
2
2
  * Inline Upload Container
3
3
  *
4
- * Renders upload UI inline within a target element.
5
- * Unlike UploadModalContainer which creates an overlay popup, this embeds
6
- * directly into the customer's page where render() was called.
4
+ * Renders upload UI inline within a target element, in the SDK's shared
5
+ * inline shell. Unlike UploadModalContainer, which opens a dialog, this embeds
6
+ * directly into the customer's page where render() was called. The upload and
7
+ * ceremony states run in a dialog of their own (the renderer's hybrid mode),
8
+ * so the inline surface has no dark mode or sidebar.
7
9
  *
8
10
  * Implements the UploadContainer interface for use with UploadRenderer.
9
11
  */
10
12
  import type { UploadContainer } from './container';
11
13
  import type { UploadBranding } from './types';
12
- export interface InlineContainerOptions {
13
- /** Show header with branding and optional close button */
14
- showHeader?: boolean;
15
- /** Show close button in header (requires showHeader) */
16
- showCloseButton?: boolean;
17
- /** Show footer with SparkVault branding */
18
- showFooter?: boolean;
19
- }
20
14
  export declare class UploadInlineContainer implements UploadContainer {
21
15
  private readonly targetElement;
22
- private readonly containerOptions;
23
- private container;
24
- private header;
25
- private body;
26
- private footer;
27
- private sidebar;
28
- private closeBtn;
29
- private onCloseCallback;
30
- private closeBtnClickHandler;
31
- private isDarkMode;
32
- private branding;
33
- constructor(targetElement: HTMLElement, options?: InlineContainerOptions);
16
+ private shell;
17
+ constructor(targetElement: HTMLElement);
34
18
  /**
35
- * Create the inline container with loading state.
19
+ * Create the inline container with loading state. An embedded widget has no
20
+ * close affordance of its own, so the close callback is not wired.
36
21
  */
37
22
  createLoading(_options: {
38
23
  backdropBlur?: boolean;
39
- }, onClose: () => void): void;
24
+ }, _onClose: () => void): void;
40
25
  /**
41
- * Update branding after vault config loads.
26
+ * Branding shows only in the dialog chrome, so the inline surface has none to update.
42
27
  */
43
- updateBranding(branding: UploadBranding): void;
28
+ updateBranding(_branding: UploadBranding): void;
44
29
  /**
45
30
  * Update backdrop blur setting (no-op for inline container).
46
31
  */
47
32
  updateBackdropBlur(_enabled: boolean): void;
48
- /**
49
- * Set dark mode for uploading/ceremony states.
50
- */
51
- setDarkMode(enabled: boolean): void;
52
- /**
53
- * Show or hide the security sidebar.
54
- */
55
- toggleSidebar(show: boolean): void;
56
33
  /**
57
34
  * Get the body element for content rendering.
58
35
  */
59
36
  getBody(): HTMLDivElement | null;
60
- /**
61
- * Get the sidebar element.
62
- */
63
- getSidebar(): HTMLDivElement | null;
64
37
  /**
65
38
  * Check if the container is currently active.
66
39
  */
67
40
  isOpen(): boolean;
68
41
  /**
69
- * Destroy the container and clean up.
42
+ * Destroy the container, leaving the target empty.
70
43
  */
71
44
  destroy(): void;
72
- private createHeader;
73
- private handleClose;
74
45
  }
@@ -1,35 +1,20 @@
1
1
  /**
2
2
  * Upload Modal Container
3
3
  *
4
- * Single responsibility: DOM modal container lifecycle.
5
- * Creates, shows, hides, and destroys the modal overlay and container.
6
- * Does NOT handle content rendering - that's the Renderer's job.
4
+ * Single responsibility: the upload dialog's chrome (branded header, body,
5
+ * footer, and the security sidebar of the dark states) inside the SDK's shared
6
+ * modal shell, which owns the dialog behaviour (dismissal, scroll lock,
7
+ * focus). Does NOT handle content rendering - that's the Renderer's job.
7
8
  */
8
9
  import type { UploadBranding } from './types';
9
10
  import type { UploadContainer } from './container';
10
- export interface UploadModalOptions {
11
- branding?: UploadBranding;
12
- backdropBlur?: boolean;
13
- }
14
- export interface ModalContainerElements {
15
- overlay: HTMLDivElement;
16
- modal: HTMLDivElement;
17
- main: HTMLDivElement;
18
- header: HTMLDivElement;
19
- body: HTMLDivElement;
20
- footer: HTMLDivElement;
21
- sidebar: HTMLDivElement | null;
22
- }
23
11
  export declare class UploadModalContainer implements UploadContainer {
24
- private elements;
12
+ private shell;
13
+ private header;
14
+ private body;
15
+ private sidebar;
25
16
  private onCloseCallback;
26
- private keydownHandler;
27
- private overlayClickHandler;
28
- private closeBtnClickHandler;
29
- private closeBtn;
30
- private backdropBlur;
31
17
  private isDarkMode;
32
- private headerElement;
33
18
  private branding;
34
19
  /**
35
20
  * Create and show the modal immediately with loading state.
@@ -37,11 +22,9 @@ export declare class UploadModalContainer implements UploadContainer {
37
22
  createLoading(options: {
38
23
  backdropBlur?: boolean;
39
24
  }, onClose: () => void): void;
40
- /**
41
- * Create and show the modal container.
42
- */
43
- private create;
44
25
  private createHeader;
26
+ /** Redraw the header for the current branding and theme, keeping its visibility. */
27
+ private refreshHeader;
45
28
  /**
46
29
  * Update branding after vault config loads.
47
30
  */
@@ -55,7 +38,8 @@ export declare class UploadModalContainer implements UploadContainer {
55
38
  */
56
39
  setDarkMode(enabled: boolean): void;
57
40
  /**
58
- * Show or hide the security sidebar.
41
+ * Show or hide the security sidebar. The sidebar carries its own logo, so
42
+ * the header hides while it shows.
59
43
  */
60
44
  toggleSidebar(show: boolean): void;
61
45
  private handleClose;
@@ -63,16 +47,13 @@ export declare class UploadModalContainer implements UploadContainer {
63
47
  * Get the modal body element for content rendering.
64
48
  */
65
49
  getBody(): HTMLDivElement | null;
66
- /**
67
- * Get the sidebar element.
68
- */
69
- getSidebar(): HTMLDivElement | null;
70
50
  /**
71
51
  * Check if the modal is currently open.
72
52
  */
73
53
  isOpen(): boolean;
74
54
  /**
75
- * Destroy the modal and clean up all event listeners.
55
+ * Destroy the modal; the shell removes its listeners, releases the scroll
56
+ * lock and returns focus.
76
57
  */
77
58
  destroy(): void;
78
59
  }
@@ -74,6 +74,5 @@ export declare class UploadRenderer {
74
74
  private startUpload;
75
75
  private runCeremony;
76
76
  private handleApiError;
77
- private escapeHtml;
78
77
  }
79
78
  export {};
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * Upload Widget Styles
3
3
  *
4
- * Enterprise-grade styling for the vault upload widget.
5
- * Follows the same design principles as the identity modal.
4
+ * SparkVault design system, product register, as the identity modal: slate
5
+ * neutrals with Action Blue carrying interactivity, on a light card that turns
6
+ * to the dark surface for the upload and security ceremony. Every color is the
7
+ * design system's (ui/ds-tokens).
6
8
  */
7
9
  /**
8
10
  * Inject upload widget styles into the document head.
@@ -146,14 +146,14 @@ export type UploadViewState = {
146
146
  view: 'uploading';
147
147
  file: File;
148
148
  ingotId: string;
149
- requestId: string;
149
+ requestId: string | null;
150
150
  progress: number;
151
151
  bytesUploaded: number;
152
152
  } | {
153
153
  view: 'ceremony';
154
154
  file: File;
155
155
  ingotId: string;
156
- requestId: string;
156
+ requestId: string | null;
157
157
  step: number;
158
158
  complete: boolean;
159
159
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkvault/sdk-js",
3
- "version": "10.0.1",
3
+ "version": "11.0.0",
4
4
  "description": "SparkVault JavaScript SDK - Identity Verification and Encrypted Vaults",
5
5
  "type": "module",
6
6
  "exports": {
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build": "rollup -c",
24
24
  "build:watch": "rollup -c -w",
25
- "typecheck": "tsc --noEmit",
25
+ "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
26
26
  "lint": "eslint src --ext .ts",
27
27
  "test": "vitest run",
28
28
  "test:watch": "vitest",
@@ -1,52 +0,0 @@
1
- /**
2
- * Base64URL Encoding/Decoding Utilities
3
- *
4
- * Centralized implementation (DRY).
5
- * Used by Identity (WebAuthn) and Vaults modules.
6
- */
7
- /**
8
- * Encode Uint8Array to base64url string (URL-safe base64 without padding)
9
- *
10
- * @param data - Binary data to encode
11
- * @returns Base64url encoded string
12
- */
13
- export declare function base64urlEncode(data: Uint8Array): string;
14
- /**
15
- * Encode ArrayBuffer to base64url string
16
- *
17
- * @param buffer - ArrayBuffer to encode
18
- * @returns Base64url encoded string
19
- */
20
- export declare function arrayBufferToBase64url(buffer: ArrayBuffer): string;
21
- /**
22
- * Encode a string as STANDARD base64 (with padding) of its UTF-8 bytes.
23
- *
24
- * Unlike base64urlEncode this keeps `+`/`/` and padding, so it round-trips
25
- * through a server-side standard-base64 decoder. Used to carry arbitrary
26
- * Unicode through an HTTP header value (which is limited to latin1 bytes).
27
- *
28
- * @param value - String to encode
29
- * @returns Standard base64 string
30
- */
31
- export declare function base64EncodeUtf8(value: string): string;
32
- /**
33
- * Decode base64url string to Uint8Array
34
- *
35
- * @param base64url - Base64url encoded string
36
- * @returns Decoded bytes as Uint8Array
37
- */
38
- export declare function base64urlDecode(base64url: string): Uint8Array;
39
- /**
40
- * Decode base64url string to ArrayBuffer
41
- *
42
- * @param base64url - Base64url encoded string
43
- * @returns Decoded ArrayBuffer
44
- */
45
- export declare function base64urlToArrayBuffer(base64url: string): ArrayBuffer;
46
- /**
47
- * Decode base64url string to UTF-8 string
48
- *
49
- * @param base64url - Base64url encoded string
50
- * @returns Decoded UTF-8 string
51
- */
52
- export declare function base64urlToString(base64url: string): string;