@arcblock/did-connect-service 4.1.40 → 4.1.42
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/_generated/asset-bytes.js +1 -1
- package/dist/_generated/asset-manifest.js +2 -2
- package/dist/app-identity.d.ts +283 -0
- package/dist/app-identity.d.ts.map +1 -0
- package/dist/app-identity.js +431 -0
- package/dist/app-identity.js.map +1 -0
- package/dist/assets/{admin-extra.c7a0720f.js → admin-extra.da2c9785.js} +164 -10
- package/dist/assets/{admin.ab0009f2.css → admin.d99b416e.css} +23 -0
- package/dist/blocklet-service-rpc-types.d.ts +12 -0
- package/dist/blocklet-service-rpc-types.d.ts.map +1 -1
- package/dist/blocklet-service-rpc.d.ts +10 -1
- package/dist/blocklet-service-rpc.d.ts.map +1 -1
- package/dist/blocklet-service-rpc.js +32 -3
- package/dist/blocklet-service-rpc.js.map +1 -1
- package/dist/blocklet-service.d.ts +7 -0
- package/dist/blocklet-service.d.ts.map +1 -1
- package/dist/blocklet-service.js +30 -23
- package/dist/blocklet-service.js.map +1 -1
- package/dist/branding-sources.d.ts +60 -0
- package/dist/branding-sources.d.ts.map +1 -0
- package/dist/branding-sources.js +55 -0
- package/dist/branding-sources.js.map +1 -0
- package/dist/embedded.d.ts +20 -0
- package/dist/embedded.d.ts.map +1 -1
- package/dist/embedded.js +45 -27
- package/dist/embedded.js.map +1 -1
- package/dist/handlers/access-key-connect-handler.d.ts.map +1 -1
- package/dist/handlers/access-key-connect-handler.js +3 -1
- package/dist/handlers/access-key-connect-handler.js.map +1 -1
- package/dist/handlers/admin-instance-handler.d.ts.map +1 -1
- package/dist/handlers/admin-instance-handler.js +4 -1
- package/dist/handlers/admin-instance-handler.js.map +1 -1
- package/dist/handlers/auth-handler.d.ts +36 -1
- package/dist/handlers/auth-handler.d.ts.map +1 -1
- package/dist/handlers/auth-handler.js +58 -38
- package/dist/handlers/auth-handler.js.map +1 -1
- package/dist/handlers/blocklet-js-handler.d.ts +10 -2
- package/dist/handlers/blocklet-js-handler.d.ts.map +1 -1
- package/dist/handlers/blocklet-js-handler.js +55 -25
- package/dist/handlers/blocklet-js-handler.js.map +1 -1
- package/dist/handlers/branding-handler.d.ts +97 -11
- package/dist/handlers/branding-handler.d.ts.map +1 -1
- package/dist/handlers/branding-handler.js +212 -113
- package/dist/handlers/branding-handler.js.map +1 -1
- package/dist/handlers/passkey-handler.d.ts +6 -1
- package/dist/handlers/passkey-handler.d.ts.map +1 -1
- package/dist/handlers/passkey-handler.js +38 -26
- package/dist/handlers/passkey-handler.js.map +1 -1
- package/dist/handlers/team-handler.d.ts +4 -0
- package/dist/handlers/team-handler.d.ts.map +1 -1
- package/dist/handlers/team-handler.js +24 -5
- package/dist/handlers/team-handler.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/logo-paths.d.ts +23 -0
- package/dist/logo-paths.d.ts.map +1 -1
- package/dist/logo-paths.js +57 -2
- package/dist/logo-paths.js.map +1 -1
- package/dist/package-branding.d.ts +95 -6
- package/dist/package-branding.d.ts.map +1 -1
- package/dist/package-branding.js +87 -36
- package/dist/package-branding.js.map +1 -1
- package/dist/pages/admin/i18n.d.ts.map +1 -1
- package/dist/pages/admin/i18n.js +32 -0
- package/dist/pages/admin/i18n.js.map +1 -1
- package/dist/pages/admin/styles.d.ts +1 -1
- package/dist/pages/admin/styles.d.ts.map +1 -1
- package/dist/pages/admin/styles.js +23 -0
- package/dist/pages/admin/styles.js.map +1 -1
- package/dist/pages/admin/tab-branding.d.ts.map +1 -1
- package/dist/pages/admin/tab-branding.js +180 -15
- package/dist/pages/admin/tab-branding.js.map +1 -1
- package/dist/store/d1-store.d.ts +9 -1
- package/dist/store/d1-store.d.ts.map +1 -1
- package/dist/store/d1-store.js +30 -0
- package/dist/store/d1-store.js.map +1 -1
- package/dist/theme-utils.d.ts +21 -0
- package/dist/theme-utils.d.ts.map +1 -1
- package/dist/theme-utils.js +63 -1
- package/dist/theme-utils.js.map +1 -1
- package/dist/types.d.ts +5 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/http/security-headers.d.ts +0 -38
- package/dist/http/security-headers.d.ts.map +0 -1
- package/dist/http/security-headers.js +0 -67
- package/dist/http/security-headers.js.map +0 -1
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App identity — the single resolver for "what is this app called and what does it
|
|
3
|
+
* look like" (did#247, S4 of ArcBlock/arc#7073).
|
|
4
|
+
*
|
|
5
|
+
* Every surface that shows the app's identity (name / description / icon / logos /
|
|
6
|
+
* theme) resolves it here instead of reading D1 and layering fallbacks on its own:
|
|
7
|
+
* `resolveAppInfo`, `BrandingHandler` (logo serving, letter-mark fallback, theme CSS,
|
|
8
|
+
* OG text), `BlockletJsHandler` (`__blocklet__.js`), the login page, the homepage and
|
|
9
|
+
* the access-key page name.
|
|
10
|
+
*
|
|
11
|
+
* Layers, highest first:
|
|
12
|
+
*
|
|
13
|
+
* name instance app:branding.name → instance legacy app:name → package name
|
|
14
|
+
* → deployment name → built-in default
|
|
15
|
+
* description instance app:branding.description (any string, "" included)
|
|
16
|
+
* → package description → absent
|
|
17
|
+
* icon instance app:branding.icon
|
|
18
|
+
* logos instance app:logos.<slot> (R2 key) → package logo (square slot, `v` only;
|
|
19
|
+
* every type whose fallback chain reaches `square` follows it)
|
|
20
|
+
* → fallback-scope app:logos.<slot>
|
|
21
|
+
* theme instance app:theme → package palette → fallback-scope app:theme → default;
|
|
22
|
+
* each deep-merged over the built-in palettes by formatThemeForOutput
|
|
23
|
+
* passportColor instance app:branding.passportColor → package passportColor
|
|
24
|
+
* → fallback-scope app:branding.passportColor → absent
|
|
25
|
+
*
|
|
26
|
+
* connect-service never reads the app package itself (arc#7073 red line 1): the
|
|
27
|
+
* package layer only ever arrives as host-supplied {@link PackageBranding}, and it is
|
|
28
|
+
* never written back into D1 (red line 2).
|
|
29
|
+
*
|
|
30
|
+
* ## Per-field origin
|
|
31
|
+
*
|
|
32
|
+
* Every field carries `from`. `"instance"` means the value is configured on the
|
|
33
|
+
* instance whose identity is being resolved — nothing else. When the host asserted a
|
|
34
|
+
* request's instance X (route-context `instanceDid`, or an opted-in `X-Instance-Did`)
|
|
35
|
+
* but a surface read another scope's rows (e.g. `__blocklet__.js` reading the
|
|
36
|
+
* handler's construction instance), those rows are passed with `scope: "fallback"`
|
|
37
|
+
* and labelled `"deployment"` — see {@link identityScopeFor}. The arc-side lesson
|
|
38
|
+
* recorded on `resolveRawInstanceBranding` (services/shared/src/identity.ts) is that a
|
|
39
|
+
* ROOT fallback masquerading as instance-configured branding permanently outranks the
|
|
40
|
+
* package layer. With no asserted instance (a root / control-plane request), the
|
|
41
|
+
* construction rows ARE the instance's own and are labelled `"instance"`.
|
|
42
|
+
*
|
|
43
|
+
* ## Precedence decision (S5): own instance > package > fallback > default
|
|
44
|
+
*
|
|
45
|
+
* For the layers S5/S8 add — logos, theme, passportColor — a fallback-scope row (the
|
|
46
|
+
* deployment's root instance standing in for an app that has no row of its own) ranks
|
|
47
|
+
* BELOW the package layer. A stand-in row describes a different app; the package is the
|
|
48
|
+
* app's own declaration, so it must win (this is the arc-side lesson above). Only the
|
|
49
|
+
* app's OWN instance rows outrank the package (R3: the operator's override wins, and
|
|
50
|
+
* clearing it falls back to the package).
|
|
51
|
+
*
|
|
52
|
+
* - Logos are resolved per slot: own slot > package slot > fallback slot. The package
|
|
53
|
+
* fills only `square`, so a fallback `rect` / `favicon` / splash row is still used
|
|
54
|
+
* for its own slot; variant/chain semantics on derived surfaces belong to S7.
|
|
55
|
+
* - Theme is one unit: an own configured theme replaces the package palette entirely
|
|
56
|
+
* (no merging of the two); a fallback theme is used only when the package has none.
|
|
57
|
+
* - The package layer never changes output where it is absent: without a package
|
|
58
|
+
* logo/theme/passportColor every surface is byte-identical to S4 (baseline).
|
|
59
|
+
*
|
|
60
|
+
* name / description KEEP S4's order (fallback rows > package): changing it would change
|
|
61
|
+
* existing output on configured deployments, which S5 does not do. Aligning them is a
|
|
62
|
+
* separate, explicit decision.
|
|
63
|
+
*
|
|
64
|
+
* ## Which layers a surface honors is the caller's input, not a flag
|
|
65
|
+
*
|
|
66
|
+
* The surfaces do not all honor the same layers today, and S4 preserves that byte for
|
|
67
|
+
* byte (locked by test/app-identity-baseline.test.ts). The resolver is pure and takes
|
|
68
|
+
* only the layers it is given, so each divergence is expressed by what the caller
|
|
69
|
+
* passes:
|
|
70
|
+
*
|
|
71
|
+
* - Letter-mark logo fallback: passes only the instance `branding` row and the
|
|
72
|
+
* deployment name — legacy app:name and package branding never reach the initial.
|
|
73
|
+
* - Embedded (Node) host: builds its handler identity with no instance rows at all,
|
|
74
|
+
* so legacy app:name is never honored there (per-request surfaces still overlay
|
|
75
|
+
* the request-scope app:branding).
|
|
76
|
+
* - Per-request surfaces pass the handler's build-time identity as `inherited`: the
|
|
77
|
+
* request-scope instance rows sit on top of it, and it replaces the
|
|
78
|
+
* package / deployment / default layers for name and description.
|
|
79
|
+
* - The scope (which instance's rows are read) stays where it is today at each call
|
|
80
|
+
* site; see `readInstanceIdentityRows`.
|
|
81
|
+
* - The package logo / palette / passportColor (S5, S8) enter once, in the build-time
|
|
82
|
+
* identity, and reach per-request surfaces through `inherited`, ranked as described
|
|
83
|
+
* under "Precedence decision" below.
|
|
84
|
+
*/
|
|
85
|
+
import { packageBrandingCacheToken, sanitizePackageBranding, } from "./package-branding.js";
|
|
86
|
+
import { formatPackageThemeForOutput, formatThemeForOutput } from "./theme-utils.js";
|
|
87
|
+
/** Logo slots (`app:logos.<type>` = R2 key on the instance layer). */
|
|
88
|
+
export const LOGO_TYPES = [
|
|
89
|
+
"square",
|
|
90
|
+
"squareDark",
|
|
91
|
+
"rect",
|
|
92
|
+
"rectDark",
|
|
93
|
+
"favicon",
|
|
94
|
+
"splashPortrait",
|
|
95
|
+
"splashLandscape",
|
|
96
|
+
"ogImage",
|
|
97
|
+
];
|
|
98
|
+
/**
|
|
99
|
+
* The D1 settings keys that carry app identity. Every identity SURFACE reads them through
|
|
100
|
+
* `readInstanceIdentityRows` / `instanceIdentityRowsFromSettings`. Raw reads remain in the
|
|
101
|
+
* admin CRUD endpoints, instance listings and federation/invite paths (see the did#253
|
|
102
|
+
* PR's unconverged-readers table).
|
|
103
|
+
*/
|
|
104
|
+
export const IDENTITY_SETTING_KEYS = {
|
|
105
|
+
branding: "app:branding",
|
|
106
|
+
legacyName: "app:name",
|
|
107
|
+
logos: "app:logos",
|
|
108
|
+
theme: "app:theme",
|
|
109
|
+
};
|
|
110
|
+
function packageLayerOf(branding) {
|
|
111
|
+
if (!branding)
|
|
112
|
+
return undefined;
|
|
113
|
+
const layer = {
|
|
114
|
+
...(branding.logo ? { logo: { v: branding.logo.v } } : {}),
|
|
115
|
+
...(branding.theme ? { theme: formatPackageThemeForOutput(branding.theme) } : {}),
|
|
116
|
+
...(branding.passportColor ? { passportColor: branding.passportColor } : {}),
|
|
117
|
+
};
|
|
118
|
+
return Object.keys(layer).length > 0 ? layer : undefined;
|
|
119
|
+
}
|
|
120
|
+
// ─── Parsing ──────────────────────────────────────────────────────────────
|
|
121
|
+
function parseJson(raw) {
|
|
122
|
+
if (!raw)
|
|
123
|
+
return undefined;
|
|
124
|
+
try {
|
|
125
|
+
return JSON.parse(raw);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/** A stored JSON object row, or `{}` for absent / malformed / non-object rows. */
|
|
132
|
+
export function parseSettingObject(raw) {
|
|
133
|
+
const parsed = parseJson(raw);
|
|
134
|
+
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)
|
|
135
|
+
? parsed
|
|
136
|
+
: {};
|
|
137
|
+
}
|
|
138
|
+
function nonEmptyString(value) {
|
|
139
|
+
return typeof value === "string" && value ? value : undefined;
|
|
140
|
+
}
|
|
141
|
+
/** Mirrors formatThemeForOutput's own branching: does the stored theme configure anything? */
|
|
142
|
+
function themeIsConfigured(theme) {
|
|
143
|
+
if (Array.isArray(theme.concepts) && theme.currentConceptId) {
|
|
144
|
+
return theme.concepts.some((c) => c?.id === theme.currentConceptId);
|
|
145
|
+
}
|
|
146
|
+
return Boolean(theme.light || theme.dark || theme.common || theme.prefer || theme.name);
|
|
147
|
+
}
|
|
148
|
+
function declaredPrefer(theme) {
|
|
149
|
+
const concept = Array.isArray(theme.concepts)
|
|
150
|
+
? theme.concepts.find((c) => c?.id === theme.currentConceptId)
|
|
151
|
+
: undefined;
|
|
152
|
+
return concept?.prefer || theme.prefer;
|
|
153
|
+
}
|
|
154
|
+
// ─── Fingerprint ──────────────────────────────────────────────────────────
|
|
155
|
+
/** FNV-1a 32-bit, seeded — two seeds give a 64-bit (16 hex) fingerprint. Not a MAC. */
|
|
156
|
+
function fnv1a(input, seed) {
|
|
157
|
+
let hash = seed >>> 0;
|
|
158
|
+
for (let i = 0; i < input.length; i++) {
|
|
159
|
+
hash ^= input.charCodeAt(i);
|
|
160
|
+
hash = Math.imul(hash, 0x01000193) >>> 0;
|
|
161
|
+
}
|
|
162
|
+
return hash.toString(16).padStart(8, "0");
|
|
163
|
+
}
|
|
164
|
+
function fingerprint(parts) {
|
|
165
|
+
const canonical = JSON.stringify(parts);
|
|
166
|
+
return `v1-${fnv1a(canonical, 0x811c9dc5)}${fnv1a(canonical, 0x9747b28c)}`;
|
|
167
|
+
}
|
|
168
|
+
// ─── Resolver ─────────────────────────────────────────────────────────────
|
|
169
|
+
export function resolveAppIdentity(input) {
|
|
170
|
+
const rows = input.instance ?? {};
|
|
171
|
+
const instanceFrom = rows.scope === "fallback" ? "deployment" : "instance";
|
|
172
|
+
const inherited = input.inherited;
|
|
173
|
+
const packageBranding = inherited ? undefined : sanitizePackageBranding(input.packageBranding);
|
|
174
|
+
const isFallback = rows.scope === "fallback";
|
|
175
|
+
// The package layer: from the host's branding, or carried by the inherited identity.
|
|
176
|
+
const pkg = inherited ? inherited.packageLayer : packageLayerOf(packageBranding);
|
|
177
|
+
const branding = parseSettingObject(rows.branding);
|
|
178
|
+
const logosRow = parseSettingObject(rows.logos);
|
|
179
|
+
// name
|
|
180
|
+
let name;
|
|
181
|
+
const brandingName = nonEmptyString(branding.name);
|
|
182
|
+
const legacyName = nonEmptyString(rows.legacyName);
|
|
183
|
+
const packageName = packageBranding?.name || undefined;
|
|
184
|
+
if (brandingName !== undefined)
|
|
185
|
+
name = { value: brandingName, from: instanceFrom };
|
|
186
|
+
else if (legacyName !== undefined)
|
|
187
|
+
name = { value: legacyName, from: instanceFrom };
|
|
188
|
+
else if (inherited)
|
|
189
|
+
name = { ...inherited.name };
|
|
190
|
+
else if (packageName !== undefined)
|
|
191
|
+
name = { value: packageName, from: "package" };
|
|
192
|
+
else if (input.deploymentName !== undefined)
|
|
193
|
+
name = { value: input.deploymentName, from: "deployment" };
|
|
194
|
+
else
|
|
195
|
+
name = { value: input.defaultName ?? "DID Connect", from: "default" };
|
|
196
|
+
// description
|
|
197
|
+
let description;
|
|
198
|
+
if (typeof branding.description === "string")
|
|
199
|
+
description = { value: branding.description, from: instanceFrom };
|
|
200
|
+
else if (inherited)
|
|
201
|
+
description = { ...inherited.description };
|
|
202
|
+
else if (packageBranding !== undefined && Object.hasOwn(packageBranding, "description")) {
|
|
203
|
+
description = { value: packageBranding.description, from: "package" };
|
|
204
|
+
}
|
|
205
|
+
else
|
|
206
|
+
description = { from: "default" };
|
|
207
|
+
// icon (instance only; inherited keeps its own)
|
|
208
|
+
const brandingIcon = nonEmptyString(branding.icon);
|
|
209
|
+
const icon = brandingIcon !== undefined
|
|
210
|
+
? { value: brandingIcon, from: instanceFrom }
|
|
211
|
+
: inherited
|
|
212
|
+
? { ...inherited.icon }
|
|
213
|
+
: { from: "default" };
|
|
214
|
+
// logos — per slot: own instance > package > fallback row > inherited
|
|
215
|
+
const packageSlot = (type) => type === "square" && pkg?.logo ? { from: "package", v: pkg.logo.v } : undefined;
|
|
216
|
+
const logos = {};
|
|
217
|
+
for (const type of LOGO_TYPES) {
|
|
218
|
+
const key = nonEmptyString(logosRow[type]);
|
|
219
|
+
const fromPackage = packageSlot(type);
|
|
220
|
+
if (key !== undefined && !isFallback)
|
|
221
|
+
logos[type] = { from: "instance", key };
|
|
222
|
+
else if (fromPackage)
|
|
223
|
+
logos[type] = fromPackage;
|
|
224
|
+
else if (key !== undefined)
|
|
225
|
+
logos[type] = { from: "deployment", key };
|
|
226
|
+
else if (inherited?.logos[type])
|
|
227
|
+
logos[type] = { ...inherited.logos[type] };
|
|
228
|
+
}
|
|
229
|
+
const blurhash = logosRow.blurhash
|
|
230
|
+
? { value: logosRow.blurhash, from: instanceFrom }
|
|
231
|
+
: inherited?.blurhash
|
|
232
|
+
? { ...inherited.blurhash }
|
|
233
|
+
: undefined;
|
|
234
|
+
// theme
|
|
235
|
+
const storedTheme = parseJson(rows.theme);
|
|
236
|
+
const themeObject = typeof storedTheme === "object" && storedTheme !== null
|
|
237
|
+
? storedTheme
|
|
238
|
+
: undefined;
|
|
239
|
+
// Non-object JSON values (a bare string/number) reach formatThemeForOutput as-is —
|
|
240
|
+
// exactly what __blocklet__.js did — and resolve to the default palette.
|
|
241
|
+
const themeInput = storedTheme === undefined || storedTheme === null ? {} : storedTheme;
|
|
242
|
+
const ownTheme = {
|
|
243
|
+
value: formatThemeForOutput(themeInput),
|
|
244
|
+
...(themeObject && declaredPrefer(themeObject) !== undefined ? { prefer: declaredPrefer(themeObject) } : {}),
|
|
245
|
+
from: themeObject && themeIsConfigured(themeObject) ? instanceFrom : "default",
|
|
246
|
+
};
|
|
247
|
+
// Package palette (formatPackageThemeForOutput: completed from the defaults, with the
|
|
248
|
+
// derived shades of overridden groups left for MUI to compute).
|
|
249
|
+
const packageTheme = pkg?.theme ? { value: pkg.theme, from: "package" } : undefined;
|
|
250
|
+
// own instance > package > fallback row > inherited non-default > default. A default
|
|
251
|
+
// inherited theme never replaces the computed one, so without a package layer the
|
|
252
|
+
// bytes stay exactly what the row alone produces (S4).
|
|
253
|
+
let theme;
|
|
254
|
+
if (ownTheme.from === "instance")
|
|
255
|
+
theme = ownTheme;
|
|
256
|
+
else if (packageTheme)
|
|
257
|
+
theme = packageTheme;
|
|
258
|
+
else if (ownTheme.from === "deployment")
|
|
259
|
+
theme = ownTheme;
|
|
260
|
+
else if (inherited && inherited.theme.from !== "default")
|
|
261
|
+
theme = { ...inherited.theme };
|
|
262
|
+
else
|
|
263
|
+
theme = ownTheme;
|
|
264
|
+
// passportColor — own instance > package > fallback row. Nothing but the package
|
|
265
|
+
// layer is taken from `inherited`: a build-time instance value would be a stale copy
|
|
266
|
+
// of the row this request re-reads.
|
|
267
|
+
const rowPassportColor = branding.passportColor || undefined;
|
|
268
|
+
const packagePassportColor = pkg?.passportColor
|
|
269
|
+
? { value: pkg.passportColor, from: "package" }
|
|
270
|
+
: undefined;
|
|
271
|
+
const passportColor = rowPassportColor !== undefined && !isFallback
|
|
272
|
+
? { value: rowPassportColor, from: "instance" }
|
|
273
|
+
: packagePassportColor ?? (rowPassportColor !== undefined ? { value: rowPassportColor, from: "deployment" } : undefined);
|
|
274
|
+
const etag = fingerprint([
|
|
275
|
+
rows.branding ?? null,
|
|
276
|
+
rows.legacyName ?? null,
|
|
277
|
+
rows.logos ?? null,
|
|
278
|
+
rows.theme ?? null,
|
|
279
|
+
rows.scope ?? "own",
|
|
280
|
+
inherited ? inherited.etag : packageBrandingCacheToken(packageBranding),
|
|
281
|
+
inherited ? null : (input.deploymentName ?? null),
|
|
282
|
+
inherited ? null : (input.defaultName ?? null),
|
|
283
|
+
]);
|
|
284
|
+
return {
|
|
285
|
+
v: 1,
|
|
286
|
+
etag,
|
|
287
|
+
name,
|
|
288
|
+
description,
|
|
289
|
+
icon,
|
|
290
|
+
logos,
|
|
291
|
+
...(blurhash ? { blurhash } : {}),
|
|
292
|
+
...(passportColor ? { passportColor } : {}),
|
|
293
|
+
...(pkg ? { packageLayer: pkg } : {}),
|
|
294
|
+
theme,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
// ─── AppInfo bridge ───────────────────────────────────────────────────────
|
|
298
|
+
/** The legacy `AppInfo` shape (`resolveAppInfo`'s output) of an identity. */
|
|
299
|
+
export function toAppInfo(identity) {
|
|
300
|
+
return {
|
|
301
|
+
name: identity.name.value,
|
|
302
|
+
...(identity.description.value !== undefined ? { description: identity.description.value } : {}),
|
|
303
|
+
...(identity.icon.value ? { icon: identity.icon.value } : {}),
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Wrap an `AppInfo` a host resolved on its own (no per-field origins available) as an
|
|
308
|
+
* identity. Labelled `"deployment"`: it is host/deployment-supplied, and must never
|
|
309
|
+
* read as instance-configured.
|
|
310
|
+
*/
|
|
311
|
+
export function identityFromAppInfo(appInfo) {
|
|
312
|
+
return {
|
|
313
|
+
v: 1,
|
|
314
|
+
etag: fingerprint(["appInfo", appInfo.name, appInfo.description ?? null, appInfo.icon ?? null]),
|
|
315
|
+
name: { value: appInfo.name, from: "deployment" },
|
|
316
|
+
description: appInfo.description !== undefined
|
|
317
|
+
? { value: appInfo.description, from: "deployment" }
|
|
318
|
+
: { from: "default" },
|
|
319
|
+
icon: appInfo.icon !== undefined ? { value: appInfo.icon, from: "deployment" } : { from: "default" },
|
|
320
|
+
logos: {},
|
|
321
|
+
theme: { value: formatThemeForOutput({}), from: "default" },
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Read the requested identity rows of `instanceDid` (one `getSetting` per field, in
|
|
326
|
+
* parallel). The caller owns the scope decision — which instance's rows answer this
|
|
327
|
+
* request — and says so via `scope`.
|
|
328
|
+
*/
|
|
329
|
+
export async function readInstanceIdentityRows(store, instanceDid, fields, scope = "own") {
|
|
330
|
+
const values = await Promise.all(fields.map((f) => store.getSetting(instanceDid, IDENTITY_SETTING_KEYS[f])));
|
|
331
|
+
const rows = {};
|
|
332
|
+
fields.forEach((f, i) => {
|
|
333
|
+
rows[f] = values[i] ?? null;
|
|
334
|
+
});
|
|
335
|
+
rows.scope = scope;
|
|
336
|
+
return rows;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* The requested identity rows out of an already-loaded settings map (e.g. from
|
|
340
|
+
* `listSettings`). Pass `fields` explicitly: a surface that does not honor a layer
|
|
341
|
+
* (e.g. legacy `app:name`) must not receive it just because the map happens to hold it.
|
|
342
|
+
*/
|
|
343
|
+
export function instanceIdentityRowsFromSettings(settings, fields = ["branding", "legacyName", "logos", "theme"], scope = "own") {
|
|
344
|
+
const rows = {};
|
|
345
|
+
for (const f of fields)
|
|
346
|
+
rows[f] = settings?.get(IDENTITY_SETTING_KEYS[f]) ?? null;
|
|
347
|
+
rows.scope = scope;
|
|
348
|
+
return rows;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* The `scope` of rows read from `readInstanceDid`, given the instance the HOST asserted
|
|
352
|
+
* for this request — the route-context `instanceDid`, or `X-Instance-Did` only on an
|
|
353
|
+
* embedded host that opted in with `trustInstanceHeader` (the same signal that decides
|
|
354
|
+
* branding scope; never a raw client header).
|
|
355
|
+
*
|
|
356
|
+
* - nothing asserted (root / control-plane request, single-tenant) → `"own"`
|
|
357
|
+
* - asserted X and the rows are X's → `"own"`
|
|
358
|
+
* - asserted X but the rows are another scope's (or no scope) → `"fallback"`
|
|
359
|
+
*/
|
|
360
|
+
export function identityScopeFor(readInstanceDid, assertedInstanceDid) {
|
|
361
|
+
if (!assertedInstanceDid)
|
|
362
|
+
return "own";
|
|
363
|
+
return readInstanceDid && sameInstance(readInstanceDid, assertedInstanceDid) ? "own" : "fallback";
|
|
364
|
+
}
|
|
365
|
+
/** did:abt: prefix and bare address name the same instance; opaque keys compare exactly. */
|
|
366
|
+
function sameInstance(a, b) {
|
|
367
|
+
const bare = (v) => (v.startsWith("did:abt:") ? v.slice("did:abt:".length) : v);
|
|
368
|
+
return bare(a) === bare(b);
|
|
369
|
+
}
|
|
370
|
+
// ─── Logo slot resolution ─────────────────────────────────────────────────
|
|
371
|
+
const LOGO_FALLBACK_CHAINS = {
|
|
372
|
+
square: ["square"],
|
|
373
|
+
squareDark: ["squareDark", "square"],
|
|
374
|
+
rect: ["rect", "square"],
|
|
375
|
+
rectDark: ["rectDark", "squareDark", "rect", "square"],
|
|
376
|
+
favicon: ["favicon", "square"],
|
|
377
|
+
splashPortrait: ["splashPortrait"],
|
|
378
|
+
splashLandscape: ["splashLandscape"],
|
|
379
|
+
ogImage: ["ogImage"],
|
|
380
|
+
};
|
|
381
|
+
/** The slots a logo type falls back through, most specific first. */
|
|
382
|
+
export function logoFallbackChain(type) {
|
|
383
|
+
return LOGO_FALLBACK_CHAINS[type] ?? [type];
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* The slot that answers `type`: the FIRST configured slot along its fallback chain.
|
|
387
|
+
* That slot decides — a miss on its bytes serves the generated fallback, it does not
|
|
388
|
+
* continue down the chain.
|
|
389
|
+
*/
|
|
390
|
+
export function resolveLogoSlot(identity, type) {
|
|
391
|
+
for (const slot of logoFallbackChain(type)) {
|
|
392
|
+
const hit = identity.logos[slot];
|
|
393
|
+
if (hit)
|
|
394
|
+
return { slot: slot, ...hit };
|
|
395
|
+
}
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Whether a derived surface (`__blocklet__.js`) advertises `type`'s own URL (did#248).
|
|
400
|
+
*
|
|
401
|
+
* On when `type`'s fallback chain resolves to a slot that is either `type` itself
|
|
402
|
+
* (configured on the instance / fallback scope, or the package's `square`), or the
|
|
403
|
+
* package logo reached through the chain — arc serves the package bytes on every path
|
|
404
|
+
* whose chain reaches it (arc#7077). A D1 slot reached only THROUGH the chain does not
|
|
405
|
+
* turn a variant on: that is today's output for D1-configured apps, locked by the S1
|
|
406
|
+
* baseline (`logoSquare` combo), and this rule leaves it unchanged. Splash / og-image
|
|
407
|
+
* chains never reach `square`, so a package-only app leaves them off.
|
|
408
|
+
*/
|
|
409
|
+
export function advertisesLogoSlot(identity, type) {
|
|
410
|
+
const hit = resolveLogoSlot(identity, type);
|
|
411
|
+
return hit !== null && (hit.slot === type || hit.from === "package");
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* The 16-char content fingerprint of a resolved logo slot: the R2 key's last segment
|
|
415
|
+
* truncated to 16 (an instance / fallback upload), else the package logo's `v` (already
|
|
416
|
+
* 16 chars, arc#7073 red line 4). One length, one lineage — OG cache keys use it.
|
|
417
|
+
*/
|
|
418
|
+
export function logoFingerprint(entry) {
|
|
419
|
+
if (entry?.key)
|
|
420
|
+
return entry.key.split("/").pop()?.slice(0, 16);
|
|
421
|
+
return entry?.v;
|
|
422
|
+
}
|
|
423
|
+
/** `resolveAppInfo`'s historical signature, now a view over {@link resolveAppIdentity}. */
|
|
424
|
+
export function resolveAppInfo(params) {
|
|
425
|
+
return toAppInfo(resolveAppIdentity({
|
|
426
|
+
instance: { branding: params.brandingRaw, legacyName: params.legacyAppName },
|
|
427
|
+
packageBranding: params.packageBranding,
|
|
428
|
+
deploymentName: params.deploymentName,
|
|
429
|
+
}));
|
|
430
|
+
}
|
|
431
|
+
//# sourceMappingURL=app-identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-identity.js","sourceRoot":"","sources":["../src/app-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmFG;AAEH,OAAO,EAGL,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAIrF,sEAAsE;AACtE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,QAAQ;IACR,YAAY;IACZ,MAAM;IACN,UAAU;IACV,SAAS;IACT,gBAAgB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