@sparkvault/sdk-js 1.26.0 → 1.27.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 +6 -6
- package/dist/config.d.ts +1 -1
- package/dist/identity/api.d.ts +2 -5
- package/dist/identity/handlers/passkey-handler.d.ts +3 -1
- package/dist/identity/handlers/totp-handler.d.ts +2 -0
- package/dist/identity/renderer.d.ts +8 -2
- package/dist/identity/types.d.ts +1 -1
- package/dist/identity/views/index.d.ts +1 -1
- package/dist/identity/views/{app-not-activated.d.ts → product-not-configured.d.ts} +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/sparkvault.cjs.js +120 -108
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +120 -108
- package/dist/sparkvault.esm.js.map +1 -1
- package/dist/sparkvault.js +1 -1
- package/dist/sparkvault.js.map +1 -1
- package/package.json +2 -2
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
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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
|
|
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;
|
package/dist/identity/api.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Identity API Client
|
|
3
3
|
*
|
|
4
|
-
* Handles all HTTP communication with the Identity
|
|
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
|
-
* `
|
|
40
|
-
* Identity
|
|
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;
|
package/dist/identity/types.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Product Not Configured View
|
|
3
3
|
*
|
|
4
|
-
* Full-dialog terminal screen shown when the SparkVault Identity
|
|
5
|
-
* been
|
|
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
|
|
11
|
+
export interface ProductNotConfiguredViewProps {
|
|
12
12
|
onClose: () => void;
|
|
13
13
|
}
|
|
14
|
-
export declare class
|
|
14
|
+
export declare class ProductNotConfiguredView implements View {
|
|
15
15
|
private readonly props;
|
|
16
16
|
private dismissButton;
|
|
17
17
|
private readonly boundHandleClose;
|
|
18
|
-
constructor(props:
|
|
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
|
|
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;
|