@celestia-island/hikari 0.55.501 → 0.55.502

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.
@@ -86,10 +86,13 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
86
86
  * - `v-model` (channel key) + `channels` — the segment group.
87
87
  * - `step` — `'account' | 'verify'`; the host flips it when its ladder
88
88
  * answers with factors, and the SAME card swaps its header copy and
89
- * body over to the step-up (which never renders on an sso channel: a
90
- * redirect flow has no second step by construction — passing
91
- * `step="verify"` with an sso channel renders the account body as a
92
- * fail-safe).
89
+ * body over to the step-up. A redirect (sso) channel has no second step
90
+ * of its own, so `step="verify"` without an announced factor table
91
+ * renders the account body as a fail-safe — but a host that RECEIVED a
92
+ * ladder (the OAuth hand-off calling back with `mfa_pending` /
93
+ * `mfa_factors`, which is the only way an SSO-only deployment can ask
94
+ * for a second factor) passes `verifyFactors` and gets the real step-up
95
+ * on the sso channel too.
93
96
  * - `account-submit(channel, username, password)` — credentials
94
97
  * channel submitted (password is empty while `passwordField` is off).
95
98
  * - `sso-click(channel)` — the primary sso row was picked.
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The central identity provider's mark, ready for `src=` / CSS `url(…)`.
3
+ *
4
+ * A 64×64 WebP data URI (transparent background) generated from the landing
5
+ * repo's logo — the single home for Celestia artwork — and committed as text
6
+ * so no host has to serve or resolve a separate asset file. Render it at
7
+ * 16×16; the source carries a 2 px margin so it optically matches the
8
+ * surrounding icons.
9
+ */
10
+ export declare const hkCentralAuthMarkSrc = "data:image/webp;base64,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";
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The built-in presentation of the central identity provider's sign-in row.
3
+ *
4
+ * Celestia's central identity provider has one wire id (`"erp"` — the id every
5
+ * live service already emits, which this module deliberately does NOT rename)
6
+ * and no name or icon of its own. Every host therefore shipped its own answer:
7
+ * a bare id in the row, or a hand-typed "Celestia ID" with no mark. This module
8
+ * is the single home for both, so chest, 0721 and future front ends render the
9
+ * same row.
10
+ *
11
+ * The module is free of Vue dependencies EXCEPT for reading the name out of
12
+ * hikari's own i18n context ({@link hkCentralAuthName}): the predicate and the
13
+ * constants below stay pure, so a non-Vue consumer can still import them.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * import {
18
+ * HK_CENTRAL_AUTH_PROVIDER_ID, hkCentralAuthMarkSrc, hkCentralAuthName,
19
+ * hkProviderLabelIsId,
20
+ * } from "@celestia-island/hikari/vue";
21
+ *
22
+ * const name = hkCentralAuthName();
23
+ * const label =
24
+ * method.provider === HK_CENTRAL_AUTH_PROVIDER_ID && hkProviderLabelIsId(method.provider, method.label)
25
+ * ? name
26
+ * : method.label;
27
+ * const icon =
28
+ * method.provider === HK_CENTRAL_AUTH_PROVIDER_ID && !method.icon
29
+ * ? hkCentralAuthMarkSrc
30
+ * : method.icon;
31
+ * ```
32
+ *
33
+ * The rules a host must honour, in order of precedence:
34
+ *
35
+ * 1. **Nothing an operator configures is overridden.** A provider `label` or
36
+ * `icon` set in the host's own configuration always wins; a deployment that
37
+ * renames the row to its company's portal keeps that name.
38
+ * 2. **The built-in name fills a fallback, not a default.** Serve the translated
39
+ * name only when the label has degenerated to the id — the long-standing
40
+ * server-side convention where an unset label is emitted as the id. Use
41
+ * `hkProviderLabelIsId` for that test; it matches the id exactly, so a
42
+ * deliberately lower-cased alias ("erp-europe") is left alone. Read the name
43
+ * through {@link hkCentralAuthName}.
44
+ * 3. **The built-in mark fills a gap, not a default.** Use
45
+ * {@link hkCentralAuthMarkSrc} only when the server supplied no icon.
46
+ * 4. **A deployment that does not configure this provider sees no change.** The
47
+ * self-hosted default is still local username/password: nothing here is
48
+ * imported unless the login-policy document actually lists the provider.
49
+ * 5. **The icon is a 64×64 inline WebP data URI.** Render it at 16×16 — the
50
+ * same box as the surrounding row glyphs; the source is scaled for exactly
51
+ * that and carries the margin to match their optical weight.
52
+ */
53
+ /**
54
+ * The central identity provider's wire id: the value every live host already
55
+ * emits in its login-policy document under `methods[].provider`.
56
+ *
57
+ * This is a wire contract with kirino and with each deployed service. It is
58
+ * named here so a host does not have to hard-code the literal, NOT to
59
+ * introduce a new id — the asset in this module (name and mark) is what
60
+ * changed, the id is not.
61
+ */
62
+ export declare const HK_CENTRAL_AUTH_PROVIDER_ID = "erp";
63
+ /**
64
+ * The i18n key of the provider's display name, in every shipped locale.
65
+ *
66
+ * `hkCentralAuthName()` reads it; a host whose own catalog merges the
67
+ * `hikari::` keys may also pass it to its `t()` directly, with
68
+ * {@link HK_CENTRAL_AUTH_NAME_EN} as the fallback.
69
+ */
70
+ export declare const HK_CENTRAL_AUTH_NAME_KEY = "hikari::loginFlow.providerCelestiaAuth";
71
+ /** The provider's display name in English — the canonical literal and the
72
+ * fallback behind {@link HK_CENTRAL_AUTH_NAME_KEY}. */
73
+ export declare const HK_CENTRAL_AUTH_NAME_EN = "Celestia Unified Authentication Platform";
74
+ /**
75
+ * The provider's display name in the language hikari's locale context is
76
+ * currently in — THE entry point hosts should render.
77
+ *
78
+ * Why not `t(HK_CENTRAL_AUTH_NAME_KEY, HK_CENTRAL_AUTH_NAME_EN)` in the host's
79
+ * own translator: that only works for a host whose i18n catalog actually merges
80
+ * hikari's `hikari::` keys. 0721's vue-i18n instance deliberately does not, so
81
+ * the same call would sit on the English fallback in every language. Every host
82
+ * does, however, keep hikari's context in step with the app language when the
83
+ * user switches (`setLocale` / `setHikariLocale` on that switch), which is
84
+ * exactly the state this function reads — so it is the one spelling that works
85
+ * everywhere. A host that DOES merge the keys may keep using `t(...)` with
86
+ * {@link HK_CENTRAL_AUTH_NAME_KEY} and {@link HK_CENTRAL_AUTH_NAME_EN}.
87
+ *
88
+ * Reads hikari's reactive locale state, so calling it inside a render or a
89
+ * `computed` makes the row re-render on a language switch. Call it there — do
90
+ * not hoist the result into a module-level constant, which would freeze
91
+ * whichever language happened to be active at import time. It returns whatever
92
+ * hikari's current language is; a host that never calls `setLocale` sees
93
+ * English.
94
+ */
95
+ export declare function hkCentralAuthName(): string;
96
+ /**
97
+ * Whether a provider's `label` has degenerated to its id — the server-side
98
+ * convention for "the operator did not name this provider", so the host should
99
+ * substitute its built-in name.
100
+ *
101
+ * True when the label is absent, empty, or whitespace only, and when it equals
102
+ * `providerId` character for character. Case differences are NOT a match:
103
+ * `"ERP"` over `"erp"` is a name an operator typed, and a host must not
104
+ * overwrite it. An empty `providerId` is never a match — every empty label
105
+ * would otherwise collapse onto it.
106
+ */
107
+ export declare function hkProviderLabelIsId(providerId: string, label: string | null | undefined): boolean;
108
+ export { hkCentralAuthMarkSrc } from "./centralAuthMarkData";
@@ -502,6 +502,7 @@ export { type HkAuthChannelListEntry as HkAuthChannelListEntry } from "./compone
502
502
  export { HkAuthHandoff as HkAuthHandoff } from "./components/HkAuthHandoff";
503
503
  export { type HkAuthHandoffAction as HkAuthHandoffAction, type HkAuthHandoffStatus as HkAuthHandoffStatus, } from "./components/HkAuthHandoff";
504
504
  export { hkIsSameOriginPath as hkIsSameOriginPath, hkLoginPlanFromDiscovery as hkLoginPlanFromDiscovery, hkRelayEntryHref as hkRelayEntryHref, type HkLoginDiscovery as HkLoginDiscovery, type HkLoginMethod as HkLoginMethod, type HkLoginMode as HkLoginMode, type HkLoginPlan as HkLoginPlan, type HkLoginPlanCopy as HkLoginPlanCopy, } from "./components/loginDiscovery";
505
+ export { HK_CENTRAL_AUTH_NAME_EN as HK_CENTRAL_AUTH_NAME_EN, HK_CENTRAL_AUTH_NAME_KEY as HK_CENTRAL_AUTH_NAME_KEY, HK_CENTRAL_AUTH_PROVIDER_ID as HK_CENTRAL_AUTH_PROVIDER_ID, hkCentralAuthMarkSrc as hkCentralAuthMarkSrc, hkCentralAuthName as hkCentralAuthName, hkProviderLabelIsId as hkProviderLabelIsId, } from "./components/loginProviders";
505
506
  export { HkLocalePicker as HkLocalePicker } from "./components/HkLocalePicker";
506
507
  export { HkAdminTablePage as HkAdminTablePage } from "./components/HkAdminTablePage";
507
508
  export { HkMasterDetail as HkMasterDetail } from "./components/HkMasterDetail";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celestia-island/hikari",
3
- "version": "0.55.501",
3
+ "version": "0.55.502",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari UI library, Vue 3 runtime — one design system for Vue 3 and Rust/WASM applications",
@@ -28,6 +28,17 @@ afterEach(() => {
28
28
  }
29
29
  });
30
30
 
31
+ /** The crossfade generation with `key` (see HkTransitionContainer's
32
+ * `enteringItem`): during a swap both generations are in the DOM, so a
33
+ * whole-tree query reads whichever one renders first. */
34
+ function within(container: HTMLElement, key: string): HTMLElement {
35
+ const item = Array.from(
36
+ container.querySelectorAll<HTMLElement>(".hk-crossfade-item"),
37
+ ).find((el) => el.dataset.crossfadeKey === key);
38
+ expect(item, `no crossfade generation keyed ${key}`).toBeTruthy();
39
+ return item!;
40
+ }
41
+
31
42
  const cloudChannel: HkLoginChannel = {
32
43
  key: "cloud",
33
44
  mode: "credentials",
@@ -251,22 +262,114 @@ describe("HkLoginFlow — sso channel", () => {
251
262
  expect(b.hasAttribute("href")).toBe(false);
252
263
  });
253
264
 
254
- it("does not enter the verify step on an sso channel (fail-safe)", () => {
265
+ it("keeps the account body on an sso channel when no factor table is announced (fail-safe)", () => {
266
+ // MUT:flow-sso-verify-unguarded (deriving `verifying` from
267
+ // `step === "verify"` alone — or from `verifyFactors` without the
268
+ // credentials arm — turns this into a dead MFA card on every sso
269
+ // flow that has no second step).
255
270
  const c = mount(
256
271
  h(HkLoginFlow, {
257
272
  channels: [orgChannel],
258
273
  modelValue: "org",
259
274
  step: "verify",
260
- verifyFactors: ["totp"],
275
+ verifyFactors: [],
261
276
  }),
262
277
  );
263
- // A redirect flow has no second step by construction; the panel
264
- // keeps showing the account card instead of a dead MFA card.
278
+ // No announced ladder = no second step to take: the panel keeps
279
+ // showing the account card instead of a dead MFA card.
265
280
  expect(c.querySelector(".hk-auth-channel-row")).not.toBeNull();
281
+ expect(c.querySelectorAll(".hk-otp-cell").length).toBe(0);
266
282
  });
267
283
  });
268
284
 
269
285
  describe("HkLoginFlow — verify step", () => {
286
+ it("renders the step-up on an sso channel once the host announces factors (OAuth hand-off)", async () => {
287
+ // The hand-off case: the OAuth callback returns with `mfa_pending` /
288
+ // `mfa_factors`, and on an SSO-only deployment the sso channel is the
289
+ // only channel there is. Without this arm every MFA account that
290
+ // signs in through SSO dead-ends on a card with no second step.
291
+ const step = ref<"account" | "verify">("account");
292
+ const factors = ref<readonly string[]>([]);
293
+ const Host = defineComponent({
294
+ setup: () => () =>
295
+ h(HkLoginFlow, {
296
+ channels: [orgChannel],
297
+ modelValue: "org",
298
+ step: step.value,
299
+ verifyFactors: factors.value,
300
+ }),
301
+ });
302
+ const c = mount(h(Host));
303
+ await nextTick();
304
+ // The redirect row is on stage; no step-up yet.
305
+ expect(c.querySelector(".hk-auth-channel-row")).not.toBeNull();
306
+ expect(c.querySelectorAll(".hk-otp-cell").length).toBe(0);
307
+
308
+ // The hand-off lands: step flips AND the ladder is announced.
309
+ factors.value = ["totp"];
310
+ step.value = "verify";
311
+ for (let i = 0; i < 12; i++) await nextTick();
312
+ // MUT:flow-sso-verify-credentials-only (reverting `verifying` to
313
+ // `channel.mode === "credentials"` leaves the account body on stage
314
+ // and this goes red — that is the dead-end bug).
315
+ expect(c.querySelectorAll(".hk-otp-cell").length).toBeGreaterThan(0);
316
+ // The header speaks the step-up vocabulary, not the sign-in title.
317
+ // Scope it to the ENTERING generation: the leaving account body
318
+ // lingers until the swap settles (jsdom fires no transitionend), and
319
+ // a whole-tree querySelector would read its title instead.
320
+ expect(
321
+ within(c, "verify").querySelector(".s-auth-title")?.textContent,
322
+ ).toBe("Verify account");
323
+ });
324
+
325
+ it("keeps the credentials channel's verify step working unchanged", async () => {
326
+ const c = mount(
327
+ h(HkLoginFlow, {
328
+ channels: [cloudChannel],
329
+ modelValue: "cloud",
330
+ step: "verify",
331
+ verifyFactors: ["totp"],
332
+ }),
333
+ );
334
+ await nextTick();
335
+ // MUT:flow-verify-credentials-arm-dropped (a fix that gates verify on
336
+ // `verifyFactors` alone regresses this: a credentials step-up with an
337
+ // empty ladder would fall back to the password form).
338
+ expect(c.querySelectorAll(".hk-otp-cell").length).toBeGreaterThan(0);
339
+ expect(
340
+ within(c, "verify").querySelector(".s-auth-title")?.textContent,
341
+ ).toBe("Verify account");
342
+ });
343
+
344
+ it("re-emits verify-back from the sso channel's step-up so the host can clear the step", async () => {
345
+ const onBack = vi.fn();
346
+ const step = ref<"account" | "verify">("verify");
347
+ const Host = defineComponent({
348
+ setup: () => () =>
349
+ h(HkLoginFlow, {
350
+ channels: [orgChannel],
351
+ modelValue: "org",
352
+ step: step.value,
353
+ verifyFactors: ["totp"],
354
+ onVerifyBack: () => {
355
+ onBack();
356
+ step.value = "account";
357
+ },
358
+ }),
359
+ });
360
+ const c = mount(h(Host));
361
+ await nextTick();
362
+ const back = Array.from(c.querySelectorAll("button")).find((b) =>
363
+ b.textContent?.toLowerCase().includes("back"));
364
+ expect(back).toBeTruthy();
365
+ back!.click();
366
+ await nextTick();
367
+ expect(onBack).toHaveBeenCalledTimes(1);
368
+ // The host cleared its step state; the sso row is reachable again.
369
+ for (let i = 0; i < 12; i++) await nextTick();
370
+ expect(c.querySelector(".hk-auth-channel-row")).not.toBeNull();
371
+ });
372
+
270
373
  it("slides to the MFA card and forwards the verify event with the composed proof", async () => {
271
374
  const onVerify = vi.fn();
272
375
  const c = mount(
@@ -103,10 +103,13 @@ export type HkLoginChannel = HkLoginCredentialsChannel | HkLoginSsoChannel;
103
103
  * - `v-model` (channel key) + `channels` — the segment group.
104
104
  * - `step` — `'account' | 'verify'`; the host flips it when its ladder
105
105
  * answers with factors, and the SAME card swaps its header copy and
106
- * body over to the step-up (which never renders on an sso channel: a
107
- * redirect flow has no second step by construction — passing
108
- * `step="verify"` with an sso channel renders the account body as a
109
- * fail-safe).
106
+ * body over to the step-up. A redirect (sso) channel has no second step
107
+ * of its own, so `step="verify"` without an announced factor table
108
+ * renders the account body as a fail-safe — but a host that RECEIVED a
109
+ * ladder (the OAuth hand-off calling back with `mfa_pending` /
110
+ * `mfa_factors`, which is the only way an SSO-only deployment can ask
111
+ * for a second factor) passes `verifyFactors` and gets the real step-up
112
+ * on the sso channel too.
110
113
  * - `account-submit(channel, username, password)` — credentials
111
114
  * channel submitted (password is empty while `passwordField` is off).
112
115
  * - `sso-click(channel)` — the primary sso row was picked.
@@ -431,9 +434,17 @@ export const HkLoginFlow = defineComponent({
431
434
  ? t("hikari::loginFlow.signInSubtitle", "Welcome back")
432
435
  : "");
433
436
 
434
- // The fail-safe of the old design, kept: verify only ever renders
435
- // for a credentials channel (a redirect flow has no second step).
436
- const verifying = props.step === "verify" && channel.mode === "credentials";
437
+ // A credentials channel carries its own second step, so `step=verify`
438
+ // always renders the step-up for it. An sso channel has no second
439
+ // step by construction — EXCEPT when the host announces a factor
440
+ // table: the OAuth hand-off hands such a login back (chest's
441
+ // `mfa_pending` / `mfa_factors` cookies) with the ladder filled in,
442
+ // and on an SSO-only deployment the sso channel is the ONLY one
443
+ // there is, so refusing to render would dead-end every account with
444
+ // MFA. With no announced factors the old fail-safe still holds: the
445
+ // account body renders instead of a dead MFA card.
446
+ const verifying = props.step === "verify"
447
+ && (channel.mode === "credentials" || props.verifyFactors.length > 0);
437
448
 
438
449
  return (
439
450
  <div class="hk-login-flow">
@@ -0,0 +1,35 @@
1
+ // AI-generated: developed with the DeepSeek Harness agent (model
2
+ // DeepSeek-V4.1-Flash) directed and reviewed by the lead agent — SySL-1.0
3
+ // §2.3 disclosure.
4
+ //
5
+ // GENERATED — do not edit. Regenerate with:
6
+ //
7
+ // python3 packages/vue/scripts/build-central-auth-mark.py \
8
+ // <checkout>/celestia-island.github.io/res/logos/celestia.webp
9
+ //
10
+ // source celestia-island.github.io/res/logos/celestia.webp
11
+ // source sha256 4f5c9efbcbdaea5e66eefe584f490c5f71b68daed3765a144f267eb7a042a648
12
+ // output 64×64-and-under square, 64×64 canvas,
13
+ // logo 60×60, 2px margin, WebP quality 90,
14
+ // method 6, 1670 bytes
15
+ //
16
+ // One WebP data URI for the built-in sign-in mark of the central identity
17
+ // provider. Hosts render it at 16×16; see `loginProviders.ts` for the
18
+ // precedence rules behind it.
19
+ //
20
+ // The payload below is ONE string literal on ONE line on purpose: adjacent
21
+ // wrapped literals survive `node` but not Vite's non-minifying oxc pass
22
+ // (see the generator's `render_module`).
23
+
24
+ const hkCentralAuthMarkPayload = "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";
25
+
26
+ /**
27
+ * The central identity provider's mark, ready for `src=` / CSS `url(…)`.
28
+ *
29
+ * A 64×64 WebP data URI (transparent background) generated from the landing
30
+ * repo's logo — the single home for Celestia artwork — and committed as text
31
+ * so no host has to serve or resolve a separate asset file. Render it at
32
+ * 16×16; the source carries a 2 px margin so it optically matches the
33
+ * surrounding icons.
34
+ */
35
+ export const hkCentralAuthMarkSrc = `data:image/webp;base64,${hkCentralAuthMarkPayload}`;
@@ -0,0 +1,236 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
+ import { tmpdir } from "node:os";
5
+ import { dirname, join, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ import { afterAll, afterEach, describe, expect, it } from "vitest";
9
+
10
+ import { setLocale } from "../i18n/context";
11
+ import {
12
+ HK_CENTRAL_AUTH_NAME_EN,
13
+ HK_CENTRAL_AUTH_NAME_KEY,
14
+ HK_CENTRAL_AUTH_PROVIDER_ID,
15
+ hkCentralAuthMarkSrc,
16
+ hkCentralAuthName,
17
+ hkProviderLabelIsId,
18
+ } from "./loginProviders";
19
+
20
+ const HERE = dirname(fileURLToPath(import.meta.url));
21
+ /** packages/vue */
22
+ const VUE_DIR = resolve(HERE, "../..");
23
+ const REPO_ROOT = resolve(VUE_DIR, "../..");
24
+ const GENERATOR = resolve(VUE_DIR, "scripts/build-central-auth-mark.py");
25
+ const MODULE_PATH = resolve(HERE, "centralAuthMarkData.ts");
26
+ const LOCALES_DIR = resolve(VUE_DIR, "src/i18n/locales");
27
+
28
+ const LOCALES = [
29
+ "ar", "de", "en", "es", "fr", "ja", "ko", "pt", "ru", "zh-Hans", "zh-Hant",
30
+ ] as const;
31
+
32
+ /** Every place the logo's single home (AGENTS.md 徽标唯一家) can be, relative
33
+ * to `packages/vue`: the sibling checkout of the repository itself, then the
34
+ * two shapes a worktree checkout sits at. The landing repo is NOT on the
35
+ * worktree path — `_worktree/<repo>/<slug>` is this repository's own worktree
36
+ * namespace, and `_worktree/celestia-island.github.io/` holds the LANDING
37
+ * repo's worktrees, not its trunk.
38
+ *
39
+ * A missing source skips the determinism cases (and says why); a source that
40
+ * is present but is not the pinned logo (another branch checked out, a
41
+ * repainted mark) FAILS them — the committed bytes would no longer be what
42
+ * the generator produces, which is exactly the drift this suite guards. */
43
+ const SOURCE_LOGO = [
44
+ resolve(REPO_ROOT, "../celestia-island.github.io/res/logos/celestia.webp"),
45
+ resolve(REPO_ROOT, "../../../celestia-island.github.io/res/logos/celestia.webp"),
46
+ resolve(REPO_ROOT, "../../../celestia-island.github.io/feat-logo-guard/res/logos/celestia.webp"),
47
+ ].find((candidate) => existsSync(candidate));
48
+
49
+ /** sha256 of the decoded WebP payload, and the canvas the generator chose.
50
+ * Pinned so a silent regeneration (a new logo, a bumped quality, a
51
+ * different resample) has to be acknowledged here too. */
52
+ const MARK_SHA256 = "71d34aea2c1afc3b056d20e8a373f201a6619339a4853bac825d766e8575d849";
53
+ const MARK_CANVAS = 64;
54
+
55
+ function localeBundle(locale: string): Record<string, unknown> {
56
+ return JSON.parse(
57
+ readFileSync(join(LOCALES_DIR, locale, "components.json"), "utf8"),
58
+ ) as Record<string, unknown>;
59
+ }
60
+
61
+ describe("hikari central identity provider — row defaults", () => {
62
+ it("pins the wire provider id the live services already emit", () => {
63
+ // Not a rename: `erp` is what kirino and every deployed service put in
64
+ // `methods[].provider`. Changing it here would silently stop matching.
65
+ expect(HK_CENTRAL_AUTH_PROVIDER_ID).toBe("erp");
66
+ });
67
+
68
+ it("names the provider in all 11 locales through one key", () => {
69
+ expect(HK_CENTRAL_AUTH_NAME_KEY).toBe("hikari::loginFlow.providerCelestiaAuth");
70
+ for (const locale of LOCALES) {
71
+ const value = localeBundle(locale)[HK_CENTRAL_AUTH_NAME_KEY];
72
+ expect(typeof value, `${locale} must define ${HK_CENTRAL_AUTH_NAME_KEY}`).toBe("string");
73
+ expect((value as string).trim().length, `${locale} must not be empty`).toBeGreaterThan(0);
74
+ }
75
+ // The English bundle IS the canonical literal hosts pass as `t()`'s
76
+ // fallback — a drift between the two renames the row for every locale
77
+ // that has not loaded its bundle yet.
78
+ expect(localeBundle("en")[HK_CENTRAL_AUTH_NAME_KEY]).toBe(HK_CENTRAL_AUTH_NAME_EN);
79
+ });
80
+ });
81
+
82
+ describe("hkProviderLabelIsId", () => {
83
+ it("treats an absent, empty or whitespace label as the id fallback", () => {
84
+ expect(hkProviderLabelIsId("erp", undefined)).toBe(true);
85
+ expect(hkProviderLabelIsId("erp", null)).toBe(true);
86
+ expect(hkProviderLabelIsId("erp", "")).toBe(true);
87
+ expect(hkProviderLabelIsId("erp", " ")).toBe(true);
88
+ expect(hkProviderLabelIsId("erp", "\t\n ")).toBe(true);
89
+ });
90
+
91
+ it("matches the id character for character only", () => {
92
+ expect(hkProviderLabelIsId("erp", "erp")).toBe(true);
93
+ expect(hkProviderLabelIsId("erp", " erp ")).toBe(true);
94
+ // Case is a name the operator typed, not a fallback.
95
+ expect(hkProviderLabelIsId("erp", "ERP")).toBe(false);
96
+ expect(hkProviderLabelIsId("erp", "Erp")).toBe(false);
97
+ });
98
+
99
+ it("leaves a genuinely different name alone", () => {
100
+ expect(hkProviderLabelIsId("erp", "Acme SSO")).toBe(false);
101
+ expect(hkProviderLabelIsId("erp", "erp-europe")).toBe(false);
102
+ // MUT:central-auth-label-prefix (a startsWith/contains test would
103
+ // swallow every alias that merely begins with the id).
104
+ expect(hkProviderLabelIsId("erp", "erpx")).toBe(false);
105
+ });
106
+
107
+ it("never matches an empty provider id", () => {
108
+ expect(hkProviderLabelIsId("", "")).toBe(false);
109
+ expect(hkProviderLabelIsId("", " ")).toBe(false);
110
+ expect(hkProviderLabelIsId("", undefined)).toBe(false);
111
+ expect(hkProviderLabelIsId("", "erp")).toBe(false);
112
+ });
113
+ });
114
+
115
+ describe("hkCentralAuthName", () => {
116
+ // hikari's locale context is a module singleton shared with every other
117
+ // suite in this worker — always hand "en" back.
118
+ afterEach(async () => {
119
+ await setLocale("en");
120
+ });
121
+
122
+ it("reads the name from hikari's own locale context", async () => {
123
+ await setLocale("en");
124
+ expect(hkCentralAuthName()).toBe(HK_CENTRAL_AUTH_NAME_EN);
125
+ await setLocale("zh-Hans");
126
+ // MUT:central-auth-name-vue-i18n (routing this through a host-side
127
+ // `t()` with no hikari keys merged leaves the English fallback here —
128
+ // exactly what 0721 would have shipped).
129
+ expect(hkCentralAuthName()).toBe("Celestia 统一认证平台");
130
+ });
131
+
132
+ it("follows a later setLocale instead of caching the first answer", async () => {
133
+ await setLocale("zh-Hans");
134
+ const first = hkCentralAuthName();
135
+ await setLocale("ja");
136
+ const second = hkCentralAuthName();
137
+ await setLocale("en");
138
+ const third = hkCentralAuthName();
139
+ // A hoisted constant (read once at import) returns `first` forever.
140
+ expect(first).toBe("Celestia 统一认证平台");
141
+ expect(second).toBe("Celestia 統一認証プラットフォーム");
142
+ expect(third).toBe(HK_CENTRAL_AUTH_NAME_EN);
143
+ });
144
+ });
145
+
146
+ describe("hkCentralAuthMarkSrc", () => {
147
+ const prefix = "data:image/webp;base64,";
148
+
149
+ it("is an inline WebP data URI", () => {
150
+ expect(hkCentralAuthMarkSrc.startsWith(prefix)).toBe(true);
151
+ });
152
+
153
+ it("decodes to the pinned WebP bytes", () => {
154
+ const payload = hkCentralAuthMarkSrc.slice(prefix.length);
155
+ const bytes = Buffer.from(payload, "base64");
156
+ expect(createHash("sha256").update(bytes).digest("hex")).toBe(MARK_SHA256);
157
+
158
+ // RIFF container: "RIFF" <size> "WEBP" <chunk>. The extended (VP8X)
159
+ // chunk is what carries the alpha flag and the canvas size in the
160
+ // first three bytes each, minus one, little-endian.
161
+ expect(bytes.subarray(0, 4).toString("latin1")).toBe("RIFF");
162
+ expect(bytes.subarray(8, 12).toString("latin1")).toBe("WEBP");
163
+ expect(bytes.subarray(12, 16).toString("latin1")).toBe("VP8X");
164
+ expect(bytes[20] & 0x10, "the X chunk must announce an alpha channel").toBeTruthy();
165
+ expect(bytes.readUIntLE(24, 3) + 1).toBe(MARK_CANVAS);
166
+ expect(bytes.readUIntLE(27, 3) + 1).toBe(MARK_CANVAS);
167
+ expect(bytes.length).toBeLessThanOrEqual(3 * 1024);
168
+ });
169
+
170
+ it("is exported through the single module (the generated file stays internal)", () => {
171
+ const generated = readFileSync(MODULE_PATH, "utf8");
172
+ expect(generated).toContain("GENERATED — do not edit");
173
+ expect(generated).toContain("export const hkCentralAuthMarkSrc");
174
+ });
175
+ });
176
+
177
+ /** Generators run in a real child process, like the error-landing drift
178
+ * guard: Pillow lives outside vitest's module graph. */
179
+ function pythonAvailable(): { ok: boolean; reason?: string } {
180
+ const probe = spawnSync("python3", ["-c", "from PIL import Image; print('ok')"], {
181
+ encoding: "utf8",
182
+ });
183
+ if (probe.error) return { ok: false, reason: `python3 failed to start: ${probe.error.message}` };
184
+ if (probe.status !== 0) {
185
+ return { ok: false, reason: `Pillow (PIL) is not importable: ${probe.stderr.trim()}` };
186
+ }
187
+ return { ok: true };
188
+ }
189
+
190
+ const scratchDirs: string[] = [];
191
+ afterAll(() => {
192
+ for (const dir of scratchDirs.splice(0)) rmSync(dir, { recursive: true, force: true });
193
+ });
194
+
195
+ describe("build-central-auth-mark.py", () => {
196
+ const python = pythonAvailable();
197
+ const skip = !python.ok
198
+ ? `generator not re-run: ${python.reason}`
199
+ : SOURCE_LOGO === undefined
200
+ ? "generator not re-run: the logo source is absent from every candidate path (the landing repo is a separate checkout)"
201
+ : false;
202
+
203
+ it.skipIf(skip)("regenerates the committed module byte for byte", () => {
204
+ const dir = mkdtempSync(join(tmpdir(), "hk-central-auth-mark-"));
205
+ scratchDirs.push(dir);
206
+ const out = join(dir, "centralAuthMarkData.ts");
207
+ const run = spawnSync("python3", [GENERATOR, SOURCE_LOGO!, "--out", out], {
208
+ encoding: "utf8",
209
+ cwd: VUE_DIR,
210
+ });
211
+ expect(run.status, `generator failed:\n${run.stderr}`).toBe(0);
212
+ // MUT:central-auth-mark-drift (hand-editing the data URI, changing the
213
+ // quality, or rescaling with a different filter goes red here).
214
+ expect(readFileSync(out, "utf8")).toBe(readFileSync(MODULE_PATH, "utf8"));
215
+ });
216
+
217
+ it.skipIf(skip)("refuses a source whose sha256 does not match the pin", () => {
218
+ const dir = mkdtempSync(join(tmpdir(), "hk-central-auth-mark-"));
219
+ scratchDirs.push(dir);
220
+ const impostor = join(dir, "impostor.webp");
221
+ // A REAL image (the logo itself, plus one appended byte): the generator
222
+ // must refuse on the HASH, not because the file happens to be unreadable.
223
+ writeFileSync(impostor, Buffer.concat([readFileSync(SOURCE_LOGO!), Buffer.from([0])]));
224
+ const out = join(dir, "out.ts");
225
+ const run = spawnSync("python3", [GENERATOR, impostor, "--out", out], {
226
+ encoding: "utf8",
227
+ cwd: VUE_DIR,
228
+ });
229
+ // MUT:mark-source-sha-pin — swapping the pinned sha for an impostor
230
+ // (a repainted logo) must be refused, never silently adopted: dropping
231
+ // the pin check reddens THIS test while the generator still runs.
232
+ expect(run.status).not.toBe(0);
233
+ expect(run.stderr).toContain("sha256 mismatch");
234
+ expect(existsSync(out)).toBe(false);
235
+ });
236
+ });
@@ -0,0 +1,132 @@
1
+ // AI-generated: developed with the DeepSeek Harness agent (model
2
+ // DeepSeek-V4.1-Flash) directed and reviewed by the lead agent — SySL-1.0
3
+ // §2.3 disclosure.
4
+
5
+ import { useI18n } from "../i18n/context";
6
+
7
+ /**
8
+ * The built-in presentation of the central identity provider's sign-in row.
9
+ *
10
+ * Celestia's central identity provider has one wire id (`"erp"` — the id every
11
+ * live service already emits, which this module deliberately does NOT rename)
12
+ * and no name or icon of its own. Every host therefore shipped its own answer:
13
+ * a bare id in the row, or a hand-typed "Celestia ID" with no mark. This module
14
+ * is the single home for both, so chest, 0721 and future front ends render the
15
+ * same row.
16
+ *
17
+ * The module is free of Vue dependencies EXCEPT for reading the name out of
18
+ * hikari's own i18n context ({@link hkCentralAuthName}): the predicate and the
19
+ * constants below stay pure, so a non-Vue consumer can still import them.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * import {
24
+ * HK_CENTRAL_AUTH_PROVIDER_ID, hkCentralAuthMarkSrc, hkCentralAuthName,
25
+ * hkProviderLabelIsId,
26
+ * } from "@celestia-island/hikari/vue";
27
+ *
28
+ * const name = hkCentralAuthName();
29
+ * const label =
30
+ * method.provider === HK_CENTRAL_AUTH_PROVIDER_ID && hkProviderLabelIsId(method.provider, method.label)
31
+ * ? name
32
+ * : method.label;
33
+ * const icon =
34
+ * method.provider === HK_CENTRAL_AUTH_PROVIDER_ID && !method.icon
35
+ * ? hkCentralAuthMarkSrc
36
+ * : method.icon;
37
+ * ```
38
+ *
39
+ * The rules a host must honour, in order of precedence:
40
+ *
41
+ * 1. **Nothing an operator configures is overridden.** A provider `label` or
42
+ * `icon` set in the host's own configuration always wins; a deployment that
43
+ * renames the row to its company's portal keeps that name.
44
+ * 2. **The built-in name fills a fallback, not a default.** Serve the translated
45
+ * name only when the label has degenerated to the id — the long-standing
46
+ * server-side convention where an unset label is emitted as the id. Use
47
+ * `hkProviderLabelIsId` for that test; it matches the id exactly, so a
48
+ * deliberately lower-cased alias ("erp-europe") is left alone. Read the name
49
+ * through {@link hkCentralAuthName}.
50
+ * 3. **The built-in mark fills a gap, not a default.** Use
51
+ * {@link hkCentralAuthMarkSrc} only when the server supplied no icon.
52
+ * 4. **A deployment that does not configure this provider sees no change.** The
53
+ * self-hosted default is still local username/password: nothing here is
54
+ * imported unless the login-policy document actually lists the provider.
55
+ * 5. **The icon is a 64×64 inline WebP data URI.** Render it at 16×16 — the
56
+ * same box as the surrounding row glyphs; the source is scaled for exactly
57
+ * that and carries the margin to match their optical weight.
58
+ */
59
+
60
+ /**
61
+ * The central identity provider's wire id: the value every live host already
62
+ * emits in its login-policy document under `methods[].provider`.
63
+ *
64
+ * This is a wire contract with kirino and with each deployed service. It is
65
+ * named here so a host does not have to hard-code the literal, NOT to
66
+ * introduce a new id — the asset in this module (name and mark) is what
67
+ * changed, the id is not.
68
+ */
69
+ export const HK_CENTRAL_AUTH_PROVIDER_ID = "erp";
70
+
71
+ /**
72
+ * The i18n key of the provider's display name, in every shipped locale.
73
+ *
74
+ * `hkCentralAuthName()` reads it; a host whose own catalog merges the
75
+ * `hikari::` keys may also pass it to its `t()` directly, with
76
+ * {@link HK_CENTRAL_AUTH_NAME_EN} as the fallback.
77
+ */
78
+ export const HK_CENTRAL_AUTH_NAME_KEY = "hikari::loginFlow.providerCelestiaAuth";
79
+
80
+ /** The provider's display name in English — the canonical literal and the
81
+ * fallback behind {@link HK_CENTRAL_AUTH_NAME_KEY}. */
82
+ export const HK_CENTRAL_AUTH_NAME_EN = "Celestia Unified Authentication Platform";
83
+
84
+ /**
85
+ * The provider's display name in the language hikari's locale context is
86
+ * currently in — THE entry point hosts should render.
87
+ *
88
+ * Why not `t(HK_CENTRAL_AUTH_NAME_KEY, HK_CENTRAL_AUTH_NAME_EN)` in the host's
89
+ * own translator: that only works for a host whose i18n catalog actually merges
90
+ * hikari's `hikari::` keys. 0721's vue-i18n instance deliberately does not, so
91
+ * the same call would sit on the English fallback in every language. Every host
92
+ * does, however, keep hikari's context in step with the app language when the
93
+ * user switches (`setLocale` / `setHikariLocale` on that switch), which is
94
+ * exactly the state this function reads — so it is the one spelling that works
95
+ * everywhere. A host that DOES merge the keys may keep using `t(...)` with
96
+ * {@link HK_CENTRAL_AUTH_NAME_KEY} and {@link HK_CENTRAL_AUTH_NAME_EN}.
97
+ *
98
+ * Reads hikari's reactive locale state, so calling it inside a render or a
99
+ * `computed` makes the row re-render on a language switch. Call it there — do
100
+ * not hoist the result into a module-level constant, which would freeze
101
+ * whichever language happened to be active at import time. It returns whatever
102
+ * hikari's current language is; a host that never calls `setLocale` sees
103
+ * English.
104
+ */
105
+ export function hkCentralAuthName(): string {
106
+ return useI18n().t(HK_CENTRAL_AUTH_NAME_KEY, HK_CENTRAL_AUTH_NAME_EN);
107
+ }
108
+
109
+ /**
110
+ * Whether a provider's `label` has degenerated to its id — the server-side
111
+ * convention for "the operator did not name this provider", so the host should
112
+ * substitute its built-in name.
113
+ *
114
+ * True when the label is absent, empty, or whitespace only, and when it equals
115
+ * `providerId` character for character. Case differences are NOT a match:
116
+ * `"ERP"` over `"erp"` is a name an operator typed, and a host must not
117
+ * overwrite it. An empty `providerId` is never a match — every empty label
118
+ * would otherwise collapse onto it.
119
+ */
120
+ export function hkProviderLabelIsId(
121
+ providerId: string,
122
+ label: string | null | undefined,
123
+ ): boolean {
124
+ if (!providerId) return false;
125
+ if (label == null) return true;
126
+ const trimmed = label.trim();
127
+ return trimmed.length === 0 || trimmed === providerId;
128
+ }
129
+
130
+ // Single exit point for the generated mark: importers reach it through this
131
+ // module (and the package barrel) rather than the generated artifact.
132
+ export { hkCentralAuthMarkSrc } from "./centralAuthMarkData";
@@ -1,7 +1,7 @@
1
1
  <!doctype html>
2
2
  <html lang="en">
3
3
  <head>
4
- <meta name="hk-error-landing" content="v1 0.55.501 <dev>">
4
+ <meta name="hk-error-landing" content="v1 0.55.502 <dev>">
5
5
  <meta charset="utf-8" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
7
  <meta name="robots" content="noindex" />
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "تسجيل الدخول بالمؤسسة",
405
405
  "hikari::loginFlow.signInTitle": "تسجيل الدخول",
406
406
  "hikari::loginFlow.signInSubtitle": "مرحبًا بعودتك",
407
+ "hikari::loginFlow.providerCelestiaAuth": "منصة المصادقة الموحّدة من Celestia",
407
408
  "hikari::mdEditor.bold": "عريض",
408
409
  "hikari::mdEditor.italic": "مائل",
409
410
  "hikari::mdEditor.strikethrough": "مشطوب",
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "Organisations-Anmeldung",
405
405
  "hikari::loginFlow.signInTitle": "Anmelden",
406
406
  "hikari::loginFlow.signInSubtitle": "Willkommen zurück",
407
+ "hikari::loginFlow.providerCelestiaAuth": "Celestia Plattform für einheitliche Authentifizierung",
407
408
  "hikari::mdEditor.bold": "Fett",
408
409
  "hikari::mdEditor.italic": "Kursiv",
409
410
  "hikari::mdEditor.strikethrough": "Durchgestrichen",
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "Organization login",
405
405
  "hikari::loginFlow.signInTitle": "Sign in",
406
406
  "hikari::loginFlow.signInSubtitle": "Welcome back",
407
+ "hikari::loginFlow.providerCelestiaAuth": "Celestia Unified Authentication Platform",
407
408
  "hikari::mdEditor.bold": "Bold",
408
409
  "hikari::mdEditor.italic": "Italic",
409
410
  "hikari::mdEditor.strikethrough": "Strikethrough",
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "Inicio de sesión de organización",
405
405
  "hikari::loginFlow.signInTitle": "Iniciar sesión",
406
406
  "hikari::loginFlow.signInSubtitle": "Bienvenido de nuevo",
407
+ "hikari::loginFlow.providerCelestiaAuth": "Plataforma de autenticación unificada de Celestia",
407
408
  "hikari::mdEditor.bold": "Negrita",
408
409
  "hikari::mdEditor.italic": "Cursiva",
409
410
  "hikari::mdEditor.strikethrough": "Tachado",
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "Connexion organisation",
405
405
  "hikari::loginFlow.signInTitle": "Se connecter",
406
406
  "hikari::loginFlow.signInSubtitle": "Bon retour",
407
+ "hikari::loginFlow.providerCelestiaAuth": "Plateforme d’authentification unifiée Celestia",
407
408
  "hikari::mdEditor.bold": "Gras",
408
409
  "hikari::mdEditor.italic": "Italique",
409
410
  "hikari::mdEditor.strikethrough": "Barré",
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "組織ログイン",
405
405
  "hikari::loginFlow.signInTitle": "ログイン",
406
406
  "hikari::loginFlow.signInSubtitle": "おかえりなさい",
407
+ "hikari::loginFlow.providerCelestiaAuth": "Celestia 統一認証プラットフォーム",
407
408
  "hikari::mdEditor.bold": "太字",
408
409
  "hikari::mdEditor.italic": "斜体",
409
410
  "hikari::mdEditor.strikethrough": "取り消し線",
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "조직 로그인",
405
405
  "hikari::loginFlow.signInTitle": "로그인",
406
406
  "hikari::loginFlow.signInSubtitle": "다시 오신 것을 환영합니다",
407
+ "hikari::loginFlow.providerCelestiaAuth": "Celestia 통합 인증 플랫폼",
407
408
  "hikari::mdEditor.bold": "굵게",
408
409
  "hikari::mdEditor.italic": "기울임꼴",
409
410
  "hikari::mdEditor.strikethrough": "취소선",
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "Login da organização",
405
405
  "hikari::loginFlow.signInTitle": "Entrar",
406
406
  "hikari::loginFlow.signInSubtitle": "Bem-vindo de volta",
407
+ "hikari::loginFlow.providerCelestiaAuth": "Plataforma de autenticação unificada da Celestia",
407
408
  "hikari::mdEditor.bold": "Negrito",
408
409
  "hikari::mdEditor.italic": "Itálico",
409
410
  "hikari::mdEditor.strikethrough": "Tachado",
@@ -404,6 +404,7 @@
404
404
  "hikari::loginFlow.channelOrg": "Вход через организацию",
405
405
  "hikari::loginFlow.signInTitle": "Войти",
406
406
  "hikari::loginFlow.signInSubtitle": "С возвращением",
407
+ "hikari::loginFlow.providerCelestiaAuth": "Единая платформа аутентификации Celestia",
407
408
  "hikari::mdEditor.bold": "Полужирный",
408
409
  "hikari::mdEditor.italic": "Курсив",
409
410
  "hikari::mdEditor.strikethrough": "Зачёркнутый",
@@ -408,6 +408,7 @@
408
408
  "hikari::loginFlow.channelOrg": "组织登录",
409
409
  "hikari::loginFlow.signInTitle": "登录",
410
410
  "hikari::loginFlow.signInSubtitle": "欢迎回来",
411
+ "hikari::loginFlow.providerCelestiaAuth": "Celestia 统一认证平台",
411
412
  "hikari::mdEditor.bold": "粗体",
412
413
  "hikari::mdEditor.italic": "斜体",
413
414
  "hikari::mdEditor.strikethrough": "删除线",
@@ -408,6 +408,7 @@
408
408
  "hikari::loginFlow.channelOrg": "組織登入",
409
409
  "hikari::loginFlow.signInTitle": "登入",
410
410
  "hikari::loginFlow.signInSubtitle": "歡迎回來",
411
+ "hikari::loginFlow.providerCelestiaAuth": "Celestia 統一認證平台",
411
412
  "hikari::mdEditor.bold": "粗體",
412
413
  "hikari::mdEditor.italic": "斜體",
413
414
  "hikari::mdEditor.strikethrough": "刪除線",
package/src/index.ts CHANGED
@@ -1166,6 +1166,19 @@ export {
1166
1166
  type HkLoginPlan as HkLoginPlan,
1167
1167
  type HkLoginPlanCopy as HkLoginPlanCopy,
1168
1168
  } from "./components/loginDiscovery";
1169
+ // The central identity provider's built-in row (name + mark): one name and
1170
+ // one 16×16 icon for chest, 0721 and every later front end, applied only when
1171
+ // the operator left the provider unnamed/uniconed. `hkCentralAuthName()` reads
1172
+ // hikari's own locale context — the spelling that works for hosts whose i18n
1173
+ // catalog does not merge the `hikari::` keys.
1174
+ export {
1175
+ HK_CENTRAL_AUTH_NAME_EN as HK_CENTRAL_AUTH_NAME_EN,
1176
+ HK_CENTRAL_AUTH_NAME_KEY as HK_CENTRAL_AUTH_NAME_KEY,
1177
+ HK_CENTRAL_AUTH_PROVIDER_ID as HK_CENTRAL_AUTH_PROVIDER_ID,
1178
+ hkCentralAuthMarkSrc as hkCentralAuthMarkSrc,
1179
+ hkCentralAuthName as hkCentralAuthName,
1180
+ hkProviderLabelIsId as hkProviderLabelIsId,
1181
+ } from "./components/loginProviders";
1169
1182
  export { HkLocalePicker as HkLocalePicker } from "./components/HkLocalePicker";
1170
1183
  export { HkAdminTablePage as HkAdminTablePage } from "./components/HkAdminTablePage";
1171
1184
  // The roster+detail twin of the table page (2026-11-23): one standard