@sparkvault/sdk-js 1.27.2 → 1.27.4
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/dist/identity/api.d.ts +7 -5
- package/dist/identity/handlers/passkey-handler.d.ts +3 -3
- package/dist/identity/handlers/totp-handler.d.ts +2 -2
- package/dist/identity/index.d.ts +7 -0
- package/dist/identity/renderer.d.ts +4 -2
- package/dist/identity/state.d.ts +5 -5
- package/dist/identity/types.d.ts +37 -18
- package/dist/identity/views/method-select.d.ts +2 -2
- package/dist/identity/views/passkey-prompt.d.ts +1 -1
- package/dist/identity/views/passkey.d.ts +3 -3
- package/dist/identity/views/totp-verify.d.ts +2 -2
- package/dist/index.d.ts +25 -7
- package/dist/sparkvault.cjs.js +228 -114
- package/dist/sparkvault.cjs.js.map +1 -1
- package/dist/sparkvault.esm.js +228 -114
- 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 -1
package/dist/identity/api.d.ts
CHANGED
|
@@ -35,12 +35,12 @@ export declare class IdentityApi extends SparkVaultApi {
|
|
|
35
35
|
*/
|
|
36
36
|
isConfigPreloaded(): boolean;
|
|
37
37
|
/**
|
|
38
|
-
* Check
|
|
38
|
+
* Check whether the SVID resolved from an email or phone has registered passkeys.
|
|
39
39
|
*
|
|
40
40
|
* Returns:
|
|
41
41
|
* - identity_valid: identity passes per-type validity check
|
|
42
42
|
* (email: MX lookup; phone: E.164 format)
|
|
43
|
-
* - has_passkey: whether any passkeys are registered
|
|
43
|
+
* - has_passkey: whether any passkeys are registered on the resolved SVID
|
|
44
44
|
* (cross-tenant — single global RP)
|
|
45
45
|
*/
|
|
46
46
|
checkPasskey(identity: string, identityType?: 'email' | 'phone'): Promise<{
|
|
@@ -70,7 +70,7 @@ export declare class IdentityApi extends SparkVaultApi {
|
|
|
70
70
|
authContext?: AuthContext;
|
|
71
71
|
}): Promise<TotpVerifyResponse>;
|
|
72
72
|
/**
|
|
73
|
-
* Start passkey registration
|
|
73
|
+
* Start passkey registration from a freshly verified identifier.
|
|
74
74
|
*/
|
|
75
75
|
startPasskeyRegister(identity: string, identityType?: 'email' | 'phone', registrationToken?: string): Promise<PasskeyChallengeResponse>;
|
|
76
76
|
/**
|
|
@@ -81,9 +81,11 @@ export declare class IdentityApi extends SparkVaultApi {
|
|
|
81
81
|
credential: PublicKeyCredential;
|
|
82
82
|
}): Promise<PasskeyVerifyResponse>;
|
|
83
83
|
/**
|
|
84
|
-
* Start passkey verification
|
|
84
|
+
* Start discoverable passkey verification. Legacy identity parameters are
|
|
85
|
+
* intentionally ignored; the credential userHandle routes completion to the
|
|
86
|
+
* SVID.
|
|
85
87
|
*/
|
|
86
|
-
startPasskeyVerify(
|
|
88
|
+
startPasskeyVerify(_identity?: string, _identityType?: 'email' | 'phone', authContext?: AuthContext): Promise<PasskeyChallengeResponse>;
|
|
87
89
|
/**
|
|
88
90
|
* Complete passkey verification
|
|
89
91
|
*/
|
|
@@ -29,9 +29,9 @@ export interface PasskeyResult {
|
|
|
29
29
|
* Result of passkey check operation
|
|
30
30
|
*/
|
|
31
31
|
export interface PasskeyCheckResult {
|
|
32
|
-
/** Whether the
|
|
32
|
+
/** Whether the identifier is valid (email domain or phone format) */
|
|
33
33
|
emailValid: boolean;
|
|
34
|
-
/** Whether the
|
|
34
|
+
/** Whether the resolved SVID has registered passkeys */
|
|
35
35
|
hasPasskey: boolean;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
@@ -44,7 +44,7 @@ export declare class PasskeyHandler {
|
|
|
44
44
|
private readonly accountId;
|
|
45
45
|
constructor(api: IdentityApi, state: VerificationState);
|
|
46
46
|
/**
|
|
47
|
-
* Check if
|
|
47
|
+
* Check if the current identifier resolves to an SVID with registered passkeys.
|
|
48
48
|
* @returns Check result with emailValid and hasPasskey, or null on error
|
|
49
49
|
*/
|
|
50
50
|
checkPasskey(): Promise<PasskeyCheckResult | null>;
|
|
@@ -40,9 +40,9 @@ export declare class TotpHandler {
|
|
|
40
40
|
private readonly state;
|
|
41
41
|
constructor(api: IdentityApi, state: VerificationState);
|
|
42
42
|
/**
|
|
43
|
-
* Send TOTP code via email or
|
|
43
|
+
* Send TOTP code via email, SMS, or voice
|
|
44
44
|
*/
|
|
45
|
-
send(method: 'email' | 'sms'): Promise<TotpSendResult>;
|
|
45
|
+
send(method: 'email' | 'sms' | 'voice'): Promise<TotpSendResult>;
|
|
46
46
|
/**
|
|
47
47
|
* Resend TOTP code
|
|
48
48
|
*/
|
package/dist/identity/index.d.ts
CHANGED
|
@@ -63,6 +63,13 @@ export declare class IdentityModule {
|
|
|
63
63
|
* using the JWKS endpoint.
|
|
64
64
|
*/
|
|
65
65
|
verifyToken(token: string): Promise<TokenClaims>;
|
|
66
|
+
/**
|
|
67
|
+
* Complete full-page redirect results produced by social-login flows.
|
|
68
|
+
* The Identity Product redirects back with `#token=...` so the token does
|
|
69
|
+
* not hit server logs. Consume it once, validate the issuer/expiry shape,
|
|
70
|
+
* then remove it from the URL bar.
|
|
71
|
+
*/
|
|
72
|
+
private consumeRedirectResult;
|
|
66
73
|
/**
|
|
67
74
|
* Close the identity dialog/inline UI if open.
|
|
68
75
|
*/
|
|
@@ -66,6 +66,7 @@ export declare class IdentityRenderer {
|
|
|
66
66
|
private handleClose;
|
|
67
67
|
private get viewState();
|
|
68
68
|
private setState;
|
|
69
|
+
private showInitialAuthStep;
|
|
69
70
|
private render;
|
|
70
71
|
private destroyCurrentView;
|
|
71
72
|
private createViewForState;
|
|
@@ -78,10 +79,11 @@ export declare class IdentityRenderer {
|
|
|
78
79
|
private handleTotpResend;
|
|
79
80
|
private handlePasskeyStart;
|
|
80
81
|
/**
|
|
81
|
-
* Handle fallback from passkey to
|
|
82
|
-
* User clicked "Having trouble? Use
|
|
82
|
+
* Handle fallback from passkey to an identifier-based code.
|
|
83
|
+
* User clicked "Having trouble? Use a code instead".
|
|
83
84
|
*/
|
|
84
85
|
private handlePasskeyFallback;
|
|
86
|
+
private passkeyFallbackMethodsAvailable;
|
|
85
87
|
/**
|
|
86
88
|
* Handle skipping passkey registration when coming from passkey prompt.
|
|
87
89
|
* User clicked "Back" or cancelled registration after being prompted.
|
package/dist/identity/state.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ interface PasskeyState {
|
|
|
26
26
|
interface TotpState {
|
|
27
27
|
/** Current kindling token for TOTP verification */
|
|
28
28
|
kindling: string;
|
|
29
|
-
/** Current TOTP method (email or
|
|
30
|
-
method: 'email' | 'sms' | null;
|
|
29
|
+
/** Current TOTP method (email, sms, or voice) */
|
|
30
|
+
method: 'email' | 'sms' | 'voice' | null;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Centralized verification state
|
|
@@ -55,7 +55,7 @@ export declare class VerificationState {
|
|
|
55
55
|
setConfig(config: SdkConfig): void;
|
|
56
56
|
get accountId(): string;
|
|
57
57
|
/**
|
|
58
|
-
* Get enriched methods filtered by
|
|
58
|
+
* Get enriched methods filtered by the fallback identifier type.
|
|
59
59
|
*/
|
|
60
60
|
getAvailableMethods(): MethodMetadata[];
|
|
61
61
|
/**
|
|
@@ -76,7 +76,7 @@ export declare class VerificationState {
|
|
|
76
76
|
setPendingResult(result: VerifyResult | null): void;
|
|
77
77
|
/**
|
|
78
78
|
* Check if we should show passkey registration prompt
|
|
79
|
-
* Based on: passkey enabled,
|
|
79
|
+
* Based on: passkey enabled, the current SVID doesn't have one, not dismissed
|
|
80
80
|
*/
|
|
81
81
|
shouldShowPasskeyPrompt(): boolean;
|
|
82
82
|
/**
|
|
@@ -89,7 +89,7 @@ export declare class VerificationState {
|
|
|
89
89
|
dismissPasskeyPrompt(): void;
|
|
90
90
|
get totp(): Readonly<TotpState>;
|
|
91
91
|
setKindling(kindling: string): void;
|
|
92
|
-
setTotpMethod(method: 'email' | 'sms'): void;
|
|
92
|
+
setTotpMethod(method: 'email' | 'sms' | 'voice'): void;
|
|
93
93
|
/**
|
|
94
94
|
* Reset state for new verification attempt
|
|
95
95
|
*/
|
package/dist/identity/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
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
|
+
export type VerifiedIdentityType = 'email' | 'phone' | 'social';
|
|
6
7
|
/**
|
|
7
8
|
* Auth context for OIDC or simple redirect flows.
|
|
8
9
|
* Used by hosted login pages to complete authorization flows.
|
|
@@ -60,17 +61,23 @@ export interface AttachOptions {
|
|
|
60
61
|
export interface VerifyResult {
|
|
61
62
|
/** Signed JWT token */
|
|
62
63
|
token: string;
|
|
63
|
-
/** Verified
|
|
64
|
+
/** Verified identifier used for audit and user-facing attribution; passkey credentials route by SVID. */
|
|
64
65
|
identity: string;
|
|
65
|
-
/** Type of
|
|
66
|
-
identityType:
|
|
66
|
+
/** Type of identifier returned with the verification result. */
|
|
67
|
+
identityType: VerifiedIdentityType;
|
|
68
|
+
/** Canonical SparkVault ID */
|
|
69
|
+
svid?: string;
|
|
70
|
+
/** Managed SparkVault Identity session ID */
|
|
71
|
+
sessionId?: string;
|
|
72
|
+
/** Managed-session refresh token, when the flow returns one */
|
|
73
|
+
refreshToken?: string;
|
|
67
74
|
/** Redirect URL (only present for OIDC/simple mode flows) */
|
|
68
75
|
redirect?: string;
|
|
69
76
|
}
|
|
70
77
|
export interface TokenClaims {
|
|
71
78
|
/** Issuer */
|
|
72
79
|
iss: string;
|
|
73
|
-
/** Subject
|
|
80
|
+
/** Subject. Managed Identity tokens use the SVID. */
|
|
74
81
|
sub: string;
|
|
75
82
|
/** Audience (account ID for simple tokens, client ID for OIDC) */
|
|
76
83
|
aud: string;
|
|
@@ -80,10 +87,14 @@ export interface TokenClaims {
|
|
|
80
87
|
iat: number;
|
|
81
88
|
/** Unique token ID for replay protection */
|
|
82
89
|
jti?: string;
|
|
83
|
-
/** Verified
|
|
90
|
+
/** Verified identifier used for audit and user-facing attribution; passkey credentials route by SVID. */
|
|
84
91
|
identity: string;
|
|
85
|
-
/**
|
|
86
|
-
identity_type:
|
|
92
|
+
/** Identifier type */
|
|
93
|
+
identity_type: VerifiedIdentityType;
|
|
94
|
+
/** Canonical SparkVault ID */
|
|
95
|
+
svid?: string;
|
|
96
|
+
/** Managed SparkVault Identity session ID */
|
|
97
|
+
session_id?: string;
|
|
87
98
|
/** Verification timestamp (Unix seconds) */
|
|
88
99
|
verified_at: number;
|
|
89
100
|
/** Authentication method used */
|
|
@@ -111,7 +122,7 @@ export interface SdkConfig {
|
|
|
111
122
|
accountId: string;
|
|
112
123
|
/** Branding configuration (optional in v1 - uses defaults if not provided) */
|
|
113
124
|
branding?: SdkConfigBranding;
|
|
114
|
-
/**
|
|
125
|
+
/** Email/phone input types derived from enabled delivery methods */
|
|
115
126
|
allowedIdentityTypes?: ('email' | 'phone')[];
|
|
116
127
|
/** Enabled method IDs */
|
|
117
128
|
methods: MethodId[];
|
|
@@ -122,8 +133,8 @@ export interface SdkConfig {
|
|
|
122
133
|
export interface MethodMetadata {
|
|
123
134
|
id: MethodId;
|
|
124
135
|
type: 'totp' | 'passkey' | 'sparklink' | 'social';
|
|
125
|
-
/** Which
|
|
126
|
-
identityType
|
|
136
|
+
/** Which identifier type this method requires. Passkeys are SVID-scoped and do not require one. */
|
|
137
|
+
identityType?: 'email' | 'phone';
|
|
127
138
|
name: string;
|
|
128
139
|
description: string;
|
|
129
140
|
icon: string;
|
|
@@ -145,6 +156,12 @@ export interface TotpVerifyResponse {
|
|
|
145
156
|
identity_type?: 'email' | 'phone';
|
|
146
157
|
/** Redirect URL for OIDC/simple mode flows */
|
|
147
158
|
redirect?: string;
|
|
159
|
+
/** Canonical SparkVault ID */
|
|
160
|
+
svid?: string;
|
|
161
|
+
/** Managed SparkVault Identity session ID */
|
|
162
|
+
session_id?: string;
|
|
163
|
+
/** Managed-session refresh token */
|
|
164
|
+
refresh_token?: string;
|
|
148
165
|
/** Returned on failure - new kindling for next attempt */
|
|
149
166
|
kindling?: string;
|
|
150
167
|
/** Returned on failure - seconds until next attempt allowed */
|
|
@@ -158,10 +175,6 @@ export interface PasskeyChallengeResponse {
|
|
|
158
175
|
rpName: string;
|
|
159
176
|
userId?: string;
|
|
160
177
|
userName?: string;
|
|
161
|
-
allowCredentials?: Array<{
|
|
162
|
-
id: string;
|
|
163
|
-
type: 'public-key';
|
|
164
|
-
}>;
|
|
165
178
|
timeout: number;
|
|
166
179
|
/** Session object to pass back in complete request */
|
|
167
180
|
session: Record<string, unknown>;
|
|
@@ -169,7 +182,13 @@ export interface PasskeyChallengeResponse {
|
|
|
169
182
|
export interface PasskeyVerifyResponse {
|
|
170
183
|
token: string;
|
|
171
184
|
identity: string;
|
|
172
|
-
identity_type:
|
|
185
|
+
identity_type: VerifiedIdentityType;
|
|
186
|
+
/** Canonical SparkVault ID */
|
|
187
|
+
svid?: string;
|
|
188
|
+
/** Managed SparkVault Identity session ID */
|
|
189
|
+
session_id?: string;
|
|
190
|
+
/** Managed-session refresh token */
|
|
191
|
+
refresh_token?: string;
|
|
173
192
|
/** Redirect URL for OIDC/simple mode flows */
|
|
174
193
|
redirect?: string;
|
|
175
194
|
}
|
|
@@ -189,18 +208,18 @@ export type IdentityViewState = {
|
|
|
189
208
|
} | {
|
|
190
209
|
view: 'totp-verify';
|
|
191
210
|
email: string;
|
|
192
|
-
method: 'email' | 'sms';
|
|
211
|
+
method: 'email' | 'sms' | 'voice';
|
|
193
212
|
kindling: string;
|
|
194
213
|
error?: string;
|
|
195
214
|
backoffExpires?: number;
|
|
196
215
|
} | {
|
|
197
216
|
view: 'passkey';
|
|
198
|
-
|
|
217
|
+
recipient: string;
|
|
199
218
|
mode: 'register' | 'verify';
|
|
200
219
|
error?: string;
|
|
201
220
|
} | {
|
|
202
221
|
view: 'passkey-prompt';
|
|
203
|
-
|
|
222
|
+
recipient: string;
|
|
204
223
|
pendingResult: VerifyResult;
|
|
205
224
|
error?: string;
|
|
206
225
|
} | {
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
import type { View } from './base';
|
|
7
7
|
import type { MethodMetadata } from '../types';
|
|
8
8
|
export interface MethodSelectViewProps {
|
|
9
|
-
email
|
|
9
|
+
email?: string;
|
|
10
10
|
methods: MethodMetadata[];
|
|
11
11
|
onSelectMethod: (method: MethodMetadata) => void;
|
|
12
|
-
onBack
|
|
12
|
+
onBack?: () => void;
|
|
13
13
|
}
|
|
14
14
|
export declare class MethodSelectView implements View {
|
|
15
15
|
private readonly props;
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { View } from './base';
|
|
7
7
|
export interface PasskeyViewProps {
|
|
8
|
-
|
|
8
|
+
identityLabel: string;
|
|
9
9
|
mode: 'register' | 'verify';
|
|
10
10
|
error?: string;
|
|
11
11
|
onStart: () => void;
|
|
12
|
-
onBack
|
|
13
|
-
/** Optional fallback to
|
|
12
|
+
onBack?: () => void;
|
|
13
|
+
/** Optional fallback to an identifier-based code if passkey fails */
|
|
14
14
|
onFallback?: () => void;
|
|
15
15
|
}
|
|
16
16
|
export declare class PasskeyView implements View {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TOTP Verification View
|
|
3
3
|
*
|
|
4
|
-
* Collects and validates the 6-digit TOTP code sent via email or
|
|
4
|
+
* Collects and validates the 6-digit TOTP code sent via email, SMS, or voice.
|
|
5
5
|
*/
|
|
6
6
|
import type { View } from './base';
|
|
7
7
|
export interface TotpVerifyViewProps {
|
|
8
8
|
email: string;
|
|
9
|
-
method: 'email' | 'sms';
|
|
9
|
+
method: 'email' | 'sms' | 'voice';
|
|
10
10
|
error?: string;
|
|
11
11
|
/** UTC timestamp (Unix seconds) when backoff expires and next attempt is allowed */
|
|
12
12
|
backoffExpires?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ declare class HealthModule {
|
|
|
68
68
|
*/
|
|
69
69
|
type AuthMethod = 'passkey' | 'totp_email' | 'totp_sms' | 'totp_voice' | 'sparklink' | 'social_google' | 'social_apple' | 'social_microsoft' | 'social_github' | 'social_facebook' | 'social_linkedin';
|
|
70
70
|
type Theme = 'light' | 'dark';
|
|
71
|
+
type VerifiedIdentityType = 'email' | 'phone' | 'social';
|
|
71
72
|
/**
|
|
72
73
|
* Auth context for OIDC or simple redirect flows.
|
|
73
74
|
* Used by hosted login pages to complete authorization flows.
|
|
@@ -125,17 +126,23 @@ interface AttachOptions {
|
|
|
125
126
|
interface VerifyResult {
|
|
126
127
|
/** Signed JWT token */
|
|
127
128
|
token: string;
|
|
128
|
-
/** Verified
|
|
129
|
+
/** Verified identifier used for audit and user-facing attribution; passkey credentials route by SVID. */
|
|
129
130
|
identity: string;
|
|
130
|
-
/** Type of
|
|
131
|
-
identityType:
|
|
131
|
+
/** Type of identifier returned with the verification result. */
|
|
132
|
+
identityType: VerifiedIdentityType;
|
|
133
|
+
/** Canonical SparkVault ID */
|
|
134
|
+
svid?: string;
|
|
135
|
+
/** Managed SparkVault Identity session ID */
|
|
136
|
+
sessionId?: string;
|
|
137
|
+
/** Managed-session refresh token, when the flow returns one */
|
|
138
|
+
refreshToken?: string;
|
|
132
139
|
/** Redirect URL (only present for OIDC/simple mode flows) */
|
|
133
140
|
redirect?: string;
|
|
134
141
|
}
|
|
135
142
|
interface TokenClaims {
|
|
136
143
|
/** Issuer */
|
|
137
144
|
iss: string;
|
|
138
|
-
/** Subject
|
|
145
|
+
/** Subject. Managed Identity tokens use the SVID. */
|
|
139
146
|
sub: string;
|
|
140
147
|
/** Audience (account ID for simple tokens, client ID for OIDC) */
|
|
141
148
|
aud: string;
|
|
@@ -145,10 +152,14 @@ interface TokenClaims {
|
|
|
145
152
|
iat: number;
|
|
146
153
|
/** Unique token ID for replay protection */
|
|
147
154
|
jti?: string;
|
|
148
|
-
/** Verified
|
|
155
|
+
/** Verified identifier used for audit and user-facing attribution; passkey credentials route by SVID. */
|
|
149
156
|
identity: string;
|
|
150
|
-
/**
|
|
151
|
-
identity_type:
|
|
157
|
+
/** Identifier type */
|
|
158
|
+
identity_type: VerifiedIdentityType;
|
|
159
|
+
/** Canonical SparkVault ID */
|
|
160
|
+
svid?: string;
|
|
161
|
+
/** Managed SparkVault Identity session ID */
|
|
162
|
+
session_id?: string;
|
|
152
163
|
/** Verification timestamp (Unix seconds) */
|
|
153
164
|
verified_at: number;
|
|
154
165
|
/** Authentication method used */
|
|
@@ -250,6 +261,13 @@ declare class IdentityModule {
|
|
|
250
261
|
* using the JWKS endpoint.
|
|
251
262
|
*/
|
|
252
263
|
verifyToken(token: string): Promise<TokenClaims>;
|
|
264
|
+
/**
|
|
265
|
+
* Complete full-page redirect results produced by social-login flows.
|
|
266
|
+
* The Identity Product redirects back with `#token=...` so the token does
|
|
267
|
+
* not hit server logs. Consume it once, validate the issuer/expiry shape,
|
|
268
|
+
* then remove it from the URL bar.
|
|
269
|
+
*/
|
|
270
|
+
private consumeRedirectResult;
|
|
253
271
|
/**
|
|
254
272
|
* Close the identity dialog/inline UI if open.
|
|
255
273
|
*/
|