@xkova/sdk 0.1.0-alpha.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/LICENSE +202 -0
- package/README.md +453 -0
- package/dist/abi.d.ts +10288 -0
- package/dist/abi.js +6645 -0
- package/dist/client.d.ts +80 -0
- package/dist/client.js +251 -0
- package/dist/cursor.d.ts +21 -0
- package/dist/cursor.js +28 -0
- package/dist/errors.d.ts +31 -0
- package/dist/errors.js +63 -0
- package/dist/generated/types.d.ts +13371 -0
- package/dist/generated/types.js +3 -0
- package/dist/idempotency.d.ts +25 -0
- package/dist/idempotency.js +46 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -0
- package/dist/member-action-intents.d.ts +72 -0
- package/dist/member-action-intents.js +181 -0
- package/dist/member-bff.d.ts +535 -0
- package/dist/member-bff.js +1594 -0
- package/dist/member-resources.d.ts +203 -0
- package/dist/member-resources.js +56 -0
- package/dist/request-signing.d.ts +23 -0
- package/dist/request-signing.js +112 -0
- package/dist/resources/account-holders.d.ts +295 -0
- package/dist/resources/account-holders.js +166 -0
- package/dist/resources/base.d.ts +47 -0
- package/dist/resources/base.js +25 -0
- package/dist/resources/branding.d.ts +154 -0
- package/dist/resources/branding.js +34 -0
- package/dist/resources/chains.d.ts +6 -0
- package/dist/resources/chains.js +6 -0
- package/dist/resources/contacts.d.ts +55 -0
- package/dist/resources/contacts.js +22 -0
- package/dist/resources/escrows.d.ts +45 -0
- package/dist/resources/escrows.js +18 -0
- package/dist/resources/fee-schedules.d.ts +40 -0
- package/dist/resources/fee-schedules.js +15 -0
- package/dist/resources/index.d.ts +21 -0
- package/dist/resources/index.js +21 -0
- package/dist/resources/integration-gateways.d.ts +114 -0
- package/dist/resources/integration-gateways.js +27 -0
- package/dist/resources/onboarding.d.ts +18 -0
- package/dist/resources/onboarding.js +9 -0
- package/dist/resources/payment-requests.d.ts +115 -0
- package/dist/resources/payment-requests.js +27 -0
- package/dist/resources/payments.d.ts +182 -0
- package/dist/resources/payments.js +33 -0
- package/dist/resources/ramps.d.ts +163 -0
- package/dist/resources/ramps.js +44 -0
- package/dist/resources/rwa.d.ts +397 -0
- package/dist/resources/rwa.js +150 -0
- package/dist/resources/tenant.d.ts +136 -0
- package/dist/resources/tenant.js +42 -0
- package/dist/resources/tokenization.d.ts +394 -0
- package/dist/resources/tokenization.js +126 -0
- package/dist/resources/transactions.d.ts +8 -0
- package/dist/resources/transactions.js +6 -0
- package/dist/resources/wallets.d.ts +56 -0
- package/dist/resources/wallets.js +21 -0
- package/dist/resources/webhooks.d.ts +115 -0
- package/dist/resources/webhooks.js +43 -0
- package/dist/resources/workflows.d.ts +44 -0
- package/dist/resources/workflows.js +70 -0
- package/dist/resources/workspace-tokens.d.ts +6 -0
- package/dist/resources/workspace-tokens.js +6 -0
- package/dist/resources/workspaces.d.ts +25 -0
- package/dist/resources/workspaces.js +12 -0
- package/dist/retry.d.ts +21 -0
- package/dist/retry.js +44 -0
- package/dist/rwa-verify.d.ts +50 -0
- package/dist/rwa-verify.js +159 -0
- package/dist/webhook.d.ts +24 -0
- package/dist/webhook.js +56 -0
- package/llms.txt +84 -0
- package/package.json +62 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
import { XKOVAMemberResources } from './member-resources.js';
|
|
2
|
+
import { XKOVAMemberActionIntents, type XKOVAMemberActionIntentStore } from './member-action-intents.js';
|
|
3
|
+
export { XKOVAMemberIntentError } from './member-action-intents.js';
|
|
4
|
+
export type { XKOVAMemberActionIntents, XKOVAMemberActionIntentStore, StoredXKOVAMemberActionIntent, XKOVAMemberPreparedAction, XKOVAMemberIntentRequest, } from './member-action-intents.js';
|
|
5
|
+
export type { XKOVAMemberResources } from './member-resources.js';
|
|
6
|
+
import { type XKOVARequestSigner } from './request-signing.js';
|
|
7
|
+
type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
8
|
+
export type XKOVAMemberProofKind = 'xkova_hosted' | 'oidc' | 'signed_launch';
|
|
9
|
+
export type XKOVAMemberProofBindingMode = 'authorization_nonce' | 'server_assertion_jti';
|
|
10
|
+
export type XKOVAAccountCenterIntent = 'security' | 'sessions' | 'wallet_readiness' | 'action';
|
|
11
|
+
export type XKOVAMemberActionResourceType = 'payment' | 'escrow' | 'approval_request';
|
|
12
|
+
export type XKOVAMemberActionName = 'sign' | 'create' | 'cancel' | 'attest';
|
|
13
|
+
export interface XKOVAMemberBffClientOptions {
|
|
14
|
+
/** API origin or versioned base URL. */
|
|
15
|
+
readonly baseUrl: string;
|
|
16
|
+
/** Confidential tenant/workspace bearer credential. */
|
|
17
|
+
readonly apiKey: string;
|
|
18
|
+
/** Non-secret member-auth application selector. */
|
|
19
|
+
readonly publishableKey: string;
|
|
20
|
+
/** Required for production mutations, optional in sandbox. */
|
|
21
|
+
readonly requestSigner?: XKOVARequestSigner;
|
|
22
|
+
/** Default request deadline. */
|
|
23
|
+
readonly timeoutMs?: number;
|
|
24
|
+
/** Override global fetch for tests or custom transport. */
|
|
25
|
+
readonly fetchImpl?: FetchLike;
|
|
26
|
+
}
|
|
27
|
+
export interface XKOVAMemberContext {
|
|
28
|
+
readonly sessionId: string;
|
|
29
|
+
readonly accountHolderId: string;
|
|
30
|
+
readonly providerSubject: string;
|
|
31
|
+
readonly expiresAt: number;
|
|
32
|
+
}
|
|
33
|
+
export interface XKOVAMemberSessionMaterial extends XKOVAMemberContext {
|
|
34
|
+
/** Confidential refresh credential, BFF storage only. */
|
|
35
|
+
readonly refreshToken: string;
|
|
36
|
+
}
|
|
37
|
+
export interface XKOVABrowserMemberProjection {
|
|
38
|
+
readonly signedIn: true;
|
|
39
|
+
readonly accountHolderId: string;
|
|
40
|
+
readonly expiresAt: string;
|
|
41
|
+
}
|
|
42
|
+
export interface StoredXKOVAMemberSession<TApplicationData = unknown> extends XKOVAMemberSessionMaterial {
|
|
43
|
+
/** Absolute expiry of the customer's first-party application session. */
|
|
44
|
+
readonly applicationExpiresAt: number;
|
|
45
|
+
/** Customer-owned data, never transmitted to XKOVA by this helper. */
|
|
46
|
+
readonly applicationData: TApplicationData;
|
|
47
|
+
/** Persisted until the exact refresh attempt is confirmed. */
|
|
48
|
+
readonly pendingRefreshAttemptId?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* `runExclusive` must serialize refresh and logout for the same reference
|
|
52
|
+
* across all BFF instances. Use a database transaction or distributed lock;
|
|
53
|
+
* a process-local mutex cannot coordinate multiple instances.
|
|
54
|
+
*/
|
|
55
|
+
export interface XKOVAMemberSessionStore<TApplicationData = unknown> {
|
|
56
|
+
put(reference: string, session: StoredXKOVAMemberSession<TApplicationData>): Promise<void>;
|
|
57
|
+
get(reference: string): Promise<StoredXKOVAMemberSession<TApplicationData> | null>;
|
|
58
|
+
replace(reference: string, session: StoredXKOVAMemberSession<TApplicationData>): Promise<void>;
|
|
59
|
+
delete(reference: string): Promise<void>;
|
|
60
|
+
runExclusive<T>(reference: string, work: () => Promise<T>): Promise<T>;
|
|
61
|
+
}
|
|
62
|
+
export type XKOVAMemberAuthorizationTransaction<TApplicationData = unknown> = {
|
|
63
|
+
readonly status: 'pending';
|
|
64
|
+
readonly completionMode: 'provider_proof';
|
|
65
|
+
/** One-way binding to the exact API origin, bearer principal, and application. */
|
|
66
|
+
readonly clientFingerprint: string;
|
|
67
|
+
readonly proofKind: XKOVAMemberProofKind;
|
|
68
|
+
readonly nonce: string;
|
|
69
|
+
readonly codeVerifier: string;
|
|
70
|
+
readonly redirectUri: string;
|
|
71
|
+
readonly exchangeAttemptId: string;
|
|
72
|
+
/** Stable local session reference used for every callback recovery attempt. */
|
|
73
|
+
readonly sessionReference: string;
|
|
74
|
+
readonly expiresAt: number;
|
|
75
|
+
/**
|
|
76
|
+
* Confidential provider proof staged after the one-time provider callback.
|
|
77
|
+
* Production stores must encrypt this value and restrict it like refresh
|
|
78
|
+
* credentials. It exists only so an ambiguous XKOVA exchange can be retried
|
|
79
|
+
* without attempting to reuse the provider authorization code.
|
|
80
|
+
*/
|
|
81
|
+
readonly stagedProviderExchange?: {
|
|
82
|
+
readonly providerCodeHash: string;
|
|
83
|
+
readonly proofToken: string;
|
|
84
|
+
readonly applicationExpiresAt: number;
|
|
85
|
+
/** Frozen on the first provider-code exchange and reused for every recovery. */
|
|
86
|
+
readonly applicationData: TApplicationData;
|
|
87
|
+
};
|
|
88
|
+
} | {
|
|
89
|
+
readonly status: 'pending';
|
|
90
|
+
readonly completionMode: 'hosted_result_code';
|
|
91
|
+
/** Absent only while the start request is provisional; persisted before start returns. */
|
|
92
|
+
readonly authorizationUrl?: string;
|
|
93
|
+
/** One-way binding to the exact API origin, bearer principal, and application. */
|
|
94
|
+
readonly clientFingerprint: string;
|
|
95
|
+
readonly codeVerifier: string;
|
|
96
|
+
readonly redirectUri: string;
|
|
97
|
+
readonly exchangeAttemptId: string;
|
|
98
|
+
/** Stable local session reference used for every callback recovery attempt. */
|
|
99
|
+
readonly sessionReference: string;
|
|
100
|
+
readonly expiresAt: number;
|
|
101
|
+
readonly stagedApplicationSession?: {
|
|
102
|
+
readonly authorizationCodeHash: string;
|
|
103
|
+
readonly applicationExpiresAt: number;
|
|
104
|
+
/** Frozen on first result-code exchange and reused for every recovery. */
|
|
105
|
+
readonly applicationData: TApplicationData;
|
|
106
|
+
};
|
|
107
|
+
} | {
|
|
108
|
+
readonly status: 'pending';
|
|
109
|
+
readonly completionMode: 'account_center_result_code';
|
|
110
|
+
/** One-way binding to the exact API origin, bearer principal, and application. */
|
|
111
|
+
readonly clientFingerprint: string;
|
|
112
|
+
readonly codeVerifier: string;
|
|
113
|
+
readonly redirectUri: string;
|
|
114
|
+
readonly exchangeAttemptId: string;
|
|
115
|
+
/** Exact existing customer application session that launched Account Center. */
|
|
116
|
+
readonly sessionReference: string;
|
|
117
|
+
readonly intent: XKOVAAccountCenterIntent;
|
|
118
|
+
readonly actionAuthorization?: {
|
|
119
|
+
readonly method: 'hosted_passkey';
|
|
120
|
+
} | {
|
|
121
|
+
readonly method: 'external_oidc';
|
|
122
|
+
readonly actionToken: string;
|
|
123
|
+
readonly nonce: string;
|
|
124
|
+
readonly stagedProviderExchange?: {
|
|
125
|
+
readonly providerCodeHash: string;
|
|
126
|
+
readonly proofToken: string;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
/** Customer application return target, stored only in the BFF transaction. */
|
|
130
|
+
readonly applicationReturnUri?: string;
|
|
131
|
+
/** Review location for cancellation or expiry, never a success destination. */
|
|
132
|
+
readonly applicationReviewUri?: string;
|
|
133
|
+
readonly actionResource?: {
|
|
134
|
+
readonly type: XKOVAMemberActionResourceType;
|
|
135
|
+
readonly id: string;
|
|
136
|
+
readonly action: XKOVAMemberActionName;
|
|
137
|
+
};
|
|
138
|
+
readonly expiresAt: number;
|
|
139
|
+
} | {
|
|
140
|
+
readonly status: 'completed';
|
|
141
|
+
readonly completionMode: 'provider_proof' | 'hosted_result_code';
|
|
142
|
+
/** Preserved so completed recovery cannot cross client applications. */
|
|
143
|
+
readonly clientFingerprint: string;
|
|
144
|
+
readonly redirectUri: string;
|
|
145
|
+
readonly providerCodeHash: string;
|
|
146
|
+
readonly sessionReference: string;
|
|
147
|
+
readonly expiresAt: number;
|
|
148
|
+
} | {
|
|
149
|
+
readonly status: 'completed';
|
|
150
|
+
readonly completionMode: 'account_center_result_code';
|
|
151
|
+
readonly clientFingerprint: string;
|
|
152
|
+
readonly redirectUri: string;
|
|
153
|
+
readonly providerCodeHash: string;
|
|
154
|
+
readonly sessionReference: string;
|
|
155
|
+
readonly intent: XKOVAAccountCenterIntent;
|
|
156
|
+
readonly signingExchangeCode?: string;
|
|
157
|
+
readonly signingUrl?: string;
|
|
158
|
+
readonly applicationReturnUri?: string;
|
|
159
|
+
readonly applicationReviewUri?: string;
|
|
160
|
+
readonly actionResource?: {
|
|
161
|
+
readonly type: XKOVAMemberActionResourceType;
|
|
162
|
+
readonly id: string;
|
|
163
|
+
readonly action: XKOVAMemberActionName;
|
|
164
|
+
};
|
|
165
|
+
readonly expiresAt: number;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* `runExclusive` must serialize callback completion for the same state across
|
|
169
|
+
* every BFF instance. `replace` and `delete` must target that exact state. A
|
|
170
|
+
* production store must encrypt the transaction because it can briefly hold a
|
|
171
|
+
* confidential provider proof while XKOVA session exchange is retried.
|
|
172
|
+
*/
|
|
173
|
+
export interface XKOVAMemberAuthorizationTransactionStore<TApplicationData = unknown> {
|
|
174
|
+
put(stateHash: string, transaction: XKOVAMemberAuthorizationTransaction<TApplicationData>): Promise<void>;
|
|
175
|
+
get(stateHash: string): Promise<XKOVAMemberAuthorizationTransaction<TApplicationData> | null>;
|
|
176
|
+
replace(stateHash: string, transaction: XKOVAMemberAuthorizationTransaction<TApplicationData>): Promise<void>;
|
|
177
|
+
delete(stateHash: string): Promise<void>;
|
|
178
|
+
runExclusive<T>(stateHash: string, work: () => Promise<T>): Promise<T>;
|
|
179
|
+
}
|
|
180
|
+
export type XKOVAMemberProofExchangeTransaction<TApplicationData = unknown> = {
|
|
181
|
+
readonly status: 'pending';
|
|
182
|
+
/** One-way binding to the exact API origin, bearer principal, and application. */
|
|
183
|
+
readonly clientFingerprint: string;
|
|
184
|
+
readonly attemptId: string;
|
|
185
|
+
readonly proofToken: string;
|
|
186
|
+
readonly sessionReference: string;
|
|
187
|
+
readonly applicationExpiresAt: number;
|
|
188
|
+
readonly applicationData: TApplicationData;
|
|
189
|
+
readonly expiresAt: number;
|
|
190
|
+
} | {
|
|
191
|
+
readonly status: 'completed';
|
|
192
|
+
/** Preserved so completed recovery cannot cross client applications. */
|
|
193
|
+
readonly clientFingerprint: string;
|
|
194
|
+
readonly sessionReference: string;
|
|
195
|
+
readonly expiresAt: number;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Durable transaction store for a confidential proof exchange that does not
|
|
199
|
+
* use the browser callback helper. Pending records contain a provider proof
|
|
200
|
+
* and customer application data, so production adapters must encrypt them.
|
|
201
|
+
*/
|
|
202
|
+
export interface XKOVAMemberProofExchangeTransactionStore<TApplicationData = unknown> {
|
|
203
|
+
put(exchangeHash: string, transaction: XKOVAMemberProofExchangeTransaction<TApplicationData>): Promise<void>;
|
|
204
|
+
get(exchangeHash: string): Promise<XKOVAMemberProofExchangeTransaction<TApplicationData> | null>;
|
|
205
|
+
replace(exchangeHash: string, transaction: XKOVAMemberProofExchangeTransaction<TApplicationData>): Promise<void>;
|
|
206
|
+
delete(exchangeHash: string): Promise<void>;
|
|
207
|
+
runExclusive<T>(exchangeHash: string, work: () => Promise<T>): Promise<T>;
|
|
208
|
+
}
|
|
209
|
+
export interface XKOVAMemberAuthorizationStart {
|
|
210
|
+
readonly state: string;
|
|
211
|
+
readonly nonce: string;
|
|
212
|
+
readonly codeChallenge: string;
|
|
213
|
+
readonly codeChallengeMethod: 'S256';
|
|
214
|
+
readonly expiresAt: string;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Safe server-side launch projection for XKOVA Hosted Auth. The BFF stores
|
|
218
|
+
* the returned `state` in its short-lived flow cookie, then redirects the
|
|
219
|
+
* browser to `authorizationUrl`. PKCE verifier material remains only in the
|
|
220
|
+
* encrypted authorization transaction store.
|
|
221
|
+
*/
|
|
222
|
+
export interface XKOVAHostedMemberAuthorizationStart {
|
|
223
|
+
readonly authorizationUrl: string;
|
|
224
|
+
readonly state: string;
|
|
225
|
+
readonly expiresAt: string;
|
|
226
|
+
}
|
|
227
|
+
/** Safe BFF-only launch projection for the controlled Hosted Account Center. */
|
|
228
|
+
export interface XKOVAAccountCenterHandoffStart {
|
|
229
|
+
readonly handoffUrl: string;
|
|
230
|
+
readonly state: string;
|
|
231
|
+
readonly expiresAt: string;
|
|
232
|
+
}
|
|
233
|
+
/** Safe completion projection. Account Center credentials never cross this boundary. */
|
|
234
|
+
export interface XKOVAAccountCenterHandoffCompletion {
|
|
235
|
+
readonly status: 'completed';
|
|
236
|
+
readonly intent: XKOVAAccountCenterIntent;
|
|
237
|
+
readonly signingExchangeCode?: string;
|
|
238
|
+
readonly signingUrl?: string;
|
|
239
|
+
readonly applicationReturnUri?: string;
|
|
240
|
+
}
|
|
241
|
+
export type XKOVAMemberActionAuthorizationStart = {
|
|
242
|
+
readonly authorizationMethod: 'hosted_passkey';
|
|
243
|
+
readonly authorizationUrl: string;
|
|
244
|
+
readonly state: string;
|
|
245
|
+
readonly expiresAt: string;
|
|
246
|
+
} | {
|
|
247
|
+
readonly authorizationMethod: 'external_oidc';
|
|
248
|
+
readonly actionToken: string;
|
|
249
|
+
readonly state: string;
|
|
250
|
+
readonly nonce: string;
|
|
251
|
+
readonly codeChallenge: string;
|
|
252
|
+
readonly codeChallengeMethod: 'S256';
|
|
253
|
+
readonly issuer: string;
|
|
254
|
+
readonly audience: string;
|
|
255
|
+
readonly maxAuthAgeSeconds: number;
|
|
256
|
+
readonly requiredAcrValues: readonly string[];
|
|
257
|
+
readonly requiredAmrValues: readonly string[];
|
|
258
|
+
readonly expiresAt: string;
|
|
259
|
+
};
|
|
260
|
+
export interface XKOVAMemberActionCompletion {
|
|
261
|
+
readonly signingExchangeCode: string;
|
|
262
|
+
readonly signingUrl: string;
|
|
263
|
+
readonly applicationReturnUri?: string;
|
|
264
|
+
readonly expiresAt?: string;
|
|
265
|
+
}
|
|
266
|
+
export interface XKOVAMemberProviderCodeExchangeInput {
|
|
267
|
+
readonly code: string;
|
|
268
|
+
readonly codeVerifier: string;
|
|
269
|
+
readonly nonce: string;
|
|
270
|
+
readonly redirectUri: string;
|
|
271
|
+
readonly proofKind: XKOVAMemberProofKind;
|
|
272
|
+
}
|
|
273
|
+
export interface XKOVAMemberProviderCodeExchangeResult {
|
|
274
|
+
/** Provider ID token or approved signed proof exchanged once with XKOVA. */
|
|
275
|
+
readonly proofToken: string;
|
|
276
|
+
/**
|
|
277
|
+
* Optional signed OIDC ID token used only to bind the provider callback to
|
|
278
|
+
* the transaction nonce. This supports providers whose XKOVA proof is a
|
|
279
|
+
* distinct access token carrying a provider-guaranteed session/JTI. Before
|
|
280
|
+
* returning a distinct nonce token, the BFF must complete full JOSE
|
|
281
|
+
* validation, including signature, issuer, audience, algorithm, expiry, and
|
|
282
|
+
* nonce. This helper only compares the already-validated nonce claim.
|
|
283
|
+
*/
|
|
284
|
+
readonly nonceToken?: string;
|
|
285
|
+
}
|
|
286
|
+
export interface EstablishedXKOVAMemberSession<TApplicationData = unknown> {
|
|
287
|
+
readonly reference: string;
|
|
288
|
+
readonly session: StoredXKOVAMemberSession<TApplicationData>;
|
|
289
|
+
readonly projection: XKOVABrowserMemberProjection;
|
|
290
|
+
}
|
|
291
|
+
export type XKOVAMemberAuthorizationTerminalReason = 'transaction_unavailable' | 'authorization_cancelled' | 'provider_rejected' | 'callback_missing_code' | 'proof_nonce_mismatch';
|
|
292
|
+
/**
|
|
293
|
+
* Marks an authorization failure that makes the exact browser transaction
|
|
294
|
+
* unusable. BFFs may retire their short-lived flow cookie for this error.
|
|
295
|
+
* Other failures must preserve the cookie so the durable transaction can be
|
|
296
|
+
* retried with the same state and XKOVA operation attempt.
|
|
297
|
+
*/
|
|
298
|
+
export declare class XKOVAMemberAuthorizationTerminalError extends Error {
|
|
299
|
+
readonly reason: XKOVAMemberAuthorizationTerminalReason;
|
|
300
|
+
/** BFF-stored, validated review destination. Never copied from callback query parameters. */
|
|
301
|
+
readonly applicationReviewUri?: string;
|
|
302
|
+
constructor(reason: XKOVAMemberAuthorizationTerminalReason, message: string, applicationReviewUri?: string);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Keep provider proofs and XKOVA sessions on the server. Your application
|
|
306
|
+
* handles the provider's sign-in UI and passes the resulting proof here.
|
|
307
|
+
*/
|
|
308
|
+
export declare class XKOVAMemberBffClient {
|
|
309
|
+
private readonly options;
|
|
310
|
+
private readonly apiBaseUrl;
|
|
311
|
+
private readonly clientFingerprint;
|
|
312
|
+
private readonly fetchImpl;
|
|
313
|
+
constructor(options: XKOVAMemberBffClientOptions);
|
|
314
|
+
issueProofChallenge(input: {
|
|
315
|
+
origin: string;
|
|
316
|
+
redirectUri: string;
|
|
317
|
+
}): Promise<{
|
|
318
|
+
nonce: string;
|
|
319
|
+
expiresAt: string;
|
|
320
|
+
}>;
|
|
321
|
+
exchangeProof(proofToken: string, options: {
|
|
322
|
+
readonly attemptId: string;
|
|
323
|
+
}): Promise<XKOVAMemberSessionMaterial>;
|
|
324
|
+
refresh(refreshToken: string, options: {
|
|
325
|
+
readonly attemptId: string;
|
|
326
|
+
}): Promise<XKOVAMemberSessionMaterial>;
|
|
327
|
+
getSession(sessionId: string): Promise<XKOVAMemberContext>;
|
|
328
|
+
/** Revokes only the exact XKOVA session named by `sessionId`. */
|
|
329
|
+
signOutExactSession(sessionId: string): Promise<void>;
|
|
330
|
+
beginAuthorization<TApplicationData = unknown>(input: {
|
|
331
|
+
readonly proofKind: XKOVAMemberProofKind;
|
|
332
|
+
/**
|
|
333
|
+
* `authorization_nonce` asks XKOVA to issue and later consume the nonce.
|
|
334
|
+
* `server_assertion_jti` keeps callback state, nonce, and PKCE in the BFF,
|
|
335
|
+
* while XKOVA consumes the verified provider assertion identifier once.
|
|
336
|
+
*/
|
|
337
|
+
readonly proofBindingMode?: XKOVAMemberProofBindingMode;
|
|
338
|
+
/** Exact browser Origin observed by the customer BFF. */
|
|
339
|
+
readonly browserOrigin: string;
|
|
340
|
+
readonly redirectUri: string;
|
|
341
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
342
|
+
}): Promise<XKOVAMemberAuthorizationStart>;
|
|
343
|
+
/**
|
|
344
|
+
* Persist the transaction before redirecting to Hosted Auth so the callback
|
|
345
|
+
* can validate state and PKCE and recover the same session after a retry.
|
|
346
|
+
*/
|
|
347
|
+
beginHostedAuthorization<TApplicationData = unknown>(input: {
|
|
348
|
+
/** Exact browser Origin observed by the customer BFF. */
|
|
349
|
+
readonly browserOrigin: string;
|
|
350
|
+
readonly redirectUri: string;
|
|
351
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
352
|
+
}): Promise<XKOVAHostedMemberAuthorizationStart>;
|
|
353
|
+
/**
|
|
354
|
+
* Available only to sandbox applications enabled for demo sign-in. The stored
|
|
355
|
+
* Hosted transaction determines the demo account and callback. An uncertain
|
|
356
|
+
* response preserves the key so a retry recovers the same reservation.
|
|
357
|
+
* Complete the returned callback using
|
|
358
|
+
* completeHostedAuthorization and the original browser flow cookie.
|
|
359
|
+
*/
|
|
360
|
+
completeSandboxDemoAuthorization<TApplicationData>(input: {
|
|
361
|
+
readonly state: string;
|
|
362
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
363
|
+
}): Promise<{
|
|
364
|
+
readonly callbackUrl: string;
|
|
365
|
+
readonly expiresAt: string;
|
|
366
|
+
}>;
|
|
367
|
+
/**
|
|
368
|
+
* Completes the one-time Hosted Auth result-code exchange and persists the
|
|
369
|
+
* provider-neutral XKOVA member session. The returned projection is safe for
|
|
370
|
+
* a browser, but `session` and `reference` remain BFF-only material.
|
|
371
|
+
*/
|
|
372
|
+
completeHostedAuthorization<TApplicationData>(input: {
|
|
373
|
+
readonly callbackUrl: string;
|
|
374
|
+
/** Exact state recovered from the initiating browser's flow cookie. */
|
|
375
|
+
readonly expectedState: string;
|
|
376
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
377
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
378
|
+
readonly applicationData: TApplicationData;
|
|
379
|
+
readonly applicationSessionSeconds?: number;
|
|
380
|
+
}): Promise<EstablishedXKOVAMemberSession<TApplicationData>>;
|
|
381
|
+
/**
|
|
382
|
+
* Launches the narrow, Hosted-only XKOVA Account Center from an existing
|
|
383
|
+
* customer application session. The browser receives only a one-time
|
|
384
|
+
* handoff URL and state. The member session, PKCE verifier, and exchange
|
|
385
|
+
* attempt remain in the customer BFF stores.
|
|
386
|
+
*/
|
|
387
|
+
beginAccountCenterHandoff<TApplicationData>(input: {
|
|
388
|
+
readonly intent: XKOVAAccountCenterIntent;
|
|
389
|
+
readonly browserOrigin: string;
|
|
390
|
+
readonly returnUri: string;
|
|
391
|
+
/** Exact-origin application screen to restore, persisted only by the BFF. */
|
|
392
|
+
readonly applicationReturnUri?: string;
|
|
393
|
+
readonly sessionReference: string;
|
|
394
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
395
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
396
|
+
}): Promise<XKOVAAccountCenterHandoffStart>;
|
|
397
|
+
/**
|
|
398
|
+
* Completes a one-time Account Center return. The same existing application
|
|
399
|
+
* session must still exist and XKOVA binds the result to its exact member
|
|
400
|
+
* session, application, tenant, workspace, account holder, state, PKCE, and
|
|
401
|
+
* durable exchange attempt.
|
|
402
|
+
*/
|
|
403
|
+
completeAccountCenterHandoff<TApplicationData>(input: {
|
|
404
|
+
readonly callbackUrl: string;
|
|
405
|
+
readonly expectedState: string;
|
|
406
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
407
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
408
|
+
}): Promise<XKOVAAccountCenterHandoffCompletion>;
|
|
409
|
+
/**
|
|
410
|
+
* Binds fresh authorization to one existing resource. Hosted applications
|
|
411
|
+
* use Account Center passkeys. OIDC applications receive the assurance
|
|
412
|
+
* requirements their BFF must request from the registered provider.
|
|
413
|
+
*/
|
|
414
|
+
beginMemberAction<TApplicationData>(input: {
|
|
415
|
+
readonly resourceType: XKOVAMemberActionResourceType;
|
|
416
|
+
readonly resourceId: string;
|
|
417
|
+
readonly action: XKOVAMemberActionName;
|
|
418
|
+
readonly browserOrigin: string;
|
|
419
|
+
readonly returnUri: string;
|
|
420
|
+
/** Same-origin destination after the wallet signature completes. */
|
|
421
|
+
readonly applicationReturnUri?: string;
|
|
422
|
+
/** Same-origin originating review screen, not the success screen. */
|
|
423
|
+
readonly applicationReviewUri?: string;
|
|
424
|
+
readonly sessionReference: string;
|
|
425
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
426
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
427
|
+
}): Promise<XKOVAMemberActionAuthorizationStart>;
|
|
428
|
+
/** Completes the exact Hosted-passkey or FI-OIDC action ceremony. */
|
|
429
|
+
completeMemberAction<TApplicationData>(input: {
|
|
430
|
+
readonly callbackUrl: string;
|
|
431
|
+
readonly expectedState: string;
|
|
432
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
433
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
434
|
+
readonly exchangeProviderCode?: (input: XKOVAMemberProviderCodeExchangeInput) => XKOVAMemberProviderCodeExchangeResult | Promise<XKOVAMemberProviderCodeExchangeResult>;
|
|
435
|
+
}): Promise<XKOVAMemberActionCompletion>;
|
|
436
|
+
completeAuthorizationCallback<TApplicationData>(input: {
|
|
437
|
+
readonly callbackUrl: string;
|
|
438
|
+
/** Exact state recovered from the initiating browser's flow cookie. */
|
|
439
|
+
readonly expectedState: string;
|
|
440
|
+
readonly transactionStore: XKOVAMemberAuthorizationTransactionStore<TApplicationData>;
|
|
441
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
442
|
+
readonly exchangeProviderCode: (input: XKOVAMemberProviderCodeExchangeInput) => XKOVAMemberProviderCodeExchangeResult | Promise<XKOVAMemberProviderCodeExchangeResult>;
|
|
443
|
+
readonly applicationData: TApplicationData;
|
|
444
|
+
readonly applicationSessionSeconds?: number;
|
|
445
|
+
}): Promise<EstablishedXKOVAMemberSession<TApplicationData>>;
|
|
446
|
+
establishSession<TApplicationData>(input: {
|
|
447
|
+
/** Stable ID generated and persisted before the first exchange attempt. */
|
|
448
|
+
readonly exchangeId: string;
|
|
449
|
+
/** Required on first use, optional when recovering a staged exchange. */
|
|
450
|
+
readonly proofToken?: string;
|
|
451
|
+
readonly exchangeStore: XKOVAMemberProofExchangeTransactionStore<TApplicationData>;
|
|
452
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
453
|
+
readonly applicationData: TApplicationData;
|
|
454
|
+
readonly applicationSessionSeconds?: number;
|
|
455
|
+
}): Promise<EstablishedXKOVAMemberSession<TApplicationData>>;
|
|
456
|
+
resolveSession<TApplicationData>(input: {
|
|
457
|
+
readonly reference: string;
|
|
458
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
459
|
+
readonly refreshSkewSeconds?: number;
|
|
460
|
+
/** Defaults true, which checks revocation, idle expiry, and policy changes. */
|
|
461
|
+
readonly validateWithXkova?: boolean;
|
|
462
|
+
}): Promise<StoredXKOVAMemberSession<TApplicationData> | null>;
|
|
463
|
+
/**
|
|
464
|
+
* Resolve, refresh and validate a confidential session, then bind typed
|
|
465
|
+
* business operations to it. Call once per incoming BFF request, after the
|
|
466
|
+
* application has checked its browser Origin and mutation CSRF proof.
|
|
467
|
+
* Do not cache the returned request-scoped resources across requests.
|
|
468
|
+
*/
|
|
469
|
+
resolveResources<TApplicationData>(input: {
|
|
470
|
+
readonly reference: string;
|
|
471
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
472
|
+
}): Promise<{
|
|
473
|
+
readonly session: StoredXKOVAMemberSession<TApplicationData>;
|
|
474
|
+
readonly resources: XKOVAMemberResources;
|
|
475
|
+
} | null>;
|
|
476
|
+
/** Bind durable action reviews to the same exact session and public resources as normal reads. */
|
|
477
|
+
resolveActionIntents<TApplicationData>(input: {
|
|
478
|
+
readonly reference: string;
|
|
479
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
480
|
+
readonly intentStore: XKOVAMemberActionIntentStore;
|
|
481
|
+
}): Promise<XKOVAMemberActionIntents | null>;
|
|
482
|
+
logoutSession<TApplicationData>(input: {
|
|
483
|
+
readonly reference: string;
|
|
484
|
+
readonly sessionStore: XKOVAMemberSessionStore<TApplicationData>;
|
|
485
|
+
}): Promise<void>;
|
|
486
|
+
private persistSessionWithAttempt;
|
|
487
|
+
private persistSessionMaterial;
|
|
488
|
+
private postJson;
|
|
489
|
+
private recoverablePostJson;
|
|
490
|
+
private getJson;
|
|
491
|
+
private requestJson;
|
|
492
|
+
private readSessionMaterial;
|
|
493
|
+
private requestSignal;
|
|
494
|
+
}
|
|
495
|
+
/** Only confirmed admission rejections may release a customer's pending demo reservation. */
|
|
496
|
+
export declare function isDefinitiveXKOVASandboxDemoAdmissionFailure(error: unknown): boolean;
|
|
497
|
+
export declare function projectXKOVAMemberSession(session: XKOVAMemberContext): XKOVABrowserMemberProjection;
|
|
498
|
+
export declare function serializeXKOVAMemberSessionCookie(input: {
|
|
499
|
+
readonly cookieName: string;
|
|
500
|
+
readonly reference: string;
|
|
501
|
+
readonly maxAgeSeconds: number;
|
|
502
|
+
}): string;
|
|
503
|
+
/** Short-lived Lax cookie for cross-site OAuth/OIDC callback state only. */
|
|
504
|
+
export declare function serializeXKOVAMemberFlowCookie(input: {
|
|
505
|
+
readonly cookieName: string;
|
|
506
|
+
readonly reference: string;
|
|
507
|
+
readonly maxAgeSeconds?: number;
|
|
508
|
+
}): string;
|
|
509
|
+
export declare function serializeClearedXKOVAMemberCookie(cookieName: string): string;
|
|
510
|
+
/** One short-lived cookie per ceremony, so another tab cannot replace its browser binding. */
|
|
511
|
+
export declare function xkovaMemberFlowCookieName(cookiePrefix: string, state: string): string;
|
|
512
|
+
/** State must match a real HttpOnly cookie. A callback query alone is never authority. */
|
|
513
|
+
export declare function readXKOVAMemberCallbackFlow(input: {
|
|
514
|
+
cookieHeader: string | null;
|
|
515
|
+
cookiePrefix: string;
|
|
516
|
+
callbackUrl: string;
|
|
517
|
+
}): {
|
|
518
|
+
state: string;
|
|
519
|
+
cookieName: string;
|
|
520
|
+
} | null;
|
|
521
|
+
export declare function readXKOVAMemberCookie(cookieHeader: string | null, cookieName: string): string | null;
|
|
522
|
+
export declare function createXKOVAMemberCsrfToken(input: {
|
|
523
|
+
readonly sessionReference: string;
|
|
524
|
+
readonly secret: string | Uint8Array;
|
|
525
|
+
readonly ttlSeconds?: number;
|
|
526
|
+
readonly now?: number;
|
|
527
|
+
}): string;
|
|
528
|
+
export declare function verifyXKOVAMemberCsrfToken(input: {
|
|
529
|
+
readonly token: string;
|
|
530
|
+
readonly sessionReference: string;
|
|
531
|
+
readonly secret: string | Uint8Array;
|
|
532
|
+
readonly now?: number;
|
|
533
|
+
}): boolean;
|
|
534
|
+
export declare function assertXKOVAMemberRequestOrigin(origin: string | null, allowedOrigins: readonly string[]): void;
|
|
535
|
+
export declare function generateXKOVAMemberOperationAttemptId(): string;
|