@ibgib/web-gib 0.0.52 → 0.0.56
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/CHANGELOG.md +7 -0
- package/dist/AUTO-GENERATED-version.d.mts +1 -1
- package/dist/AUTO-GENERATED-version.mjs +1 -1
- package/dist/api/commands/chat/hello-world.mjs.map +1 -1
- package/dist/api/commands/command-constants.d.mts +4 -4
- package/dist/api/commands/command-constants.d.mts.map +1 -1
- package/dist/api/commands/command-service-v1.d.mts.map +1 -1
- package/dist/api/commands/command-service-v1.mjs.map +1 -1
- package/dist/api/commands/ibgib/get-ibgibs.d.mts.map +1 -1
- package/dist/api/commands/ibgib/get-ibgibs.mjs.map +1 -1
- package/dist/api/ibgib-api-bridge.d.mts +81 -0
- package/dist/api/ibgib-api-bridge.d.mts.map +1 -0
- package/dist/api/ibgib-api-bridge.mjs +259 -0
- package/dist/api/ibgib-api-bridge.mjs.map +1 -0
- package/dist/app-bootstrap/init-orchestration.d.mts +1 -1
- package/dist/app-bootstrap/init-orchestration.d.mts.map +1 -1
- package/dist/app-bootstrap/init-orchestration.mjs +17 -3
- package/dist/app-bootstrap/init-orchestration.mjs.map +1 -1
- package/dist/assets/fullscreen-dialog.html +18 -0
- package/dist/assumptions.respec.mjs.map +1 -1
- package/dist/common/settings/settings-constants.d.mts.map +1 -1
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs.map +1 -1
- package/dist/helpers.web.d.mts.map +1 -1
- package/dist/helpers.web.mjs.map +1 -1
- package/dist/helpers.web.respec.mjs.map +1 -1
- package/dist/identity/keystone-sync-service.d.mts +37 -0
- package/dist/identity/keystone-sync-service.d.mts.map +1 -0
- package/dist/identity/keystone-sync-service.mjs +211 -0
- package/dist/identity/keystone-sync-service.mjs.map +1 -0
- package/dist/identity/sso/sso-custodian-service.d.mts.map +1 -1
- package/dist/identity/sso/sso-custodian-service.mjs.map +1 -1
- package/dist/identity/sso/sso-custodian-service.respec.mjs.map +1 -1
- package/dist/index.d.mts +17 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +21 -26
- package/dist/index.mjs.map +1 -1
- package/dist/storage/storage-helpers.web.mjs.map +1 -1
- package/dist/ui/component/common-component-styles.css +270 -0
- package/dist/ui/component/ibgib-component-service.d.mts.map +1 -1
- package/dist/ui/component/ibgib-dynamic-component-bases.d.mts.map +1 -1
- package/dist/ui/component/ibgib-dynamic-component-bases.mjs.map +1 -1
- package/dist/ui/component/identity/add-device/add-device.css +133 -0
- package/dist/ui/component/identity/add-device/add-device.d.mts +49 -0
- package/dist/ui/component/identity/add-device/add-device.d.mts.map +1 -0
- package/dist/ui/component/identity/add-device/add-device.html +52 -0
- package/dist/ui/component/identity/add-device/add-device.mjs +321 -0
- package/dist/ui/component/identity/add-device/add-device.mjs.map +1 -0
- package/dist/ui/component/identity/identity-header/identity-header.css +317 -0
- package/dist/ui/component/identity/identity-header/identity-header.d.mts +85 -0
- package/dist/ui/component/identity/identity-header/identity-header.d.mts.map +1 -0
- package/dist/ui/component/identity/identity-header/identity-header.html +72 -0
- package/dist/ui/component/identity/identity-header/identity-header.mjs +546 -0
- package/dist/ui/component/identity/identity-header/identity-header.mjs.map +1 -0
- package/dist/ui/component/identity/identity-manager/identity-manager.css +178 -0
- package/dist/ui/component/identity/identity-manager/identity-manager.d.mts +76 -0
- package/dist/ui/component/identity/identity-manager/identity-manager.d.mts.map +1 -0
- package/dist/ui/component/identity/identity-manager/identity-manager.html +19 -0
- package/dist/ui/component/identity/identity-manager/identity-manager.mjs +591 -0
- package/dist/ui/component/identity/identity-manager/identity-manager.mjs.map +1 -0
- package/dist/ui/component/identity/index.d.mts +17 -0
- package/dist/ui/component/identity/index.d.mts.map +1 -0
- package/dist/ui/component/identity/index.mjs +34 -0
- package/dist/ui/component/identity/index.mjs.map +1 -0
- package/dist/ui/component/identity/keystone-creator/keystone-creator.css +97 -0
- package/dist/ui/component/identity/keystone-creator/keystone-creator.d.mts +58 -0
- package/dist/ui/component/identity/keystone-creator/keystone-creator.d.mts.map +1 -0
- package/dist/ui/component/identity/keystone-creator/keystone-creator.html +51 -0
- package/dist/ui/component/identity/keystone-creator/keystone-creator.mjs +410 -0
- package/dist/ui/component/identity/keystone-creator/keystone-creator.mjs.map +1 -0
- package/dist/ui/component/identity/keystone-details/keystone-details.css +621 -0
- package/dist/ui/component/identity/keystone-details/keystone-details.d.mts +98 -0
- package/dist/ui/component/identity/keystone-details/keystone-details.d.mts.map +1 -0
- package/dist/ui/component/identity/keystone-details/keystone-details.html +154 -0
- package/dist/ui/component/identity/keystone-details/keystone-details.mjs +1377 -0
- package/dist/ui/component/identity/keystone-details/keystone-details.mjs.map +1 -0
- package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.css +46 -0
- package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.d.mts +64 -0
- package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.d.mts.map +1 -0
- package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.html +15 -0
- package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.mjs +300 -0
- package/dist/ui/component/identity/keystone-scrubber/keystone-scrubber.mjs.map +1 -0
- package/dist/ui/component/identity/remove-device/remove-device.css +118 -0
- package/dist/ui/component/identity/remove-device/remove-device.d.mts +50 -0
- package/dist/ui/component/identity/remove-device/remove-device.d.mts.map +1 -0
- package/dist/ui/component/identity/remove-device/remove-device.html +31 -0
- package/dist/ui/component/identity/remove-device/remove-device.mjs +188 -0
- package/dist/ui/component/identity/remove-device/remove-device.mjs.map +1 -0
- package/dist/ui/ui-constants.d.mts +1 -0
- package/dist/ui/ui-constants.d.mts.map +1 -1
- package/dist/ui/ui-constants.mjs +1 -0
- package/dist/ui/ui-constants.mjs.map +1 -1
- package/dist/ui/ui-types.d.mts +7 -0
- package/dist/ui/ui-types.d.mts.map +1 -1
- package/dist/witness/agent/agent-constants.d.mts.map +1 -1
- package/dist/witness/agent/agent-helpers.mjs.map +1 -1
- package/dist/witness/agent/agent-one-file.d.mts.map +1 -1
- package/dist/witness/agent/agent-one-file.mjs.map +1 -1
- package/dist/witness/agent/agents-service-v1.d.mts.map +1 -1
- package/dist/witness/agent/agents-service-v1.mjs.map +1 -1
- package/dist/witness/agent/gemini/agent-witness-gemini-v1.d.mts.map +1 -1
- package/dist/witness/agent/gemini/gemini-agent-factory.d.mts.map +1 -1
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.d.mts.map +1 -1
- package/dist/witness/live-proxy-ibgib/live-proxy-ibgib-one-file.mjs.map +1 -1
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace-helper.mjs.map +1 -1
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts +4 -0
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.d.mts.map +1 -1
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs +40 -1
- package/dist/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mjs.map +1 -1
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-types.d.mts.map +1 -1
- package/dist/witness/space/web-filesystem-space/web-filesystem-space-v1.d.mts.map +1 -1
- package/package.json +2 -2
- package/src/AUTO-GENERATED-version.mts +1 -1
- package/src/api/ibgib-api-bridge.mts +292 -0
- package/src/app-bootstrap/init-orchestration.mts +17 -6
- package/src/custom.d.ts +11 -0
- package/src/identity/keystone-sync-service.mts +257 -0
- package/src/index.mts +24 -25
- package/src/ui/component/README.md +82 -5
- package/src/ui/component/common-component-styles.css +270 -0
- package/src/ui/component/identity/add-device/add-device.css +133 -0
- package/src/ui/component/identity/add-device/add-device.html +52 -0
- package/src/ui/component/identity/add-device/add-device.mts +397 -0
- package/src/ui/component/identity/identity-header/IMPLEMENTATION.md +45 -0
- package/src/ui/component/identity/identity-header/identity-header.css +317 -0
- package/src/ui/component/identity/identity-header/identity-header.html +72 -0
- package/src/ui/component/identity/identity-header/identity-header.mts +651 -0
- package/src/ui/component/identity/identity-manager/IMPLEMENTATION.md +100 -0
- package/src/ui/component/identity/identity-manager/identity-manager.css +178 -0
- package/src/ui/component/identity/identity-manager/identity-manager.html +19 -0
- package/src/ui/component/identity/identity-manager/identity-manager.mts +675 -0
- package/src/ui/component/identity/index.mts +36 -0
- package/src/ui/component/identity/keystone-creator/keystone-creator.css +97 -0
- package/src/ui/component/identity/keystone-creator/keystone-creator.html +51 -0
- package/src/ui/component/identity/keystone-creator/keystone-creator.mts +497 -0
- package/src/ui/component/identity/keystone-details/keystone-details.css +621 -0
- package/src/ui/component/identity/keystone-details/keystone-details.html +154 -0
- package/src/ui/component/identity/keystone-details/keystone-details.mts +1506 -0
- package/src/ui/component/identity/keystone-scrubber/SCRUBBER_IMPLEMENTATION.md +33 -0
- package/src/ui/component/identity/keystone-scrubber/keystone-scrubber.css +46 -0
- package/src/ui/component/identity/keystone-scrubber/keystone-scrubber.html +15 -0
- package/src/ui/component/identity/keystone-scrubber/keystone-scrubber.mts +355 -0
- package/src/ui/component/identity/remove-device/remove-device.css +118 -0
- package/src/ui/component/identity/remove-device/remove-device.html +31 -0
- package/src/ui/component/identity/remove-device/remove-device.mts +247 -0
- package/src/ui/ui-constants.mts +1 -0
- package/src/ui/ui-types.mts +8 -0
- package/src/witness/space/metaspace/metaspace-webspace/metaspace-webspace.mts +42 -1
- package/tools/auto-generated-agent-skills/skills/ibgib-dependency-graph/SKILL.md +209 -0
- package/tools/auto-generated-agent-skills/skills/ibgib-implementation-plan/SKILL.md +102 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ui/component/identity
|
|
3
|
+
*
|
|
4
|
+
* Keystone identity UI components and registration helpers.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export * from './identity-header/identity-header.mjs';
|
|
8
|
+
export * from './identity-manager/identity-manager.mjs';
|
|
9
|
+
export * from './keystone-creator/keystone-creator.mjs';
|
|
10
|
+
export * from './keystone-details/keystone-details.mjs';
|
|
11
|
+
export * from './keystone-scrubber/keystone-scrubber.mjs';
|
|
12
|
+
export * from './add-device/add-device.mjs';
|
|
13
|
+
export * from './remove-device/remove-device.mjs';
|
|
14
|
+
|
|
15
|
+
import { getComponentSvc } from '../ibgib-component-service.mjs';
|
|
16
|
+
import { IdentityHeaderComponentMeta } from './identity-header/identity-header.mjs';
|
|
17
|
+
import { IdentityManagerComponentMeta } from './identity-manager/identity-manager.mjs';
|
|
18
|
+
import { KeystoneCreatorComponentMeta } from './keystone-creator/keystone-creator.mjs';
|
|
19
|
+
import { KeystoneDetailsComponentMeta } from './keystone-details/keystone-details.mjs';
|
|
20
|
+
import { KeystoneScrubberComponentMeta } from './keystone-scrubber/keystone-scrubber.mjs';
|
|
21
|
+
import { AddDeviceComponentMeta } from './add-device/add-device.mjs';
|
|
22
|
+
import { RemoveDeviceComponentMeta } from './remove-device/remove-device.mjs';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Registers all standard Keystone Identity UI components with the central component service.
|
|
26
|
+
*/
|
|
27
|
+
export async function registerStandardIdentityComponents(): Promise<void> {
|
|
28
|
+
const componentSvc = await getComponentSvc();
|
|
29
|
+
componentSvc.registerComponentMeta(new IdentityHeaderComponentMeta());
|
|
30
|
+
componentSvc.registerComponentMeta(new IdentityManagerComponentMeta());
|
|
31
|
+
componentSvc.registerComponentMeta(new KeystoneCreatorComponentMeta());
|
|
32
|
+
componentSvc.registerComponentMeta(new KeystoneDetailsComponentMeta());
|
|
33
|
+
componentSvc.registerComponentMeta(new KeystoneScrubberComponentMeta());
|
|
34
|
+
componentSvc.registerComponentMeta(new AddDeviceComponentMeta());
|
|
35
|
+
componentSvc.registerComponentMeta(new RemoveDeviceComponentMeta());
|
|
36
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
margin: 1rem auto;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
h2 {
|
|
8
|
+
margin-top: 0;
|
|
9
|
+
font-size: 1.5rem;
|
|
10
|
+
color: var(--clr-accent, #50fa7b);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.subtitle {
|
|
14
|
+
color: var(--clr-text-secondary, #a6adc8);
|
|
15
|
+
font-size: 0.95rem;
|
|
16
|
+
margin: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content {
|
|
20
|
+
margin-top: 1.5rem;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: 1.5rem;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.input-group {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
gap: 0.5rem;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.input-group label {
|
|
33
|
+
font-size: 0.85rem;
|
|
34
|
+
color: var(--clr-text-secondary, #a6adc8);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.action-row {
|
|
38
|
+
margin-top: 1rem;
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.action-btn {
|
|
43
|
+
width: 100%;
|
|
44
|
+
padding: 0.85rem 1.5rem;
|
|
45
|
+
border: none;
|
|
46
|
+
border-radius: 8px;
|
|
47
|
+
background: linear-gradient(135deg, #50fa7b, #40c767);
|
|
48
|
+
color: #11111b;
|
|
49
|
+
font-size: 1rem;
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
transition: transform 0.15s ease, opacity 0.15s ease;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.action-btn:hover {
|
|
56
|
+
transform: translateY(-1px);
|
|
57
|
+
opacity: 0.95;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.action-btn:active {
|
|
61
|
+
transform: translateY(0);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.status-area {
|
|
65
|
+
margin-top: 0.5rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.status-area.hidden {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.result-area {
|
|
73
|
+
padding: 1.5rem;
|
|
74
|
+
background: rgba(255, 255, 255, 0.03);
|
|
75
|
+
border: 1px solid var(--clr-border, rgba(255, 255, 255, 0.1));
|
|
76
|
+
border-radius: var(--radius-md, 8px);
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: 0.75rem;
|
|
80
|
+
transition: opacity var(--t-med, 0.2s ease);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.result-area.collapsed {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.address-label {
|
|
88
|
+
font-size: 0.8rem;
|
|
89
|
+
color: var(--clr-text-secondary, #a6adc8);
|
|
90
|
+
margin: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.warning {
|
|
94
|
+
font-size: 0.8rem;
|
|
95
|
+
color: var(--clr-warn, #f38ba8);
|
|
96
|
+
margin: 0.5rem 0 0;
|
|
97
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<div id="container" class="component-container">
|
|
2
|
+
<h2 id="title">Create Account</h2>
|
|
3
|
+
<div class="content">
|
|
4
|
+
<p class="subtitle">Create your sovereign identity and register it to begin.</p>
|
|
5
|
+
|
|
6
|
+
<div class="input-group">
|
|
7
|
+
<label for="input-username">Username</label>
|
|
8
|
+
<input type="text" id="input-username" placeholder="Enter your username..." class="text-input">
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="input-group">
|
|
12
|
+
<label for="input-description">Description (Optional)</label>
|
|
13
|
+
<input type="text" id="input-description" placeholder="Enter an optional description..." class="text-input">
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="input-group">
|
|
17
|
+
<label for="input-email">Primary Email (Optional)</label>
|
|
18
|
+
<input type="email" id="input-email" placeholder="Enter your primary email address..." class="text-input">
|
|
19
|
+
<span class="privacy-note" style="font-size: 0.78rem; color: #a6adc8; margin-top: 0.25rem;">ℹ️ Primary email is optional and used for account discovery. If provided, it is linked to your public identity graph.</span>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<div class="input-group">
|
|
23
|
+
<label for="input-secret">Master Secret (Keep this private!)</label>
|
|
24
|
+
<input type="password" id="input-secret" placeholder="Enter your master secret..." class="secret-input">
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="checkbox-group" style="margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem;">
|
|
28
|
+
<input type="checkbox" id="checkbox-make-active" checked style="cursor: pointer; width: 1rem; height: 1rem;">
|
|
29
|
+
<label for="checkbox-make-active" style="cursor: pointer; font-size: 0.9rem; user-select: none;">Make this the active identity</label>
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<div class="action-row">
|
|
33
|
+
<button id="btn-generate" class="action-btn">Generate Identity Keystone</button>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="switch-workflow" style="margin-top: 1.2rem; text-align: center; font-size: 0.9rem; color: #a6adc8;">
|
|
37
|
+
Already have an account? <button id="btn-switch-sign-in" class="link-btn" style="background: none; border: none; color: #89b4fa; font-weight: 600; cursor: pointer; text-decoration: underline; padding: 0; font-size: 0.9rem;">Sign In</button>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div id="status-area" class="status-area hidden">
|
|
41
|
+
<p id="status-text" class="status-msg"></p>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<div id="result-area" class="result-area collapsed">
|
|
45
|
+
<h3>New Keystone Generated!</h3>
|
|
46
|
+
<p class="address-label">Address:</p>
|
|
47
|
+
<code id="keystone-addr" class="keystone-addr"></code>
|
|
48
|
+
<p class="warning">⚠️ Store this address safely. It is your root identity for this space.</p>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import thisCss from "./keystone-creator.css";
|
|
2
|
+
import thisHtml from "./keystone-creator.html";
|
|
3
|
+
import commonComponentStylesCss from "../../common-component-styles.css";
|
|
4
|
+
|
|
5
|
+
import { delay, extractErrorMsg, hash } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
6
|
+
import { HashAlgorithm } from "@ibgib/helper-gib/dist/helpers/utils-helper.mjs";
|
|
7
|
+
import { IbGibAddr } from "@ibgib/ts-gib/dist/types.mjs";
|
|
8
|
+
import { IbGib_V1 } from "@ibgib/ts-gib/dist/V1/types.mjs";
|
|
9
|
+
import { getIbGibAddr } from "@ibgib/ts-gib/dist/helper.mjs";
|
|
10
|
+
import { KeystoneService_V1 } from "@ibgib/core-gib/dist/keystone/keystone-service-v1.mjs";
|
|
11
|
+
import {
|
|
12
|
+
KeystonePoolConfig, KeystoneChallengeType, KeystoneReplenishStrategy
|
|
13
|
+
} from "@ibgib/core-gib/dist/keystone/keystone-types.mjs";
|
|
14
|
+
import { KeystoneProfileBuilder } from "@ibgib/core-gib/dist/keystone/policy/keystone-profile-builder.mjs";
|
|
15
|
+
import { getGlobalMetaspace_waitIfNeeded, getLocalCoupledIbGibForDomainIbGib } from "../../../../helpers.mjs";
|
|
16
|
+
import {
|
|
17
|
+
IbGibDynamicComponentMetaBase, IbGibFormInstanceBase,
|
|
18
|
+
} from "../../ibgib-dynamic-component-bases.mjs";
|
|
19
|
+
import {
|
|
20
|
+
ElementsBase, IbGibDynamicComponentInstance,
|
|
21
|
+
IbGibDynamicComponentInstanceInitOpts,
|
|
22
|
+
} from "../../component-types.mjs";
|
|
23
|
+
|
|
24
|
+
import { getComponentCtorArg } from "../../../../app-bootstrap/init-orchestration.mjs";
|
|
25
|
+
import { getApiBridge } from "../../../../api/ibgib-api-bridge.mjs";
|
|
26
|
+
|
|
27
|
+
import {
|
|
28
|
+
createSettings, getSectionName, getSettingsScope
|
|
29
|
+
} from "../../../../common/settings/settings-helpers.mjs";
|
|
30
|
+
import { SettingsType } from "../../../../common/settings/settings-constants.mjs";
|
|
31
|
+
import { SettingsIbGib_V1 } from "../../../../common/settings/settings-types.mjs";
|
|
32
|
+
import { updateSpecialIndex, mut8Timeline } from "@ibgib/core-gib/dist/timeline/timeline-api.mjs";
|
|
33
|
+
import { toDto } from "@ibgib/core-gib/dist/common/other/ibgib-helper.mjs";
|
|
34
|
+
import { validateEmail } from "@ibgib/core-gib/dist/keystone/keystone-helpers.mjs";
|
|
35
|
+
import { KEYSTONE_USERNAME_REGEXP, KEYSTONE_DESCRIPTION_REGEXP, KEYSTONE_VERB_SYNC, KEYSTONE_VERB_CONNECT } from "@ibgib/core-gib/dist/keystone/keystone-constants.mjs";
|
|
36
|
+
import { EVENT_IBGIB_IDENTITY_REQUEST_CHANGE, EVENT_IBGIB_UI_MESSAGE } from "../../../ui-constants.mjs";
|
|
37
|
+
import { deriveDelegateSecret } from "@ibgib/core-gib/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mjs";
|
|
38
|
+
|
|
39
|
+
export const KEYSTONE_CREATOR_COMPONENT_NAME = 'ibgib-keystone-creator';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Metadata for the Keystone Creator component.
|
|
43
|
+
*/
|
|
44
|
+
export class KeystoneCreatorComponentMeta extends IbGibDynamicComponentMetaBase {
|
|
45
|
+
protected lc: string = `[KeystoneCreatorComponentMeta]`;
|
|
46
|
+
|
|
47
|
+
routeRegExp?: RegExp = new RegExp(`^${KEYSTONE_CREATOR_COMPONENT_NAME}$`);
|
|
48
|
+
componentName = KEYSTONE_CREATOR_COMPONENT_NAME;
|
|
49
|
+
|
|
50
|
+
constructor() {
|
|
51
|
+
super(getComponentCtorArg());
|
|
52
|
+
if (!customElements.get(this.componentName)) {
|
|
53
|
+
customElements.define(this.componentName, KeystoneCreatorComponentInstance);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async createInstance({
|
|
58
|
+
path,
|
|
59
|
+
ibGibAddr
|
|
60
|
+
}: {
|
|
61
|
+
path: string;
|
|
62
|
+
ibGibAddr: IbGibAddr;
|
|
63
|
+
}): Promise<IbGibDynamicComponentInstance> {
|
|
64
|
+
const lc = `${this.lc}[${this.createInstance.name}]`;
|
|
65
|
+
const component = document.createElement(this.componentName) as KeystoneCreatorComponentInstance;
|
|
66
|
+
await component.initialize({
|
|
67
|
+
ibGibAddr,
|
|
68
|
+
meta: this,
|
|
69
|
+
html: thisHtml,
|
|
70
|
+
css: [commonComponentStylesCss, thisCss],
|
|
71
|
+
});
|
|
72
|
+
return component;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* References to DOM elements within the component's shadow root.
|
|
78
|
+
*/
|
|
79
|
+
interface KeystoneCreatorElements extends ElementsBase {
|
|
80
|
+
containerEl: HTMLDivElement;
|
|
81
|
+
titleEl: HTMLHeadingElement;
|
|
82
|
+
btnGenerateEl: HTMLButtonElement;
|
|
83
|
+
resultAreaEl: HTMLDivElement;
|
|
84
|
+
keystoneAddrEl: HTMLElement;
|
|
85
|
+
inputUsername: HTMLInputElement;
|
|
86
|
+
inputDescription: HTMLInputElement;
|
|
87
|
+
inputEmail: HTMLInputElement;
|
|
88
|
+
inputSecret: HTMLInputElement;
|
|
89
|
+
checkboxMakeActive: HTMLInputElement;
|
|
90
|
+
statusArea: HTMLDivElement;
|
|
91
|
+
statusText: HTMLParagraphElement;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Concrete implementation of the Keystone Creator component.
|
|
96
|
+
*/
|
|
97
|
+
export class KeystoneCreatorComponentInstance
|
|
98
|
+
extends IbGibFormInstanceBase<IbGib_V1, KeystoneCreatorElements>
|
|
99
|
+
implements IbGibDynamicComponentInstance<IbGib_V1, KeystoneCreatorElements> {
|
|
100
|
+
|
|
101
|
+
protected lc: string = `[KeystoneCreatorComponentInstance]`;
|
|
102
|
+
private hasExistingIdentities = false;
|
|
103
|
+
|
|
104
|
+
constructor() {
|
|
105
|
+
super();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
override async initialize(opts: IbGibDynamicComponentInstanceInitOpts): Promise<void> {
|
|
109
|
+
await super.initialize(opts);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
override async created(): Promise<void> {
|
|
113
|
+
this.elements = {} as KeystoneCreatorElements;
|
|
114
|
+
|
|
115
|
+
this.elements.containerEl = this.shadowRoot!.getElementById('container') as HTMLDivElement;
|
|
116
|
+
this.elements.titleEl = this.shadowRoot!.getElementById('title') as HTMLHeadingElement;
|
|
117
|
+
this.elements.btnGenerateEl = this.shadowRoot!.getElementById('btn-generate') as HTMLButtonElement;
|
|
118
|
+
this.elements.resultAreaEl = this.shadowRoot!.getElementById('result-area') as HTMLDivElement;
|
|
119
|
+
this.elements.keystoneAddrEl = this.shadowRoot!.getElementById('keystone-addr') as HTMLElement;
|
|
120
|
+
this.elements.inputUsername = this.shadowRoot!.getElementById('input-username') as HTMLInputElement;
|
|
121
|
+
this.elements.inputDescription = this.shadowRoot!.getElementById('input-description') as HTMLInputElement;
|
|
122
|
+
this.elements.inputEmail = this.shadowRoot!.getElementById('input-email') as HTMLInputElement;
|
|
123
|
+
this.elements.inputSecret = this.shadowRoot!.getElementById('input-secret') as HTMLInputElement;
|
|
124
|
+
this.elements.checkboxMakeActive = this.shadowRoot!.getElementById('checkbox-make-active') as HTMLInputElement;
|
|
125
|
+
this.elements.statusArea = this.shadowRoot!.getElementById('status-area') as HTMLDivElement;
|
|
126
|
+
this.elements.statusText = this.shadowRoot!.getElementById('status-text') as HTMLParagraphElement;
|
|
127
|
+
|
|
128
|
+
// ElementBase requires contentEl
|
|
129
|
+
this.elements.contentEl = this.elements.containerEl;
|
|
130
|
+
|
|
131
|
+
this.initHandlers();
|
|
132
|
+
|
|
133
|
+
if (this.ibGibAddr && !this.ibGib) {
|
|
134
|
+
await this.loadIbGib();
|
|
135
|
+
}
|
|
136
|
+
await this.checkExistingIdentities();
|
|
137
|
+
await this.renderUI();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
private async checkExistingIdentities() {
|
|
141
|
+
const lc = `${this.lc}[checkExistingIdentities]`;
|
|
142
|
+
try {
|
|
143
|
+
const metaspace = await getGlobalMetaspace_waitIfNeeded();
|
|
144
|
+
const space = await metaspace.getLocalUserSpace({});
|
|
145
|
+
if (space) {
|
|
146
|
+
const keystonesIndex = await metaspace.getSpecialIbGib({
|
|
147
|
+
type: "keystones",
|
|
148
|
+
space,
|
|
149
|
+
initialize: true,
|
|
150
|
+
});
|
|
151
|
+
const registeredKeystones = keystonesIndex?.rel8ns?.keystone ?? [];
|
|
152
|
+
this.hasExistingIdentities = registeredKeystones.length > 0;
|
|
153
|
+
}
|
|
154
|
+
} catch (error) {
|
|
155
|
+
console.warn(`${lc} Error checking existing identities: ${extractErrorMsg(error)}`);
|
|
156
|
+
this.hasExistingIdentities = false;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const checkbox = this.elements!.checkboxMakeActive;
|
|
160
|
+
if (checkbox) {
|
|
161
|
+
if (!this.hasExistingIdentities) {
|
|
162
|
+
checkbox.checked = true;
|
|
163
|
+
checkbox.disabled = true;
|
|
164
|
+
checkbox.title = "At least one active identity is required.";
|
|
165
|
+
} else {
|
|
166
|
+
checkbox.disabled = false;
|
|
167
|
+
checkbox.title = "";
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
override async disconnected(): Promise<void> {
|
|
173
|
+
// cleanup if needed
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private initHandlers() {
|
|
177
|
+
this.elements!.btnGenerateEl.addEventListener('click', () => this.handleGenerate());
|
|
178
|
+
|
|
179
|
+
this.shadowRoot!.getElementById('btn-switch-sign-in')?.addEventListener('click', (e) => {
|
|
180
|
+
e.preventDefault();
|
|
181
|
+
window.dispatchEvent(new CustomEvent(EVENT_IBGIB_UI_MESSAGE, {
|
|
182
|
+
detail: { action: 'show-add-device' },
|
|
183
|
+
bubbles: true,
|
|
184
|
+
composed: true
|
|
185
|
+
}));
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Clear invalid styling when user inputs text
|
|
189
|
+
this.elements!.inputUsername.addEventListener('input', () => {
|
|
190
|
+
this.elements!.inputUsername.classList.remove('invalid');
|
|
191
|
+
});
|
|
192
|
+
this.elements!.inputDescription.addEventListener('input', () => {
|
|
193
|
+
this.elements!.inputDescription.classList.remove('invalid');
|
|
194
|
+
});
|
|
195
|
+
this.elements!.inputEmail.addEventListener('input', () => {
|
|
196
|
+
this.elements!.inputEmail.classList.remove('invalid');
|
|
197
|
+
});
|
|
198
|
+
this.elements!.inputSecret.addEventListener('input', () => {
|
|
199
|
+
this.elements!.inputSecret.classList.remove('invalid');
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private setButtonLoading(isLoading: boolean) {
|
|
204
|
+
const btn = this.shadowRoot?.getElementById('btn-generate') as HTMLButtonElement | null;
|
|
205
|
+
if (btn) {
|
|
206
|
+
btn.disabled = isLoading;
|
|
207
|
+
btn.textContent = isLoading ? 'Generating...' : 'Generate Identity Keystone';
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Triggered by the "Generate" button.
|
|
213
|
+
* Orchestrates: Secret -> Local Genesis -> Graph Collection -> Server Sync.
|
|
214
|
+
*/
|
|
215
|
+
protected async handleGenerate() {
|
|
216
|
+
const lc = `${this.lc}[${this.handleGenerate.name}]`;
|
|
217
|
+
try {
|
|
218
|
+
console.log(`${lc} starting genesis orchestration...`);
|
|
219
|
+
const humanEyeDelay = 500;
|
|
220
|
+
this.setStatus("Initializing genesis...", "info");
|
|
221
|
+
|
|
222
|
+
const username = this.elements!.inputUsername.value.trim();
|
|
223
|
+
this.elements!.inputUsername.value = username;
|
|
224
|
+
|
|
225
|
+
// Validate Username using base class validation plumbing
|
|
226
|
+
if (!this.validateInputPattern({
|
|
227
|
+
input: this.elements!.inputUsername,
|
|
228
|
+
pattern: KEYSTONE_USERNAME_REGEXP,
|
|
229
|
+
errorMessage: "Username must be 1-63 characters (alphanumeric, underscores, hyphens, dots).",
|
|
230
|
+
required: true
|
|
231
|
+
})) {
|
|
232
|
+
this.setStatus("Invalid username. Must be 1-63 characters (alphanumeric, _, -, .).", "error");
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const description = this.elements!.inputDescription.value.trim();
|
|
237
|
+
this.elements!.inputDescription.value = description;
|
|
238
|
+
|
|
239
|
+
if (!this.validateInputPattern({
|
|
240
|
+
input: this.elements!.inputDescription,
|
|
241
|
+
pattern: KEYSTONE_DESCRIPTION_REGEXP,
|
|
242
|
+
errorMessage: "Description must be 0-128 characters and consist of English characters and common punctuation.",
|
|
243
|
+
required: false
|
|
244
|
+
})) {
|
|
245
|
+
this.setStatus("Invalid description. Alphanumeric + common punctuation, max 128 chars.", "error");
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Validate Primary Email (Optional)
|
|
250
|
+
const email = this.elements!.inputEmail.value.trim();
|
|
251
|
+
this.elements!.inputEmail.value = email;
|
|
252
|
+
if (email && !validateEmail(email)) {
|
|
253
|
+
this.elements!.inputEmail.classList.add('invalid');
|
|
254
|
+
this.setStatus("Invalid email address format.", "error");
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const masterSecret = this.elements!.inputSecret.value.trim();
|
|
259
|
+
if (!masterSecret) {
|
|
260
|
+
this.elements!.inputSecret.classList.add('invalid');
|
|
261
|
+
this.setStatus("Please enter a master secret.", "error");
|
|
262
|
+
return;
|
|
263
|
+
} else {
|
|
264
|
+
this.elements!.inputSecret.classList.remove('invalid');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
this.setButtonLoading(true);
|
|
268
|
+
this.showBusy({
|
|
269
|
+
isBusy: true,
|
|
270
|
+
title: 'Checking Email Availability...',
|
|
271
|
+
msg: 'Checking server identity index...',
|
|
272
|
+
animationEmoji: '🔍'
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// 0. Pre-check email availability on server before generating local keystone
|
|
276
|
+
if (email) {
|
|
277
|
+
const resCheck = await getApiBridge().checkEmailAvailability({ email });
|
|
278
|
+
if (!resCheck.available) {
|
|
279
|
+
const msg = resCheck.message || "Email/Identity is already registered.";
|
|
280
|
+
console.error(`${lc} ${msg}`);
|
|
281
|
+
this.setStatus(msg, "error");
|
|
282
|
+
this.showBusy({ isBusy: false });
|
|
283
|
+
this.setButtonLoading(false);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
this.showBusy({
|
|
289
|
+
isBusy: true,
|
|
290
|
+
title: 'Generating Identity...',
|
|
291
|
+
msg: 'Preparing configuration and policy options...',
|
|
292
|
+
animationEmoji: '⚙️'
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
// 1. Prepare Primary/Domain Keystone Configs
|
|
296
|
+
const builder = KeystoneProfileBuilder.buildKeystone('domain')
|
|
297
|
+
.withUsername(username)
|
|
298
|
+
.withDescription(description);
|
|
299
|
+
if (email) {
|
|
300
|
+
builder.withEmails([email]);
|
|
301
|
+
}
|
|
302
|
+
builder.withDetails({
|
|
303
|
+
client: 'space-gib-web',
|
|
304
|
+
role: 'domain-identity'
|
|
305
|
+
});
|
|
306
|
+
const configs = await builder.compileConfigs();
|
|
307
|
+
|
|
308
|
+
// 2. Get local services
|
|
309
|
+
const metaspace = await getGlobalMetaspace_waitIfNeeded();
|
|
310
|
+
const space = await metaspace.getLocalUserSpace({});
|
|
311
|
+
if (!space) { throw new Error("No default space found in metaspace."); }
|
|
312
|
+
|
|
313
|
+
// 3. Perform Genesis (Local)
|
|
314
|
+
this.showBusy({
|
|
315
|
+
isBusy: true,
|
|
316
|
+
title: 'Generating Identity...',
|
|
317
|
+
msg: 'Generating cryptographic domain identity keys...',
|
|
318
|
+
animationEmoji: '🔑'
|
|
319
|
+
});
|
|
320
|
+
const keystoneService = new KeystoneService_V1();
|
|
321
|
+
const keystoneIbGib = await keystoneService.genesis({
|
|
322
|
+
masterSecret,
|
|
323
|
+
emails: email ? [email] : undefined,
|
|
324
|
+
configs,
|
|
325
|
+
metaspace,
|
|
326
|
+
space,
|
|
327
|
+
frameDetails: builder.getFrameDetails(),
|
|
328
|
+
isPrimary: true
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
const addr = getIbGibAddr({ ibGib: keystoneIbGib });
|
|
332
|
+
console.log(`${lc} local genesis complete: ${addr}`);
|
|
333
|
+
await delay(humanEyeDelay); // for human eyes, not needed for functionality
|
|
334
|
+
this.setStatus("Local genesis complete. Creating sync delegate...", "info");
|
|
335
|
+
console.log(`✓ Local genesis complete: ${addr}`);
|
|
336
|
+
|
|
337
|
+
// Automatically generate Sync Delegate Keystone
|
|
338
|
+
this.showBusy({
|
|
339
|
+
isBusy: true,
|
|
340
|
+
title: 'Creating Sync Delegate...',
|
|
341
|
+
msg: 'Generating cryptographic sync delegate keys...',
|
|
342
|
+
animationEmoji: '🔑'
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
const delegateSecret = await deriveDelegateSecret({ masterSecret });
|
|
346
|
+
const delegateBuilder = KeystoneProfileBuilder.buildKeystone('sync')
|
|
347
|
+
.withUsername(`${username}-sync`)
|
|
348
|
+
.withDescription(`Sync Delegate for ${username}`)
|
|
349
|
+
.withDetails({
|
|
350
|
+
client: 'space-gib-web',
|
|
351
|
+
role: 'sync-delegate'
|
|
352
|
+
});
|
|
353
|
+
const delegateConfigs = await delegateBuilder.compileConfigs();
|
|
354
|
+
|
|
355
|
+
const delegateKeystoneIbGib = await keystoneService.genesis({
|
|
356
|
+
masterSecret: delegateSecret,
|
|
357
|
+
configs: delegateConfigs,
|
|
358
|
+
metaspace,
|
|
359
|
+
space,
|
|
360
|
+
frameDetails: delegateBuilder.getFrameDetails()
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
const delegateAddr = getIbGibAddr({ ibGib: delegateKeystoneIbGib });
|
|
364
|
+
console.log(`${lc} sync delegate genesis complete: ${delegateAddr}`);
|
|
365
|
+
await delay(humanEyeDelay);
|
|
366
|
+
|
|
367
|
+
// Register delegate on parent
|
|
368
|
+
this.setStatus("Registering delegate on parent...", "info");
|
|
369
|
+
this.showBusy({
|
|
370
|
+
isBusy: true,
|
|
371
|
+
title: 'Registering Delegate...',
|
|
372
|
+
msg: 'Evolving domain identity to register delegate...',
|
|
373
|
+
animationEmoji: '📝'
|
|
374
|
+
});
|
|
375
|
+
const evolvedParentKeystoneIbGib = await keystoneService.registerDelegate({
|
|
376
|
+
parentKeystone: keystoneIbGib,
|
|
377
|
+
delegateKeystone: delegateKeystoneIbGib,
|
|
378
|
+
masterSecret,
|
|
379
|
+
metaspace,
|
|
380
|
+
space,
|
|
381
|
+
allowedVerbs: [KEYSTONE_VERB_SYNC, KEYSTONE_VERB_CONNECT]
|
|
382
|
+
});
|
|
383
|
+
const evolvedParentAddr = getIbGibAddr({ ibGib: evolvedParentKeystoneIbGib });
|
|
384
|
+
console.log(`${lc} delegate registered. evolved parent address: ${evolvedParentAddr}`);
|
|
385
|
+
await delay(humanEyeDelay);
|
|
386
|
+
|
|
387
|
+
// 4. Post to Server
|
|
388
|
+
console.log(`Posting genesis keystone to server...`);
|
|
389
|
+
this.setStatus("Syncing genesis to server...", "info");
|
|
390
|
+
this.showBusy({
|
|
391
|
+
isBusy: true,
|
|
392
|
+
title: 'Syncing to Server...',
|
|
393
|
+
msg: [
|
|
394
|
+
'Posting genesis keystone to server sync node...',
|
|
395
|
+
'(may take awhile, depending on strength of keystone...)',
|
|
396
|
+
].join('\n'),
|
|
397
|
+
animationEmoji: '🔄'
|
|
398
|
+
});
|
|
399
|
+
const resSync = await getApiBridge().postGenesisKeystone(keystoneIbGib);
|
|
400
|
+
if (!resSync.success) {
|
|
401
|
+
const msg = `Sync failed: ${resSync.message}`;
|
|
402
|
+
console.error(`${lc} ${msg}`);
|
|
403
|
+
this.setStatus(msg, "error");
|
|
404
|
+
this.showBusy({ isBusy: false });
|
|
405
|
+
this.setButtonLoading(false);
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// Post evolved keystone + delegate keystone
|
|
410
|
+
this.setStatus("Syncing delegate registration to server...", "info");
|
|
411
|
+
this.showBusy({
|
|
412
|
+
isBusy: true,
|
|
413
|
+
title: 'Syncing Delegate...',
|
|
414
|
+
msg: 'Posting evolved domain identity and sync delegate to server...',
|
|
415
|
+
animationEmoji: '🔄'
|
|
416
|
+
});
|
|
417
|
+
const resEvolve = await getApiBridge().putEvolveKeystone({
|
|
418
|
+
domainAddr: addr,
|
|
419
|
+
keystoneIbGib: evolvedParentKeystoneIbGib,
|
|
420
|
+
relatedKeystoneIbGibs: [delegateKeystoneIbGib]
|
|
421
|
+
});
|
|
422
|
+
if (!resEvolve.success) {
|
|
423
|
+
const msg = `Delegate registration sync failed: ${resEvolve.message}`;
|
|
424
|
+
console.error(`${lc} ${msg}`);
|
|
425
|
+
this.setStatus(msg, "error");
|
|
426
|
+
this.showBusy({ isBusy: false });
|
|
427
|
+
this.setButtonLoading(false);
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// 5. Register with the keystones special index
|
|
432
|
+
this.showBusy({
|
|
433
|
+
isBusy: true,
|
|
434
|
+
title: 'Registering Identity...',
|
|
435
|
+
msg: 'Server sync succeeded!\nUpdating local identity indexes and scope settings...',
|
|
436
|
+
animationEmoji: '💾'
|
|
437
|
+
});
|
|
438
|
+
await delay(humanEyeDelay); // for human eyes, not needed for functionality
|
|
439
|
+
await updateSpecialIndex({
|
|
440
|
+
type: "keystones",
|
|
441
|
+
rel8nInfos: [
|
|
442
|
+
{
|
|
443
|
+
rel8nName: "keystone",
|
|
444
|
+
ibGibs: [
|
|
445
|
+
toDto({ ibGib: evolvedParentKeystoneIbGib }),
|
|
446
|
+
toDto({ ibGib: delegateKeystoneIbGib })
|
|
447
|
+
],
|
|
448
|
+
},
|
|
449
|
+
],
|
|
450
|
+
metaspace,
|
|
451
|
+
space,
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// Expose for dev tools
|
|
455
|
+
(window as any).dev_domainI = evolvedParentKeystoneIbGib;
|
|
456
|
+
(window as any).dev_domainIMasterSecret = masterSecret;
|
|
457
|
+
(window as any).dev_syncDelegate = delegateKeystoneIbGib;
|
|
458
|
+
(window as any).dev_syncDelegateSecret = delegateSecret;
|
|
459
|
+
|
|
460
|
+
// 6. Request to make the new identity active if the checkbox is checked
|
|
461
|
+
const makeActive = this.elements!.checkboxMakeActive?.checked;
|
|
462
|
+
if (makeActive) {
|
|
463
|
+
window.dispatchEvent(new CustomEvent(EVENT_IBGIB_IDENTITY_REQUEST_CHANGE, {
|
|
464
|
+
detail: { activeIdentityAddr: evolvedParentAddr },
|
|
465
|
+
bubbles: true,
|
|
466
|
+
composed: true
|
|
467
|
+
}));
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// 7. Success
|
|
471
|
+
this.elements!.keystoneAddrEl.textContent = evolvedParentAddr;
|
|
472
|
+
this.elements!.statusArea.classList.remove('hidden');
|
|
473
|
+
this.setStatus("Keystone successfully created and synced!", "success");
|
|
474
|
+
await delay(humanEyeDelay); // for human eyes, not needed for functionality
|
|
475
|
+
console.log(`✓ Keystone successfully created and synced!`);
|
|
476
|
+
|
|
477
|
+
} catch (error) {
|
|
478
|
+
const emsg = extractErrorMsg(error);
|
|
479
|
+
console.error(`${lc} ${emsg}`, error);
|
|
480
|
+
this.setStatus(`Error: ${emsg}`, "error");
|
|
481
|
+
} finally {
|
|
482
|
+
this.showBusy({
|
|
483
|
+
isBusy: false,
|
|
484
|
+
submitBtnSelector: '#btn-generate'
|
|
485
|
+
});
|
|
486
|
+
this.setButtonLoading(false);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
protected override async renderUI(): Promise<void> {
|
|
491
|
+
// No complex rendering needed for this simple creator component yet
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
override async handleContextUpdated(): Promise<void> {
|
|
495
|
+
await this.renderUI();
|
|
496
|
+
}
|
|
497
|
+
}
|