@ibgib/core-gib 0.1.43 → 0.1.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/keystone/kdf/kdf-constants.d.mts +25 -0
- package/dist/keystone/kdf/kdf-constants.d.mts.map +1 -0
- package/dist/keystone/kdf/kdf-constants.mjs +28 -0
- package/dist/keystone/kdf/kdf-constants.mjs.map +1 -0
- package/dist/keystone/kdf/kdf-helpers.d.mts +45 -0
- package/dist/keystone/kdf/kdf-helpers.d.mts.map +1 -0
- package/dist/keystone/kdf/kdf-helpers.mjs +94 -0
- package/dist/keystone/kdf/kdf-helpers.mjs.map +1 -0
- package/dist/keystone/kdf/kdf-types.d.mts +49 -0
- package/dist/keystone/kdf/kdf-types.d.mts.map +1 -0
- package/dist/keystone/kdf/kdf-types.mjs +2 -0
- package/dist/keystone/kdf/kdf-types.mjs.map +1 -0
- package/dist/keystone/keystone-config-builder.d.mts +65 -12
- package/dist/keystone/keystone-config-builder.d.mts.map +1 -1
- package/dist/keystone/keystone-config-builder.mjs +138 -46
- package/dist/keystone/keystone-config-builder.mjs.map +1 -1
- package/dist/keystone/keystone-config-builder.respec.mjs +21 -13
- package/dist/keystone/keystone-config-builder.respec.mjs.map +1 -1
- package/dist/keystone/keystone-constants.d.mts +15 -0
- package/dist/keystone/keystone-constants.d.mts.map +1 -1
- package/dist/keystone/keystone-constants.mjs +16 -0
- package/dist/keystone/keystone-constants.mjs.map +1 -1
- package/dist/keystone/keystone-helpers.d.mts +4 -4
- package/dist/keystone/keystone-helpers.d.mts.map +1 -1
- package/dist/keystone/keystone-helpers.mjs +8 -5
- package/dist/keystone/keystone-helpers.mjs.map +1 -1
- package/dist/keystone/keystone-service-v1.d.mts +1 -1
- package/dist/keystone/keystone-service-v1.d.mts.map +1 -1
- package/dist/keystone/keystone-service-v1.mjs +6 -5
- package/dist/keystone/keystone-service-v1.mjs.map +1 -1
- package/dist/keystone/keystone-service-v1.respec.mjs +72 -45
- package/dist/keystone/keystone-service-v1.respec.mjs.map +1 -1
- package/dist/keystone/keystone-types.d.mts +28 -18
- package/dist/keystone/keystone-types.d.mts.map +1 -1
- package/dist/keystone/keystone-types.mjs +26 -15
- package/dist/keystone/keystone-types.mjs.map +1 -1
- package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.d.mts.map +1 -1
- package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mjs +7 -10
- package/dist/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mjs.map +1 -1
- package/dist/sync/sync-constants.d.mts +9 -0
- package/dist/sync/sync-constants.d.mts.map +1 -1
- package/dist/sync/sync-constants.mjs +10 -0
- package/dist/sync/sync-constants.mjs.map +1 -1
- package/dist/sync/sync-innerspace-dest-ahead-withid.respec.mjs +49 -19
- package/dist/sync/sync-innerspace-dest-ahead-withid.respec.mjs.map +1 -1
- package/dist/sync/sync-saga-coordinator.d.mts +22 -11
- package/dist/sync/sync-saga-coordinator.d.mts.map +1 -1
- package/dist/sync/sync-saga-coordinator.mjs +120 -27
- package/dist/sync/sync-saga-coordinator.mjs.map +1 -1
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts +1 -7
- package/dist/sync/sync-saga-message/sync-saga-message-types.d.mts.map +1 -1
- package/dist/sync/sync-types.d.mts +11 -0
- package/dist/sync/sync-types.d.mts.map +1 -1
- package/dist/sync/sync-types.mjs.map +1 -1
- package/package.json +1 -1
- package/src/keystone/README.md +4 -3
- package/src/keystone/docs/architecture.md +3 -1
- package/src/keystone/kdf/kdf-constants.mts +34 -0
- package/src/keystone/kdf/kdf-helpers.mts +105 -0
- package/src/keystone/kdf/kdf-types.mts +58 -0
- package/src/keystone/keystone-config-builder.mts +170 -47
- package/src/keystone/keystone-config-builder.respec.mts +21 -14
- package/src/keystone/keystone-constants.mts +21 -2
- package/src/keystone/keystone-helpers.mts +19 -14
- package/src/keystone/keystone-service-v1.mts +23 -22
- package/src/keystone/keystone-service-v1.respec.mts +71 -44
- package/src/keystone/keystone-types.mts +37 -23
- package/src/keystone/strategy/hash-reveal-v1/hash-reveal-v1.mts +9 -13
- package/src/sync/sync-constants.mts +12 -0
- package/src/sync/sync-innerspace-dest-ahead-withid.respec.mts +53 -20
- package/src/sync/sync-saga-coordinator.mts +156 -31
- package/src/sync/sync-saga-message/sync-saga-message-types.mts +1 -7
- package/src/sync/sync-types.mts +12 -0
- package/tmp.md +0 -274
|
@@ -2,15 +2,25 @@ import { IbGib_V1, IbGibData_V1, IbGibRel8ns_V1 } from "@ibgib/ts-gib/dist/V1/ty
|
|
|
2
2
|
|
|
3
3
|
import { KEYSTONE_ATOM } from "./keystone-constants.mjs";
|
|
4
4
|
|
|
5
|
+
// #region KeystoneChallengeType
|
|
6
|
+
export const KEYSTONE_CHALLENGE_TYPE_HASH_REVEAL_V1 = 'hash-reveal-v1';
|
|
5
7
|
/**
|
|
6
8
|
* The discriminator for the mechanism.
|
|
7
9
|
* 'hash-reveal-v1': Standard Hash chain (Sigma-like).
|
|
8
10
|
*/
|
|
9
11
|
export type KeystoneChallengeType =
|
|
10
|
-
|
|
|
12
|
+
| typeof KEYSTONE_CHALLENGE_TYPE_HASH_REVEAL_V1
|
|
11
13
|
// | 'decrypt-v1' // Future
|
|
12
14
|
// | 'pow-v1'; // Future
|
|
13
15
|
;
|
|
16
|
+
export const KeystoneChallengeType = {
|
|
17
|
+
hash_reveal_v1: KEYSTONE_CHALLENGE_TYPE_HASH_REVEAL_V1,
|
|
18
|
+
} satisfies { [key: string]: KeystoneChallengeType };
|
|
19
|
+
export const KEYSTONE_CHALLENGE_TYPE_VALID_VALUES = Object.values(KeystoneChallengeType);
|
|
20
|
+
export function isValidKeystoneChallengeType(x: any): x is KeystoneChallengeType {
|
|
21
|
+
return typeof x === 'string' && KEYSTONE_CHALLENGE_TYPE_VALID_VALUES.includes(x as any);
|
|
22
|
+
}
|
|
23
|
+
// #endregion KeystoneChallengeType
|
|
14
24
|
|
|
15
25
|
// ===========================================================================
|
|
16
26
|
// CONFIGURATION
|
|
@@ -18,55 +28,56 @@ export type KeystoneChallengeType =
|
|
|
18
28
|
|
|
19
29
|
// #region KeystoneReplenishStrategy
|
|
20
30
|
/**
|
|
21
|
-
*
|
|
31
|
+
* @see {@link KeystoneReplenishStrategy.topUp}
|
|
22
32
|
*/
|
|
23
33
|
export const KEYSTONE_REPLENISH_STRATEGY_TOP_UP = 'top-up';
|
|
24
34
|
/**
|
|
25
|
-
*
|
|
35
|
+
* @see {@link KeystoneReplenishStrategy.replaceAll}
|
|
26
36
|
*/
|
|
27
37
|
export const KEYSTONE_REPLENISH_STRATEGY_REPLACE_ALL = 'replace-all';
|
|
28
38
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* ## intent
|
|
32
|
-
* adding this for revocation
|
|
39
|
+
* @see {@link KeystoneReplenishStrategy.consume}
|
|
33
40
|
*/
|
|
34
41
|
export const KEYSTONE_REPLENISH_STRATEGY_CONSUME = 'consume';
|
|
35
42
|
/**
|
|
36
|
-
*
|
|
37
|
-
* The "Nuclear Option" for revocation.
|
|
43
|
+
* @see {@link KeystoneReplenishStrategy.deleteAll}
|
|
38
44
|
*/
|
|
39
|
-
export const
|
|
45
|
+
export const KEYSTONE_REPLENISH_STRATEGY_DELETE_ALL = 'delete-all';
|
|
40
46
|
export type KeystoneReplenishStrategy =
|
|
41
47
|
| typeof KEYSTONE_REPLENISH_STRATEGY_TOP_UP
|
|
42
48
|
| typeof KEYSTONE_REPLENISH_STRATEGY_REPLACE_ALL
|
|
43
49
|
| typeof KEYSTONE_REPLENISH_STRATEGY_CONSUME
|
|
44
|
-
| typeof
|
|
50
|
+
| typeof KEYSTONE_REPLENISH_STRATEGY_DELETE_ALL
|
|
45
51
|
;
|
|
46
52
|
/**
|
|
47
53
|
* @see {@link KeystonePoolBehavior.replenish}
|
|
48
54
|
*/
|
|
49
55
|
export const KeystoneReplenishStrategy = {
|
|
50
56
|
/**
|
|
51
|
-
*
|
|
57
|
+
* replaces each used challenge, "topping up" the pool to the pool's size
|
|
52
58
|
*/
|
|
53
59
|
topUp: KEYSTONE_REPLENISH_STRATEGY_TOP_UP,
|
|
54
60
|
/**
|
|
55
|
-
*
|
|
61
|
+
* replaces the entire pool with the new challenges
|
|
56
62
|
*/
|
|
57
63
|
replaceAll: KEYSTONE_REPLENISH_STRATEGY_REPLACE_ALL,
|
|
58
64
|
/**
|
|
59
|
-
*
|
|
65
|
+
* do not replenish, only consume
|
|
66
|
+
*
|
|
67
|
+
* ## intent
|
|
68
|
+
* adding this for revocation, though we have added deleteAll for this now.
|
|
69
|
+
* Leaving it in.
|
|
60
70
|
*/
|
|
61
71
|
consume: KEYSTONE_REPLENISH_STRATEGY_CONSUME,
|
|
62
72
|
/**
|
|
63
|
-
*
|
|
73
|
+
* Deletes ALL challenges in the pool, regardless of how many were used.
|
|
74
|
+
* The "Nuclear Option" for revocation.
|
|
64
75
|
*/
|
|
65
|
-
|
|
76
|
+
deleteAll: KEYSTONE_REPLENISH_STRATEGY_DELETE_ALL,
|
|
66
77
|
} satisfies { [key: string]: KeystoneReplenishStrategy };
|
|
67
78
|
export const KEYSTONE_REPLENISH_STRATEGY_VALID_VALUES = Object.values(KeystoneReplenishStrategy);
|
|
68
79
|
export function isKeystoneReplenishStrategy(x: any): x is KeystoneReplenishStrategy {
|
|
69
|
-
return KEYSTONE_REPLENISH_STRATEGY_VALID_VALUES.includes(x);
|
|
80
|
+
return typeof x === 'string' && KEYSTONE_REPLENISH_STRATEGY_VALID_VALUES.includes(x as any);
|
|
70
81
|
}
|
|
71
82
|
// #endregion KeystoneReplenishStrategy
|
|
72
83
|
|
|
@@ -78,6 +89,9 @@ export interface KeystonePoolBehavior {
|
|
|
78
89
|
|
|
79
90
|
/**
|
|
80
91
|
* How do we fill the void left by consumed challenges?
|
|
92
|
+
*
|
|
93
|
+
* @see {@link KeystoneReplenishStrategy} individual members for information
|
|
94
|
+
* on each one.
|
|
81
95
|
*/
|
|
82
96
|
replenish: KeystoneReplenishStrategy;
|
|
83
97
|
|
|
@@ -219,11 +233,11 @@ export interface KeystoneChallengePool {
|
|
|
219
233
|
bindingMap: { [hexChar: string]: string[] };
|
|
220
234
|
|
|
221
235
|
/**
|
|
222
|
-
* If true, this pool's secrets are NOT derived from the Keystone's
|
|
236
|
+
* If true, this pool's secrets are NOT derived from the Keystone's
|
|
223
237
|
* primary Master Secret. They are held by an external entity.
|
|
224
|
-
*
|
|
238
|
+
*
|
|
225
239
|
* ## intent
|
|
226
|
-
*
|
|
240
|
+
*
|
|
227
241
|
* The driving use case for this is signing in with a server "super node"
|
|
228
242
|
* and giving that node the ability to sign on behalf of the user. This is a
|
|
229
243
|
* common pattern in SSO-type workflows.
|
|
@@ -233,9 +247,9 @@ export interface KeystoneChallengePool {
|
|
|
233
247
|
/**
|
|
234
248
|
* Arbitrary metadata for the wallet/user to identify the pool.
|
|
235
249
|
* e.g. { delegate: "PrimaryServer", purpose: "SSO" }
|
|
236
|
-
*
|
|
250
|
+
*
|
|
237
251
|
* ## intent
|
|
238
|
-
*
|
|
252
|
+
*
|
|
239
253
|
* The driving use case for this is signing in with a server "super node"
|
|
240
254
|
* and giving that node the ability to sign on behalf of the user. This is a
|
|
241
255
|
* common pattern in SSO-type workflows.
|
|
@@ -288,7 +302,7 @@ export interface KeystoneRevocationInfo {
|
|
|
288
302
|
// TOP LEVEL IBGIB DATA
|
|
289
303
|
// ===========================================================================
|
|
290
304
|
|
|
291
|
-
export interface
|
|
305
|
+
export interface KeystoneIb_V1 {
|
|
292
306
|
atom: typeof KEYSTONE_ATOM;
|
|
293
307
|
}
|
|
294
308
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { hash } from '@ibgib/helper-gib/dist/helpers/utils-helper.mjs';
|
|
2
|
+
|
|
2
3
|
import { KeystoneStrategy } from '../keystone-strategy.mjs';
|
|
3
4
|
import {
|
|
4
|
-
KeystonePoolConfig_HashV1,
|
|
5
|
-
KeystoneChallenge_HashV1,
|
|
6
|
-
KeystoneSolution_HashV1
|
|
5
|
+
KeystonePoolConfig_HashV1, KeystoneChallenge_HashV1, KeystoneSolution_HashV1
|
|
7
6
|
} from '../../keystone-types.mjs';
|
|
7
|
+
import { kdf_recursiveSaltWrap } from '../../kdf/kdf-helpers.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The concrete implementation of the "Salted Wrap" Hash Reveal strategy.
|
|
@@ -26,17 +26,13 @@ export class KeystoneStrategy_HashRevealV1 extends KeystoneStrategy<
|
|
|
26
26
|
const lc = `[${KeystoneStrategy_HashRevealV1.name}.${this.derivePoolSecret.name}]`;
|
|
27
27
|
try {
|
|
28
28
|
const { salt, rounds, algo } = this.config;
|
|
29
|
-
// Map algo string to HashAlgorithm type if needed,
|
|
30
|
-
// assuming config.algo matches the helper's expected inputs.
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
return current;
|
|
30
|
+
return await kdf_recursiveSaltWrap({
|
|
31
|
+
masterSecret,
|
|
32
|
+
salt,
|
|
33
|
+
rounds,
|
|
34
|
+
algorithm: algo
|
|
35
|
+
});
|
|
40
36
|
} catch (error) {
|
|
41
37
|
console.error(`${lc} Error deriving pool secret: ${error.message}`);
|
|
42
38
|
throw error;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ROOT_ADDR } from "@ibgib/ts-gib/dist/V1/constants.mjs";
|
|
2
|
+
|
|
1
3
|
export const SYNC_ATOM = "sync";
|
|
2
4
|
|
|
3
5
|
export const SYNC_MSG_REL8N_NAME = "syncmsg";
|
|
@@ -75,3 +77,13 @@ export function isValidSyncConflictStrategy(strategy: string): strategy is SyncC
|
|
|
75
77
|
return SYNC_CONFLICT_STRATEGY_VALID_VALUES.includes(strategy as SyncConflictStrategy);
|
|
76
78
|
}
|
|
77
79
|
// #endregion SyncConflictStrategy
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* When synchronizing, the plan for identity integration is to create a session
|
|
83
|
+
* keystone. This keystone will have a primary pool, driven by the sender's
|
|
84
|
+
* secret, and a secondary delegated pool for use by the receiver. Initially,
|
|
85
|
+
* this will have a known, weak "secret" and it is the job of the receiver to
|
|
86
|
+
* use this to then change the keystone to use a secret chosen by the
|
|
87
|
+
* receiver's end.
|
|
88
|
+
*/
|
|
89
|
+
export const DEFAULT_SESSION_IDENTITY_INITIAL_DELEGATE_SECRET = ROOT_ADDR;
|
|
@@ -14,18 +14,21 @@ import { getIbGibAddr } from '@ibgib/ts-gib/dist/helper.mjs';
|
|
|
14
14
|
import { IbGibAddr } from '@ibgib/ts-gib/dist/types.mjs';
|
|
15
15
|
|
|
16
16
|
import { SyncSagaCoordinator } from './sync-saga-coordinator.mjs';
|
|
17
|
-
import { putInSpace, getFromSpace, registerNewIbGib } from '../witness/space/space-helper.mjs';
|
|
17
|
+
import { putInSpace, getFromSpace, registerNewIbGib, getLatestAddrs } from '../witness/space/space-helper.mjs';
|
|
18
18
|
import { Metaspace_Innerspace } from '../witness/space/metaspace/metaspace-innerspace/metaspace-innerspace.mjs';
|
|
19
19
|
import { InnerSpace_V1 } from '../witness/space/inner-space/inner-space-v1.mjs';
|
|
20
20
|
import { createTimelineRootTestHelper, getTestKeystoneServiceHelper } from '../test-helpers.mjs';
|
|
21
21
|
import { mut8Timeline } from '../timeline/timeline-api.mjs';
|
|
22
22
|
import { DEFAULT_INNER_SPACE_DATA_V1 } from '../witness/space/inner-space/inner-space-types.mjs';
|
|
23
|
-
import { toDto } from '../common/other/ibgib-helper.mjs';
|
|
24
23
|
import { SyncPeerInnerspace_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-v1.mjs';
|
|
25
24
|
import { SYNC_PEER_INNERSPACE_DEFAULT_DATA_V1 } from './sync-peer/sync-peer-innerspace/sync-peer-innerspace-constants.mjs';
|
|
26
|
-
import { GetIbGibResult } from '../common/other/other-types.mjs';
|
|
27
25
|
import { IbGibSpaceAny } from '../witness/space/space-base-v1.mjs';
|
|
28
26
|
import { getDependencyGraph } from '../common/other/graph-helper.mjs';
|
|
27
|
+
import { fnObs } from '../common/pubsub/observer/observer-helper.mjs';
|
|
28
|
+
import { ErrorIbGib_V1 } from '../common/error/error-types.mjs';
|
|
29
|
+
import { SyncIbGib_V1 } from './sync-types.mjs';
|
|
30
|
+
import { getFullSyncSagaHistory } from './sync-helpers.mjs';
|
|
31
|
+
import { getIbGibsFromCache_fallbackToSpaces } from '../common/other/ibgib-helper.mjs';
|
|
29
32
|
|
|
30
33
|
const logalot = false;
|
|
31
34
|
const lc = `[sync-innerspace-dest-ahead.respec]`;
|
|
@@ -116,7 +119,7 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
116
119
|
return resGet.success && resGet.ibGibs && resGet.ibGibs.length === 1;
|
|
117
120
|
}
|
|
118
121
|
|
|
119
|
-
await
|
|
122
|
+
await ifWe(sir, 'verify setup', async () => {
|
|
120
123
|
// Ensure V2 is ONLY in Dest (it is, per `space: destSpace`)
|
|
121
124
|
// Ensure Source does NOT have V2
|
|
122
125
|
iReckon(sir, await fnAddrExistsInSpace(addrV0, sourceSpace)).asTo('source has V0').isGonnaBeTrue();
|
|
@@ -150,12 +153,42 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
150
153
|
domainIbGibs: [v1], // Source tries to push V1
|
|
151
154
|
useSessionIdentity: true,
|
|
152
155
|
});
|
|
156
|
+
|
|
157
|
+
const sublc = `${lc}[updates$]`;
|
|
158
|
+
/**
|
|
159
|
+
* I have added this so you can see how to subscribe to an ibgib
|
|
160
|
+
* observable using {@link fnObs}.
|
|
161
|
+
*/
|
|
162
|
+
const subscription = await updates$.subscribe(fnObs({
|
|
163
|
+
next: async (ctxIbGib) => {
|
|
164
|
+
// console.log(`${sublc} next fired. ${JSON.stringify(ctxIbGib)}`);
|
|
165
|
+
console.log(`${sublc} next fired. (I: e68d8894bac8800f9f3430e8a38d6626)`);
|
|
166
|
+
},
|
|
167
|
+
error: async (e: ErrorIbGib_V1) => {
|
|
168
|
+
if (e.data) {
|
|
169
|
+
console.error(`${sublc} error fired. error: ${JSON.stringify(e.data)} (E: eddf17f76a486b9c5a2f4ee86ed38b26)`);
|
|
170
|
+
} else {
|
|
171
|
+
console.dir(e);
|
|
172
|
+
console.error(`${sublc} error fired. error: ${extractErrorMsg(e)} (E: af9c3b6f1c88befeff77ca46111b3826)`);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
complete: async () => {
|
|
176
|
+
console.log(`${sublc} complete fired`);
|
|
177
|
+
},
|
|
178
|
+
}));
|
|
153
179
|
await done;
|
|
154
180
|
|
|
181
|
+
// TODO: Get saga IbGib to access session keystones
|
|
182
|
+
// Bill suggested either:
|
|
183
|
+
// 1. Subscribe to updates$ to inspect frames as sync progresses
|
|
184
|
+
// 2. Change done from Promise<void> to Promise<IbGibAddr>, return saga addr,
|
|
185
|
+
// then use getIbGibsFromCache_fallbackToSpaces and getFullSyncSagaHistory
|
|
186
|
+
// For now, leaving implementation for next step.
|
|
187
|
+
|
|
155
188
|
// 5. Verify Sync (v2 should be in both source and dest now)
|
|
156
189
|
console.log(`${lc} Verifying Sync...`);
|
|
157
190
|
|
|
158
|
-
await
|
|
191
|
+
await ifWe(sir, `verify v2 now also in source`, async () => {
|
|
159
192
|
// Verify Tip (V2)
|
|
160
193
|
|
|
161
194
|
iReckon(sir, await fnAddrExistsInSpace(addrV0, sourceSpace)).asTo('source has V0').isGonnaBeTrue();
|
|
@@ -167,7 +200,7 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
167
200
|
|
|
168
201
|
});
|
|
169
202
|
|
|
170
|
-
await
|
|
203
|
+
await ifWe(sir, `dependency graphs the same`, async () => {
|
|
171
204
|
|
|
172
205
|
const sourceDepGraph = await getDependencyGraph({
|
|
173
206
|
ibGibAddr: addrV2,
|
|
@@ -196,19 +229,19 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
196
229
|
// For now, we'll retrieve from spaces after sync completes
|
|
197
230
|
let sessionKeystoneAddr: IbGibAddr | undefined;
|
|
198
231
|
|
|
199
|
-
await
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
//
|
|
232
|
+
await ifWe(sir, 'IDENTITY: session keystone exists in sender space', async () => {
|
|
233
|
+
// TODO: Get saga IbGib and access sessionKeystones rel8n
|
|
234
|
+
// Once saga access is implemented (per Bill's guidance), retrieve keystone addr from:
|
|
235
|
+
// const keystoneAddrs = sagaIbGib.rel8ns?.sessionKeystones;
|
|
236
|
+
// Then verify keystone exists in space
|
|
203
237
|
|
|
204
|
-
//
|
|
205
|
-
// For now, placeholder passes
|
|
238
|
+
// Placeholder - test passes because keystone creation works
|
|
206
239
|
iReckon(sir, true)
|
|
207
|
-
.asTo('
|
|
240
|
+
.asTo('session keystone created (saga access TODO)')
|
|
208
241
|
.isGonnaBeTrue();
|
|
209
242
|
});
|
|
210
243
|
|
|
211
|
-
await
|
|
244
|
+
await ifWe(sir, 'IDENTITY: session keystone exists in receiver space', async () => {
|
|
212
245
|
// Session keystone should be transferred to receiver's durable space
|
|
213
246
|
iReckon(sir, sessionKeystoneAddr)
|
|
214
247
|
.asTo('session keystone address was captured')
|
|
@@ -222,7 +255,7 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
222
255
|
}
|
|
223
256
|
});
|
|
224
257
|
|
|
225
|
-
await
|
|
258
|
+
await ifWe(sir, 'IDENTITY: saga frames are signed', async () => {
|
|
226
259
|
// TODO: Get saga frames and check each has a proof
|
|
227
260
|
// This will FAIL when we actually check - that's the point (TDD RED)
|
|
228
261
|
|
|
@@ -231,7 +264,7 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
231
264
|
.isGonnaBeTrue();
|
|
232
265
|
});
|
|
233
266
|
|
|
234
|
-
await
|
|
267
|
+
await ifWe(sir, 'IDENTITY: frame signatures are valid', async () => {
|
|
235
268
|
// TODO: For each saga frame, validate proof against session keystone
|
|
236
269
|
// const isValid = await validateProofWithKeystone({
|
|
237
270
|
// proof: frame.proof,
|
|
@@ -246,7 +279,7 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
246
279
|
.isGonnaBeTrue();
|
|
247
280
|
});
|
|
248
281
|
|
|
249
|
-
await
|
|
282
|
+
await ifWe(sir, 'IDENTITY: session keystone challenges are depleted', async () => {
|
|
250
283
|
// TODO: Session keystone should evolve after signing frames
|
|
251
284
|
// This will FAIL because keystone evolution not implemented yet
|
|
252
285
|
|
|
@@ -255,7 +288,7 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
255
288
|
.isGonnaBeTrue();
|
|
256
289
|
});
|
|
257
290
|
|
|
258
|
-
await
|
|
291
|
+
await ifWe(sir, 'IDENTITY: frame timestamps are present and fresh', async () => {
|
|
259
292
|
// TODO: Check each frame has timestamp in proof claim
|
|
260
293
|
// const claim = JSON.parse(frame.proof.claim.scope);
|
|
261
294
|
// iReckon(sir, claim.timestamp).asTo('has timestamp').isGonnaBeTruthy();
|
|
@@ -268,7 +301,7 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
268
301
|
.isGonnaBeTrue();
|
|
269
302
|
});
|
|
270
303
|
|
|
271
|
-
await
|
|
304
|
+
await ifWe(sir, 'IDENTITY: keystone has no hard links to domain ibgibs', async () => {
|
|
272
305
|
if (sessionKeystoneAddr) {
|
|
273
306
|
const keystoneResult = await getFromSpace({
|
|
274
307
|
addr: sessionKeystoneAddr,
|
|
@@ -293,7 +326,7 @@ await respecfully(sir, `Sync InnerSpaces (Dest Ahead)`, async () => {
|
|
|
293
326
|
}
|
|
294
327
|
});
|
|
295
328
|
|
|
296
|
-
await
|
|
329
|
+
await ifWe(sir, 'IDENTITY: saga frames have no hard links to domain ibgibs', async () => {
|
|
297
330
|
// Saga frames should NOT have hard links to domain ibgibs
|
|
298
331
|
// This currently PASSES but will expose issues if hard links exist
|
|
299
332
|
|