@uniformdev/mesh-sdk 20.50.2-alpha.149 → 20.50.2-alpha.167

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/index.mjs CHANGED
@@ -4,108 +4,6 @@ var __typeError = (msg) => {
4
4
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
5
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
6
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
9
-
10
- // src/clients/DelegationTokenClient.ts
11
- var DelegationTokenError = class extends Error {
12
- constructor(status, kind, publicMessage) {
13
- super(publicMessage);
14
- this.name = "DelegationTokenError";
15
- this.status = status;
16
- this.kind = kind;
17
- }
18
- };
19
- var PUBLIC_MESSAGES = {
20
- bad_request: "Token exchange request was rejected as invalid",
21
- unauthenticated: "Token exchange authentication failed",
22
- forbidden: "Token exchange forbidden by server",
23
- not_found: "Token exchange target was not found",
24
- rate_limited: "Token exchange rate limit exceeded",
25
- server_error: "Token exchange server error",
26
- unknown: "Token exchange failed"
27
- };
28
- function classifyDelegationTokenStatus(status) {
29
- if (status === 400) {
30
- return "bad_request";
31
- }
32
- if (status === 401) {
33
- return "unauthenticated";
34
- }
35
- if (status === 403) {
36
- return "forbidden";
37
- }
38
- if (status === 404) {
39
- return "not_found";
40
- }
41
- if (status === 429) {
42
- return "rate_limited";
43
- }
44
- if (status >= 500) {
45
- return "server_error";
46
- }
47
- return "unknown";
48
- }
49
- function buildDelegationTokenError(status) {
50
- const kind = classifyDelegationTokenStatus(status);
51
- return new DelegationTokenError(status, kind, PUBLIC_MESSAGES[kind]);
52
- }
53
- var _options, _DelegationTokenClient_instances, post_fn;
54
- var DelegationTokenClient = class {
55
- constructor(options) {
56
- __privateAdd(this, _DelegationTokenClient_instances);
57
- __privateAdd(this, _options);
58
- __privateSet(this, _options, options);
59
- }
60
- /**
61
- * Exchanges a short-lived session token for a delegation token and refresh token.
62
- * The session token is obtained by the integration's frontend via `sdk.getSessionToken()`.
63
- *
64
- * @deprecated This beta identity delegation API may change with breaking changes.
65
- */
66
- async exchangeSessionToken(sessionToken) {
67
- return __privateMethod(this, _DelegationTokenClient_instances, post_fn).call(this, {
68
- grantType: "delegation_token",
69
- sessionToken,
70
- integrationId: __privateGet(this, _options).integrationId,
71
- integrationSecret: __privateGet(this, _options).integrationSecret
72
- });
73
- }
74
- /**
75
- * Exchanges a refresh token for a new delegation token and a new refresh token.
76
- *
77
- * Replay posture: refresh tokens are bearer credentials that are valid until
78
- * their server-side expiry. They are NOT single-use — a captured refresh token can be
79
- * replayed by an attacker that also has the integration secret until it expires.
80
- * Single-use enforcement (refresh-token storage, family/jti tracking, replay revocation)
81
- * is tracked in `UNI-9279`.
82
- *
83
- * @deprecated This beta identity delegation API may change with breaking changes.
84
- */
85
- async refreshDelegationToken(refreshToken) {
86
- return __privateMethod(this, _DelegationTokenClient_instances, post_fn).call(this, {
87
- grantType: "refresh_token",
88
- refreshToken,
89
- integrationId: __privateGet(this, _options).integrationId,
90
- integrationSecret: __privateGet(this, _options).integrationSecret
91
- });
92
- }
93
- };
94
- _options = new WeakMap();
95
- _DelegationTokenClient_instances = new WeakSet();
96
- post_fn = async function(body) {
97
- const url = `${__privateGet(this, _options).apiHost}/api/v1/token`;
98
- const response = await fetch(url, {
99
- method: "POST",
100
- headers: { "Content-Type": "application/json" },
101
- body: JSON.stringify(body)
102
- });
103
- if (!response.ok) {
104
- await response.text().catch(() => "");
105
- throw buildDelegationTokenError(response.status);
106
- }
107
- return await response.json();
108
- };
109
7
 
110
8
  // src/clients/IntegrationDefinitionClient.ts
111
9
  import { ApiClient } from "@uniformdev/context/api";
@@ -216,6 +114,10 @@ _url2 = new WeakMap();
216
114
  __privateAdd(_IntegrationInstallationClient, _url2, "/api/v1/integration-installations");
217
115
  var IntegrationInstallationClient = _IntegrationInstallationClient;
218
116
 
117
+ // src/delegation/csrfConstants.ts
118
+ var CSRF_HEADER_NAME = "x-mesh-csrf";
119
+ var CSRF_HEADER_VALUE = "1";
120
+
219
121
  // src/locations/aiAgents.ts
220
122
  var functionCallSystemParameters = ["pageHtml"];
221
123
  function parseFunctionCall(request) {
@@ -261,7 +163,7 @@ var getLogger = (prefix, debug) => {
261
163
  };
262
164
 
263
165
  // src/temp/version.ts
264
- var UNIFORM_MESH_SDK_VERSION = "20.68.0";
166
+ var UNIFORM_MESH_SDK_VERSION = "20.71.0";
265
167
 
266
168
  // src/framepost/constants.ts
267
169
  var DEFAULT_REQUEST_TIMEOUT = 5e3;
@@ -1083,8 +985,8 @@ var hasRole = (role, user) => {
1083
985
  return user.roles.some((userRole) => userRole.name === role || userRole.id === role);
1084
986
  };
1085
987
  export {
1086
- DelegationTokenClient,
1087
- DelegationTokenError,
988
+ CSRF_HEADER_NAME,
989
+ CSRF_HEADER_VALUE,
1088
990
  IntegrationDefinitionClient,
1089
991
  IntegrationInstallationClient,
1090
992
  functionCallSystemParameters,
@@ -0,0 +1,378 @@
1
+ /** @deprecated This beta identity delegation API may change with breaking changes. */
2
+ interface DelegationTokenClientOptions {
3
+ /** Uniform API host (e.g. 'https://uniform.app'). */
4
+ apiHost: string;
5
+ /** UUID of the integration definition. */
6
+ integrationId: string;
7
+ /** Plaintext app secret for this integration. */
8
+ integrationSecret: string;
9
+ }
10
+ /** @deprecated This beta identity delegation API may change with breaking changes. */
11
+ interface DelegationTokenResponse {
12
+ /** Bearer access token that can be used to call Uniform APIs on behalf of the user. */
13
+ accessToken: string;
14
+ /** Refresh token for obtaining a new access token when the current one expires. Absent when the session was minted with `allowRefresh: false`. */
15
+ refreshToken?: string;
16
+ /** Always 'Bearer'. */
17
+ tokenType: 'Bearer';
18
+ /** Token lifetime in seconds. */
19
+ expiresIn: number;
20
+ }
21
+ /**
22
+ * Stable, low-detail kinds of token-exchange failures. Callers branch on these
23
+ * instead of parsing arbitrary upstream message text, and integrators surface a
24
+ * sanitised public message rather than whatever the server happened to return.
25
+ */
26
+ type DelegationTokenErrorKind = 'bad_request' | 'unauthenticated' | 'forbidden' | 'not_found' | 'rate_limited' | 'server_error' | 'unknown';
27
+ /** @deprecated This beta identity delegation API may change with breaking changes. */
28
+ declare class DelegationTokenError extends Error {
29
+ readonly status: number;
30
+ readonly kind: DelegationTokenErrorKind;
31
+ constructor(status: number, kind: DelegationTokenErrorKind, publicMessage: string);
32
+ }
33
+ /**
34
+ * Maps an HTTP status code to a stable `DelegationTokenErrorKind`. Never
35
+ * propagate arbitrary upstream `errorMessage`/`error`/`message` body content.
36
+ * We are guarding against propagating attacker-influenced or sensitive upstream text
37
+ * out of /api/v1/token failures into integrator-side surfaces (logs, Sentry, integrator UI errors).
38
+ */
39
+ declare function classifyDelegationTokenStatus(status: number): DelegationTokenErrorKind;
40
+ /**
41
+ * Builds a sanitised {@link DelegationTokenError} for a non-OK token exchange response.
42
+ * The error body is intentionally ignored because it may contain attacker-controlled or
43
+ * upstream library text (token fragments, claim values, stack traces).
44
+ */
45
+ declare function buildDelegationTokenError(status: number): DelegationTokenError;
46
+ /**
47
+ * Server-side client for the Uniform token exchange endpoint.
48
+ * Use this in your integration's backend to exchange a session token (obtained from the
49
+ * Mesh SDK iframe context) for a delegation token, or to refresh an existing delegation token.
50
+ *
51
+ * @deprecated This beta identity delegation API may change with breaking changes.
52
+ */
53
+ declare class DelegationTokenClient {
54
+ #private;
55
+ constructor(options: DelegationTokenClientOptions);
56
+ /**
57
+ * Exchanges a short-lived session token for a delegation token and refresh token.
58
+ * The session token is obtained by the integration's frontend via `sdk.getSessionToken()`.
59
+ *
60
+ * @deprecated This beta identity delegation API may change with breaking changes.
61
+ */
62
+ exchangeSessionToken(sessionToken: string): Promise<DelegationTokenResponse>;
63
+ /**
64
+ * Exchanges a refresh token for a new delegation token and a new refresh token.
65
+ *
66
+ * Replay posture: refresh tokens are bearer credentials that are valid until
67
+ * their server-side expiry. They are NOT single-use — a captured refresh token can be
68
+ * replayed by an attacker that also has the integration secret until it expires.
69
+ * Single-use enforcement (refresh-token storage, family/jti tracking, replay revocation)
70
+ * is tracked in `UNI-9279`.
71
+ *
72
+ * @deprecated This beta identity delegation API may change with breaking changes.
73
+ */
74
+ refreshDelegationToken(refreshToken: string): Promise<DelegationTokenResponse>;
75
+ }
76
+
77
+ /**
78
+ * Default cookie name for the JWE-sealed Mesh delegation session.
79
+ *
80
+ * Exported as a constant so partners can keep one source of truth across the
81
+ * BFF (`Set-Cookie` writer + `Cookie` reader) without introducing typos.
82
+ * Partners running multiple integration BFFs on the same host SHOULD pick a
83
+ * unique cookie name per integration (e.g. `__Host-uniform_mesh_delegation_<integrationId>`)
84
+ * and pass that explicitly to `serializeSessionCookie`/`parseCookies` lookups.
85
+ * Names with the `__Host-` prefix require `Path=/` and must not set `Domain`.
86
+ */
87
+ declare const DELEGATION_COOKIE_NAME = "__Host-uniform_mesh_delegation";
88
+ /**
89
+ * Default session TTL in seconds (8 hours). Shared between
90
+ * `sealDelegationSession` (JWE `exp` claim) and `serializeSessionCookie`
91
+ * (`Max-Age` attribute) so they cannot drift independently.
92
+ */
93
+ declare const SESSION_TTL_SECONDS: number;
94
+
95
+ /**
96
+ * Parse a raw `Cookie` request-header value into a name → value map.
97
+ *
98
+ * Wraps `cookie.parse` so consumers get RFC 6265 §5.4 behaviour: quoted
99
+ * values are unwrapped, URL-encoded values are decoded, and when the same
100
+ * name appears twice the FIRST occurrence wins (matching the user-agent's
101
+ * stored set semantics). `undefined` input returns `{}` so callers can pass
102
+ * `req.headers.cookie` directly without a null-check at every call site.
103
+ *
104
+ * The return type is `Record<string, string>`; the underlying parser may
105
+ * return `undefined` for malformed values, but the wrapper filters those
106
+ * out so consumers can rely on `cookies[NAME]` being either a string or
107
+ * absent (`in` check) without a `typeof` guard.
108
+ */
109
+ declare function parseCookies(cookieHeader: string | undefined): Record<string, string>;
110
+
111
+ /**
112
+ * Caller-tunable options for `serializeSessionCookie`.
113
+ *
114
+ * Cookie-flag invariants intentionally absent from this surface:
115
+ * - `httpOnly`, `secure`, `sameSite` are always emitted with the values
116
+ * the iframe-embedded mesh-app context requires. Any other choice is
117
+ * silently broken in this deployment shape and is not configurable.
118
+ */
119
+ type SerializeSessionCookieOptions = {
120
+ /**
121
+ * `Path` attribute. Defaults to `/` so the cookie attaches on every BFF
122
+ * route. Override to scope the cookie to a sub-path when the BFF lives
123
+ * under a known prefix (e.g. `/api/mesh/`).
124
+ */
125
+ path?: string;
126
+ /**
127
+ * `Max-Age` in seconds. Defaults to 8 hours, matching the refresh-token
128
+ * lifetime issued by the Uniform delegation token endpoint at the time of
129
+ * writing. Partners on a different refresh-token TTL should pass their
130
+ * value explicitly.
131
+ */
132
+ maxAge?: number;
133
+ /**
134
+ * Emit the `Partitioned` (CHIPS) attribute. Defaults to `true` because
135
+ * the mesh-app is loaded as a cross-site iframe and CHIPS keys the cookie
136
+ * to (our origin × top-level site), which gives per-embedding isolation
137
+ * and survives Chrome's third-party cookie phase-out.
138
+ *
139
+ * Browser support for `Partitioned` is not yet universal — Safari is
140
+ * partial as of 2026 (same as Sec-Fetch-Site it seems :-/).
141
+ */
142
+ partitioned?: boolean;
143
+ };
144
+ /**
145
+ * Build a `Set-Cookie` header value for the delegation session cookie.
146
+ *
147
+ * The following flags are HARDCODED because the iframe-embedded mesh-app
148
+ * context is invariant — any other configuration is silently broken:
149
+ *
150
+ * - `HttpOnly`: JavaScript cannot read the cookie via `document.cookie`.
151
+ * - `Secure`: cookie only flows over HTTPS. Dev MUST also be HTTPS
152
+ * (`next dev --experimental-https`, self-signed cert for Express, etc.).
153
+ * - `SameSite=None`: required so the browser attaches the cookie on
154
+ * subresource requests from inside the cross-site iframe. With
155
+ * `Lax`/`Strict` the cookie would be stored but not returned.
156
+ *
157
+ * `Partitioned` (CHIPS) is emitted by default; pass `partitioned: false`
158
+ * to suppress it for partners deploying to a single embedding host.
159
+ *
160
+ * The cookie value is URL-encoded by the underlying `cookie` package so
161
+ * the resulting header is RFC 6265 §4.1.1 compliant. JWE strings produced
162
+ * by `sealDelegationSession` only contain unreserved characters, so the
163
+ * encoding is a no-op for them but is essential when partners reuse the
164
+ * helper for any other payload.
165
+ */
166
+ declare function serializeSessionCookie(name: string, value: string, opts?: SerializeSessionCookieOptions): string;
167
+
168
+ /**
169
+ * Headers `verifyCsrf` consumes. Callers extract these from their framework
170
+ * request object — see the README "Quick start" section for Next.js and
171
+ * Express snippets.
172
+ */
173
+ type CsrfInput = {
174
+ /** `Origin` request header. */
175
+ origin: string | undefined;
176
+ /** `Referer` request header. Used as fallback when `Origin` is absent. */
177
+ referer: string | undefined;
178
+ /** `Sec-Fetch-Site` request header. Chromium-only; absent on Safari/Firefox<90. */
179
+ secFetchSite: string | undefined;
180
+ /** Value of the custom CSRF header (default name `x-mesh-csrf`). */
181
+ customHeader: string | undefined;
182
+ };
183
+ /**
184
+ * Caller-supplied CSRF policy. The package never reads `process.env`; the
185
+ * allow-list lives in consumer code so a typo is loud at boot and so the
186
+ * package stays edge-runtime-safe.
187
+ */
188
+ type CsrfConfig = {
189
+ /**
190
+ * Origins allowed to call state-changing endpoints. Typical wiring:
191
+ * `[process.env.UNIFORM_DASHBOARD_ORIGIN, process.env.SELF_ORIGIN]`.
192
+ * MUST be origin strings (`https://host[:port]`). Trailing slashes are
193
+ * stripped before comparison so a misconfigured env var does not silently
194
+ * disable the CSRF check for that origin.
195
+ */
196
+ allowedOrigins: readonly string[];
197
+ /**
198
+ * Dev-only escape hatch. When `true`, skip Origin/Referer validation and
199
+ * rely on the custom CSRF header alone. Defaults to `false`.
200
+ *
201
+ * Wire from the consumer's dev-mode indicator — e.g.
202
+ * `process.env.NODE_ENV === 'development'` or an explicit local-only env
203
+ * var. Chromium often omits `Origin` on `https://localhost` iframe
204
+ * subresource requests (https://issues.chromium.org/issues/40499674); this
205
+ * flag exists for that local mesh dev case, not for loopback hosts in
206
+ * general.
207
+ */
208
+ skipOriginValidation?: boolean;
209
+ /** Expected custom-header value. Defaults to `'1'`. */
210
+ headerValue?: string;
211
+ /**
212
+ * When `true`, also require `Sec-Fetch-Site: same-origin`. Defaults to
213
+ * `false` because Safari/Firefox<90 omit the header. Partners on a
214
+ * Chromium-only embedding host can flip this on for defence-in-depth.
215
+ */
216
+ requireSecFetchSite?: boolean;
217
+ };
218
+ /**
219
+ * Discriminated result so consumers can log specific failure modes for
220
+ * metrics without echoing the reason verbatim to clients.
221
+ */
222
+ type CsrfResult = {
223
+ ok: true;
224
+ } | {
225
+ ok: false;
226
+ reason: 'origin_mismatch' | 'origin_missing' | 'header_missing' | 'sec_fetch_site_mismatch';
227
+ };
228
+
229
+ /**
230
+ * Verify a request against the delegation BFF CSRF policy.
231
+ *
232
+ * Order of checks (first failure wins):
233
+ *
234
+ * 1. Origin in `allowedOrigins`. If `Origin` header is absent, parse the
235
+ * origin from `Referer` and check that. If both are absent, accept
236
+ * `Sec-Fetch-Site: same-origin` as proof the request came from the
237
+ * server's own origin (this header is forbidden — browsers never let
238
+ * JS set it). This handles the spec-correct case where browsers omit
239
+ * `Origin` on same-origin GET/HEAD requests. Skipped entirely when
240
+ * `skipOriginValidation` is `true` (dev-only; see `CsrfConfig`). If
241
+ * none of the above apply and no origin signal is present, fail with
242
+ * `origin_missing`.
243
+ * 2. Custom header presence + value match. Closes the classic
244
+ * cross-origin-from-a-browser CSRF case via the no-CORS-preflight
245
+ * property of non-safelisted headers.
246
+ * 3. `Sec-Fetch-Site === 'same-origin'` when `requireSecFetchSite: true`.
247
+ * Defence-in-depth on Chromium-only deployments. NOT a substitute for
248
+ * either earlier check — Safari and Firefox<90 omit the header, so
249
+ * partners supporting those browsers MUST leave this off.
250
+ *
251
+ * The caller is responsible for responding `403` on `ok: false`. The
252
+ * `reason` is intended for server-side logging and metrics; do NOT echo it
253
+ * verbatim to the client if you want to avoid leaking which check failed
254
+ * to a probing attacker.
255
+ */
256
+ declare function verifyCsrf(input: CsrfInput, config: CsrfConfig): CsrfResult;
257
+
258
+ /**
259
+ * Token pair stored inside the encrypted delegation session cookie.
260
+ */
261
+ type DelegationSession = {
262
+ /** Short-lived Bearer token for calling Uniform APIs on behalf of the user. */
263
+ accessToken: string;
264
+ /**
265
+ * Long-lived refresh token. `undefined` means the user gave "this session
266
+ * only" consent during the delegation handshake — the BFF must re-handshake
267
+ * via cross-frame communication when the access token expires; it cannot
268
+ * silently rotate.
269
+ */
270
+ refreshToken: string | undefined;
271
+ /** Unix epoch milliseconds when `accessToken` expires. */
272
+ expiresAt: number;
273
+ };
274
+
275
+ /**
276
+ * Returns `true` when `session.accessToken` will expire within `bufferMs`
277
+ * (defaults to 60 seconds). 60s gives the BFF enough runway to absorb
278
+ * network latency to the Uniform token endpoint and minor clock skew.
279
+ *
280
+ * Consumers call this before every upstream Uniform API call. When it
281
+ * returns `true`, the consumer's BFF route refreshes the token pair via
282
+ * `DelegationTokenClient.refreshDelegationToken` (consumer code, not in
283
+ * this package), reseals via `sealDelegationSession`, and writes a new
284
+ * `Set-Cookie` header on the response BEFORE issuing the API call.
285
+ */
286
+ declare function needsRefresh(session: DelegationSession, bufferMs?: number): boolean;
287
+
288
+ /**
289
+ * Encrypt a `DelegationSession` into an AES-256-GCM JWE string suitable for
290
+ * storage inside an `HttpOnly` cookie.
291
+ *
292
+ * Algorithm: `dir` (direct key agreement) + `A256GCM` (encryption).
293
+ *
294
+ * The 32-byte key is derived from the secret via HKDF-SHA-256 (see `deriveKey`).
295
+ * The JWE carries `iat` and `exp` claims (8h TTL); `unsealDelegationSession`
296
+ * fails decryption once `exp` has elapsed, which protects against replay of
297
+ * a stale cookie value extracted from logs or a CDN cache after rotation.
298
+ */
299
+ declare function sealDelegationSession(session: DelegationSession, secret: string): Promise<string>;
300
+
301
+ /**
302
+ * Decrypt a JWE cookie string back into a `DelegationSession`.
303
+ *
304
+ * Returns `null` (instead of throwing) for any failure mode:
305
+ * - expired `exp` claim,
306
+ * - tampered ciphertext / authentication-tag mismatch,
307
+ * - wrong secret,
308
+ * - malformed payload (`accessToken` missing or wrong type, etc.).
309
+ *
310
+ * Callers treat `null` as "no session" and respond accordingly. Validation
311
+ * errors are surfaced via `console.error` with metadata about field presence
312
+ * and types only — raw token values are NEVER logged so a malformed payload
313
+ * cannot leak bearer credentials into log destinations.
314
+ */
315
+ declare function unsealDelegationSession(jwe: string, secret: string): Promise<DelegationSession | null>;
316
+
317
+ /** Issuer (`iss`) claim on Uniform delegation access tokens. */
318
+ declare const uniformDelegationIssuer = "uniform:delegation";
319
+ /** Audience (`aud`) claim on Uniform delegation access tokens accepted by Uniform HTTP APIs. */
320
+ declare const uniformApiAudience = "uniform:api";
321
+ /** Resolves the public JWKS URL for delegation access token verification. */
322
+ declare function getJwksUrl(origin?: string): string;
323
+
324
+ /**
325
+ * Configuration for {@link verifyDelegationAccessToken}.
326
+ */
327
+ interface VerifyDelegationTokenOptions {
328
+ /**
329
+ * Full URL to the delegation JWKS endpoint.
330
+ *
331
+ * Defaults to {@link getJwksUrl} (`https://uniform.app/delegation/.well-known/jwks.json`).
332
+ *
333
+ * @example getJwksUrl(process.env.UNIFORM_API_HOST)
334
+ */
335
+ jwksUrl?: string | URL;
336
+ /**
337
+ * Clock tolerance in seconds for `exp` / `nbf` validation.
338
+ * @default 2
339
+ */
340
+ clockToleranceSeconds?: number;
341
+ }
342
+ /** Verified claims from a Uniform delegation access token. */
343
+ interface DelegationAccessTokenClaims {
344
+ /** User identifier of the delegating user (`sub`). */
345
+ sub: string;
346
+ /** Team that owns the integration installation. */
347
+ teamId: string;
348
+ /** Actor claim: which integration is acting on behalf of the user. */
349
+ act: {
350
+ /** Integration definition ID. */
351
+ sub: string;
352
+ /** Integration type slug. */
353
+ integration_type: string;
354
+ };
355
+ /** Token issued-at (epoch seconds). */
356
+ iat: number;
357
+ /** Token expiry (epoch seconds). */
358
+ exp: number;
359
+ }
360
+
361
+ /**
362
+ * Verifies a Uniform delegation access token against the public JWKS.
363
+ *
364
+ * Use when your BFF makes authorization decisions outside Uniform APIs. If your BFF only
365
+ * proxies requests with the bearer token, skip verification — Uniform validates on its side.
366
+ *
367
+ * @throws When signature, issuer, audience, or expiry validation fails.
368
+ *
369
+ * @example
370
+ * ```ts
371
+ * const claims = await verifyDelegationAccessToken(token, {
372
+ * jwksUrl: getJwksUrl(process.env.UNIFORM_API_HOST),
373
+ * });
374
+ * ```
375
+ */
376
+ declare function verifyDelegationAccessToken(token: string, options?: VerifyDelegationTokenOptions): Promise<DelegationAccessTokenClaims>;
377
+
378
+ export { type CsrfConfig, type CsrfInput, type CsrfResult, DELEGATION_COOKIE_NAME, type DelegationAccessTokenClaims, type DelegationSession, DelegationTokenClient, type DelegationTokenClientOptions, DelegationTokenError, type DelegationTokenErrorKind, type DelegationTokenResponse, SESSION_TTL_SECONDS, type SerializeSessionCookieOptions, type VerifyDelegationTokenOptions, buildDelegationTokenError, classifyDelegationTokenStatus, getJwksUrl, needsRefresh, parseCookies, sealDelegationSession, serializeSessionCookie, uniformApiAudience, uniformDelegationIssuer, unsealDelegationSession, verifyCsrf, verifyDelegationAccessToken };