@ibgib/core-gib 0.1.61 → 0.1.63

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.
Files changed (100) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/keystone/keystone-constants.d.mts +0 -1
  3. package/dist/keystone/keystone-constants.d.mts.map +1 -1
  4. package/dist/keystone/keystone-constants.mjs +0 -1
  5. package/dist/keystone/keystone-constants.mjs.map +1 -1
  6. package/dist/keystone/keystone-helpers.d.mts +23 -1
  7. package/dist/keystone/keystone-helpers.d.mts.map +1 -1
  8. package/dist/keystone/keystone-helpers.mjs +98 -5
  9. package/dist/keystone/keystone-helpers.mjs.map +1 -1
  10. package/dist/keystone/keystone-service-v1.d.mts +39 -2
  11. package/dist/keystone/keystone-service-v1.d.mts.map +1 -1
  12. package/dist/keystone/keystone-service-v1.mjs +175 -3
  13. package/dist/keystone/keystone-service-v1.mjs.map +1 -1
  14. package/dist/keystone/keystone-service-v1.respec.mjs +397 -42
  15. package/dist/keystone/keystone-service-v1.respec.mjs.map +1 -1
  16. package/dist/keystone/keystone-types.d.mts +54 -0
  17. package/dist/keystone/keystone-types.d.mts.map +1 -1
  18. package/dist/keystone/policy/keystone-profile-builder.d.mts +1 -1
  19. package/dist/keystone/policy/keystone-profile-builder.d.mts.map +1 -1
  20. package/dist/keystone/policy/keystone-profile-builder.mjs +8 -0
  21. package/dist/keystone/policy/keystone-profile-builder.mjs.map +1 -1
  22. package/dist/keystone/policy/profiles/profile-domain.json +84 -0
  23. package/dist/keystone/policy/profiles/profile-sync.json +84 -0
  24. package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.d.mts +8 -0
  25. package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.d.mts.map +1 -1
  26. package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mjs +15 -1
  27. package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mjs.map +1 -1
  28. package/dist/sync/sync-conflict-adv-multitimelines.withid.respec.mjs +16 -4
  29. package/dist/sync/sync-conflict-adv-multitimelines.withid.respec.mjs.map +1 -1
  30. package/dist/sync/sync-conflict-basic-divergence.withid.respec.mjs +4 -1
  31. package/dist/sync/sync-conflict-basic-divergence.withid.respec.mjs.map +1 -1
  32. package/dist/sync/sync-conflict-basic-multitimelines.withid.respec.mjs +4 -1
  33. package/dist/sync/sync-conflict-basic-multitimelines.withid.respec.mjs.map +1 -1
  34. package/dist/sync/sync-conflict-text-merge.withid.respec.mjs +10 -4
  35. package/dist/sync/sync-conflict-text-merge.withid.respec.mjs.map +1 -1
  36. package/dist/sync/sync-innerspace-constants.withid.respec.mjs +12 -3
  37. package/dist/sync/sync-innerspace-constants.withid.respec.mjs.map +1 -1
  38. package/dist/sync/sync-innerspace-deep-updates.withid.respec.mjs +4 -1
  39. package/dist/sync/sync-innerspace-deep-updates.withid.respec.mjs.map +1 -1
  40. package/dist/sync/sync-innerspace-dest-ahead.withid.respec.mjs +4 -1
  41. package/dist/sync/sync-innerspace-dest-ahead.withid.respec.mjs.map +1 -1
  42. package/dist/sync/sync-innerspace-multiple-timelines.withid.respec.mjs +4 -1
  43. package/dist/sync/sync-innerspace-multiple-timelines.withid.respec.mjs.map +1 -1
  44. package/dist/sync/sync-innerspace-partial-update.withid.respec.mjs +4 -1
  45. package/dist/sync/sync-innerspace-partial-update.withid.respec.mjs.map +1 -1
  46. package/dist/sync/sync-innerspace.withid.respec.mjs +4 -1
  47. package/dist/sync/sync-innerspace.withid.respec.mjs.map +1 -1
  48. package/dist/sync/sync-peer/sync-peer-types.d.mts +4 -0
  49. package/dist/sync/sync-peer/sync-peer-types.d.mts.map +1 -1
  50. package/dist/sync/sync-peer/sync-peer-v1.d.mts.map +1 -1
  51. package/dist/sync/sync-peer/sync-peer-v1.mjs +4 -1
  52. package/dist/sync/sync-peer/sync-peer-v1.mjs.map +1 -1
  53. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.d.mts.map +1 -1
  54. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.mjs +90 -22
  55. package/dist/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.mjs.map +1 -1
  56. package/dist/sync/sync-saga-coordinator.d.mts +7 -10
  57. package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
  58. package/dist/sync/sync-saga-coordinator.mjs +14 -5
  59. package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
  60. package/dist/sync/sync-types.d.mts +5 -0
  61. package/dist/sync/sync-types.d.mts.map +1 -1
  62. package/dist/sync/sync-types.mjs.map +1 -1
  63. package/dist/sync/sync-withid.connect.respec.mjs +4 -1
  64. package/dist/sync/sync-withid.connect.respec.mjs.map +1 -1
  65. package/dist/sync/sync-withid.establish.respec.mjs +4 -1
  66. package/dist/sync/sync-withid.establish.respec.mjs.map +1 -1
  67. package/dist/sync/sync-withid.pingpong.respec.mjs +4 -1
  68. package/dist/sync/sync-withid.pingpong.respec.mjs.map +1 -1
  69. package/package.json +1 -1
  70. package/src/keystone/README.md +15 -2
  71. package/src/keystone/docs/architecture.md +21 -2
  72. package/src/keystone/docs/delegation.md +57 -0
  73. package/src/keystone/keystone-constants.mts +0 -1
  74. package/src/keystone/keystone-helpers.mts +131 -5
  75. package/src/keystone/keystone-service-v1.mts +223 -2
  76. package/src/keystone/keystone-service-v1.respec.mts +436 -40
  77. package/src/keystone/keystone-types.mts +55 -0
  78. package/src/keystone/policy/keystone-profile-builder.mts +9 -1
  79. package/src/keystone/policy/profiles/profile-domain.json +84 -0
  80. package/src/keystone/policy/profiles/profile-sync.json +84 -0
  81. package/src/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mts +20 -1
  82. package/src/sync/sync-conflict-adv-multitimelines.withid.respec.mts +16 -4
  83. package/src/sync/sync-conflict-basic-divergence.withid.respec.mts +4 -1
  84. package/src/sync/sync-conflict-basic-multitimelines.withid.respec.mts +4 -1
  85. package/src/sync/sync-conflict-text-merge.withid.respec.mts +10 -4
  86. package/src/sync/sync-innerspace-constants.withid.respec.mts +12 -3
  87. package/src/sync/sync-innerspace-deep-updates.withid.respec.mts +4 -1
  88. package/src/sync/sync-innerspace-dest-ahead.withid.respec.mts +4 -1
  89. package/src/sync/sync-innerspace-multiple-timelines.withid.respec.mts +4 -1
  90. package/src/sync/sync-innerspace-partial-update.withid.respec.mts +4 -1
  91. package/src/sync/sync-innerspace.withid.respec.mts +4 -1
  92. package/src/sync/sync-peer/sync-peer-types.mts +4 -0
  93. package/src/sync/sync-peer/sync-peer-v1.mts +5 -1
  94. package/src/sync/sync-peer/sync-peer-websocket/sync-peer-websocket-receiver/sync-websocket-peer-helpers.mts +96 -22
  95. package/src/sync/sync-saga-coordinator.mts +17 -12
  96. package/src/sync/sync-types.mts +6 -0
  97. package/src/sync/sync-withid.connect.respec.mts +5 -2
  98. package/src/sync/sync-withid.establish.respec.mts +4 -1
  99. package/src/sync/sync-withid.pingpong.respec.mts +4 -1
  100. package/src/sync/unused-identity-backup.mts.md +0 -311
@@ -314,6 +314,55 @@ export interface KeystoneRevocationInfo {
314
314
  proof: KeystoneProof;
315
315
  }
316
316
 
317
+ /**
318
+ * Shape of info we collect about delegated keystones. We can check
319
+ * against this info later when validating any identity delegation requests.
320
+ */
321
+ export interface DelegateKeystoneInfo {
322
+ /**
323
+ * The Timeline Junction Point (TJP) address of the delegate keystone.
324
+ * Serves as its immutable, unique identifier.
325
+ */
326
+ delegateTjpAddr: IbGibAddr;
327
+ /**
328
+ * concrete addr of **DELEGATE** keystone **at the time when the
329
+ * delegate was added.**
330
+ *
331
+ * So if we have a delegate keystone at D3, then this value would be the
332
+ * addr of that D3 keystone. This will have both a `punctiliarHash` and a
333
+ * `tjpGib` in its `GibInfo`.
334
+ */
335
+ delegateAddr: IbGibAddr;
336
+ /**
337
+ * concrete keystone addr of **THIS** parent keystone **at the time
338
+ * when the delegate was added.**
339
+ *
340
+ * So if we have a delegate keystone at D3, then this value would be the
341
+ * addr of that D3 keystone. This will have both a `punctiliarHash` and a
342
+ * `tjpGib` in its `GibInfo`.
343
+ */
344
+ thisAddr: IbGibAddr;
345
+ /**
346
+ * Optional list of verbs allowed for this delegate.
347
+ * e.g. ["sync^gib"]
348
+ */
349
+ allowedVerbs?: string[];
350
+ }
351
+
352
+ /**
353
+ * Status response when checking if a delegate keystone is registered.
354
+ */
355
+ export interface DelegateKeystoneStatus {
356
+ /**
357
+ * True if the delegate is currently registered on the parent.
358
+ */
359
+ registered: boolean;
360
+ /**
361
+ * Truthy only if registered is true.
362
+ */
363
+ delegateInfo?: DelegateKeystoneInfo;
364
+ }
365
+
317
366
  // ===========================================================================
318
367
  // TOP LEVEL IBGIB DATA
319
368
  // ===========================================================================
@@ -351,6 +400,12 @@ export interface KeystoneData_V1 extends IbGibData_V1 {
351
400
  * Acts as a snapshot to avoid walking the entire timeline.
352
401
  */
353
402
  checkpointDetails?: any;
403
+
404
+ /**
405
+ * Map of delegated keystones soft-linked to this parent keystone.
406
+ * Keyed by the delegate keystone's tjp address.
407
+ */
408
+ delegates?: { [delegateTjpAddr: IbGibAddr]: DelegateKeystoneInfo };
354
409
  }
355
410
 
356
411
  export interface KeystoneRel8ns_V1 extends IbGibRel8ns_V1 {
@@ -8,6 +8,8 @@ import profileMedium from "./profiles/profile-medium.json" assert { type: "json"
8
8
  import profileLow from "./profiles/profile-low.json" assert { type: "json" };
9
9
  import profileSession from "./profiles/profile-session.json" assert { type: "json" };
10
10
  import profileTest from "./profiles/profile-test.json" assert { type: "json" };
11
+ import profileDomain from "./profiles/profile-domain.json" assert { type: "json" };
12
+ import profileSync from "./profiles/profile-sync.json" assert { type: "json" };
11
13
 
12
14
  export class KeystoneProfileBuilder {
13
15
  private _template: KeystonePolicyConfigTemplate;
@@ -22,7 +24,7 @@ export class KeystoneProfileBuilder {
22
24
  this._template = JSON.parse(JSON.stringify(template));
23
25
  }
24
26
 
25
- static buildKeystone(profileName: 'high' | 'medium' | 'low' | 'session' | 'test'): KeystoneProfileBuilder {
27
+ static buildKeystone(profileName: 'high' | 'medium' | 'low' | 'session' | 'test' | 'domain' | 'sync'): KeystoneProfileBuilder {
26
28
  let selected: KeystonePolicyConfigTemplate;
27
29
  switch (profileName) {
28
30
  case 'high':
@@ -40,6 +42,12 @@ export class KeystoneProfileBuilder {
40
42
  case 'test':
41
43
  selected = profileTest as any;
42
44
  break;
45
+ case 'domain':
46
+ selected = profileDomain as any;
47
+ break;
48
+ case 'sync':
49
+ selected = profileSync as any;
50
+ break;
43
51
  default:
44
52
  throw new Error(`Unknown profile name: ${profileName} (E: fc10a8ad482ef2bda871ac567d268d26)`);
45
53
  }
@@ -0,0 +1,84 @@
1
+ {
2
+ "$schema": "../schemas/keystone.high.schema.json",
3
+ "metadata": {
4
+ "name": "Domain Identity Profile",
5
+ "securityLevel": "high"
6
+ },
7
+ "pools": {
8
+ "sync": {
9
+ "id": "sync",
10
+ "allowedVerbs": [
11
+ "sync"
12
+ ],
13
+ "algo": "SHA-512",
14
+ "rounds": 4,
15
+ "behavior": {
16
+ "size": 2000,
17
+ "replenish": "top-up",
18
+ "selectSequentially": 10,
19
+ "selectRandomly": 10,
20
+ "targetBindingCount": 16
21
+ }
22
+ },
23
+ "manage": {
24
+ "id": "manage",
25
+ "allowedVerbs": [
26
+ "manage"
27
+ ],
28
+ "algo": "SHA-512",
29
+ "rounds": 6,
30
+ "behavior": {
31
+ "size": 2000,
32
+ "replenish": "replace-all",
33
+ "selectSequentially": 12,
34
+ "selectRandomly": 12,
35
+ "targetBindingCount": 16
36
+ }
37
+ },
38
+ "revoke": {
39
+ "id": "revoke",
40
+ "allowedVerbs": [
41
+ "revoke"
42
+ ],
43
+ "algo": "SHA-512",
44
+ "rounds": 20,
45
+ "behavior": {
46
+ "size": 2000,
47
+ "replenish": "delete-all",
48
+ "selectSequentially": 50,
49
+ "selectRandomly": 50,
50
+ "targetBindingCount": 0
51
+ }
52
+ },
53
+ "connect": {
54
+ "id": "connect",
55
+ "allowedVerbs": [
56
+ "connect"
57
+ ],
58
+ "algo": "SHA-512",
59
+ "rounds": 4,
60
+ "behavior": {
61
+ "size": 2000,
62
+ "replenish": "top-up",
63
+ "selectSequentially": 10,
64
+ "selectRandomly": 10,
65
+ "targetBindingCount": 16
66
+ }
67
+ },
68
+ "sign": {
69
+ "id": "default",
70
+ "allowedVerbs": [
71
+ "sign"
72
+ ],
73
+ "algo": "SHA-512",
74
+ "rounds": 4,
75
+ "behavior": {
76
+ "size": 2000,
77
+ "replenish": "top-up",
78
+ "selectSequentially": 10,
79
+ "selectRandomly": 10,
80
+ "targetBindingCount": 16
81
+ }
82
+ }
83
+ }
84
+ }
@@ -0,0 +1,84 @@
1
+ {
2
+ "$schema": "../schemas/keystone.low.schema.json",
3
+ "metadata": {
4
+ "name": "Sync Delegate Profile",
5
+ "securityLevel": "low"
6
+ },
7
+ "pools": {
8
+ "sync": {
9
+ "id": "sync",
10
+ "allowedVerbs": [
11
+ "sync"
12
+ ],
13
+ "algo": "SHA-256",
14
+ "rounds": 1,
15
+ "behavior": {
16
+ "size": 100,
17
+ "replenish": "top-up",
18
+ "selectSequentially": 3,
19
+ "selectRandomly": 3,
20
+ "targetBindingCount": 8
21
+ }
22
+ },
23
+ "manage": {
24
+ "id": "manage",
25
+ "allowedVerbs": [
26
+ "manage"
27
+ ],
28
+ "algo": "SHA-256",
29
+ "rounds": 2,
30
+ "behavior": {
31
+ "size": 100,
32
+ "replenish": "replace-all",
33
+ "selectSequentially": 3,
34
+ "selectRandomly": 3,
35
+ "targetBindingCount": 8
36
+ }
37
+ },
38
+ "revoke": {
39
+ "id": "revoke",
40
+ "allowedVerbs": [
41
+ "revoke"
42
+ ],
43
+ "algo": "SHA-256",
44
+ "rounds": 5,
45
+ "behavior": {
46
+ "size": 100,
47
+ "replenish": "delete-all",
48
+ "selectSequentially": 3,
49
+ "selectRandomly": 3,
50
+ "targetBindingCount": 0
51
+ }
52
+ },
53
+ "connect": {
54
+ "id": "connect",
55
+ "allowedVerbs": [
56
+ "connect"
57
+ ],
58
+ "algo": "SHA-256",
59
+ "rounds": 1,
60
+ "behavior": {
61
+ "size": 100,
62
+ "replenish": "top-up",
63
+ "selectSequentially": 3,
64
+ "selectRandomly": 3,
65
+ "targetBindingCount": 8
66
+ }
67
+ },
68
+ "sign": {
69
+ "id": "default",
70
+ "allowedVerbs": [
71
+ "sign"
72
+ ],
73
+ "algo": "SHA-256",
74
+ "rounds": 2,
75
+ "behavior": {
76
+ "size": 100,
77
+ "replenish": "top-up",
78
+ "selectSequentially": 3,
79
+ "selectRandomly": 3,
80
+ "targetBindingCount": 8
81
+ }
82
+ }
83
+ }
84
+ }
@@ -1,4 +1,4 @@
1
- import { hash } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
1
+ import { hash, HashAlgorithm } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
2
2
 
3
3
  import { KeystoneStrategy } from '../keystone-strategy.mjs';
4
4
  import {
@@ -140,3 +140,22 @@ export class KeystoneStrategy_HashRevealV1 extends KeystoneStrategy<
140
140
  }
141
141
  }
142
142
  }
143
+
144
+ /**
145
+ * Derives a delegate secret from the parent's masterSecret using KDF.
146
+ * Salt is the sha512 hash of the masterSecret.
147
+ * Number of rounds is hardcoded to 1000.
148
+ */
149
+ export async function deriveDelegateSecret({
150
+ masterSecret,
151
+ }: {
152
+ masterSecret: string;
153
+ }): Promise<string> {
154
+ const salt = await hash({ s: masterSecret, algorithm: HashAlgorithm.sha_512 });
155
+ return await kdf_recursiveSaltWrap({
156
+ masterSecret,
157
+ salt,
158
+ rounds: 1000,
159
+ algorithm: HashAlgorithm.sha_512
160
+ });
161
+ }
@@ -178,7 +178,10 @@ await respecfully(sir, `Multi-round/timeline permutations with Identity`, async
178
178
  metaspace,
179
179
  domainIbGibs: [r1_alpha_v1_source_common.ibGib],
180
180
  conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
181
- senderIdentity: senderIdentityLatestSource,
181
+ senderIdentityInfo: {
182
+ senderIdentity: senderIdentityLatestSource,
183
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
184
+ },
182
185
  fnSenderSecret: async () => SENDER_SECRET,
183
186
  });
184
187
 
@@ -300,7 +303,10 @@ await respecfully(sir, `Multi-round/timeline permutations with Identity`, async
300
303
  metaspace,
301
304
  domainIbGibs: [r2_alpha_v3_source_rel8dBeta.ibGib],
302
305
  conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
303
- senderIdentity: senderIdentityLatestSource,
306
+ senderIdentityInfo: {
307
+ senderIdentity: senderIdentityLatestSource,
308
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
309
+ },
304
310
  fnSenderSecret: async () => SENDER_SECRET,
305
311
  });
306
312
  await r2_syncSaga.done;
@@ -449,7 +455,10 @@ await respecfully(sir, `Multi-round/timeline permutations with Identity`, async
449
455
  metaspace,
450
456
  domainIbGibs: [r3_alpha_v4_source_mut8fieldC.ibGib, r3_beta_v1_source.ibGib],
451
457
  conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
452
- senderIdentity: senderIdentityLatestSource,
458
+ senderIdentityInfo: {
459
+ senderIdentity: senderIdentityLatestSource,
460
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
461
+ },
453
462
  fnSenderSecret: async () => SENDER_SECRET,
454
463
  });
455
464
  await r3_syncSaga.done;
@@ -625,7 +634,10 @@ await respecfully(sir, `Multi-round/timeline permutations with Identity`, async
625
634
  metaspace,
626
635
  domainIbGibs: [r4_alpha_v7_source.ibGib, r4_gamma_v0_source.ibGib, r4_beta_v2_source.ibGib],
627
636
  conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
628
- senderIdentity: senderIdentityLatestSource,
637
+ senderIdentityInfo: {
638
+ senderIdentity: senderIdentityLatestSource,
639
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
640
+ },
629
641
  fnSenderSecret: async () => SENDER_SECRET,
630
642
  });
631
643
  await r4_syncSaga.done;
@@ -221,7 +221,10 @@ await respecfully(sir, `Sync Conflict Basic Divergence with Identity`, async ()
221
221
  metaspace,
222
222
  domainIbGibs: [v2a],
223
223
  conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
224
- senderIdentity: r1_senderIdentity_v0_source,
224
+ senderIdentityInfo: {
225
+ senderIdentity: r1_senderIdentity_v0_source,
226
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
227
+ },
225
228
  fnSenderSecret: async () => SENDER_SECRET,
226
229
  });
227
230
  await resSync.done;
@@ -254,7 +254,10 @@ await respecfully(sir, `Sync Conflict Basic Multitimelines with Identity`, async
254
254
  metaspace,
255
255
  domainIbGibs: [alpha_v3_source_rel8beta],
256
256
  conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
257
- senderIdentity: r1_senderIdentity_v0_source,
257
+ senderIdentityInfo: {
258
+ senderIdentity: r1_senderIdentity_v0_source,
259
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
260
+ },
258
261
  fnSenderSecret: async () => SENDER_SECRET,
259
262
  });
260
263
  await resSync.done;
@@ -150,9 +150,12 @@ await respecfully(sir, `Text merge (LCS) conflict resolution with Identity`, asy
150
150
  localSpace: sourceSpace,
151
151
  metaspace,
152
152
  domainIbGibs: [r1_alpha_v0_source.ibGib],
153
- conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
154
- senderIdentity: senderIdentityLatestSource,
153
+ senderIdentityInfo: {
154
+ senderIdentity: senderIdentityLatestSource,
155
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
156
+ },
155
157
  fnSenderSecret: async () => SENDER_SECRET,
158
+ conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
156
159
  });
157
160
  await r1_syncSaga.done;
158
161
  if (logalot) { console.log(`${lc} R1 Sync Complete.`); }
@@ -286,9 +289,12 @@ await respecfully(sir, `Text merge (LCS) conflict resolution with Identity`, asy
286
289
  localSpace: sourceSpace,
287
290
  metaspace,
288
291
  domainIbGibs: [r2_alpha_v1_source_appendedText.ibGib],
289
- conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
290
- senderIdentity: senderIdentityLatestSource,
292
+ senderIdentityInfo: {
293
+ senderIdentity: senderIdentityLatestSource,
294
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
295
+ },
291
296
  fnSenderSecret: async () => SENDER_SECRET,
297
+ conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
292
298
  });
293
299
  await r2_syncSaga.done;
294
300
  } catch (e) {
@@ -134,7 +134,10 @@ await respecfully(sir, `Sync Constants (No TJP) with Identity`, async () => {
134
134
  localSpace: sourceSpace,
135
135
  metaspace: metaspace,
136
136
  domainIbGibs: [r1_c1_v0_source],
137
- senderIdentity: r1_senderIdentity_v0_source,
137
+ senderIdentityInfo: {
138
+ senderIdentity: r1_senderIdentity_v0_source,
139
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
140
+ },
138
141
  fnSenderSecret: async () => SENDER_SECRET,
139
142
  });
140
143
  await resSync.done;
@@ -153,7 +156,10 @@ await respecfully(sir, `Sync Constants (No TJP) with Identity`, async () => {
153
156
  localSpace: sourceSpace,
154
157
  metaspace: metaspace,
155
158
  domainIbGibs: [r1_c1_v0_source],
156
- senderIdentity: r1_senderIdentity_v1_source_postSync1,
159
+ senderIdentityInfo: {
160
+ senderIdentity: r1_senderIdentity_v1_source_postSync1,
161
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
162
+ },
157
163
  fnSenderSecret: async () => SENDER_SECRET,
158
164
  });
159
165
  await resSync.done;
@@ -183,7 +189,10 @@ await respecfully(sir, `Sync Constants (No TJP) with Identity`, async () => {
183
189
  localSpace: sourceSpace,
184
190
  metaspace: metaspace,
185
191
  domainIbGibs: [r1_c2_v0_source_rel8C1],
186
- senderIdentity: r1_senderIdentity_v2_source_postSync2,
192
+ senderIdentityInfo: {
193
+ senderIdentity: r1_senderIdentity_v2_source_postSync2,
194
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
195
+ },
187
196
  fnSenderSecret: async () => SENDER_SECRET,
188
197
  });
189
198
  await resSync.done;
@@ -162,7 +162,10 @@ await respecfully(sir, `Sync InnerSpaces (Deep Updates) with Identity`, async ()
162
162
  localSpace: sourceSpace,
163
163
  metaspace: metaspace,
164
164
  domainIbGibs: [r1_alpha_v2_source],
165
- senderIdentity: r1_senderIdentity_v0_source,
165
+ senderIdentityInfo: {
166
+ senderIdentity: r1_senderIdentity_v0_source,
167
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
168
+ },
166
169
  fnSenderSecret: async () => SENDER_SECRET,
167
170
  });
168
171
  await resSync.done;
@@ -184,7 +184,10 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead) with Identity`, async () =
184
184
  localSpace: sourceSpace,
185
185
  metaspace: metaspace,
186
186
  domainIbGibs: [r1_alpha_v1_source],
187
- senderIdentity: r1_senderIdentity_v0_source,
187
+ senderIdentityInfo: {
188
+ senderIdentity: r1_senderIdentity_v0_source,
189
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
190
+ },
188
191
  fnSenderSecret: async () => SENDER_SECRET,
189
192
  });
190
193
  await resSync.done;
@@ -175,7 +175,10 @@ await respecfully(sir, `Sync InnerSpaces (Multiple Timelines) with Identity`, as
175
175
  localSpace: sourceSpace,
176
176
  metaspace: metaspace,
177
177
  domainIbGibs: [r1_alpha_v1_source, r1_beta_v2_source],
178
- senderIdentity: r1_senderIdentity_v0_source,
178
+ senderIdentityInfo: {
179
+ senderIdentity: r1_senderIdentity_v0_source,
180
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
181
+ },
179
182
  fnSenderSecret: async () => SENDER_SECRET,
180
183
  });
181
184
  await resSync.done;
@@ -163,7 +163,10 @@ await respecfully(sir, `Sync InnerSpaces (Partial Update) with Identity`, async
163
163
  localSpace: sourceSpace,
164
164
  metaspace: metaspace,
165
165
  domainIbGibs: [r1_alpha_v2_source],
166
- senderIdentity: r1_senderIdentity_v0_source,
166
+ senderIdentityInfo: {
167
+ senderIdentity: r1_senderIdentity_v0_source,
168
+ senderDomainAddr: getIbGibAddr({ ibGib: r1_senderIdentity_v0_source }),
169
+ },
167
170
  fnSenderSecret: async () => SENDER_SECRET,
168
171
  });
169
172
  await resSync.done;
@@ -152,7 +152,10 @@ await respecfully(sir, `Sync InnerSpaces with Identity`, async () => {
152
152
  localSpace: sourceSpace,
153
153
  metaspace: metaspace,
154
154
  domainIbGibs: [r1_alpha_v1_source], // Sync the child
155
- senderIdentity,
155
+ senderIdentityInfo: {
156
+ senderIdentity,
157
+ senderDomainAddr: getIbGibAddr({ ibGib: senderIdentity }),
158
+ },
156
159
  fnSenderSecret: async () => SENDER_SECRET,
157
160
  conflictStrategy: SyncConflictStrategy.optimisticWithLCS,
158
161
  });
@@ -89,6 +89,10 @@ export interface InitializeSyncPeerOpts {
89
89
  * together or omitted together.
90
90
  */
91
91
  senderIdentity?: KeystoneIbGib_V1;
92
+ /**
93
+ * The root Domain Identity address associated with the senderIdentity delegate.
94
+ */
95
+ senderDomainAddr?: string;
92
96
  /**
93
97
  * Returns the plaintext secret corresponding to {@link senderIdentity}.
94
98
  * Wrapped in a function to avoid holding the secret in memory longer than needed.
@@ -224,13 +224,17 @@ export abstract class SyncPeer_V1<
224
224
 
225
225
  if (!this.opts) { throw new Error(`(UNEXPECTED) this.opts falsy? Call initializeOpts first. (E: a1b2c3d4e5f6a7b8c9d0e1f2a3b4c526)`); }
226
226
 
227
- const { senderIdentity, fnSenderSecret, sagaId, localMetaspace, localSpace } = this.opts;
227
+ const { senderIdentity, fnSenderSecret, senderDomainAddr, sagaId, localMetaspace, localSpace } = this.opts;
228
228
 
229
229
  // No identity provided — anonymous sync, nothing to establish.
230
230
  if (!senderIdentity || !fnSenderSecret) {
231
231
  if (logalot) { console.log(`${lc} no senderIdentity/fnSenderSecret — skipping establish (I: f29348a77d1542326d14043ea4b69126)`); }
232
232
  return undefined;
233
233
  }
234
+
235
+ if (!senderDomainAddr) {
236
+ throw new Error(`(UNEXPECTED) senderDomainAddr falsy but senderIdentity/fnSenderSecret truthy? if identity is used, senderDomainAddr must be provided. (E: c288fa8e9d3d82fc)`);
237
+ }
234
238
  const senderIdentityAddr = getIbGibAddr({ ibGib: senderIdentity });
235
239
  const senderIdentityTjpAddr = getTjpAddr({ ibGib: senderIdentity });
236
240
  if (!senderIdentityTjpAddr) { throw new Error(`(UNEXPECTED) senderIdentityTjpAddr falsy? (E: d5d8c3ab25a83a2c127904fe96de1526)`); }