@ibgib/web-gib 0.0.42 → 0.0.44
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/AUTO-GENERATED-version.d.mts +1 -1
- package/dist/AUTO-GENERATED-version.mjs +1 -1
- package/dist/api/commands/ui/ui-index.mjs +2 -2
- package/dist/api/commands/ui/ui-index.mjs.map +1 -1
- package/dist/api/commands/ui/update-css-variables.d.mts +13 -1
- package/dist/api/commands/ui/update-css-variables.d.mts.map +1 -1
- package/dist/api/commands/ui/update-css-variables.mjs +46 -36
- package/dist/api/commands/ui/update-css-variables.mjs.map +1 -1
- package/dist/identity/identity-constants.d.mts +72 -0
- package/dist/identity/identity-constants.d.mts.map +1 -0
- package/dist/identity/identity-constants.mjs +94 -0
- package/dist/identity/identity-constants.mjs.map +1 -0
- package/dist/identity/identity-types.d.mts +214 -0
- package/dist/identity/identity-types.d.mts.map +1 -0
- package/dist/identity/identity-types.mjs +17 -0
- package/dist/identity/identity-types.mjs.map +1 -0
- package/dist/ui/ui-helpers.d.mts +31 -0
- package/dist/ui/ui-helpers.d.mts.map +1 -1
- package/dist/ui/ui-helpers.mjs +50 -1
- package/dist/ui/ui-helpers.mjs.map +1 -1
- package/package.json +5 -5
- package/src/AUTO-GENERATED-version.mts +1 -1
- package/src/api/commands/ui/ui-index.mts +2 -2
- package/src/api/commands/ui/update-css-variables.mts +53 -35
- package/src/identity/identity-constants.mts +107 -0
- package/src/identity/identity-types.mts +250 -0
- package/src/ui/ui-helpers.mts +57 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/constants.mts.template +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/helpers.web.mts.template +3 -3
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/index.mts.template +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-core/templates/types.mts.template +1 -115
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/app-v1.mts.template +1 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-create-app-witness/templates/witness/app/helper.mts.template +1 -1
package/dist/ui/ui-helpers.d.mts
CHANGED
|
@@ -34,9 +34,40 @@ export declare function showFullscreenDialog(opts: {
|
|
|
34
34
|
cancelButtonTitle?: string;
|
|
35
35
|
isPassword?: boolean;
|
|
36
36
|
}): Promise<string | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Gets {@link UIThemeInfo} if it exists in the db ({@link dbName}) and store
|
|
39
|
+
* ({@link storeName}) at the given {@link key}.
|
|
40
|
+
*
|
|
41
|
+
* Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
|
|
42
|
+
*
|
|
43
|
+
* @see {@link putUIInfoInStore}
|
|
44
|
+
* @see {@link UI_THEME_INFO_KEY}
|
|
45
|
+
* @see {@link putUIInfoInStore}
|
|
46
|
+
* @see {@link getGlobalDbName}
|
|
47
|
+
* @see {@link getGlobalStoreName}
|
|
48
|
+
*/
|
|
37
49
|
export declare function getExistingUIInfo({ dbName, storeName, key, }: {
|
|
38
50
|
dbName: string;
|
|
39
51
|
storeName: string;
|
|
40
52
|
key?: string;
|
|
41
53
|
}): Promise<UIThemeInfo | undefined>;
|
|
54
|
+
/**
|
|
55
|
+
* Complementing {@link getExistingUIInfo}, this puts {@link newUIInfo} in the
|
|
56
|
+
* db ({@link dbName}) and into the store ({@link storeName}) at the given
|
|
57
|
+
* {@link key}.
|
|
58
|
+
*
|
|
59
|
+
* Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
|
|
60
|
+
*
|
|
61
|
+
* @see {@link getExistingUIInfo}
|
|
62
|
+
* @see {@link UI_THEME_INFO_KEY}
|
|
63
|
+
* @see {@link putUIInfoInStore}
|
|
64
|
+
* @see {@link getGlobalDbName}
|
|
65
|
+
* @see {@link getGlobalStoreName}
|
|
66
|
+
*/
|
|
67
|
+
export declare function putUIInfoInStore({ dbName, storeName, key, newUIInfo, }: {
|
|
68
|
+
dbName: string;
|
|
69
|
+
storeName: string;
|
|
70
|
+
key?: string;
|
|
71
|
+
newUIInfo: UIThemeInfo;
|
|
72
|
+
}): Promise<void>;
|
|
42
73
|
//# sourceMappingURL=ui-helpers.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-helpers.d.mts","sourceRoot":"","sources":["../../src/ui/ui-helpers.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"ui-helpers.d.mts","sourceRoot":"","sources":["../../src/ui/ui-helpers.mts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAO7C;;;;;;;;GAQG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CA2I9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,iBAAiB,CAAC,EACpC,MAAM,EACN,SAAS,EACT,GAAuB,GAC1B,EAAE;IACC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA6BnC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,gBAAgB,CAAC,EACnC,MAAM,EACN,SAAS,EACT,GAAuB,EACvB,SAAS,GACZ,EAAE;IACC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,WAAW,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAkBhB"}
|
package/dist/ui/ui-helpers.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { delay, extractErrorMsg, } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
2
2
|
import { GLOBAL_LOG_A_LOT } from "../constants.mjs";
|
|
3
|
-
import { storageGet } from "../storage/storage-helpers.web.mjs";
|
|
3
|
+
import { storageGet, storagePut } from "../storage/storage-helpers.web.mjs";
|
|
4
4
|
import { UI_THEME_INFO_KEY } from "./ui-constants.mjs";
|
|
5
5
|
const logalot = GLOBAL_LOG_A_LOT;
|
|
6
6
|
/**
|
|
@@ -159,6 +159,18 @@ export async function showFullscreenDialog(opts) {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Gets {@link UIThemeInfo} if it exists in the db ({@link dbName}) and store
|
|
164
|
+
* ({@link storeName}) at the given {@link key}.
|
|
165
|
+
*
|
|
166
|
+
* Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
|
|
167
|
+
*
|
|
168
|
+
* @see {@link putUIInfoInStore}
|
|
169
|
+
* @see {@link UI_THEME_INFO_KEY}
|
|
170
|
+
* @see {@link putUIInfoInStore}
|
|
171
|
+
* @see {@link getGlobalDbName}
|
|
172
|
+
* @see {@link getGlobalStoreName}
|
|
173
|
+
*/
|
|
162
174
|
export async function getExistingUIInfo({ dbName, storeName, key = UI_THEME_INFO_KEY, }) {
|
|
163
175
|
const lc = `[${getExistingUIInfo.name}]`;
|
|
164
176
|
try {
|
|
@@ -195,4 +207,41 @@ export async function getExistingUIInfo({ dbName, storeName, key = UI_THEME_INFO
|
|
|
195
207
|
}
|
|
196
208
|
}
|
|
197
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Complementing {@link getExistingUIInfo}, this puts {@link newUIInfo} in the
|
|
212
|
+
* db ({@link dbName}) and into the store ({@link storeName}) at the given
|
|
213
|
+
* {@link key}.
|
|
214
|
+
*
|
|
215
|
+
* Used with libs\web-gib\src\api\commands\ui\update-css-variables.mts
|
|
216
|
+
*
|
|
217
|
+
* @see {@link getExistingUIInfo}
|
|
218
|
+
* @see {@link UI_THEME_INFO_KEY}
|
|
219
|
+
* @see {@link putUIInfoInStore}
|
|
220
|
+
* @see {@link getGlobalDbName}
|
|
221
|
+
* @see {@link getGlobalStoreName}
|
|
222
|
+
*/
|
|
223
|
+
export async function putUIInfoInStore({ dbName, storeName, key = UI_THEME_INFO_KEY, newUIInfo, }) {
|
|
224
|
+
const lc = `[${putUIInfoInStore.name}]`;
|
|
225
|
+
try {
|
|
226
|
+
if (logalot) {
|
|
227
|
+
console.log(`${lc} starting... (I: 79c9ee707e426fd8c861c4ff4cf16826)`);
|
|
228
|
+
}
|
|
229
|
+
await storagePut({
|
|
230
|
+
dbName,
|
|
231
|
+
storeName,
|
|
232
|
+
key,
|
|
233
|
+
value: JSON.stringify(newUIInfo),
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
catch (error) {
|
|
237
|
+
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
238
|
+
throw error;
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
if (logalot) {
|
|
242
|
+
console.log(`${lc} complete.`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
;
|
|
198
247
|
//# sourceMappingURL=ui-helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-helpers.mjs","sourceRoot":"","sources":["../../src/ui/ui-helpers.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,eAAe,GAAG,MAAM,iDAAiD,CAAC;AAE1F,OAAO,EAAE,gB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gBAAgB,CAAC,EACnC,MAAM,EACN,SAAS,EACT,GAAG,GAAG,iBAAiB,EACvB,SAAS,GAMZ;IACG,MAAM,EAAE,GAAG,IAAI,gBAAgB,CAAC,IAAI,GAAG,CAAC;IACxC,IAAI,CAAC;QACD,IAAI,OAAO,EAAE,CAAC;YAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,oDAAoD,CAAC,CAAC;QAAC,CAAC;QAExF,MAAM,UAAU,CAAC;YACb,MAAM;YACN,SAAS;YACT,GAAG;YACH,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;SACnC,CAAC,CAAC;IAEP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC;IAChB,CAAC;YAAS,CAAC;QACP,IAAI,OAAO,EAAE,CAAC;YAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAAC,CAAC;IACpD,CAAC;AACL,CAAC;AAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibgib/web-gib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"description": "Framework for creating agentic ibGib web apps. Contains plumbing for ibgib components, agentic framework (currently only Gemini implemented), web-based IndexedDB storage substrate, and more.",
|
|
5
5
|
"funding": {
|
|
6
6
|
"type": "individual",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"license": "ISC",
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@google/genai": "^1.33.0",
|
|
31
|
-
"@ibgib/core-gib": "
|
|
32
|
-
"@ibgib/encrypt-gib": "
|
|
33
|
-
"@ibgib/helper-gib": "
|
|
34
|
-
"@ibgib/ts-gib": "
|
|
31
|
+
"@ibgib/core-gib": "^0.1.58",
|
|
32
|
+
"@ibgib/encrypt-gib": "^0.2.37",
|
|
33
|
+
"@ibgib/helper-gib": "^0.0.36",
|
|
34
|
+
"@ibgib/ts-gib": "^0.5.32"
|
|
35
35
|
},
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=19.0.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIFunctionInfo } from "../../api-types.mjs";
|
|
2
|
-
import { updateCSSVariablesFunctionInfo } from './update-css-variables.mjs';
|
|
2
|
+
// import { updateCSSVariablesFunctionInfo } from './update-css-variables.mjs';
|
|
3
3
|
|
|
4
4
|
export const UIAgentFunctionInfos: APIFunctionInfo<any>[] = [
|
|
5
|
-
updateCSSVariablesFunctionInfo,
|
|
5
|
+
// updateCSSVariablesFunctionInfo,
|
|
6
6
|
];
|
|
@@ -9,7 +9,7 @@ import { FUNCTION_CALL_EXAMPLES_HEADER } from "../../api-constants.mjs";
|
|
|
9
9
|
import { UI_THEME_INFO_KEY, VALID_CSS_VARIABLES } from "../../../ui/ui-constants.mjs";
|
|
10
10
|
import { storagePut } from "../../../storage/storage-helpers.web.mjs";
|
|
11
11
|
import { UIThemeInfo } from "../../../ui/ui-types.mjs";
|
|
12
|
-
import { getExistingUIInfo } from "../../../ui/ui-helpers.mjs";
|
|
12
|
+
import { getExistingUIInfo, putUIInfoInStore } from "../../../ui/ui-helpers.mjs";
|
|
13
13
|
import { getGlobalDbName, getGlobalStoreName } from "../../../helpers.web.mjs";
|
|
14
14
|
|
|
15
15
|
const logalot = GLOBAL_LOG_A_LOT;
|
|
@@ -126,7 +126,7 @@ async function updateCSSVariablesImpl(opts: UpdateCSSVariablesOpts): Promise<voi
|
|
|
126
126
|
|
|
127
127
|
// update the theme in the options
|
|
128
128
|
const dbName = getGlobalDbName();
|
|
129
|
-
const storeName =
|
|
129
|
+
const storeName = getGlobalStoreName();
|
|
130
130
|
const existingUIInfo = await getExistingUIInfo({ dbName, storeName }) ?? { cssVariableOverrides: {}, };
|
|
131
131
|
const newUIInfo: UIThemeInfo = {
|
|
132
132
|
...existingUIInfo,
|
|
@@ -136,11 +136,10 @@ async function updateCSSVariablesImpl(opts: UpdateCSSVariablesOpts): Promise<voi
|
|
|
136
136
|
},
|
|
137
137
|
};
|
|
138
138
|
|
|
139
|
-
await
|
|
139
|
+
await putUIInfoInStore({
|
|
140
140
|
dbName,
|
|
141
|
-
storeName
|
|
142
|
-
|
|
143
|
-
value: JSON.stringify(newUIInfo),
|
|
141
|
+
storeName,
|
|
142
|
+
newUIInfo,
|
|
144
143
|
});
|
|
145
144
|
} catch (error) {
|
|
146
145
|
console.error(`${lc} ${extractErrorMsg(error)}`);
|
|
@@ -152,36 +151,55 @@ async function updateCSSVariablesImpl(opts: UpdateCSSVariablesOpts): Promise<voi
|
|
|
152
151
|
|
|
153
152
|
|
|
154
153
|
/**
|
|
155
|
-
* API function info for the updateCSSVariables
|
|
154
|
+
* Factory function to get an API function info for the updateCSSVariables
|
|
155
|
+
* command. This enables an agent to update the {@link cssVariables} to create
|
|
156
|
+
* dynamic themes, which in turn enables users to use natural language to change
|
|
157
|
+
* the theme.
|
|
158
|
+
*
|
|
159
|
+
* initially this was just {@link VALID_CSS_VARIABLES}, but we have changed
|
|
160
|
+
* this to be a dynamic factory function driven by this {@link cssVariables}.
|
|
156
161
|
*/
|
|
157
|
-
export
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
162
|
+
export function getFunctionInfo_updateCSSVariablesFunctionInfo({
|
|
163
|
+
cssVariables,
|
|
164
|
+
}: {
|
|
165
|
+
/**
|
|
166
|
+
* list of variables that the agent has access to change.
|
|
167
|
+
*/
|
|
168
|
+
cssVariables: string[],
|
|
169
|
+
}): APIFunctionInfo<typeof updateCSSVariablesViaCmd> {
|
|
170
|
+
return {
|
|
171
|
+
nameOrId: FUNCTION_NAME,
|
|
172
|
+
fnViaCmd: updateCSSVariablesViaCmd,
|
|
173
|
+
functionImpl: updateCSSVariablesImpl,
|
|
174
|
+
cmd: CMD_CATEGORY,
|
|
175
|
+
cmdModifiers: CMD_MODIFIERS,
|
|
176
|
+
schema: {
|
|
177
|
+
name: FUNCTION_NAME,
|
|
178
|
+
description: FUNCTION_DESCRIPTION,
|
|
179
|
+
parameters: {
|
|
180
|
+
type: 'object',
|
|
181
|
+
properties: {
|
|
182
|
+
...COMMAND_BASE_SCHEMA_PROPERTIES,
|
|
183
|
+
cssVariables: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
description: 'CSS variables to update when theming or otherwise changing these visual aspects of the web app per user preferences or the user directly asking for it. (atow there are no preferences saved or anything, so this is just user-driven if they ask for it.)',
|
|
186
|
+
properties: Object.fromEntries(
|
|
187
|
+
cssVariables.map(varName => [
|
|
188
|
+
varName,
|
|
189
|
+
{
|
|
190
|
+
type: 'string',
|
|
191
|
+
description: `configurable css variable`,
|
|
192
|
+
},
|
|
193
|
+
])
|
|
194
|
+
),
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
required: ['cssVariables'],
|
|
183
198
|
},
|
|
184
|
-
required: ['cssVariables'],
|
|
185
199
|
},
|
|
186
|
-
}
|
|
200
|
+
};
|
|
187
201
|
};
|
|
202
|
+
|
|
203
|
+
export const updateCSSVariablesFunctionInfo = getFunctionInfo_updateCSSVariablesFunctionInfo({
|
|
204
|
+
cssVariables: VALID_CSS_VARIABLES,
|
|
205
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file identity-constants.mts
|
|
3
|
+
* @description Constants for the ibgib identity layer: pool IDs, verbs, KDF salts,
|
|
4
|
+
* IndexedDB store names, and default pool configuration presets.
|
|
5
|
+
*
|
|
6
|
+
* @see docs/identity/KEYSTONES.md
|
|
7
|
+
* @see docs/identity/TODO.md#02-identity-constants--verbs
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// ===========================================================================
|
|
11
|
+
// IDENTITY VERBS
|
|
12
|
+
// These extend the base KeystoneVerb set with identity-tier-specific actions.
|
|
13
|
+
// Used as values in KeystoneClaim.verb and KeystonePoolConfig.allowedVerbs.
|
|
14
|
+
// ===========================================================================
|
|
15
|
+
|
|
16
|
+
/** Evolve META: add a LOCAL keystone to the trusted list. */
|
|
17
|
+
export const IDENTITY_VERB_ADD_DEVICE = 'identity-add-device';
|
|
18
|
+
/** Evolve META: remove a LOCAL keystone from the trusted list. */
|
|
19
|
+
export const IDENTITY_VERB_REMOVE_DEVICE = 'identity-remove-device';
|
|
20
|
+
/** Evolve META: transfer custodianship (custodial → sovereign). */
|
|
21
|
+
export const IDENTITY_VERB_CUSTODY_TRANSFER = 'identity-custody-transfer';
|
|
22
|
+
|
|
23
|
+
/** Evolve LOCAL: register a new APP-LOCAL keystone. */
|
|
24
|
+
export const IDENTITY_VERB_ADD_APP = 'identity-add-app';
|
|
25
|
+
/** Evolve LOCAL: deregister an APP-LOCAL keystone. */
|
|
26
|
+
export const IDENTITY_VERB_REMOVE_APP = 'identity-remove-app';
|
|
27
|
+
|
|
28
|
+
/** Evolve APP-LOCAL: establish a SESSION keystone genesis. */
|
|
29
|
+
export const IDENTITY_VERB_ESTABLISH_SESSION = 'identity-establish-session';
|
|
30
|
+
/** Evolve APP-LOCAL: authorize an app-level action. */
|
|
31
|
+
export const IDENTITY_VERB_AUTHORIZE = 'identity-authorize';
|
|
32
|
+
/**
|
|
33
|
+
* Evolve APP-LOCAL (final frame of old epoch): transition to a new epoch keystone.
|
|
34
|
+
* Uses `consume` replenish strategy — self-contained, no parent evolution needed.
|
|
35
|
+
* @see docs/identity/PARADIGM.md#epoch-rotation-handling-keystone-growth
|
|
36
|
+
*/
|
|
37
|
+
export const IDENTITY_VERB_EPOCH_TRANSITION = 'identity-epoch-transition';
|
|
38
|
+
|
|
39
|
+
// ===========================================================================
|
|
40
|
+
// POOL IDs
|
|
41
|
+
// Conventional pool identifiers for each identity tier's pools.
|
|
42
|
+
// ===========================================================================
|
|
43
|
+
|
|
44
|
+
/** META keystone: structural changes (add/remove device). */
|
|
45
|
+
export const IDENTITY_POOL_ID_ADD_DEVICE = 'identity-add-device';
|
|
46
|
+
/** META keystone: structural changes (remove device). Separate pool allows tighter policy. */
|
|
47
|
+
export const IDENTITY_POOL_ID_REMOVE_DEVICE = 'identity-remove-device';
|
|
48
|
+
/** META keystone: custody transfer (consume strategy — limited uses). */
|
|
49
|
+
export const IDENTITY_POOL_ID_CUSTODY_TRANSFER = 'identity-custody-transfer';
|
|
50
|
+
|
|
51
|
+
/** LOCAL keystone: register/deregister app-local keystones. */
|
|
52
|
+
export const IDENTITY_POOL_ID_ADD_APP = 'identity-add-app';
|
|
53
|
+
/** LOCAL keystone: deregister app-local keystones. */
|
|
54
|
+
export const IDENTITY_POOL_ID_REMOVE_APP = 'identity-remove-app';
|
|
55
|
+
|
|
56
|
+
/** APP-LOCAL keystone: establish session keystones. */
|
|
57
|
+
export const IDENTITY_POOL_ID_APP_SESSION = 'identity-app-session';
|
|
58
|
+
/** APP-LOCAL keystone: general app-level authorization. */
|
|
59
|
+
export const IDENTITY_POOL_ID_APP_AUTHORIZE = 'identity-app-authorize';
|
|
60
|
+
/**
|
|
61
|
+
* APP-LOCAL keystone: epoch transition pool.
|
|
62
|
+
* Strategy: consume — self-authenticates epoch rotation without parent evolution.
|
|
63
|
+
*/
|
|
64
|
+
export const IDENTITY_POOL_ID_APP_EPOCH = 'identity-app-epoch';
|
|
65
|
+
|
|
66
|
+
// ===========================================================================
|
|
67
|
+
// KDF SALTS
|
|
68
|
+
// Used to derive tier-specific MasterSecrets from a root passphrase.
|
|
69
|
+
// Different salt per tier ensures independent secrets even with same passphrase.
|
|
70
|
+
// ===========================================================================
|
|
71
|
+
|
|
72
|
+
export const IDENTITY_KDF_SALT_META = 'ibgib-identity-meta-v1';
|
|
73
|
+
export const IDENTITY_KDF_SALT_LOCAL = 'ibgib-identity-local-v1';
|
|
74
|
+
/**
|
|
75
|
+
* APP-LOCAL salt base. Full derivation:
|
|
76
|
+
* `KDF(MasterSecret_local, IDENTITY_KDF_SALT_APP_LOCAL + appId + deviceSalt)`
|
|
77
|
+
*/
|
|
78
|
+
export const IDENTITY_KDF_SALT_APP_LOCAL = 'ibgib-identity-app-local-v1';
|
|
79
|
+
export const IDENTITY_KDF_SALT_SESSION = 'ibgib-identity-session-v1';
|
|
80
|
+
|
|
81
|
+
// ===========================================================================
|
|
82
|
+
// INDEXEDDB STORE NAMES
|
|
83
|
+
// ===========================================================================
|
|
84
|
+
|
|
85
|
+
/** Stores `LocalIdentityContext` — one record per browser profile. */
|
|
86
|
+
export const IDENTITY_IDB_STORE_LOCAL_CONTEXT = 'identity-local-context';
|
|
87
|
+
/** Stores `AppLocalIdentityContext` — one record per appId per browser profile. */
|
|
88
|
+
export const IDENTITY_IDB_STORE_APP_LOCAL_CONTEXT = 'identity-app-local-context';
|
|
89
|
+
/** Cached META keystone chain — periodically refreshed from identity service. */
|
|
90
|
+
export const IDENTITY_IDB_STORE_META_CACHE = 'identity-meta-cache';
|
|
91
|
+
/** LOCAL keystone frames — genesis through current tip. */
|
|
92
|
+
export const IDENTITY_IDB_STORE_LOCAL_CHAIN = 'identity-local-chain';
|
|
93
|
+
/** APP-LOCAL keystone frames — current epoch genesis through tip. */
|
|
94
|
+
export const IDENTITY_IDB_STORE_APP_LOCAL_CHAIN = 'identity-app-local-chain';
|
|
95
|
+
|
|
96
|
+
// ===========================================================================
|
|
97
|
+
// STALENESS POLICY DEFAULTS (milliseconds)
|
|
98
|
+
// App-level policy: how old can a cached META chain be before re-fetch?
|
|
99
|
+
// @see docs/identity/PARADIGM.md#staleness-policy
|
|
100
|
+
// ===========================================================================
|
|
101
|
+
|
|
102
|
+
/** Default max age for cached META chain for routine verification. */
|
|
103
|
+
export const IDENTITY_META_CACHE_TTL_NORMAL_MS = 60 * 60 * 1000; // 1 hour
|
|
104
|
+
/** For session establishment: always fetch fresh. */
|
|
105
|
+
export const IDENTITY_META_CACHE_TTL_SESSION_MS = 0;
|
|
106
|
+
/** For offline operation: no TTL (accept whatever is cached). */
|
|
107
|
+
export const IDENTITY_META_CACHE_TTL_OFFLINE_MS = Infinity;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file identity-types.mts
|
|
3
|
+
* @description Type definitions for the four-tier ibgib identity hierarchy.
|
|
4
|
+
*
|
|
5
|
+
* ## Tier Overview
|
|
6
|
+
* ```
|
|
7
|
+
* META keystone → universal identity handle (cross-app, cross-device)
|
|
8
|
+
* └─ LOCAL keystone → device/browser-profile-scoped identity
|
|
9
|
+
* └─ APP-LOCAL keystone → app-scoped identity (one per app per browser profile)
|
|
10
|
+
* └─ SESSION keystone → session-scoped (existing sync protocol)
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @see docs/identity/PARADIGM.md
|
|
14
|
+
* @see docs/identity/KEYSTONES.md
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
18
|
+
import { KeystoneData_V1, KeystoneIbGib_V1 } from "@ibgib/core-gib/dist/keystone/keystone-types.mjs";
|
|
19
|
+
|
|
20
|
+
// ===========================================================================
|
|
21
|
+
// KEYSTONE DATA EXTENSIONS — one per tier
|
|
22
|
+
// ===========================================================================
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Data shape for the META keystone tier.
|
|
26
|
+
*
|
|
27
|
+
* The META keystone is the user's universal identity — stable across all apps,
|
|
28
|
+
* devices, and time. Its `tjpGib` is the user's permanent identity handle.
|
|
29
|
+
*
|
|
30
|
+
* @see docs/identity/KEYSTONES.md#meta-keystone
|
|
31
|
+
* @see docs/identity/PARADIGM.md#meta-keystone
|
|
32
|
+
*/
|
|
33
|
+
export interface MetaKeystoneData extends KeystoneData_V1 {
|
|
34
|
+
/**
|
|
35
|
+
* List of LOCAL keystone `tjpGib` values currently trusted by this identity.
|
|
36
|
+
*
|
|
37
|
+
* This is the **trust register** — an app verifies a user by finding the
|
|
38
|
+
* LOCAL keystone's tjpGib in this list from the current META frame.
|
|
39
|
+
*
|
|
40
|
+
* Mutated by: add-device evolution (append), remove-device evolution (remove).
|
|
41
|
+
*
|
|
42
|
+
* @see docs/identity/PARADIGM.md#cross-app-identity
|
|
43
|
+
*/
|
|
44
|
+
trustedLocalTjpGibs: IbGibAddr[];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* For custodial keystones: the publicly-visible nonce used by the custodian
|
|
48
|
+
* to re-derive `MasterSecret_user = KDF(server_secret, custodialNonce)`.
|
|
49
|
+
*
|
|
50
|
+
* No secrecy requirement — security comes from `server_secret` alone.
|
|
51
|
+
* Stored here so the custodian needs no separate mapping table.
|
|
52
|
+
*
|
|
53
|
+
* Undefined for sovereign (user-held) keystones.
|
|
54
|
+
*
|
|
55
|
+
* @see docs/identity/PARADIGM.md#custodianship--the-oauth2-path
|
|
56
|
+
* @see docs/identity/FLOWS.md#flow-2-first-login--custodial-path-oauth2
|
|
57
|
+
*/
|
|
58
|
+
custodialNonce?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Data shape for the LOCAL keystone tier.
|
|
63
|
+
*
|
|
64
|
+
* Device/browser-profile-scoped identity. Evolves offline. Lives in IndexedDB.
|
|
65
|
+
* One per browser profile per user.
|
|
66
|
+
*
|
|
67
|
+
* @see docs/identity/KEYSTONES.md#local-keystone
|
|
68
|
+
*/
|
|
69
|
+
export interface LocalKeystoneData extends KeystoneData_V1 {
|
|
70
|
+
/**
|
|
71
|
+
* Map of registered APP-LOCAL keystones on this browser profile.
|
|
72
|
+
*
|
|
73
|
+
* Key: `appId`
|
|
74
|
+
* Value: the **first epoch** APP-LOCAL keystone `tjpGib` for that app.
|
|
75
|
+
*
|
|
76
|
+
* Subsequent epochs are authenticated transitively through the APP-LOCAL
|
|
77
|
+
* epoch chain — the LOCAL keystone does NOT need to evolve for epoch rotation.
|
|
78
|
+
*
|
|
79
|
+
* Mutated by: add-app evolution (set), remove-app evolution (delete).
|
|
80
|
+
*
|
|
81
|
+
* @see docs/identity/PARADIGM.md#epoch-rotation-handling-keystone-growth
|
|
82
|
+
*/
|
|
83
|
+
registeredAppLocals: Record<string, IbGibAddr>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Data shape for the APP-LOCAL keystone tier.
|
|
88
|
+
*
|
|
89
|
+
* App-scoped identity for a specific browser profile + app combination.
|
|
90
|
+
* Evolves offline. Lives in IndexedDB (client) and app server (synced).
|
|
91
|
+
* One per app per browser profile per user.
|
|
92
|
+
*
|
|
93
|
+
* @see docs/identity/KEYSTONES.md#app-local-keystone
|
|
94
|
+
*/
|
|
95
|
+
export interface AppLocalKeystoneData extends KeystoneData_V1 {
|
|
96
|
+
/** The app identifier this APP-LOCAL belongs to. */
|
|
97
|
+
appId: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The LOCAL keystone `tjpGib` this APP-LOCAL is derived from.
|
|
101
|
+
* Used by verifiers to link APP-LOCAL trust back to LOCAL → META.
|
|
102
|
+
*/
|
|
103
|
+
localTjpGib: IbGibAddr;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The META keystone `tjpGib` for this identity.
|
|
107
|
+
* Stored for reference/display. The authoritative trust chain is
|
|
108
|
+
* always verified by replaying META → LOCAL → APP-LOCAL.
|
|
109
|
+
*/
|
|
110
|
+
metaTjpGib: IbGibAddr;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* For epoch-chained APP-LOCAL keystones: the ibgib address of the
|
|
114
|
+
* **final frame** of the previous epoch. Establishes the transitive
|
|
115
|
+
* trust chain from the first epoch.
|
|
116
|
+
*
|
|
117
|
+
* Undefined for the first epoch (no prior epoch).
|
|
118
|
+
*
|
|
119
|
+
* @see docs/identity/PARADIGM.md#epoch-rotation-handling-keystone-growth
|
|
120
|
+
*/
|
|
121
|
+
prevEpochFinalFrameAddr?: IbGibAddr;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ===========================================================================
|
|
125
|
+
// BROWSER LOCAL CONTEXT (IndexedDB)
|
|
126
|
+
// ===========================================================================
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The browser-local identity context for a user on this browser profile.
|
|
130
|
+
* Stored in IndexedDB. Reconstructed from keystone chains if lost.
|
|
131
|
+
*
|
|
132
|
+
* @see docs/identity/FLOWS.md#flow-3-return-login--same-browser-profile
|
|
133
|
+
* @see docs/identity/PARTIES.md#party-app-client
|
|
134
|
+
*/
|
|
135
|
+
export interface LocalIdentityContext {
|
|
136
|
+
/** The user's universal identity handle. Used for cross-app identity. */
|
|
137
|
+
metaTjpGib: IbGibAddr;
|
|
138
|
+
|
|
139
|
+
/** URL of the identity service hosting the user's META keystone. */
|
|
140
|
+
identityServiceUrl: string;
|
|
141
|
+
|
|
142
|
+
/** This browser profile's LOCAL keystone `tjpGib`. */
|
|
143
|
+
localTjpGib: IbGibAddr;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Per-app identity context for a specific browser profile + app.
|
|
148
|
+
* Stored in IndexedDB by the app client.
|
|
149
|
+
*
|
|
150
|
+
* @see docs/identity/KEYSTONES.md#app-local-keystone
|
|
151
|
+
*/
|
|
152
|
+
export interface AppLocalIdentityContext {
|
|
153
|
+
/** The user's universal identity handle. */
|
|
154
|
+
metaTjpGib: IbGibAddr;
|
|
155
|
+
|
|
156
|
+
/** This browser profile's LOCAL keystone `tjpGib`. */
|
|
157
|
+
localTjpGib: IbGibAddr;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The **current** (possibly epoch-N) APP-LOCAL keystone `tjpGib`.
|
|
161
|
+
* Updated in-place after each epoch rotation.
|
|
162
|
+
*/
|
|
163
|
+
appLocalTjpGib: IbGibAddr;
|
|
164
|
+
|
|
165
|
+
/** The app identifier. */
|
|
166
|
+
appId: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ===========================================================================
|
|
170
|
+
// IDENTITY SERVICE (Shared Space) INTERFACE
|
|
171
|
+
// ===========================================================================
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The shared identity space — a write-verifying history store.
|
|
175
|
+
*
|
|
176
|
+
* NOT an authority. Verifies chain continuity on writes. Serves raw chain
|
|
177
|
+
* data on reads. Any party can independently verify the chain it returns.
|
|
178
|
+
*
|
|
179
|
+
* Initial deployment: hosted on the app's server. Federated by design.
|
|
180
|
+
*
|
|
181
|
+
* @see docs/identity/PARADIGM.md#the-shared-identity-space
|
|
182
|
+
* @see docs/identity/PARTIES.md#party-identity-service
|
|
183
|
+
*/
|
|
184
|
+
export interface IIdentityService {
|
|
185
|
+
/**
|
|
186
|
+
* POST a genesis frame — accepted unconditionally if internally valid.
|
|
187
|
+
* Genesis is self-legitimizing: Alice's identity IS her genesis frame.
|
|
188
|
+
*
|
|
189
|
+
* @returns the `tjpGib` (ibgib address of the genesis frame)
|
|
190
|
+
* @throws if the frame is internally invalid (malformed structure)
|
|
191
|
+
*/
|
|
192
|
+
postGenesis(frame: KeystoneIbGib_V1): Promise<{ tjpGib: IbGibAddr }>;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* POST an evolution frame.
|
|
196
|
+
* Verifies chain continuity: revealed solutions must hash-match prior
|
|
197
|
+
* frame's commitments. Implements CAS: rejects if prior frame is stale.
|
|
198
|
+
*
|
|
199
|
+
* @throws `IdentityServiceStaleTipError` if prior frame is no longer tip
|
|
200
|
+
* @throws `IdentityServiceChainError` if hash pre-images are invalid
|
|
201
|
+
*/
|
|
202
|
+
postEvolution(frame: KeystoneIbGib_V1): Promise<void>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* GET the full keystone chain from genesis to current tip.
|
|
206
|
+
*
|
|
207
|
+
* Does NOT change state. Safe to call without coordination.
|
|
208
|
+
*/
|
|
209
|
+
getChain(tjpGib: IbGibAddr): Promise<KeystoneIbGib_V1[]>;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* GET the current tip frame for a keystone.
|
|
213
|
+
*
|
|
214
|
+
* Does NOT change state.
|
|
215
|
+
*/
|
|
216
|
+
getTip(tjpGib: IbGibAddr): Promise<KeystoneIbGib_V1>;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// ===========================================================================
|
|
220
|
+
// MASTERSECRET DERIVATION
|
|
221
|
+
// ===========================================================================
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Inputs for deriving a tier-specific MasterSecret from a root passphrase.
|
|
225
|
+
*
|
|
226
|
+
* Each tier uses a different salt to ensure independent MasterSecrets
|
|
227
|
+
* even when the same passphrase is used for all tiers.
|
|
228
|
+
*
|
|
229
|
+
* @see docs/identity/KEYSTONES.md for per-tier salt conventions
|
|
230
|
+
* @see identity-helpers.mts for derivation functions
|
|
231
|
+
*/
|
|
232
|
+
export interface MasterSecretDerivationContext {
|
|
233
|
+
/** The root passphrase (sovereign path) or server secret (custodial path). */
|
|
234
|
+
passphrase: string;
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Tier-specific salt (e.g., `IDENTITY_KDF_SALT_META`, `IDENTITY_KDF_SALT_LOCAL`).
|
|
238
|
+
* @see identity-constants.mts
|
|
239
|
+
*/
|
|
240
|
+
salt: string;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Additional device-specific entropy for LOCAL and APP-LOCAL tiers.
|
|
244
|
+
* Generated once per browser profile and stored in IndexedDB.
|
|
245
|
+
*/
|
|
246
|
+
deviceSalt?: string;
|
|
247
|
+
|
|
248
|
+
/** For APP-LOCAL tier: the app identifier, mixed into derivation. */
|
|
249
|
+
appId?: string;
|
|
250
|
+
}
|