@sparkvault/sdk 1.1.6 → 1.8.2

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
@@ -198,7 +198,7 @@ const result = await sparkvault.identity.pop();
198
198
 
199
199
  ## Identity Verification
200
200
 
201
- The Identity module provides passwordless authentication through a beautiful, customizable modal. Users can verify via passkeys, email codes, SMS codes, magic links, or social providers.
201
+ The Identity module provides passwordless authentication through a beautiful, customizable modal. Users can verify via passkeys, email codes, SMS codes, SparkLink, or social providers.
202
202
 
203
203
  ### Basic Usage
204
204
 
@@ -275,13 +275,13 @@ Authentication methods are configured in your Identity App settings. The SDK aut
275
275
  | `totp_email` | 6-digit code sent via email | Email |
276
276
  | `totp_sms` | 6-digit code sent via SMS | Phone |
277
277
  | `totp_voice` | 6-digit code sent via voice call | Phone |
278
- | `magic_link` / `sparklink` | One-click magic link via email | Email |
279
- | `google` | Sign in with Google | Email |
280
- | `apple` | Sign in with Apple | Email |
281
- | `microsoft` | Sign in with Microsoft | Email |
282
- | `github` | Sign in with GitHub | Email |
283
- | `facebook` | Sign in with Facebook | Email |
284
- | `linkedin` | Sign in with LinkedIn | Email |
278
+ | `sparklink` | One-click sign-in link via email | Email |
279
+ | `social_google` | Sign in with Google | Email |
280
+ | `social_apple` | Sign in with Apple | Email |
281
+ | `social_microsoft` | Sign in with Microsoft | Email |
282
+ | `social_github` | Sign in with GitHub | Email |
283
+ | `social_facebook` | Sign in with Facebook | Email |
284
+ | `social_linkedin` | Sign in with LinkedIn | Email |
285
285
 
286
286
  ## Backend Token Verification
287
287
 
@@ -1,51 +1,32 @@
1
1
  /**
2
2
  * SparkVault Auto-Initialization
3
3
  *
4
- * Enables zero-config initialization via script tag data attributes.
4
+ * Auto-initializes the SDK from script tag data attributes.
5
5
  *
6
6
  * @example
7
7
  * ```html
8
8
  * <script
9
- * async
10
9
  * src="https://cdn.sparkvault.com/sdk/v1/sparkvault.js"
11
10
  * data-account-id="acc_your_account_id"
12
- * data-attach-selector=".js-sparkvault-auth"
13
- * data-success-url="https://example.com/auth/verify-token"
14
- * data-error-function="handleSparkVaultError"
15
- * data-debug="true"
16
11
  * ></script>
12
+ *
13
+ * <script>
14
+ * // SDK is ready - just use it
15
+ * SparkVault.identity.attach('.login-btn', {
16
+ * onSuccess: (result) => console.log('Verified:', result.identity)
17
+ * });
18
+ * </script>
17
19
  * ```
18
20
  *
19
21
  * Supported attributes:
20
22
  * - data-account-id: Account ID (required for auto-init)
21
- * - data-attach-selector: CSS selector for elements to attach click handlers
22
- * - data-success-url: URL to POST { token, identity } on successful verification
23
- * - data-success-function: Global function name to call on success (receives { token, identity, identityType })
24
- * - data-error-url: URL to redirect to on error (appends ?error=message)
25
- * - data-error-function: Global function name to call on error (receives Error object)
26
23
  * - data-debug: Set to "true" to enable verbose console logging
27
24
  */
28
25
  import type { SparkVault } from './index';
29
- /** Auto-init configuration parsed from script tag attributes */
30
- export interface AutoInitConfig {
31
- accountId: string | null;
32
- attachSelector: string | null;
33
- successUrl: string | null;
34
- successFunction: string | null;
35
- errorUrl: string | null;
36
- errorFunction: string | null;
37
- debug: boolean;
38
- preloadConfig: boolean;
39
- timeout: number;
40
- }
41
26
  /**
42
- * Initialize the SDK from script tag attributes
27
+ * Initialize the SDK from script tag attributes.
43
28
  *
44
29
  * Called automatically when the script loads.
45
- * Requires SparkVault class to be passed in to avoid circular dependency.
46
- */
47
- export declare function autoInit(SparkVaultClass: typeof SparkVault): void;
48
- /**
49
- * Clean up auto-init resources
30
+ * Returns the initialized instance if data-account-id is present, null otherwise.
50
31
  */
51
- export declare function cleanup(): void;
32
+ export declare function autoInit(SparkVaultClass: typeof SparkVault): SparkVault | null;
package/dist/config.d.ts CHANGED
@@ -13,6 +13,8 @@ export interface SparkVaultConfig {
13
13
  * Set to false to defer config loading until verify() is called.
14
14
  */
15
15
  preloadConfig?: boolean;
16
+ /** Enable backdrop blur on dialogs (default: true) */
17
+ backdropBlur?: boolean;
16
18
  }
17
19
  export interface ResolvedConfig {
18
20
  accountId: string;
@@ -20,6 +22,7 @@ export interface ResolvedConfig {
20
22
  apiBaseUrl: string;
21
23
  identityBaseUrl: string;
22
24
  preloadConfig: boolean;
25
+ backdropBlur: boolean;
23
26
  }
24
27
  export declare function resolveConfig(config: SparkVaultConfig): ResolvedConfig;
25
28
  export declare function validateConfig(config: SparkVaultConfig): void;
@@ -5,7 +5,7 @@
5
5
  * Single responsibility: API calls only.
6
6
  */
7
7
  import type { ResolvedConfig } from '../config';
8
- import type { SdkConfig, TotpSendResponse, TotpVerifyResponse, PasskeyChallengeResponse, PasskeyVerifyResponse, SparkLinkSendResponse, SparkLinkStatusResponse } from './types';
8
+ import type { SdkConfig, TotpSendResponse, TotpVerifyResponse, PasskeyChallengeResponse, PasskeyVerifyResponse, SparkLinkSendResponse, SparkLinkStatusResponse, AuthContext } from './types';
9
9
  export declare class IdentityApi {
10
10
  private readonly config;
11
11
  private readonly timeoutMs;
@@ -40,12 +40,18 @@ export declare class IdentityApi {
40
40
  email_valid: boolean;
41
41
  hasPasskey: boolean;
42
42
  }>;
43
+ /**
44
+ * Build auth context params for API requests (OIDC/simple mode).
45
+ * Converts AuthContext to snake_case params expected by backend.
46
+ */
47
+ private buildAuthContextParams;
43
48
  /**
44
49
  * Send TOTP code to email or phone
45
50
  */
46
51
  sendTotp(params: {
47
52
  recipient: string;
48
53
  method: 'email' | 'sms' | 'voice';
54
+ authContext?: AuthContext;
49
55
  }): Promise<TotpSendResponse>;
50
56
  /**
51
57
  * Verify TOTP code
@@ -54,6 +60,7 @@ export declare class IdentityApi {
54
60
  kindling: string;
55
61
  pin: string;
56
62
  recipient: string;
63
+ authContext?: AuthContext;
57
64
  }): Promise<TotpVerifyResponse>;
58
65
  /**
59
66
  * Start passkey registration
@@ -69,31 +76,28 @@ export declare class IdentityApi {
69
76
  /**
70
77
  * Start passkey verification
71
78
  */
72
- startPasskeyVerify(email: string): Promise<PasskeyChallengeResponse>;
79
+ startPasskeyVerify(email: string, authContext?: AuthContext): Promise<PasskeyChallengeResponse>;
73
80
  /**
74
81
  * Complete passkey verification
75
82
  */
76
83
  completePasskeyVerify(params: {
77
84
  session: Record<string, unknown>;
78
85
  credential: PublicKeyCredential;
86
+ authContext?: AuthContext;
79
87
  }): Promise<PasskeyVerifyResponse>;
80
88
  /**
81
89
  * Get OAuth redirect URL for social provider
82
90
  */
83
91
  getSocialAuthUrl(provider: string, redirectUri: string, state: string): string;
84
- /**
85
- * Get SAML redirect URL for enterprise provider
86
- */
87
- getEnterpriseAuthUrl(provider: string, redirectUri: string, state: string): string;
88
92
  /**
89
93
  * Send SparkLink email for identity verification.
90
94
  * Includes openerOrigin for postMessage-based completion notification.
91
95
  */
92
- sendSparkLink(email: string): Promise<SparkLinkSendResponse>;
96
+ sendSparkLink(email: string, authContext?: AuthContext): Promise<SparkLinkSendResponse>;
93
97
  /**
94
98
  * Check SparkLink verification status (polling endpoint)
95
99
  */
96
- checkSparkLinkStatus(sparkId: string): Promise<SparkLinkStatusResponse>;
100
+ checkSparkLinkStatus(sparkId: string, _authContext?: AuthContext): Promise<SparkLinkStatusResponse>;
97
101
  }
98
102
  export declare class IdentityApiError extends Error {
99
103
  readonly code: string;
@@ -1,8 +1,15 @@
1
1
  /**
2
2
  * Passkey Handler
3
3
  *
4
- * Single responsibility: WebAuthn passkey registration and verification.
5
- * Extracts passkey logic from IdentityRenderer for better separation of concerns.
4
+ * Handles WebAuthn passkey registration and verification via popup.
5
+ * Uses a popup window on sparkvault.com domain to ensure WebAuthn works
6
+ * correctly when the SDK is embedded on third-party client domains.
7
+ *
8
+ * Flow:
9
+ * 1. SDK opens popup to sparkvault.com/passkey/popup
10
+ * 2. Popup executes WebAuthn (origin = sparkvault.com matches RP ID)
11
+ * 3. Popup sends result via postMessage
12
+ * 4. SDK receives result and returns to caller
6
13
  */
7
14
  import type { IdentityApi } from '../api';
8
15
  import type { VerifyResult } from '../types';
@@ -14,7 +21,7 @@ export interface PasskeyResult {
14
21
  success: boolean;
15
22
  result?: VerifyResult;
16
23
  error?: string;
17
- errorType?: 'cancelled' | 'not_found' | 'not_allowed' | 'unknown';
24
+ errorType?: 'cancelled' | 'not_found' | 'not_allowed' | 'popup_blocked' | 'unknown';
18
25
  }
19
26
  /**
20
27
  * Result of passkey check operation
@@ -26,11 +33,13 @@ export interface PasskeyCheckResult {
26
33
  hasPasskey: boolean;
27
34
  }
28
35
  /**
29
- * Handles WebAuthn passkey registration and verification
36
+ * Handles WebAuthn passkey registration and verification via popup
30
37
  */
31
38
  export declare class PasskeyHandler {
32
39
  private readonly api;
33
40
  private readonly state;
41
+ private readonly baseUrl;
42
+ private readonly accountId;
34
43
  constructor(api: IdentityApi, state: VerificationState);
35
44
  /**
36
45
  * Check if user has registered passkeys and validate email domain
@@ -38,15 +47,23 @@ export declare class PasskeyHandler {
38
47
  */
39
48
  checkPasskey(): Promise<PasskeyCheckResult | null>;
40
49
  /**
41
- * Register a new passkey for the user
50
+ * Register a new passkey for the user via popup
42
51
  */
43
52
  register(): Promise<PasskeyResult>;
44
53
  /**
45
- * Verify user with existing passkey
54
+ * Verify user with existing passkey via popup
46
55
  */
47
56
  verify(): Promise<PasskeyResult>;
48
57
  /**
49
- * Handle WebAuthn errors and categorize them
58
+ * Open passkey popup and wait for result
59
+ */
60
+ private openPasskeyPopup;
61
+ /**
62
+ * Validate that a message origin is from sparkvault.com domain
63
+ */
64
+ private isValidMessageOrigin;
65
+ /**
66
+ * Handle popup error response
50
67
  */
51
- private handleError;
68
+ private handlePopupError;
52
69
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * SparkLink Handler
3
3
  *
4
- * Single responsibility: SparkLink (magic link) sending and status polling.
4
+ * Single responsibility: SparkLink sending and status polling.
5
5
  * Extracts SparkLink logic from IdentityRenderer for better separation of concerns.
6
6
  */
7
7
  import type { IdentityApi } from '../api';
@@ -23,9 +23,11 @@ export interface SparkLinkStatusResult {
23
23
  token?: string;
24
24
  identity?: string;
25
25
  identityType?: string;
26
+ /** Redirect URL for OIDC/simple mode flows */
27
+ redirect?: string;
26
28
  }
27
29
  /**
28
- * Handles SparkLink (magic link) sending and verification polling
30
+ * Handles SparkLink sending and verification polling
29
31
  */
30
32
  export declare class SparkLinkHandler {
31
33
  private readonly api;
@@ -1,69 +1,87 @@
1
1
  /**
2
2
  * Identity Module
3
3
  *
4
- * Provides identity verification through a DOM-based modal interface.
5
- * Supports passkey, TOTP, magic link, and social authentication.
4
+ * Provides identity verification through dialog or inline UI.
5
+ * Supports passkey, TOTP, SparkLink, and social authentication.
6
+ *
7
+ * @example Dialog mode (immediate)
8
+ * const result = await sv.identity.verify();
9
+ *
10
+ * @example Dialog mode (attached to clicks)
11
+ * sv.identity.attach('.login-btn');
12
+ *
13
+ * @example Inline mode
14
+ * const result = await sv.identity.verify({ target: '#auth-container' });
6
15
  */
7
16
  import type { ResolvedConfig } from '../config';
8
- import type { VerifyOptions, VerifyResult, TokenClaims, RenderOptions } from './types';
17
+ import type { VerifyOptions, VerifyResult, TokenClaims, AttachOptions } from './types';
9
18
  export declare class IdentityModule {
10
19
  private readonly config;
11
20
  private readonly api;
12
21
  private renderer;
22
+ private attachedElements;
13
23
  constructor(config: ResolvedConfig);
14
24
  /**
15
- * Open the identity verification modal (popup).
16
- * Returns when user successfully verifies their identity.
25
+ * Verify user identity.
17
26
  *
18
- * @example
19
- * const result = await sv.identity.pop({
27
+ * - Without `target`: Opens a dialog (modal)
28
+ * - With `target`: Renders inline into the specified element
29
+ *
30
+ * @example Dialog mode
31
+ * const result = await sv.identity.verify();
32
+ * console.log(result.token, result.identity);
33
+ *
34
+ * @example Inline mode
35
+ * const result = await sv.identity.verify({
36
+ * target: '#auth-container',
20
37
  * email: 'user@example.com'
21
38
  * });
22
- * console.log(result.token, result.identity, result.identityType);
23
39
  */
24
- pop(options?: VerifyOptions): Promise<VerifyResult>;
40
+ verify(options?: VerifyOptions): Promise<VerifyResult>;
25
41
  /**
26
- * Render identity verification inline within a target element.
27
- * Unlike verify() which opens a modal popup, this embeds the UI
28
- * directly into the specified element.
42
+ * Attach identity verification to element clicks.
43
+ * When any matching element is clicked, opens the verification dialog.
29
44
  *
30
- * @example
31
- * // Render in a div
32
- * const result = await sv.identity.render({
33
- * target: document.getElementById('auth-container'),
34
- * email: 'user@example.com'
35
- * });
45
+ * @param selector - CSS selector for elements to attach to
46
+ * @param options - Verification options and callbacks
47
+ * @returns Cleanup function to remove event listeners
36
48
  *
37
49
  * @example
38
- * // Render in a custom dialog without header/footer
39
- * const result = await sv.identity.render({
40
- * target: dialogContentElement,
41
- * showHeader: false,
42
- * showFooter: false
50
+ * const cleanup = sv.identity.attach('.login-btn', {
51
+ * onSuccess: (result) => console.log('Verified:', result.identity)
43
52
  * });
53
+ *
54
+ * // Later, remove listeners
55
+ * cleanup();
44
56
  */
45
- render(options: RenderOptions): Promise<VerifyResult>;
57
+ attach(selector: string, options?: AttachOptions): () => void;
46
58
  /**
47
59
  * Verify and decode an identity token.
48
60
  * Validates the token structure, expiry, and issuer.
49
61
  *
50
62
  * Note: For production use, verify the Ed25519 signature server-side
51
63
  * using the JWKS endpoint.
52
- *
53
- * @example
54
- * const claims = await sv.identity.verifyToken(token);
55
- * console.log(claims.identity, claims.identity_type, claims.method);
56
64
  */
57
65
  verifyToken(token: string): Promise<TokenClaims>;
58
66
  /**
59
- * Close the identity modal if open.
67
+ * Close the identity dialog/inline UI if open.
60
68
  */
61
69
  close(): void;
62
70
  /**
63
- * @deprecated Use `pop()` instead. Will be removed in v2.0.
71
+ * Resolve target to an HTMLElement.
64
72
  */
65
- verify(options?: VerifyOptions): Promise<VerifyResult>;
73
+ private createInlineContainer;
74
+ /**
75
+ * @deprecated Use `verify()` instead. Will be removed in v2.0.
76
+ */
77
+ pop(options?: VerifyOptions): Promise<VerifyResult>;
78
+ /**
79
+ * @deprecated Use `verify({ target })` instead. Will be removed in v2.0.
80
+ */
81
+ render(options: VerifyOptions & {
82
+ target: HTMLElement;
83
+ }): Promise<VerifyResult>;
66
84
  }
67
- export type { VerifyOptions, RenderOptions, VerifyResult, TokenClaims, AuthMethod, Theme, SdkConfig, SdkConfigBranding, MethodId, MethodMetadata, } from './types';
85
+ export type { VerifyOptions, AttachOptions, VerifyResult, TokenClaims, AuthMethod, AuthContext, Theme, SdkConfig, SdkConfigBranding, MethodId, MethodMetadata, } from './types';
68
86
  export { METHOD_REGISTRY, getMethodMetadata, enrichMethods } from './methods';
69
87
  export { IdentityApi, IdentityApiError } from './api';
@@ -65,6 +65,14 @@ export declare class IdentityRenderer {
65
65
  private handlePasskeyRegistrationSkip;
66
66
  private handleSocialLogin;
67
67
  private normalizeError;
68
+ /**
69
+ * Check if error is a session/token expiration that should redirect to identity input.
70
+ */
71
+ private isSessionExpiredError;
72
+ /**
73
+ * Handle errors - redirect to identity input for session errors, show error view otherwise.
74
+ */
75
+ private handleErrorWithRecovery;
68
76
  /**
69
77
  * Check if we should show the passkey registration prompt after PIN verification.
70
78
  */
@@ -7,7 +7,7 @@
7
7
  * - Easier debugging and testing
8
8
  * - Clear data ownership
9
9
  */
10
- import type { SdkConfig, VerifyResult, IdentityViewState, MethodMetadata } from './types';
10
+ import type { SdkConfig, VerifyResult, IdentityViewState, MethodMetadata, AuthContext } from './types';
11
11
  import type { IdentityType } from './views';
12
12
  /**
13
13
  * Passkey-specific state
@@ -37,6 +37,7 @@ export declare class VerificationState {
37
37
  private _viewState;
38
38
  private _recipient;
39
39
  private _identityType;
40
+ private _authContext;
40
41
  private readonly _passkey;
41
42
  private readonly _totp;
42
43
  private readonly listeners;
@@ -67,6 +68,8 @@ export declare class VerificationState {
67
68
  get identityType(): IdentityType;
68
69
  setIdentity(recipient: string, type: IdentityType): void;
69
70
  getAllowedIdentityTypes(): IdentityType[];
71
+ get authContext(): AuthContext | undefined;
72
+ setAuthContext(context: AuthContext | undefined): void;
70
73
  get passkey(): Readonly<PasskeyState>;
71
74
  setPasskeyStatus(hasPasskey: boolean | null): void;
72
75
  enablePasskeyFallback(): void;
@@ -1,31 +1,59 @@
1
1
  /**
2
2
  * Identity Module Types
3
3
  */
4
- export type AuthMethod = 'passkey' | 'totp_email' | 'totp_sms' | 'totp_voice' | 'magic_link' | 'sparklink' | 'google' | 'apple' | 'microsoft' | 'github' | 'facebook' | 'linkedin' | 'social_google' | 'social_apple' | 'social_microsoft' | 'social_github' | 'social_facebook' | 'social_linkedin';
4
+ export type AuthMethod = 'passkey' | 'totp_email' | 'totp_sms' | 'totp_voice' | 'sparklink' | 'social_google' | 'social_apple' | 'social_microsoft' | 'social_github' | 'social_facebook' | 'social_linkedin';
5
5
  export type Theme = 'light' | 'dark';
6
+ /**
7
+ * Auth context for OIDC or simple redirect flows.
8
+ * Used by hosted login pages to complete authorization flows.
9
+ */
10
+ export interface AuthContext {
11
+ /** OIDC auth request ID for authorization code flow */
12
+ authRequestId?: string;
13
+ /** Simple redirect mode configuration */
14
+ simpleMode?: {
15
+ successUrl: string;
16
+ failureUrl: string;
17
+ state?: string;
18
+ };
19
+ }
6
20
  export interface VerifyOptions {
7
21
  /** Pre-fill email address (mutually exclusive with phone) */
8
22
  email?: string;
9
23
  /** Pre-fill phone number in E.164 format, e.g. "+14155551234" (mutually exclusive with email) */
10
24
  phone?: string;
11
- /** Override backdrop blur setting from app config */
25
+ /**
26
+ * Target element for inline rendering. Can be:
27
+ * - A CSS selector string (e.g., "#auth-container")
28
+ * - An HTMLElement reference
29
+ * - Omitted for dialog mode (default)
30
+ */
31
+ target?: string | HTMLElement;
32
+ /** Override backdrop blur for this dialog (uses global config if omitted) */
12
33
  backdropBlur?: boolean;
13
- /** Called when user cancels */
34
+ /** Auth context for OIDC/simple mode flows (used by hosted login) */
35
+ authContext?: AuthContext;
36
+ /** Called when user cancels (if omitted, uses server-configured redirect) */
14
37
  onCancel?: () => void;
15
- /** Called when verification completes (before promise resolves) */
38
+ /** Called when verification completes (if omitted, uses server-configured redirect) */
16
39
  onSuccess?: (result: VerifyResult) => void;
17
- /** Called on error (before promise rejects) */
40
+ /** Called on error (if omitted, uses server-configured redirect) */
18
41
  onError?: (error: Error) => void;
19
42
  }
20
- export interface RenderOptions extends VerifyOptions {
21
- /** Target element to render inline UI into (required) */
22
- target: HTMLElement;
23
- /** Show header with branding and close button (default: true) */
24
- showHeader?: boolean;
25
- /** Show close button in header (default: true, requires showHeader) */
26
- showCloseButton?: boolean;
27
- /** Show footer with SparkVault branding (default: true) */
28
- showFooter?: boolean;
43
+ /** Options for attach() - binds verification to element clicks */
44
+ export interface AttachOptions {
45
+ /** Pre-fill email address */
46
+ email?: string;
47
+ /** Pre-fill phone number in E.164 format */
48
+ phone?: string;
49
+ /** Auth context for OIDC/simple mode flows */
50
+ authContext?: AuthContext;
51
+ /** Called when user cancels */
52
+ onCancel?: () => void;
53
+ /** Called when verification completes */
54
+ onSuccess?: (result: VerifyResult) => void;
55
+ /** Called on error */
56
+ onError?: (error: Error) => void;
29
57
  }
30
58
  export interface VerifyResult {
31
59
  /** Signed JWT token */
@@ -34,6 +62,8 @@ export interface VerifyResult {
34
62
  identity: string;
35
63
  /** Type of identity verified */
36
64
  identityType: 'email' | 'phone';
65
+ /** Redirect URL (only present for OIDC/simple mode flows) */
66
+ redirect?: string;
37
67
  }
38
68
  export interface TokenClaims {
39
69
  /** Issuer */
@@ -74,7 +104,7 @@ export interface SdkConfigBranding {
74
104
  themeMode?: 'light' | 'dark';
75
105
  }
76
106
  /** Method ID returned by config endpoint */
77
- export type MethodId = 'totp_email' | 'totp_sms' | 'totp_voice' | 'passkey' | 'sparklink' | 'social_google' | 'social_apple' | 'social_microsoft' | 'social_github' | 'social_facebook' | 'social_linkedin' | 'enterprise_okta' | 'enterprise_entra' | 'enterprise_onelogin' | 'enterprise_ping' | 'enterprise_jumpcloud' | 'hris_bamboohr' | 'hris_workday' | 'hris_adp' | 'hris_gusto' | 'hris_rippling';
107
+ export type MethodId = 'totp_email' | 'totp_sms' | 'totp_voice' | 'passkey' | 'sparklink' | 'social_google' | 'social_apple' | 'social_microsoft' | 'social_github' | 'social_facebook' | 'social_linkedin';
78
108
  export interface SdkConfig {
79
109
  accountId: string;
80
110
  /** Branding configuration (optional in v1 - uses defaults if not provided) */
@@ -87,13 +117,13 @@ export interface SdkConfig {
87
117
  /** Method metadata for SDK rendering (static lookup) */
88
118
  export interface MethodMetadata {
89
119
  id: MethodId;
90
- type: 'totp' | 'passkey' | 'magic_link' | 'social' | 'enterprise' | 'hris';
120
+ type: 'totp' | 'passkey' | 'sparklink' | 'social';
91
121
  /** Which identity type this method requires */
92
122
  identityType: 'email' | 'phone';
93
123
  name: string;
94
124
  description: string;
95
125
  icon: string;
96
- /** Provider name for social/enterprise/hris methods */
126
+ /** Provider name for social methods */
97
127
  provider?: string;
98
128
  }
99
129
  export interface TotpSendResponse {
@@ -109,6 +139,8 @@ export interface TotpVerifyResponse {
109
139
  identity?: string;
110
140
  /** Identity type - 'email' or 'phone' */
111
141
  identity_type?: 'email' | 'phone';
142
+ /** Redirect URL for OIDC/simple mode flows */
143
+ redirect?: string;
112
144
  /** Returned on failure - new kindling for next attempt */
113
145
  kindling?: string;
114
146
  /** Returned on failure - seconds until next attempt allowed */
@@ -134,6 +166,8 @@ export interface PasskeyVerifyResponse {
134
166
  token: string;
135
167
  identity: string;
136
168
  identity_type: 'email' | 'phone';
169
+ /** Redirect URL for OIDC/simple mode flows */
170
+ redirect?: string;
137
171
  }
138
172
  export interface SparkLinkSendResponse {
139
173
  sparkId: string;
@@ -144,6 +178,8 @@ export interface SparkLinkStatusResponse {
144
178
  token?: string;
145
179
  identity?: string;
146
180
  identityType?: string;
181
+ /** Redirect URL for OIDC/simple mode flows */
182
+ redirect?: string;
147
183
  }
148
184
  export type IdentityViewState = {
149
185
  view: 'loading';
@@ -170,6 +206,7 @@ export type IdentityViewState = {
170
206
  view: 'passkey-prompt';
171
207
  email: string;
172
208
  pendingResult: VerifyResult;
209
+ error?: string;
173
210
  } | {
174
211
  view: 'sparklink-waiting';
175
212
  email: string;
@@ -21,7 +21,7 @@ export declare function createCloseIcon(): SVGSVGElement;
21
21
  */
22
22
  export declare function createAuthShieldIcon(): SVGSVGElement;
23
23
  /**
24
- * Passkey icon
24
+ * Passkey icon - simple key design
25
25
  */
26
26
  export declare function createPasskeyIcon(): SVGSVGElement;
27
27
  /**
@@ -9,6 +9,8 @@ export interface PasskeyPromptViewProps {
9
9
  email: string;
10
10
  onAddPasskey: () => void;
11
11
  onSkip: () => void;
12
+ /** Error message to display when registration fails */
13
+ error?: string;
12
14
  }
13
15
  export declare class PasskeyPromptView implements View {
14
16
  private readonly props;