@sparkvault/sdk-js 1.26.0 → 1.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -267,7 +267,7 @@ try {
267
267
 
268
268
  ### Authentication Methods
269
269
 
270
- Authentication methods are configured in your Identity App settings. The SDK automatically shows only the methods you have enabled.
270
+ Authentication methods are configured in your Identity Product settings. The SDK automatically shows only the methods you have enabled.
271
271
 
272
272
  | Method | Description | Identity Type |
273
273
  |--------|-------------|---------------|
@@ -293,7 +293,7 @@ Authentication methods are configured in your Identity App settings. The SDK aut
293
293
  import * as jose from 'jose';
294
294
 
295
295
  const ACCOUNT_ID = 'acc_YOUR_ACCOUNT_ID';
296
- const IDENTITY_URL = 'https://api.sparkvault.com/v1/apps/identity';
296
+ const IDENTITY_URL = 'https://api.sparkvault.com/v1/products/identity';
297
297
 
298
298
  app.post('/api/auth/login', async (req, res) => {
299
299
  const { token } = req.body;
@@ -326,7 +326,7 @@ import jwt
326
326
  from jwt import PyJWKClient
327
327
 
328
328
  ACCOUNT_ID = 'acc_YOUR_ACCOUNT_ID'
329
- IDENTITY_URL = 'https://api.sparkvault.com/v1/apps/identity'
329
+ IDENTITY_URL = 'https://api.sparkvault.com/v1/products/identity'
330
330
 
331
331
  def verify_identity_token(token: str):
332
332
  """Verify a SparkVault Identity token and return the claims."""
@@ -376,7 +376,7 @@ import (
376
376
 
377
377
  const (
378
378
  AccountID = "acc_YOUR_ACCOUNT_ID"
379
- IdentityURL = "https://api.sparkvault.com/v1/apps/identity"
379
+ IdentityURL = "https://api.sparkvault.com/v1/products/identity"
380
380
  )
381
381
 
382
382
  func verifyToken(tokenString string) (jwt.Token, error) {
@@ -428,7 +428,7 @@ require 'net/http'
428
428
  require 'json'
429
429
 
430
430
  ACCOUNT_ID = 'acc_YOUR_ACCOUNT_ID'
431
- IDENTITY_URL = 'https://api.sparkvault.com/v1/apps/identity'
431
+ IDENTITY_URL = 'https://api.sparkvault.com/v1/products/identity'
432
432
 
433
433
  def verify_identity_token(token)
434
434
  jwks_url = "#{IDENTITY_URL}/#{ACCOUNT_ID}/.well-known/jwks.json"
@@ -475,7 +475,7 @@ When decoded, the JWT token contains these claims:
475
475
 
476
476
  ```json
477
477
  {
478
- "iss": "https://api.sparkvault.com/v1/apps/identity/acc_xxx",
478
+ "iss": "https://api.sparkvault.com/v1/products/identity/acc_xxx",
479
479
  "sub": "identity:a1b2c3d4e5f67890",
480
480
  "aud": "acc_xxx",
481
481
  "identity": "user@example.com",
package/dist/config.d.ts CHANGED
@@ -6,7 +6,7 @@ export interface SparkVaultConfig {
6
6
  accountId: string;
7
7
  /** Core API origin. Defaults to https://api.sparkvault.com. A trailing /v1 is accepted and normalized. */
8
8
  apiBaseUrl?: string;
9
- /** Identity App API base URL. Defaults to https://api.sparkvault.com/v1/apps/identity. */
9
+ /** Identity Product API base URL. Defaults to https://api.sparkvault.com/v1/products/identity. */
10
10
  identityBaseUrl?: string;
11
11
  /** Static SparkVault Core access token for authenticated API calls. */
12
12
  accessToken?: string;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Identity API Client
3
3
  *
4
- * Handles all HTTP communication with the Identity App endpoints.
4
+ * Handles all HTTP communication with the Identity Product endpoints.
5
5
  * Single responsibility: API calls only.
6
6
  */
7
7
  import type { ResolvedConfig } from '../config';
@@ -42,12 +42,9 @@ export declare class IdentityApi extends SparkVaultApi {
42
42
  * (email: MX lookup; phone: E.164 format)
43
43
  * - has_passkey: whether any passkeys are registered for this identity
44
44
  * (cross-tenant — single global RP)
45
- * - email_valid: legacy alias for identity_valid, present for backward
46
- * compatibility with older SDK versions
47
45
  */
48
46
  checkPasskey(identity: string, identityType?: 'email' | 'phone'): Promise<{
49
47
  identity_valid: boolean;
50
- email_valid: boolean;
51
48
  has_passkey: boolean;
52
49
  }>;
53
50
  /**
@@ -75,7 +72,7 @@ export declare class IdentityApi extends SparkVaultApi {
75
72
  /**
76
73
  * Start passkey registration for an identity (email or phone).
77
74
  */
78
- startPasskeyRegister(identity: string, identityType?: 'email' | 'phone'): Promise<PasskeyChallengeResponse>;
75
+ startPasskeyRegister(identity: string, identityType?: 'email' | 'phone', registrationToken?: string): Promise<PasskeyChallengeResponse>;
79
76
  /**
80
77
  * Complete passkey registration
81
78
  */
@@ -22,6 +22,8 @@ export interface PasskeyResult {
22
22
  result?: VerifyResult;
23
23
  error?: string;
24
24
  errorType?: 'cancelled' | 'not_found' | 'not_allowed' | 'popup_blocked' | 'unknown';
25
+ /** Machine-readable API error code (e.g. 'identity_locked'). */
26
+ errorCode?: string;
25
27
  }
26
28
  /**
27
29
  * Result of passkey check operation
@@ -49,7 +51,7 @@ export declare class PasskeyHandler {
49
51
  /**
50
52
  * Register a new passkey for the user via popup
51
53
  */
52
- register(): Promise<PasskeyResult>;
54
+ register(registrationToken?: string): Promise<PasskeyResult>;
53
55
  /**
54
56
  * Verify user with existing passkey via popup
55
57
  */
@@ -29,6 +29,8 @@ export interface TotpVerifyResult {
29
29
  /** When backoff expires (Unix timestamp) */
30
30
  backoffExpires?: number;
31
31
  error?: string;
32
+ /** Machine-readable API error code (e.g. 'identity_locked'). */
33
+ errorCode?: string;
32
34
  }
33
35
  /**
34
36
  * Handles TOTP code sending and verification
@@ -25,6 +25,12 @@ export declare class IdentityRenderer {
25
25
  private focusTimeoutId;
26
26
  private sparkLinkWs;
27
27
  constructor(container: Container, api: IdentityApi, options: VerifyOptions, callbacks: RendererCallbacks);
28
+ /**
29
+ * Fire the host's onSuccess callback, swallowing any exception so a
30
+ * misbehaving host handler can't block the post-success redirect the
31
+ * caller is depending on. The verify flow continues regardless.
32
+ */
33
+ private safeOnSuccess;
28
34
  private get recipient();
29
35
  private get identityType();
30
36
  private get sdkConfig();
@@ -36,8 +42,8 @@ export declare class IdentityRenderer {
36
42
  start(): Promise<void>;
37
43
  /**
38
44
  * Map a config-fetch error to the appropriate terminal view.
39
- * `app_not_installed` is a misconfiguration (account hasn't installed the
40
- * Identity app) — show a developer-targeted "Not Activated" screen with a
45
+ * `product_not_configured` is a misconfiguration (the account has not
46
+ * configured Identity) — show a developer-targeted terminal screen with a
41
47
  * link to SparkVault.com instead of the generic service-unavailable view.
42
48
  */
43
49
  private viewStateForConfigError;
@@ -217,5 +217,5 @@ export type IdentityViewState = {
217
217
  } | {
218
218
  view: 'service-unavailable';
219
219
  } | {
220
- view: 'app-not-activated';
220
+ view: 'product-not-configured';
221
221
  };
@@ -13,4 +13,4 @@ export * from './passkey-prompt';
13
13
  export * from './sparklink-waiting';
14
14
  export * from './error';
15
15
  export * from './service-unavailable';
16
- export * from './app-not-activated';
16
+ export * from './product-not-configured';
@@ -1,21 +1,21 @@
1
1
  /**
2
- * App Not Activated View
2
+ * Product Not Configured View
3
3
  *
4
- * Full-dialog terminal screen shown when the SparkVault Identity app has not
5
- * been activated for the account that the JS SDK is configured against. The
4
+ * Full-dialog terminal screen shown when the SparkVault Identity Product has
5
+ * not been configured for the account that the JS SDK is configured against. The
6
6
  * audience is the website owner / developer — this is a misconfiguration
7
7
  * surface, not an end-user error — so the dialog drops customer branding and
8
8
  * presents itself as an unmistakable SparkVault notice.
9
9
  */
10
10
  import type { View } from './base';
11
- export interface AppNotActivatedViewProps {
11
+ export interface ProductNotConfiguredViewProps {
12
12
  onClose: () => void;
13
13
  }
14
- export declare class AppNotActivatedView implements View {
14
+ export declare class ProductNotConfiguredView implements View {
15
15
  private readonly props;
16
16
  private dismissButton;
17
17
  private readonly boundHandleClose;
18
- constructor(props: AppNotActivatedViewProps);
18
+ constructor(props: ProductNotConfiguredViewProps);
19
19
  render(): HTMLElement;
20
20
  destroy(): void;
21
21
  }
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ interface SparkVaultConfig {
6
6
  accountId: string;
7
7
  /** Core API origin. Defaults to https://api.sparkvault.com. A trailing /v1 is accepted and normalized. */
8
8
  apiBaseUrl?: string;
9
- /** Identity App API base URL. Defaults to https://api.sparkvault.com/v1/apps/identity. */
9
+ /** Identity Product API base URL. Defaults to https://api.sparkvault.com/v1/products/identity. */
10
10
  identityBaseUrl?: string;
11
11
  /** Static SparkVault Core access token for authenticated API calls. */
12
12
  accessToken?: string;