@shellui/core 0.6.0 → 0.6.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.
@@ -0,0 +1,445 @@
1
+ import type { ShellUIConfig } from '../../config/types';
2
+ import {
3
+ getShellUILoginClientTimezone,
4
+ getShellUILoginCompanyId,
5
+ getShellUILoginDeviceId,
6
+ } from './clientLoginContext';
7
+ import {
8
+ desktopAuthErrorMessage,
9
+ desktopRedirectUri,
10
+ normalizeDesktopScheme,
11
+ parseDesktopAuthCallback,
12
+ } from './desktopAuthCallback';
13
+ import { createPkcePair } from './pkce';
14
+
15
+ const PKCE_STORAGE_KEY = 'shellui.auth.desktop.pkce';
16
+ /** One sign-in. Magic-link clicks can be later than the 120s OAuth code. */
17
+ const PKCE_MAX_AGE_MS = 24 * 60 * 60 * 1000;
18
+
19
+ export const PKCE_CHALLENGE_METHOD = 'S256';
20
+
21
+ type PendingDesktopPkce = {
22
+ verifier: string;
23
+ redirectTo: string;
24
+ createdAt: number;
25
+ };
26
+
27
+ export type DesktopAuthOpenUrl = (url: string) => void | Promise<void>;
28
+
29
+ export type DesktopAuthUrlListener = (urls: string[]) => void;
30
+
31
+ /**
32
+ * Subscribe to OS deep links. Wire `@tauri-apps/plugin-deep-link` `onOpenUrl`.
33
+ * Return an unsubscribe function when the plugin provides one.
34
+ */
35
+ export type DesktopAuthOnOpenUrl = (
36
+ listener: DesktopAuthUrlListener,
37
+ ) => void | (() => void) | Promise<void | (() => void)>;
38
+
39
+ export interface DesktopAuthAdapters {
40
+ /** Open the identity authorize URL in the system browser. */
41
+ openUrl: DesktopAuthOpenUrl;
42
+ /** Optional. When omitted, the shell listens with Tauri's deep-link plugin IPC. */
43
+ onOpenUrl?: DesktopAuthOnOpenUrl;
44
+ }
45
+
46
+ export type DesktopAuthEvent =
47
+ | { type: 'code'; authCode: string; redirectTo: string; codeVerifier: string }
48
+ | { type: 'error'; errorCode: string; message: string };
49
+
50
+ type TauriInternals = {
51
+ invoke: (cmd: string, args?: Record<string, unknown>) => Promise<unknown>;
52
+ transformCallback?: (callback: (data: unknown) => void, once?: boolean) => number;
53
+ unregisterCallback?: (id: number) => void;
54
+ };
55
+
56
+ let adapters: DesktopAuthAdapters | null = null;
57
+ let activeScheme: string | null = null;
58
+ let memoryPending: PendingDesktopPkce | null = null;
59
+ let handledCode: string | null = null;
60
+ let queued: DesktopAuthEvent | null = null;
61
+ const listeners = new Set<(event: DesktopAuthEvent) => void>();
62
+ let unlisten: (() => void) | null = null;
63
+ let listenerPromise: Promise<void> | null = null;
64
+ let replayedLaunchUrl = false;
65
+
66
+ function sessionStore(): Storage | null {
67
+ try {
68
+ if (typeof sessionStorage === 'undefined') return null;
69
+ return sessionStorage;
70
+ } catch {
71
+ return null;
72
+ }
73
+ }
74
+
75
+ function readPending(): PendingDesktopPkce | null {
76
+ if (memoryPending && !isExpired(memoryPending)) return memoryPending;
77
+ memoryPending = null;
78
+ const store = sessionStore();
79
+ if (!store) return null;
80
+ try {
81
+ const raw = store.getItem(PKCE_STORAGE_KEY);
82
+ if (!raw) return null;
83
+ const parsed = JSON.parse(raw) as PendingDesktopPkce;
84
+ if (
85
+ !parsed ||
86
+ typeof parsed.verifier !== 'string' ||
87
+ typeof parsed.redirectTo !== 'string' ||
88
+ typeof parsed.createdAt !== 'number' ||
89
+ isExpired(parsed)
90
+ ) {
91
+ store.removeItem(PKCE_STORAGE_KEY);
92
+ return null;
93
+ }
94
+ memoryPending = parsed;
95
+ return parsed;
96
+ } catch {
97
+ return null;
98
+ }
99
+ }
100
+
101
+ function writePending(pending: PendingDesktopPkce): void {
102
+ memoryPending = pending;
103
+ const store = sessionStore();
104
+ if (!store) return;
105
+ try {
106
+ store.setItem(PKCE_STORAGE_KEY, JSON.stringify(pending));
107
+ } catch {
108
+ // The in-memory copy is enough for this sign-in.
109
+ }
110
+ }
111
+
112
+ export function clearDesktopPkce(): void {
113
+ memoryPending = null;
114
+ const store = sessionStore();
115
+ if (!store) return;
116
+ try {
117
+ store.removeItem(PKCE_STORAGE_KEY);
118
+ } catch {
119
+ // ignore
120
+ }
121
+ }
122
+
123
+ function isExpired(pending: PendingDesktopPkce): boolean {
124
+ return Date.now() - pending.createdAt > PKCE_MAX_AGE_MS;
125
+ }
126
+
127
+ function takePending(): PendingDesktopPkce | null {
128
+ const pending = readPending();
129
+ clearDesktopPkce();
130
+ return pending;
131
+ }
132
+
133
+ export function isLiveTauriRuntime(): boolean {
134
+ if (typeof window === 'undefined') return false;
135
+ const w = window as Window & { __TAURI__?: unknown; __TAURI_INTERNALS__?: unknown };
136
+ return !!(w.__TAURI__ ?? w.__TAURI_INTERNALS__);
137
+ }
138
+
139
+ export function shouldUseDesktopSignIn(
140
+ config: Pick<ShellUIConfig, 'auth' | 'backend'> | null | undefined,
141
+ tauriRuntime: boolean = isLiveTauriRuntime(),
142
+ ): boolean {
143
+ if (!tauriRuntime || config?.backend?.type !== 'shellui') return false;
144
+ return normalizeDesktopScheme(config.auth?.desktopScheme) !== null;
145
+ }
146
+
147
+ /** Set when a Tauri shell has a scheme value that identity-service would refuse. */
148
+ export function desktopSignInBlockReason(
149
+ config: Pick<ShellUIConfig, 'auth' | 'backend'> | null | undefined,
150
+ tauriRuntime: boolean,
151
+ ): string | null {
152
+ if (!tauriRuntime || config?.backend?.type !== 'shellui') return null;
153
+ const raw = config.auth?.desktopScheme;
154
+ if (typeof raw !== 'string' || raw.trim() === '') return null;
155
+ if (normalizeDesktopScheme(raw)) return null;
156
+ return 'auth.desktopScheme must be a lowercase custom scheme such as shellui-playground.';
157
+ }
158
+
159
+ export function setActiveDesktopScheme(scheme: string | null): void {
160
+ activeScheme = scheme ? normalizeDesktopScheme(scheme) : null;
161
+ }
162
+
163
+ export function configureDesktopAuth(next: DesktopAuthAdapters): void {
164
+ adapters = { openUrl: next.openUrl, onOpenUrl: next.onOpenUrl };
165
+ if (unlisten) {
166
+ unlisten();
167
+ unlisten = null;
168
+ }
169
+ listenerPromise = null;
170
+ if (activeScheme) {
171
+ void ensureDesktopDeepLinkListener();
172
+ }
173
+ }
174
+
175
+ export function subscribeDesktopAuth(listener: (event: DesktopAuthEvent) => void): () => void {
176
+ listeners.add(listener);
177
+ if (queued) {
178
+ const event = queued;
179
+ queued = null;
180
+ listener(event);
181
+ }
182
+ return () => {
183
+ listeners.delete(listener);
184
+ };
185
+ }
186
+
187
+ function emitDesktopAuth(event: DesktopAuthEvent): void {
188
+ if (listeners.size === 0) {
189
+ queued = event;
190
+ return;
191
+ }
192
+ for (const listener of listeners) listener(event);
193
+ }
194
+
195
+ export function buildDesktopAuthorizeUrl(input: {
196
+ backendUrl: string;
197
+ companyId?: string;
198
+ provider: string;
199
+ oauthClientId?: number;
200
+ redirectTo: string;
201
+ codeChallenge: string;
202
+ clientTimezone?: string;
203
+ clientDeviceId?: string;
204
+ }): string {
205
+ const authorizeUrl = new URL(`${input.backendUrl.replace(/\/+$/, '')}/api/v1/authorize`);
206
+ authorizeUrl.searchParams.set('provider', input.provider);
207
+ authorizeUrl.searchParams.set('redirect_to', input.redirectTo);
208
+ authorizeUrl.searchParams.set('code_challenge', input.codeChallenge);
209
+ authorizeUrl.searchParams.set('code_challenge_method', PKCE_CHALLENGE_METHOD);
210
+ if (
211
+ typeof input.oauthClientId === 'number' &&
212
+ Number.isFinite(input.oauthClientId) &&
213
+ input.oauthClientId > 0
214
+ ) {
215
+ authorizeUrl.searchParams.set(
216
+ 'company_oauth_client_id',
217
+ String(Math.trunc(input.oauthClientId)),
218
+ );
219
+ }
220
+ if (input.companyId) {
221
+ authorizeUrl.searchParams.set('company_id', input.companyId);
222
+ }
223
+ if (input.clientTimezone) {
224
+ authorizeUrl.searchParams.set('client_timezone', input.clientTimezone);
225
+ }
226
+ if (input.clientDeviceId) {
227
+ authorizeUrl.searchParams.set('client_device_id', input.clientDeviceId);
228
+ }
229
+ return authorizeUrl.toString();
230
+ }
231
+
232
+ export async function createAndStoreDesktopPkce(
233
+ scheme: string,
234
+ ): Promise<{ challenge: string; redirectTo: string }> {
235
+ const normalized = normalizeDesktopScheme(scheme);
236
+ if (!normalized) {
237
+ throw new Error(
238
+ 'auth.desktopScheme must be a lowercase custom scheme such as shellui-playground.',
239
+ );
240
+ }
241
+ const redirectTo = desktopRedirectUri(normalized);
242
+ const { verifier, challenge } = await createPkcePair();
243
+ handledCode = null;
244
+ writePending({ verifier, redirectTo, createdAt: Date.now() });
245
+ return { challenge, redirectTo };
246
+ }
247
+
248
+ function getTauriInternals(): TauriInternals | null {
249
+ if (typeof window === 'undefined') return null;
250
+ return (window as Window & { __TAURI_INTERNALS__?: TauriInternals }).__TAURI_INTERNALS__ ?? null;
251
+ }
252
+
253
+ async function openSystemBrowser(url: string): Promise<void> {
254
+ if (adapters?.openUrl) {
255
+ await adapters.openUrl(url);
256
+ return;
257
+ }
258
+ const internals = getTauriInternals();
259
+ if (!internals?.invoke) {
260
+ throw new Error(
261
+ 'Desktop sign-in needs a system browser opener. Call configureDesktopAuth({ openUrl }).',
262
+ );
263
+ }
264
+ try {
265
+ await internals.invoke('plugin:opener|open_url', { url });
266
+ } catch {
267
+ throw new Error(
268
+ 'Desktop sign-in could not open the system browser. Add the Tauri opener plugin, or pass openUrl to configureDesktopAuth.',
269
+ );
270
+ }
271
+ }
272
+
273
+ export async function beginDesktopOAuth(input: {
274
+ backendUrl: string;
275
+ companyId?: string | number;
276
+ provider: string;
277
+ oauthClientId?: number;
278
+ scheme: string;
279
+ }): Promise<void> {
280
+ const scheme = normalizeDesktopScheme(input.scheme);
281
+ if (!scheme) {
282
+ throw new Error(
283
+ 'auth.desktopScheme must be a lowercase custom scheme such as shellui-playground.',
284
+ );
285
+ }
286
+ const backendUrl = input.backendUrl?.replace(/\/+$/, '') ?? '';
287
+ if (!backendUrl) {
288
+ throw new Error('Missing Shellui backend URL.');
289
+ }
290
+ setActiveDesktopScheme(scheme);
291
+ const prepared = await createAndStoreDesktopPkce(scheme);
292
+ const authorizeUrl = buildDesktopAuthorizeUrl({
293
+ backendUrl,
294
+ companyId: getShellUILoginCompanyId(input.companyId),
295
+ provider: input.provider,
296
+ oauthClientId: input.oauthClientId,
297
+ redirectTo: prepared.redirectTo,
298
+ codeChallenge: prepared.challenge,
299
+ clientTimezone: getShellUILoginClientTimezone(),
300
+ clientDeviceId: getShellUILoginDeviceId(),
301
+ });
302
+ try {
303
+ await openSystemBrowser(authorizeUrl);
304
+ } catch (error) {
305
+ clearDesktopPkce();
306
+ throw error;
307
+ }
308
+ try {
309
+ // Skip the launch URL here. A previous deep link would spend the verifier
310
+ // stored for this attempt.
311
+ await ensureDesktopDeepLinkListener({ replayLaunchUrl: false });
312
+ } catch {
313
+ // The browser is already open. The app can still forward the deep link.
314
+ }
315
+ }
316
+
317
+ /**
318
+ * Feed one deep-link URL, for example from `@tauri-apps/plugin-deep-link` `onOpenUrl`.
319
+ * Codes, verifiers, and tokens are not logged.
320
+ */
321
+ export function handleDesktopAuthCallback(rawUrl: string): void {
322
+ const scheme = activeScheme;
323
+ if (!scheme || typeof rawUrl !== 'string' || !rawUrl) return;
324
+ const parsed = parseDesktopAuthCallback(rawUrl, scheme);
325
+ if (!parsed) return;
326
+
327
+ if (parsed.kind === 'error') {
328
+ clearDesktopPkce();
329
+ emitDesktopAuth({ type: 'error', errorCode: parsed.errorCode, message: parsed.message });
330
+ return;
331
+ }
332
+
333
+ if (handledCode === parsed.authCode) return;
334
+ handledCode = parsed.authCode;
335
+ const pending = takePending();
336
+ if (!pending) {
337
+ emitDesktopAuth({
338
+ type: 'error',
339
+ errorCode: 'desktop_signin_expired',
340
+ message: desktopAuthErrorMessage('desktop_signin_expired'),
341
+ });
342
+ return;
343
+ }
344
+ emitDesktopAuth({
345
+ type: 'code',
346
+ authCode: parsed.authCode,
347
+ redirectTo: pending.redirectTo,
348
+ codeVerifier: pending.verifier,
349
+ });
350
+ }
351
+
352
+ function urlsFromDeepLinkPayload(data: unknown): string[] {
353
+ const payload =
354
+ data && typeof data === 'object' && data !== null && 'payload' in data
355
+ ? (data as { payload?: unknown }).payload
356
+ : data;
357
+ if (!Array.isArray(payload)) return [];
358
+ return payload.filter((item): item is string => typeof item === 'string' && item.length > 0);
359
+ }
360
+
361
+ async function readCurrentDeepLinks(): Promise<void> {
362
+ const internals = getTauriInternals();
363
+ if (!internals?.invoke) return;
364
+ try {
365
+ const current = await internals.invoke('plugin:deep-link|get_current');
366
+ for (const url of urlsFromDeepLinkPayload(current)) {
367
+ handleDesktopAuthCallback(url);
368
+ }
369
+ } catch {
370
+ // The deep-link plugin is optional until the desktop app registers it.
371
+ }
372
+ }
373
+
374
+ export function ensureDesktopDeepLinkListener(options?: {
375
+ replayLaunchUrl?: boolean;
376
+ }): Promise<void> {
377
+ const replay = options?.replayLaunchUrl !== false;
378
+ if (listenerPromise) {
379
+ if (replay && !replayedLaunchUrl) {
380
+ replayedLaunchUrl = true;
381
+ return listenerPromise.then(() => readCurrentDeepLinks());
382
+ }
383
+ return listenerPromise;
384
+ }
385
+ listenerPromise = attachDeepLinkListener(replay).catch((error) => {
386
+ listenerPromise = null;
387
+ throw error;
388
+ });
389
+ return listenerPromise;
390
+ }
391
+
392
+ async function attachDeepLinkListener(replayLaunchUrl: boolean): Promise<void> {
393
+ if (replayLaunchUrl && !replayedLaunchUrl) {
394
+ replayedLaunchUrl = true;
395
+ await readCurrentDeepLinks();
396
+ }
397
+ if (adapters?.onOpenUrl) {
398
+ const result = await adapters.onOpenUrl((urls) => {
399
+ for (const url of urls) handleDesktopAuthCallback(url);
400
+ });
401
+ if (typeof result === 'function') {
402
+ unlisten = () => {
403
+ result();
404
+ };
405
+ }
406
+ return;
407
+ }
408
+
409
+ const internals = getTauriInternals();
410
+ if (!internals?.invoke || !internals.transformCallback) return;
411
+ const callbackId = internals.transformCallback((data) => {
412
+ for (const url of urlsFromDeepLinkPayload(data)) {
413
+ handleDesktopAuthCallback(url);
414
+ }
415
+ }, false);
416
+ try {
417
+ const eventId = (await internals.invoke('plugin:event|listen', {
418
+ event: 'deep-link://new-url',
419
+ target: { kind: 'Any' },
420
+ handler: callbackId,
421
+ })) as number;
422
+ unlisten = () => {
423
+ internals.unregisterCallback?.(callbackId);
424
+ void internals
425
+ .invoke('plugin:event|unlisten', { event: 'deep-link://new-url', eventId })
426
+ .catch(() => undefined);
427
+ };
428
+ } catch {
429
+ internals.unregisterCallback?.(callbackId);
430
+ }
431
+ }
432
+
433
+ /** Test-only reset. Not part of the app API. */
434
+ export function resetDesktopAuthState(): void {
435
+ if (unlisten) unlisten();
436
+ unlisten = null;
437
+ listenerPromise = null;
438
+ replayedLaunchUrl = false;
439
+ adapters = null;
440
+ activeScheme = null;
441
+ handledCode = null;
442
+ queued = null;
443
+ listeners.clear();
444
+ clearDesktopPkce();
445
+ }
@@ -0,0 +1,23 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import {
3
+ refreshFrameAccessTokenIfNeeded,
4
+ registerFrameSessionRefresher,
5
+ } from './frameSessionRefresher';
6
+
7
+ describe('refreshFrameAccessTokenIfNeeded', () => {
8
+ it('returns undefined until a refresher is registered, then the token it resolves', async () => {
9
+ expect(await refreshFrameAccessTokenIfNeeded()).toBeUndefined();
10
+
11
+ const stop = registerFrameSessionRefresher(async () => 'fresh-access');
12
+ expect(await refreshFrameAccessTokenIfNeeded()).toBe('fresh-access');
13
+
14
+ stop();
15
+ expect(await refreshFrameAccessTokenIfNeeded()).toBeUndefined();
16
+ });
17
+
18
+ it('passes through null when the shell has no session', async () => {
19
+ const stop = registerFrameSessionRefresher(async () => null);
20
+ expect(await refreshFrameAccessTokenIfNeeded()).toBeNull();
21
+ stop();
22
+ });
23
+ });
@@ -0,0 +1,21 @@
1
+ type FrameSessionRefresher = () => Promise<string | null>;
2
+
3
+ let refresher: FrameSessionRefresher | null = null;
4
+
5
+ /** AuthProvider registers the shell refresh used when an iframe asks for a session. */
6
+ export function registerFrameSessionRefresher(fn: FrameSessionRefresher): () => void {
7
+ refresher = fn;
8
+ return () => {
9
+ if (refresher === fn) refresher = null;
10
+ };
11
+ }
12
+
13
+ /**
14
+ * Refresh when the shell token is due, then return the access token to hand off.
15
+ * `undefined` means no refresher is registered and the caller should use its own copy.
16
+ * `null` means the shell has no session.
17
+ */
18
+ export async function refreshFrameAccessTokenIfNeeded(): Promise<string | null | undefined> {
19
+ if (!refresher) return undefined;
20
+ return refresher();
21
+ }
@@ -0,0 +1,36 @@
1
+ import { describe, expect, test } from 'vitest';
2
+ import { createPkcePair, generateCodeChallenge, generateCodeVerifier } from './pkce';
3
+
4
+ const UNRESERVED = /^[A-Za-z0-9\-._~]+$/;
5
+
6
+ describe('PKCE S256', () => {
7
+ test('verifier is 43 unreserved characters and the challenge is its SHA-256', async () => {
8
+ const verifier = generateCodeVerifier();
9
+ expect(verifier.length).toBe(43);
10
+ expect(verifier).toMatch(UNRESERVED);
11
+
12
+ const challenge = await generateCodeChallenge(verifier);
13
+ expect(challenge.length).toBe(43);
14
+ expect(challenge).toMatch(/^[A-Za-z0-9\-_]+$/);
15
+ expect(challenge).not.toMatch(/[=+/]/);
16
+
17
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier));
18
+ const expected = btoa(String.fromCharCode(...new Uint8Array(digest)))
19
+ .replace(/\+/g, '-')
20
+ .replace(/\//g, '_')
21
+ .replace(/=+$/g, '');
22
+ expect(challenge).toBe(expected);
23
+ });
24
+
25
+ test('two sign-in attempts do not reuse the verifier', async () => {
26
+ const first = await createPkcePair();
27
+ const second = await createPkcePair();
28
+ expect(first.verifier).not.toBe(second.verifier);
29
+ expect(first.challenge).not.toBe(second.challenge);
30
+ expect(first.challenge).not.toBe(first.verifier);
31
+ });
32
+
33
+ test('rejects a verifier outside the identity-service length', async () => {
34
+ await expect(generateCodeChallenge('short')).rejects.toThrow(/43 to 128/);
35
+ });
36
+ });
@@ -0,0 +1,38 @@
1
+ /**
2
+ * PKCE S256 (RFC 7636). The verifier stays in the app. Only the challenge is sent.
3
+ * 32 random bytes encode to 43 base64url characters, inside the 43-128 range.
4
+ */
5
+
6
+ const VERIFIER_PATTERN = /^[A-Za-z0-9\-._~]{43,128}$/;
7
+
8
+ function base64UrlEncode(bytes: Uint8Array): string {
9
+ let binary = '';
10
+ for (const byte of bytes) {
11
+ binary += String.fromCharCode(byte);
12
+ }
13
+ return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/g, '');
14
+ }
15
+
16
+ export function generateCodeVerifier(): string {
17
+ const bytes = new Uint8Array(32);
18
+ crypto.getRandomValues(bytes);
19
+ const verifier = base64UrlEncode(bytes);
20
+ if (!VERIFIER_PATTERN.test(verifier)) {
21
+ throw new Error('Could not generate a PKCE verifier.');
22
+ }
23
+ return verifier;
24
+ }
25
+
26
+ export async function generateCodeChallenge(verifier: string): Promise<string> {
27
+ if (!VERIFIER_PATTERN.test(verifier)) {
28
+ throw new Error('PKCE verifier must be 43 to 128 unreserved characters.');
29
+ }
30
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(verifier));
31
+ return base64UrlEncode(new Uint8Array(digest));
32
+ }
33
+
34
+ export async function createPkcePair(): Promise<{ verifier: string; challenge: string }> {
35
+ const verifier = generateCodeVerifier();
36
+ const challenge = await generateCodeChallenge(verifier);
37
+ return { verifier, challenge };
38
+ }
@@ -204,6 +204,18 @@ export interface SecurityConfig {
204
204
  csp?: CspConfig;
205
205
  }
206
206
 
207
+ /**
208
+ * Desktop (Tauri) sign-in. Ignored in the browser, so the web OAuth redirect stays as it is.
209
+ * The scheme must match the OAuth application's `desktop_redirect_scheme`.
210
+ */
211
+ export interface AuthConfig {
212
+ /**
213
+ * Custom URL scheme for Tauri sign-in, such as `shellui-playground`.
214
+ * Lowercase. Not `http`, `https`, or another browser scheme.
215
+ */
216
+ desktopScheme?: string;
217
+ }
218
+
207
219
  /** Backend API configuration. */
208
220
  export interface BackendConfig {
209
221
  /** Backend provider type. */
@@ -411,6 +423,11 @@ export interface ShellUIConfig {
411
423
  sentry?: SentryConfig;
412
424
  /** Backend communication config. Defaults to undefined (no backend integration). */
413
425
  backend?: BackendConfig;
426
+ /**
427
+ * Desktop sign-in scheme for a Tauri shell. See `auth.desktopScheme`.
428
+ * Browser shells ignore this block.
429
+ */
430
+ auth?: AuthConfig;
414
431
  /** Host security (postMessage allowlist, BFF auth, CSP — see docs/features/security.md). */
415
432
  security?: SecurityConfig;
416
433
  /** Cookie consent: list of cookies by category; accepted ids are stored in settings. */