cojson 0.18.18 → 0.18.20
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +18 -0
- package/dist/GarbageCollector.d.ts +2 -1
- package/dist/GarbageCollector.d.ts.map +1 -1
- package/dist/GarbageCollector.js +3 -2
- package/dist/GarbageCollector.js.map +1 -1
- package/dist/coValueCore/coValueCore.d.ts +28 -25
- package/dist/coValueCore/coValueCore.d.ts.map +1 -1
- package/dist/coValueCore/coValueCore.js +128 -90
- package/dist/coValueCore/coValueCore.js.map +1 -1
- package/dist/coValueCore/utils.d.ts +6 -0
- package/dist/coValueCore/utils.d.ts.map +1 -1
- package/dist/coValueCore/utils.js +53 -25
- package/dist/coValueCore/utils.js.map +1 -1
- package/dist/localNode.d.ts +5 -4
- package/dist/localNode.d.ts.map +1 -1
- package/dist/localNode.js +31 -37
- package/dist/localNode.js.map +1 -1
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +56 -69
- package/dist/sync.js.map +1 -1
- package/dist/tests/GarbageCollector.test.js +14 -0
- package/dist/tests/GarbageCollector.test.js.map +1 -1
- package/dist/tests/SyncStateManager.test.js +1 -1
- package/dist/tests/coValueCore.dependencies.test.d.ts +2 -0
- package/dist/tests/coValueCore.dependencies.test.d.ts.map +1 -0
- package/dist/tests/coValueCore.dependencies.test.js +55 -0
- package/dist/tests/coValueCore.dependencies.test.js.map +1 -0
- package/dist/tests/coValueCore.test.js +2 -2
- package/dist/tests/coValueCore.test.js.map +1 -1
- package/dist/tests/coValueCoreLoadingState.test.js +43 -62
- package/dist/tests/coValueCoreLoadingState.test.js.map +1 -1
- package/dist/tests/permissions.test.js +117 -117
- package/dist/tests/permissions.test.js.map +1 -1
- package/dist/tests/sync.load.test.js +238 -9
- package/dist/tests/sync.load.test.js.map +1 -1
- package/dist/tests/sync.peerReconciliation.test.js +7 -6
- package/dist/tests/sync.peerReconciliation.test.js.map +1 -1
- package/dist/tests/testUtils.d.ts.map +1 -1
- package/dist/tests/testUtils.js +2 -1
- package/dist/tests/testUtils.js.map +1 -1
- package/package.json +2 -2
- package/src/GarbageCollector.ts +5 -2
- package/src/coValueCore/coValueCore.ts +172 -118
- package/src/coValueCore/utils.ts +85 -31
- package/src/localNode.ts +43 -48
- package/src/sync.ts +63 -89
- package/src/tests/GarbageCollector.test.ts +20 -0
- package/src/tests/SyncStateManager.test.ts +1 -1
- package/src/tests/coValueCore.dependencies.test.ts +90 -0
- package/src/tests/coValueCore.test.ts +2 -2
- package/src/tests/coValueCoreLoadingState.test.ts +50 -66
- package/src/tests/permissions.test.ts +120 -123
- package/src/tests/sync.load.test.ts +308 -9
- package/src/tests/sync.peerReconciliation.test.ts +7 -6
- package/src/tests/testUtils.ts +5 -3
|
@@ -26,11 +26,11 @@ test("Initial admin can add another admin to a group (high level)", () => {
|
|
|
26
26
|
groupWithTwoAdminsHighLevel();
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
test("Added admin can add a third admin to a group", () => {
|
|
29
|
+
test("Added admin can add a third admin to a group", async () => {
|
|
30
30
|
const { groupCore, otherAdmin, node } = groupWithTwoAdmins();
|
|
31
31
|
|
|
32
32
|
const groupAsOtherAdmin = expectGroup(
|
|
33
|
-
groupCore.contentInClonedNodeWithDifferentAccount(otherAdmin),
|
|
33
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(otherAdmin),
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
expect(groupAsOtherAdmin.get(otherAdmin.id)).toEqual("admin");
|
|
@@ -41,11 +41,11 @@ test("Added admin can add a third admin to a group", () => {
|
|
|
41
41
|
expect(groupAsOtherAdmin.get(thirdAdmin.id)).toEqual("admin");
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
test("Added adming can add a third admin to a group (high level)", () => {
|
|
44
|
+
test("Added adming can add a third admin to a group (high level)", async () => {
|
|
45
45
|
const { group, otherAdmin } = groupWithTwoAdminsHighLevel();
|
|
46
46
|
|
|
47
47
|
const groupAsOtherAdmin = expectGroup(
|
|
48
|
-
group.core.contentInClonedNodeWithDifferentAccount(otherAdmin),
|
|
48
|
+
await group.core.contentInClonedNodeWithDifferentAccount(otherAdmin),
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
const thirdAdmin = createAccountInNode(groupAsOtherAdmin.core.node);
|
|
@@ -55,7 +55,7 @@ test("Added adming can add a third admin to a group (high level)", () => {
|
|
|
55
55
|
expect(groupAsOtherAdmin.get(thirdAdmin.id)).toEqual("admin");
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
test("Admins can't demote other admins in a group", () => {
|
|
58
|
+
test("Admins can't demote other admins in a group", async () => {
|
|
59
59
|
const { groupCore, admin, otherAdmin } = groupWithTwoAdmins();
|
|
60
60
|
|
|
61
61
|
const groupContent = expectGroup(groupCore.getCurrentContent());
|
|
@@ -66,18 +66,18 @@ test("Admins can't demote other admins in a group", () => {
|
|
|
66
66
|
expect(groupContent.get(otherAdmin.id)).toEqual("admin");
|
|
67
67
|
|
|
68
68
|
const groupAsOtherAdmin = expectGroup(
|
|
69
|
-
groupCore.contentInClonedNodeWithDifferentAccount(otherAdmin),
|
|
69
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(otherAdmin),
|
|
70
70
|
);
|
|
71
71
|
|
|
72
72
|
groupAsOtherAdmin.set(admin.id, "writer", "trusting");
|
|
73
73
|
expect(groupAsOtherAdmin.get(admin.id)).toEqual("admin");
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
test("Admins can't demote other admins in a group (high level)", () => {
|
|
76
|
+
test("Admins can't demote other admins in a group (high level)", async () => {
|
|
77
77
|
const { group, admin, otherAdmin } = groupWithTwoAdminsHighLevel();
|
|
78
78
|
|
|
79
79
|
const groupAsOtherAdmin = expectGroup(
|
|
80
|
-
group.core.contentInClonedNodeWithDifferentAccount(otherAdmin),
|
|
80
|
+
await group.core.contentInClonedNodeWithDifferentAccount(otherAdmin),
|
|
81
81
|
);
|
|
82
82
|
|
|
83
83
|
expect(() => groupAsOtherAdmin.addMemberInternal(admin.id, "writer")).toThrow(
|
|
@@ -87,7 +87,7 @@ test("Admins can't demote other admins in a group (high level)", () => {
|
|
|
87
87
|
expect(groupAsOtherAdmin.get(admin.id)).toEqual("admin");
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
-
test("Admins an add writers to a group, who can't add admins, writers, or readers", () => {
|
|
90
|
+
test("Admins an add writers to a group, who can't add admins, writers, or readers", async () => {
|
|
91
91
|
const { groupCore, node } = newGroup();
|
|
92
92
|
const writer = createAccountInNode(node);
|
|
93
93
|
|
|
@@ -99,7 +99,7 @@ test("Admins an add writers to a group, who can't add admins, writers, or reader
|
|
|
99
99
|
expect(groupContent.get(writer.id)).toEqual("writer");
|
|
100
100
|
|
|
101
101
|
const groupAsWriter = expectGroup(
|
|
102
|
-
groupCore.contentInClonedNodeWithDifferentAccount(writer),
|
|
102
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(writer),
|
|
103
103
|
);
|
|
104
104
|
|
|
105
105
|
expect(groupAsWriter.get(writer.id)).toEqual("writer");
|
|
@@ -116,7 +116,7 @@ test("Admins an add writers to a group, who can't add admins, writers, or reader
|
|
|
116
116
|
expect(groupAsWriter.get(otherAgent.id)).toBeUndefined();
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
test("Admins an add writers to a group, who can't add admins, writers, or readers (high level)", () => {
|
|
119
|
+
test("Admins an add writers to a group, who can't add admins, writers, or readers (high level)", async () => {
|
|
120
120
|
const { group, node } = newGroupHighLevel();
|
|
121
121
|
|
|
122
122
|
const writer = createAccountInNode(node);
|
|
@@ -125,7 +125,7 @@ test("Admins an add writers to a group, who can't add admins, writers, or reader
|
|
|
125
125
|
expect(group.get(writer.id)).toEqual("writer");
|
|
126
126
|
|
|
127
127
|
const groupAsWriter = expectGroup(
|
|
128
|
-
group.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
128
|
+
await group.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
129
129
|
);
|
|
130
130
|
|
|
131
131
|
expect(groupAsWriter.get(writer.id)).toEqual("writer");
|
|
@@ -145,7 +145,7 @@ test("Admins an add writers to a group, who can't add admins, writers, or reader
|
|
|
145
145
|
expect(groupAsWriter.get(otherAgent.id)).toBeUndefined();
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
test("Admins can add readers to a group, who can't add admins, writers, or readers", () => {
|
|
148
|
+
test("Admins can add readers to a group, who can't add admins, writers, or readers", async () => {
|
|
149
149
|
const { groupCore, node } = newGroup();
|
|
150
150
|
const reader = createAccountInNode(node);
|
|
151
151
|
|
|
@@ -155,7 +155,7 @@ test("Admins can add readers to a group, who can't add admins, writers, or reade
|
|
|
155
155
|
expect(groupContent.get(reader.id)).toEqual("reader");
|
|
156
156
|
|
|
157
157
|
const groupAsReader = expectGroup(
|
|
158
|
-
groupCore.contentInClonedNodeWithDifferentAccount(reader),
|
|
158
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(reader),
|
|
159
159
|
);
|
|
160
160
|
|
|
161
161
|
expect(groupAsReader.get(reader.id)).toEqual("reader");
|
|
@@ -173,7 +173,7 @@ test("Admins can add readers to a group, who can't add admins, writers, or reade
|
|
|
173
173
|
expect(groupAsReader.get(otherAgent.id)).toBeUndefined();
|
|
174
174
|
});
|
|
175
175
|
|
|
176
|
-
test("Admins can add readers to a group, who can't add admins, writers, or readers (high level)", () => {
|
|
176
|
+
test("Admins can add readers to a group, who can't add admins, writers, or readers (high level)", async () => {
|
|
177
177
|
const { group, node } = newGroupHighLevel();
|
|
178
178
|
|
|
179
179
|
const reader = createAccountInNode(node);
|
|
@@ -182,7 +182,7 @@ test("Admins can add readers to a group, who can't add admins, writers, or reade
|
|
|
182
182
|
expect(group.get(reader.id)).toEqual("reader");
|
|
183
183
|
|
|
184
184
|
const groupAsReader = expectGroup(
|
|
185
|
-
group.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
185
|
+
await group.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
186
186
|
);
|
|
187
187
|
|
|
188
188
|
expect(groupAsReader.get(reader.id)).toEqual("reader");
|
|
@@ -227,7 +227,7 @@ test("Admins can write to an object that is owned by their group (high level)",
|
|
|
227
227
|
expect(childObject.get("foo")).toEqual("bar");
|
|
228
228
|
});
|
|
229
229
|
|
|
230
|
-
test("Writers can write to an object that is owned by their group", () => {
|
|
230
|
+
test("Writers can write to an object that is owned by their group", async () => {
|
|
231
231
|
const { node, groupCore } = newGroup();
|
|
232
232
|
|
|
233
233
|
const writer = createAccountInNode(node);
|
|
@@ -244,14 +244,14 @@ test("Writers can write to an object that is owned by their group", () => {
|
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
const childObjectAsWriter = expectMap(
|
|
247
|
-
childObject.contentInClonedNodeWithDifferentAccount(writer),
|
|
247
|
+
await childObject.contentInClonedNodeWithDifferentAccount(writer),
|
|
248
248
|
);
|
|
249
249
|
|
|
250
250
|
childObjectAsWriter.set("foo", "bar", "trusting");
|
|
251
251
|
expect(childObjectAsWriter.get("foo")).toEqual("bar");
|
|
252
252
|
});
|
|
253
253
|
|
|
254
|
-
test("Writers can write to an object that is owned by their group (high level)", () => {
|
|
254
|
+
test("Writers can write to an object that is owned by their group (high level)", async () => {
|
|
255
255
|
const { node, group } = newGroupHighLevel();
|
|
256
256
|
|
|
257
257
|
const writer = createAccountInNode(node);
|
|
@@ -261,14 +261,14 @@ test("Writers can write to an object that is owned by their group (high level)",
|
|
|
261
261
|
const childObject = group.createMap();
|
|
262
262
|
|
|
263
263
|
const childObjectAsWriter = expectMap(
|
|
264
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
264
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
265
265
|
);
|
|
266
266
|
|
|
267
267
|
childObjectAsWriter.set("foo", "bar", "trusting");
|
|
268
268
|
expect(childObjectAsWriter.get("foo")).toEqual("bar");
|
|
269
269
|
});
|
|
270
270
|
|
|
271
|
-
test("Readers can not write to an object that is owned by their group", () => {
|
|
271
|
+
test("Readers can not write to an object that is owned by their group", async () => {
|
|
272
272
|
const { node, groupCore } = newGroup();
|
|
273
273
|
|
|
274
274
|
const reader = createAccountInNode(node);
|
|
@@ -285,7 +285,7 @@ test("Readers can not write to an object that is owned by their group", () => {
|
|
|
285
285
|
});
|
|
286
286
|
|
|
287
287
|
const childObjectAsReader = expectMap(
|
|
288
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
288
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
289
289
|
);
|
|
290
290
|
|
|
291
291
|
childObjectAsReader.set("foo", "bar", "trusting");
|
|
@@ -293,7 +293,7 @@ test("Readers can not write to an object that is owned by their group", () => {
|
|
|
293
293
|
expect(childObjectAsReader.get("foo")).toBeUndefined();
|
|
294
294
|
});
|
|
295
295
|
|
|
296
|
-
test("Readers can not write to an object that is owned by their group (high level)", () => {
|
|
296
|
+
test("Readers can not write to an object that is owned by their group (high level)", async () => {
|
|
297
297
|
const { node, group } = newGroupHighLevel();
|
|
298
298
|
|
|
299
299
|
const reader = createAccountInNode(node);
|
|
@@ -303,7 +303,7 @@ test("Readers can not write to an object that is owned by their group (high leve
|
|
|
303
303
|
const childObject = group.createMap();
|
|
304
304
|
|
|
305
305
|
const childObjectAsReader = expectMap(
|
|
306
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
306
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
307
307
|
);
|
|
308
308
|
|
|
309
309
|
childObjectAsReader.set("foo", "bar", "trusting");
|
|
@@ -358,7 +358,7 @@ test("Admins can set group read key and then use it to create and read private t
|
|
|
358
358
|
expect(childObject.get("foo")).toEqual("bar");
|
|
359
359
|
});
|
|
360
360
|
|
|
361
|
-
test("Admins can set group read key and then writers can use it to create and read private transactions in owned objects", () => {
|
|
361
|
+
test("Admins can set group read key and then writers can use it to create and read private transactions in owned objects", async () => {
|
|
362
362
|
const { node, groupCore, admin } = newGroup();
|
|
363
363
|
|
|
364
364
|
const writer = createAccountInNode(node);
|
|
@@ -404,7 +404,7 @@ test("Admins can set group read key and then writers can use it to create and re
|
|
|
404
404
|
});
|
|
405
405
|
|
|
406
406
|
const childObjectAsWriter = expectMap(
|
|
407
|
-
childObject.contentInClonedNodeWithDifferentAccount(writer),
|
|
407
|
+
await childObject.contentInClonedNodeWithDifferentAccount(writer),
|
|
408
408
|
);
|
|
409
409
|
|
|
410
410
|
expect(childObject.getCurrentReadKey().secret).toEqual(readKey);
|
|
@@ -414,7 +414,7 @@ test("Admins can set group read key and then writers can use it to create and re
|
|
|
414
414
|
expect(childObjectAsWriter.get("foo")).toEqual("bar");
|
|
415
415
|
});
|
|
416
416
|
|
|
417
|
-
test("Admins can set group read key and then writers can use it to create and read private transactions in owned objects (high level)", () => {
|
|
417
|
+
test("Admins can set group read key and then writers can use it to create and read private transactions in owned objects (high level)", async () => {
|
|
418
418
|
const { node, group } = newGroupHighLevel();
|
|
419
419
|
|
|
420
420
|
const writer = createAccountInNode(node);
|
|
@@ -424,14 +424,14 @@ test("Admins can set group read key and then writers can use it to create and re
|
|
|
424
424
|
const childObject = group.createMap();
|
|
425
425
|
|
|
426
426
|
const childObjectAsWriter = expectMap(
|
|
427
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
427
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
428
428
|
);
|
|
429
429
|
|
|
430
430
|
childObjectAsWriter.set("foo", "bar", "private");
|
|
431
431
|
expect(childObjectAsWriter.get("foo")).toEqual("bar");
|
|
432
432
|
});
|
|
433
433
|
|
|
434
|
-
test("Admins can set group read key and then use it to create private transactions in owned objects, which readers can read", () => {
|
|
434
|
+
test("Admins can set group read key and then use it to create private transactions in owned objects, which readers can read", async () => {
|
|
435
435
|
const { node, groupCore, admin } = newGroup();
|
|
436
436
|
|
|
437
437
|
const reader = createAccountInNode(node);
|
|
@@ -482,14 +482,14 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
482
482
|
expect(childContent.get("foo")).toEqual("bar");
|
|
483
483
|
|
|
484
484
|
const childObjectAsReader = expectMap(
|
|
485
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
485
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
486
486
|
);
|
|
487
487
|
|
|
488
488
|
expect(childObjectAsReader.core.getCurrentReadKey().secret).toEqual(readKey);
|
|
489
489
|
expect(childObjectAsReader.get("foo")).toEqual("bar");
|
|
490
490
|
});
|
|
491
491
|
|
|
492
|
-
test("Admins can set group read key and then use it to create private transactions in owned objects, which readers can read (high level)", () => {
|
|
492
|
+
test("Admins can set group read key and then use it to create private transactions in owned objects, which readers can read (high level)", async () => {
|
|
493
493
|
const { node, group } = newGroupHighLevel();
|
|
494
494
|
|
|
495
495
|
const reader = createAccountInNode(node);
|
|
@@ -502,13 +502,13 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
502
502
|
expect(childObject.get("foo")).toEqual("bar");
|
|
503
503
|
|
|
504
504
|
const childContentAsReader = expectMap(
|
|
505
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
505
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
506
506
|
);
|
|
507
507
|
|
|
508
508
|
expect(childContentAsReader.get("foo")).toEqual("bar");
|
|
509
509
|
});
|
|
510
510
|
|
|
511
|
-
test("Admins can set group read key and then use it to create private transactions in owned objects, which readers can read, even with a separate later revelation for the same read key", () => {
|
|
511
|
+
test("Admins can set group read key and then use it to create private transactions in owned objects, which readers can read, even with a separate later revelation for the same read key", async () => {
|
|
512
512
|
const { node, groupCore, admin } = newGroup();
|
|
513
513
|
|
|
514
514
|
const reader1 = createAccountInNode(node);
|
|
@@ -560,7 +560,7 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
560
560
|
expect(childContent.get("foo")).toEqual("bar");
|
|
561
561
|
|
|
562
562
|
const childObjectAsReader1 = expectMap(
|
|
563
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader1),
|
|
563
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader1),
|
|
564
564
|
);
|
|
565
565
|
|
|
566
566
|
expect(childObjectAsReader1.core.getCurrentReadKey().secret).toEqual(readKey);
|
|
@@ -579,17 +579,17 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
579
579
|
groupContent.set(`${readKeyID}_for_${reader2.id}`, revelation3, "trusting");
|
|
580
580
|
|
|
581
581
|
const childObjectAsReader2 = expectMap(
|
|
582
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader2),
|
|
582
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader2),
|
|
583
583
|
);
|
|
584
584
|
|
|
585
585
|
// Need to copy the account coValue to the new node to be able to read the readKey
|
|
586
|
-
childObjectAsReader2.core.node.
|
|
586
|
+
await childObjectAsReader2.core.node.loadVerifiedStateFrom(node, reader2.id);
|
|
587
587
|
|
|
588
588
|
expect(childObjectAsReader2.core.getCurrentReadKey().secret).toEqual(readKey);
|
|
589
589
|
expect(childObjectAsReader2.get("foo")).toEqual("bar");
|
|
590
590
|
});
|
|
591
591
|
|
|
592
|
-
test("Admins can set group read key and then use it to create private transactions in owned objects, which readers can read, even with a separate later revelation for the same read key (high level)", () => {
|
|
592
|
+
test("Admins can set group read key and then use it to create private transactions in owned objects, which readers can read, even with a separate later revelation for the same read key (high level)", async () => {
|
|
593
593
|
const { node, group } = newGroupHighLevel();
|
|
594
594
|
|
|
595
595
|
const reader1 = createAccountInNode(node);
|
|
@@ -604,14 +604,14 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
604
604
|
expect(childObject.get("foo")).toEqual("bar");
|
|
605
605
|
|
|
606
606
|
const childContentAsReader1 = expectMap(
|
|
607
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(reader1),
|
|
607
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(reader1),
|
|
608
608
|
);
|
|
609
609
|
expect(childContentAsReader1.get("foo")).toEqual("bar");
|
|
610
610
|
|
|
611
611
|
group.addMember(reader2, "reader");
|
|
612
612
|
|
|
613
613
|
const childContentAsReader2 = expectMap(
|
|
614
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(reader2),
|
|
614
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(reader2),
|
|
615
615
|
);
|
|
616
616
|
expect(childContentAsReader2.get("foo")).toEqual("bar");
|
|
617
617
|
});
|
|
@@ -692,7 +692,7 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
692
692
|
expect(childObject.get("foo2")).toEqual("bar2");
|
|
693
693
|
});
|
|
694
694
|
|
|
695
|
-
test("Admins can set group read key, make a private transaction in an owned object, rotate the read key, add a reader, make another private transaction in the owned object, and both can be read by the reader", () => {
|
|
695
|
+
test("Admins can set group read key, make a private transaction in an owned object, rotate the read key, add a reader, make another private transaction in the owned object, and both can be read by the reader", async () => {
|
|
696
696
|
const { node, groupCore, admin } = newGroup();
|
|
697
697
|
|
|
698
698
|
const childObject = node.createCoValue({
|
|
@@ -777,7 +777,7 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
777
777
|
expect(childContent.get("foo2")).toEqual("bar2");
|
|
778
778
|
|
|
779
779
|
const childObjectAsReader = expectMap(
|
|
780
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
780
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
781
781
|
);
|
|
782
782
|
|
|
783
783
|
expect(childObjectAsReader.core.getCurrentReadKey().secret).toEqual(readKey2);
|
|
@@ -785,7 +785,7 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
785
785
|
expect(childObjectAsReader.get("foo2")).toEqual("bar2");
|
|
786
786
|
});
|
|
787
787
|
|
|
788
|
-
test("Admins can set group read key, make a private transaction in an owned object, rotate the read key, add a reader, make another private transaction in the owned object, and both can be read by the reader (high level)", () => {
|
|
788
|
+
test("Admins can set group read key, make a private transaction in an owned object, rotate the read key, add a reader, make another private transaction in the owned object, and both can be read by the reader (high level)", async () => {
|
|
789
789
|
const { node, group } = newGroupHighLevel();
|
|
790
790
|
|
|
791
791
|
const childObject = group.createMap();
|
|
@@ -809,21 +809,21 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
809
809
|
expect(childObject.get("foo2")).toEqual("bar2");
|
|
810
810
|
|
|
811
811
|
const childContentAsReader = expectMap(
|
|
812
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
812
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
813
813
|
);
|
|
814
814
|
|
|
815
815
|
expect(childContentAsReader.get("foo")).toEqual("bar");
|
|
816
816
|
expect(childContentAsReader.get("foo2")).toEqual("bar2");
|
|
817
817
|
});
|
|
818
818
|
|
|
819
|
-
test("only admins can add agent ids", () => {
|
|
819
|
+
test("only admins can add agent ids", async () => {
|
|
820
820
|
const { groupCore } = newGroup();
|
|
821
821
|
|
|
822
822
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
823
823
|
const inviteID = Crypto.getAgentID(inviteSecret);
|
|
824
824
|
|
|
825
825
|
const groupAsInvite = expectGroup(
|
|
826
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
826
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
827
827
|
new ControlledAgent(inviteSecret, Crypto),
|
|
828
828
|
),
|
|
829
829
|
);
|
|
@@ -833,7 +833,7 @@ test("only admins can add agent ids", () => {
|
|
|
833
833
|
expect(groupAsInvite.get(inviteID)).toEqual(undefined);
|
|
834
834
|
});
|
|
835
835
|
|
|
836
|
-
test("Admins can set group read rey, make a private transaction in an owned object, rotate the read key, add two readers, rotate the read key again to kick out one reader, make another private transaction in the owned object, and only the remaining reader can read both transactions", () => {
|
|
836
|
+
test("Admins can set group read rey, make a private transaction in an owned object, rotate the read key, add two readers, rotate the read key again to kick out one reader, make another private transaction in the owned object, and only the remaining reader can read both transactions", async () => {
|
|
837
837
|
const { node, groupCore, admin } = newGroup();
|
|
838
838
|
|
|
839
839
|
const childObject = node.createCoValue({
|
|
@@ -900,13 +900,13 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
900
900
|
expect(childContent.get("foo")).toEqual("bar");
|
|
901
901
|
|
|
902
902
|
let childObjectAsReader = expectMap(
|
|
903
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
903
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
904
904
|
);
|
|
905
905
|
|
|
906
906
|
expect(childObjectAsReader.get("foo")).toEqual("bar");
|
|
907
907
|
|
|
908
908
|
let childObjectAsReader2 = expectMap(
|
|
909
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader2),
|
|
909
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader2),
|
|
910
910
|
);
|
|
911
911
|
|
|
912
912
|
expect(childObjectAsReader2.get("foo")).toEqual("bar");
|
|
@@ -955,10 +955,10 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
955
955
|
|
|
956
956
|
// TODO: make sure these instances of coValues sync between each other so this isn't necessary?
|
|
957
957
|
childObjectAsReader = expectMap(
|
|
958
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
958
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
959
959
|
);
|
|
960
960
|
childObjectAsReader2 = expectMap(
|
|
961
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader2),
|
|
961
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader2),
|
|
962
962
|
);
|
|
963
963
|
|
|
964
964
|
expect(childObjectAsReader.get("foo2")).toBeUndefined();
|
|
@@ -997,7 +997,7 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
997
997
|
expect(childObject.get("foo3")).toEqual("bar3");
|
|
998
998
|
|
|
999
999
|
const childContentAsReader2 = expectMap(
|
|
1000
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(reader2),
|
|
1000
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(reader2),
|
|
1001
1001
|
);
|
|
1002
1002
|
|
|
1003
1003
|
expect(childContentAsReader2.get("foo")).toEqual("bar");
|
|
@@ -1006,7 +1006,7 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
1006
1006
|
|
|
1007
1007
|
expect(
|
|
1008
1008
|
expectMap(
|
|
1009
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
1009
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
1010
1010
|
).get("foo3"),
|
|
1011
1011
|
).toBeUndefined();
|
|
1012
1012
|
});
|
|
@@ -1031,7 +1031,7 @@ test("Can create two owned objects in the same group and they will have differen
|
|
|
1031
1031
|
expect(childObject1.id).not.toEqual(childObject2.id);
|
|
1032
1032
|
});
|
|
1033
1033
|
|
|
1034
|
-
test("Admins can create an adminInvite, which can add an admin", () => {
|
|
1034
|
+
test("Admins can create an adminInvite, which can add an admin", async () => {
|
|
1035
1035
|
const { groupCore, admin } = newGroup();
|
|
1036
1036
|
|
|
1037
1037
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1070,7 +1070,7 @@ test("Admins can create an adminInvite, which can add an admin", () => {
|
|
|
1070
1070
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1071
1071
|
|
|
1072
1072
|
const groupAsInvite = expectGroup(
|
|
1073
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1073
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1074
1074
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1075
1075
|
),
|
|
1076
1076
|
);
|
|
@@ -1115,9 +1115,8 @@ test("Admins can create an adminInvite, which can add an admin (high-level)", as
|
|
|
1115
1115
|
const invitedAdminSecret = Crypto.newRandomAgentSecret();
|
|
1116
1116
|
const invitedAdminID = Crypto.getAgentID(invitedAdminSecret);
|
|
1117
1117
|
|
|
1118
|
-
const nodeAsInvitedAdmin =
|
|
1119
|
-
group.id,
|
|
1120
|
-
invitedAdminSecret,
|
|
1118
|
+
const nodeAsInvitedAdmin = (
|
|
1119
|
+
await node.loadCoValueAsDifferentAgent(group.id, invitedAdminSecret)
|
|
1121
1120
|
).node;
|
|
1122
1121
|
|
|
1123
1122
|
await nodeAsInvitedAdmin.acceptInvite(group.id, inviteSecret);
|
|
@@ -1138,7 +1137,7 @@ test("Admins can create an adminInvite, which can add an admin (high-level)", as
|
|
|
1138
1137
|
expect(groupAsInvitedAdmin.get(thirdAdminID)).toEqual("admin");
|
|
1139
1138
|
});
|
|
1140
1139
|
|
|
1141
|
-
test("Admins can create a writerInvite, which can add a writer", () => {
|
|
1140
|
+
test("Admins can create a writerInvite, which can add a writer", async () => {
|
|
1142
1141
|
const { groupCore, admin } = newGroup();
|
|
1143
1142
|
|
|
1144
1143
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1177,7 +1176,7 @@ test("Admins can create a writerInvite, which can add a writer", () => {
|
|
|
1177
1176
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1178
1177
|
|
|
1179
1178
|
const groupAsInvite = expectGroup(
|
|
1180
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1179
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1181
1180
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1182
1181
|
),
|
|
1183
1182
|
);
|
|
@@ -1222,9 +1221,8 @@ test("Admins can create a writerInvite, which can add a writer (high-level)", as
|
|
|
1222
1221
|
const invitedWriterSecret = Crypto.newRandomAgentSecret();
|
|
1223
1222
|
const invitedWriterID = Crypto.getAgentID(invitedWriterSecret);
|
|
1224
1223
|
|
|
1225
|
-
const nodeAsInvitedWriter =
|
|
1226
|
-
group.id,
|
|
1227
|
-
invitedWriterSecret,
|
|
1224
|
+
const nodeAsInvitedWriter = (
|
|
1225
|
+
await node.loadCoValueAsDifferentAgent(group.id, invitedWriterSecret)
|
|
1228
1226
|
).node;
|
|
1229
1227
|
|
|
1230
1228
|
await nodeAsInvitedWriter.acceptInvite(group.id, inviteSecret);
|
|
@@ -1238,7 +1236,7 @@ test("Admins can create a writerInvite, which can add a writer (high-level)", as
|
|
|
1238
1236
|
expect(groupAsInvitedWriter.core.getCurrentReadKey().secret).toBeDefined();
|
|
1239
1237
|
});
|
|
1240
1238
|
|
|
1241
|
-
test("Admins can create a readerInvite, which can add a reader", () => {
|
|
1239
|
+
test("Admins can create a readerInvite, which can add a reader", async () => {
|
|
1242
1240
|
const { groupCore, admin } = newGroup();
|
|
1243
1241
|
|
|
1244
1242
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1277,7 +1275,7 @@ test("Admins can create a readerInvite, which can add a reader", () => {
|
|
|
1277
1275
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1278
1276
|
|
|
1279
1277
|
const groupAsInvite = expectGroup(
|
|
1280
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1278
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1281
1279
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1282
1280
|
),
|
|
1283
1281
|
);
|
|
@@ -1312,9 +1310,8 @@ test("Admins can create a readerInvite, which can add a reader (high-level)", as
|
|
|
1312
1310
|
const invitedReaderSecret = Crypto.newRandomAgentSecret();
|
|
1313
1311
|
const invitedReaderID = Crypto.getAgentID(invitedReaderSecret);
|
|
1314
1312
|
|
|
1315
|
-
const nodeAsInvitedReader =
|
|
1316
|
-
group.id,
|
|
1317
|
-
invitedReaderSecret,
|
|
1313
|
+
const nodeAsInvitedReader = (
|
|
1314
|
+
await node.loadCoValueAsDifferentAgent(group.id, invitedReaderSecret)
|
|
1318
1315
|
).node;
|
|
1319
1316
|
|
|
1320
1317
|
await nodeAsInvitedReader.acceptInvite(group.id, inviteSecret);
|
|
@@ -1328,7 +1325,7 @@ test("Admins can create a readerInvite, which can add a reader (high-level)", as
|
|
|
1328
1325
|
expect(groupAsInvitedReader.core.getCurrentReadKey().secret).toBeDefined();
|
|
1329
1326
|
});
|
|
1330
1327
|
|
|
1331
|
-
test("WriterInvites can not invite admins", () => {
|
|
1328
|
+
test("WriterInvites can not invite admins", async () => {
|
|
1332
1329
|
const { groupCore, admin } = newGroup();
|
|
1333
1330
|
|
|
1334
1331
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1367,7 +1364,7 @@ test("WriterInvites can not invite admins", () => {
|
|
|
1367
1364
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1368
1365
|
|
|
1369
1366
|
const groupAsInvite = expectGroup(
|
|
1370
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1367
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1371
1368
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1372
1369
|
),
|
|
1373
1370
|
);
|
|
@@ -1379,7 +1376,7 @@ test("WriterInvites can not invite admins", () => {
|
|
|
1379
1376
|
expect(groupAsInvite.get(invitedAdminID)).toBeUndefined();
|
|
1380
1377
|
});
|
|
1381
1378
|
|
|
1382
|
-
test("ReaderInvites can not invite admins", () => {
|
|
1379
|
+
test("ReaderInvites can not invite admins", async () => {
|
|
1383
1380
|
const { groupCore, admin } = newGroup();
|
|
1384
1381
|
|
|
1385
1382
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1418,7 +1415,7 @@ test("ReaderInvites can not invite admins", () => {
|
|
|
1418
1415
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1419
1416
|
|
|
1420
1417
|
const groupAsInvite = expectGroup(
|
|
1421
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1418
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1422
1419
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1423
1420
|
),
|
|
1424
1421
|
);
|
|
@@ -1430,7 +1427,7 @@ test("ReaderInvites can not invite admins", () => {
|
|
|
1430
1427
|
expect(groupAsInvite.get(invitedAdminID)).toBeUndefined();
|
|
1431
1428
|
});
|
|
1432
1429
|
|
|
1433
|
-
test("ReaderInvites can not invite writers", () => {
|
|
1430
|
+
test("ReaderInvites can not invite writers", async () => {
|
|
1434
1431
|
const { groupCore, admin } = newGroup();
|
|
1435
1432
|
|
|
1436
1433
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1469,7 +1466,7 @@ test("ReaderInvites can not invite writers", () => {
|
|
|
1469
1466
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1470
1467
|
|
|
1471
1468
|
const groupAsInvite = expectGroup(
|
|
1472
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1469
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1473
1470
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1474
1471
|
),
|
|
1475
1472
|
);
|
|
@@ -1481,7 +1478,7 @@ test("ReaderInvites can not invite writers", () => {
|
|
|
1481
1478
|
expect(groupAsInvite.get(invitedWriterID)).toBeUndefined();
|
|
1482
1479
|
});
|
|
1483
1480
|
|
|
1484
|
-
test("WriteOnlyInvites can not invite writers", () => {
|
|
1481
|
+
test("WriteOnlyInvites can not invite writers", async () => {
|
|
1485
1482
|
const { groupCore, admin } = newGroup();
|
|
1486
1483
|
|
|
1487
1484
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1520,7 +1517,7 @@ test("WriteOnlyInvites can not invite writers", () => {
|
|
|
1520
1517
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1521
1518
|
|
|
1522
1519
|
const groupAsInvite = expectGroup(
|
|
1523
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1520
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1524
1521
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1525
1522
|
),
|
|
1526
1523
|
);
|
|
@@ -1532,7 +1529,7 @@ test("WriteOnlyInvites can not invite writers", () => {
|
|
|
1532
1529
|
expect(groupAsInvite.get(invitedWriterID)).toBeUndefined();
|
|
1533
1530
|
});
|
|
1534
1531
|
|
|
1535
|
-
test("WriteOnlyInvites can not invite admins", () => {
|
|
1532
|
+
test("WriteOnlyInvites can not invite admins", async () => {
|
|
1536
1533
|
const { groupCore, admin } = newGroup();
|
|
1537
1534
|
|
|
1538
1535
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1571,7 +1568,7 @@ test("WriteOnlyInvites can not invite admins", () => {
|
|
|
1571
1568
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1572
1569
|
|
|
1573
1570
|
const groupAsInvite = expectGroup(
|
|
1574
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1571
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1575
1572
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1576
1573
|
),
|
|
1577
1574
|
);
|
|
@@ -1583,7 +1580,7 @@ test("WriteOnlyInvites can not invite admins", () => {
|
|
|
1583
1580
|
expect(groupAsInvite.get(invitedWriterID)).toBeUndefined();
|
|
1584
1581
|
});
|
|
1585
1582
|
|
|
1586
|
-
test("WriteOnlyInvites can invite writeOnly", () => {
|
|
1583
|
+
test("WriteOnlyInvites can invite writeOnly", async () => {
|
|
1587
1584
|
const { groupCore, admin } = newGroup();
|
|
1588
1585
|
|
|
1589
1586
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1622,7 +1619,7 @@ test("WriteOnlyInvites can invite writeOnly", () => {
|
|
|
1622
1619
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1623
1620
|
|
|
1624
1621
|
const groupAsInvite = expectGroup(
|
|
1625
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1622
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1626
1623
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1627
1624
|
),
|
|
1628
1625
|
);
|
|
@@ -1634,7 +1631,7 @@ test("WriteOnlyInvites can invite writeOnly", () => {
|
|
|
1634
1631
|
expect(groupAsInvite.get(invitedWriterID)).toEqual("writeOnly");
|
|
1635
1632
|
});
|
|
1636
1633
|
|
|
1637
|
-
test("WriteOnlyInvites can set writeKeys", () => {
|
|
1634
|
+
test("WriteOnlyInvites can set writeKeys", async () => {
|
|
1638
1635
|
const { groupCore, admin } = newGroup();
|
|
1639
1636
|
|
|
1640
1637
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1673,7 +1670,7 @@ test("WriteOnlyInvites can set writeKeys", () => {
|
|
|
1673
1670
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1674
1671
|
|
|
1675
1672
|
const groupAsInvite = expectGroup(
|
|
1676
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1673
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1677
1674
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1678
1675
|
),
|
|
1679
1676
|
);
|
|
@@ -1682,7 +1679,7 @@ test("WriteOnlyInvites can set writeKeys", () => {
|
|
|
1682
1679
|
expect(groupAsInvite.get(`writeKeyFor_${admin.id}`)).toEqual(readKeyID);
|
|
1683
1680
|
});
|
|
1684
1681
|
|
|
1685
|
-
test("WriteOnlyInvites can't override writeKeys", () => {
|
|
1682
|
+
test("WriteOnlyInvites can't override writeKeys", async () => {
|
|
1686
1683
|
const { groupCore, admin } = newGroup();
|
|
1687
1684
|
|
|
1688
1685
|
const inviteSecret = Crypto.newRandomAgentSecret();
|
|
@@ -1721,7 +1718,7 @@ test("WriteOnlyInvites can't override writeKeys", () => {
|
|
|
1721
1718
|
group.set(`${readKeyID}_for_${inviteID}`, revelationForInvite, "trusting");
|
|
1722
1719
|
|
|
1723
1720
|
const groupAsInvite = expectGroup(
|
|
1724
|
-
groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1721
|
+
await groupCore.contentInClonedNodeWithDifferentAccount(
|
|
1725
1722
|
new ControlledAgent(inviteSecret, Crypto),
|
|
1726
1723
|
),
|
|
1727
1724
|
);
|
|
@@ -1735,7 +1732,7 @@ test("WriteOnlyInvites can't override writeKeys", () => {
|
|
|
1735
1732
|
expect(groupAsInvite.get(`writeKeyFor_${admin.id}`)).toEqual(readKeyID);
|
|
1736
1733
|
});
|
|
1737
1734
|
|
|
1738
|
-
test("Can give read permission to 'everyone'", () => {
|
|
1735
|
+
test("Can give read permission to 'everyone'", async () => {
|
|
1739
1736
|
const { node, groupCore } = newGroup();
|
|
1740
1737
|
|
|
1741
1738
|
const childObject = node.createCoValue({
|
|
@@ -1762,7 +1759,7 @@ test("Can give read permission to 'everyone'", () => {
|
|
|
1762
1759
|
const newAccount = new ControlledAgent(Crypto.newRandomAgentSecret(), Crypto);
|
|
1763
1760
|
|
|
1764
1761
|
const childContent2 = expectMap(
|
|
1765
|
-
childObject.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
1762
|
+
await childObject.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
1766
1763
|
);
|
|
1767
1764
|
|
|
1768
1765
|
expect(childContent2.get("foo")).toEqual("bar");
|
|
@@ -1783,7 +1780,7 @@ test("Can give read permissions to 'everyone' (high-level)", async () => {
|
|
|
1783
1780
|
const newAccount = new ControlledAgent(Crypto.newRandomAgentSecret(), Crypto);
|
|
1784
1781
|
|
|
1785
1782
|
const childContent2 = expectMap(
|
|
1786
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
1783
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
1787
1784
|
);
|
|
1788
1785
|
|
|
1789
1786
|
expect(childContent2.get("foo")).toEqual("bar");
|
|
@@ -1816,7 +1813,7 @@ test("Can give write permission to 'everyone'", async () => {
|
|
|
1816
1813
|
const newAccount = new ControlledAgent(Crypto.newRandomAgentSecret(), Crypto);
|
|
1817
1814
|
|
|
1818
1815
|
const childContent2 = expectMap(
|
|
1819
|
-
childObject.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
1816
|
+
await childObject.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
1820
1817
|
);
|
|
1821
1818
|
|
|
1822
1819
|
// TODO: resolve race condition
|
|
@@ -1843,7 +1840,7 @@ test("Can give write permissions to 'everyone' (high-level)", async () => {
|
|
|
1843
1840
|
const newAccount = new ControlledAgent(Crypto.newRandomAgentSecret(), Crypto);
|
|
1844
1841
|
|
|
1845
1842
|
const childContent2 = expectMap(
|
|
1846
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
1843
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
1847
1844
|
);
|
|
1848
1845
|
|
|
1849
1846
|
connectTwoPeers(group.core.node, childContent2.core.node, "server", "server");
|
|
@@ -1865,7 +1862,7 @@ test("Admins can set parent extensions", () => {
|
|
|
1865
1862
|
expect(group.get(`parent_${parentGroup.id}`)).toEqual("extend");
|
|
1866
1863
|
});
|
|
1867
1864
|
|
|
1868
|
-
test("Writers, readers and invitees can not set parent extensions", () => {
|
|
1865
|
+
test("Writers, readers and invitees can not set parent extensions", async () => {
|
|
1869
1866
|
const { group, node } = newGroupHighLevel();
|
|
1870
1867
|
const parentGroup = node.createGroup();
|
|
1871
1868
|
|
|
@@ -1882,35 +1879,35 @@ test("Writers, readers and invitees can not set parent extensions", () => {
|
|
|
1882
1879
|
group.addMember(readerInvite, "readerInvite");
|
|
1883
1880
|
|
|
1884
1881
|
const groupAsWriter = expectGroup(
|
|
1885
|
-
group.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
1882
|
+
await group.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
1886
1883
|
);
|
|
1887
1884
|
|
|
1888
1885
|
groupAsWriter.set(`parent_${parentGroup.id}`, "extend", "trusting");
|
|
1889
1886
|
expect(groupAsWriter.get(`parent_${parentGroup.id}`)).toBeUndefined();
|
|
1890
1887
|
|
|
1891
1888
|
const groupAsReader = expectGroup(
|
|
1892
|
-
group.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
1889
|
+
await group.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
1893
1890
|
);
|
|
1894
1891
|
|
|
1895
1892
|
groupAsReader.set(`parent_${parentGroup.id}`, "extend", "trusting");
|
|
1896
1893
|
expect(groupAsReader.get(`parent_${parentGroup.id}`)).toBeUndefined();
|
|
1897
1894
|
|
|
1898
1895
|
const groupAsAdminInvite = expectGroup(
|
|
1899
|
-
group.core.contentInClonedNodeWithDifferentAccount(adminInvite),
|
|
1896
|
+
await group.core.contentInClonedNodeWithDifferentAccount(adminInvite),
|
|
1900
1897
|
);
|
|
1901
1898
|
|
|
1902
1899
|
groupAsAdminInvite.set(`parent_${parentGroup.id}`, "extend", "trusting");
|
|
1903
1900
|
expect(groupAsAdminInvite.get(`parent_${parentGroup.id}`)).toBeUndefined();
|
|
1904
1901
|
|
|
1905
1902
|
const groupAsWriterInvite = expectGroup(
|
|
1906
|
-
group.core.contentInClonedNodeWithDifferentAccount(writerInvite),
|
|
1903
|
+
await group.core.contentInClonedNodeWithDifferentAccount(writerInvite),
|
|
1907
1904
|
);
|
|
1908
1905
|
|
|
1909
1906
|
groupAsWriterInvite.set(`parent_${parentGroup.id}`, "extend", "trusting");
|
|
1910
1907
|
expect(groupAsWriterInvite.get(`parent_${parentGroup.id}`)).toBeUndefined();
|
|
1911
1908
|
|
|
1912
1909
|
const groupAsReaderInvite = expectGroup(
|
|
1913
|
-
group.core.contentInClonedNodeWithDifferentAccount(readerInvite),
|
|
1910
|
+
await group.core.contentInClonedNodeWithDifferentAccount(readerInvite),
|
|
1914
1911
|
);
|
|
1915
1912
|
|
|
1916
1913
|
groupAsReaderInvite.set(`parent_${parentGroup.id}`, "extend", "trusting");
|
|
@@ -1955,7 +1952,7 @@ test("Admins can set child extensions when the admin role is inherited", async (
|
|
|
1955
1952
|
);
|
|
1956
1953
|
});
|
|
1957
1954
|
|
|
1958
|
-
test("Writers, readers and writeOnly can set child extensions", () => {
|
|
1955
|
+
test("Writers, readers and writeOnly can set child extensions", async () => {
|
|
1959
1956
|
const { group, node } = newGroupHighLevel();
|
|
1960
1957
|
const childGroup = node.createGroup();
|
|
1961
1958
|
|
|
@@ -1968,14 +1965,14 @@ test("Writers, readers and writeOnly can set child extensions", () => {
|
|
|
1968
1965
|
group.addMember(writeOnly, "writeOnly");
|
|
1969
1966
|
|
|
1970
1967
|
const groupAsWriter = expectGroup(
|
|
1971
|
-
group.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
1968
|
+
await group.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
1972
1969
|
);
|
|
1973
1970
|
|
|
1974
1971
|
groupAsWriter.set(`child_${childGroup.id}`, "extend", "trusting");
|
|
1975
1972
|
expect(groupAsWriter.get(`child_${childGroup.id}`)).toEqual("extend");
|
|
1976
1973
|
|
|
1977
1974
|
const groupAsReader = expectGroup(
|
|
1978
|
-
group.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
1975
|
+
await group.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
1979
1976
|
);
|
|
1980
1977
|
|
|
1981
1978
|
groupAsReader.set(`child_${childGroup.id}`, "extend", "trusting");
|
|
@@ -2067,7 +2064,7 @@ test("Admins can reveal parent read keys to child groups", () => {
|
|
|
2067
2064
|
expect(group.get(`${readKeyID}_for_${parentReadKeyID}`)).toEqual(encrypted);
|
|
2068
2065
|
});
|
|
2069
2066
|
|
|
2070
|
-
test("Writers can't reveal parent read keys to child groups", () => {
|
|
2067
|
+
test("Writers can't reveal parent read keys to child groups", async () => {
|
|
2071
2068
|
const { group, node } = newGroupHighLevel();
|
|
2072
2069
|
const parentGroup = node.createGroup();
|
|
2073
2070
|
|
|
@@ -2088,7 +2085,7 @@ test("Writers can't reveal parent read keys to child groups", () => {
|
|
|
2088
2085
|
group.addMember(writer, "writer");
|
|
2089
2086
|
|
|
2090
2087
|
const groupAsWriter = expectGroup(
|
|
2091
|
-
group.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
2088
|
+
await group.core.contentInClonedNodeWithDifferentAccount(writer),
|
|
2092
2089
|
);
|
|
2093
2090
|
|
|
2094
2091
|
groupAsWriter.set(
|
|
@@ -2101,7 +2098,7 @@ test("Writers can't reveal parent read keys to child groups", () => {
|
|
|
2101
2098
|
).toBeUndefined();
|
|
2102
2099
|
});
|
|
2103
2100
|
|
|
2104
|
-
test("Readers can't reveal parent read keys to child groups", () => {
|
|
2101
|
+
test("Readers can't reveal parent read keys to child groups", async () => {
|
|
2105
2102
|
const { group, node } = newGroupHighLevel();
|
|
2106
2103
|
const parentGroup = node.createGroup();
|
|
2107
2104
|
|
|
@@ -2122,7 +2119,7 @@ test("Readers can't reveal parent read keys to child groups", () => {
|
|
|
2122
2119
|
group.addMember(reader, "reader");
|
|
2123
2120
|
|
|
2124
2121
|
const groupAsReader = expectGroup(
|
|
2125
|
-
group.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
2122
|
+
await group.core.contentInClonedNodeWithDifferentAccount(reader),
|
|
2126
2123
|
);
|
|
2127
2124
|
|
|
2128
2125
|
groupAsReader.set(
|
|
@@ -2135,7 +2132,7 @@ test("Readers can't reveal parent read keys to child groups", () => {
|
|
|
2135
2132
|
).toBeUndefined();
|
|
2136
2133
|
});
|
|
2137
2134
|
|
|
2138
|
-
test.skip("Admin invites can't reveal parent read keys to child groups", () => {
|
|
2135
|
+
test.skip("Admin invites can't reveal parent read keys to child groups", async () => {
|
|
2139
2136
|
const { group, node } = newGroupHighLevel();
|
|
2140
2137
|
const parentGroup = node.createGroup();
|
|
2141
2138
|
|
|
@@ -2156,7 +2153,7 @@ test.skip("Admin invites can't reveal parent read keys to child groups", () => {
|
|
|
2156
2153
|
group.addMember(adminInvite, "adminInvite");
|
|
2157
2154
|
|
|
2158
2155
|
const groupAsAdminInvite = expectGroup(
|
|
2159
|
-
group.core.contentInClonedNodeWithDifferentAccount(adminInvite),
|
|
2156
|
+
await group.core.contentInClonedNodeWithDifferentAccount(adminInvite),
|
|
2160
2157
|
);
|
|
2161
2158
|
|
|
2162
2159
|
groupAsAdminInvite.set(
|
|
@@ -2169,7 +2166,7 @@ test.skip("Admin invites can't reveal parent read keys to child groups", () => {
|
|
|
2169
2166
|
).toBeUndefined();
|
|
2170
2167
|
});
|
|
2171
2168
|
|
|
2172
|
-
test.skip("Writer invites can't reveal parent read keys to child groups", () => {
|
|
2169
|
+
test.skip("Writer invites can't reveal parent read keys to child groups", async () => {
|
|
2173
2170
|
const { group, node } = newGroupHighLevel();
|
|
2174
2171
|
const parentGroup = node.createGroup();
|
|
2175
2172
|
|
|
@@ -2190,7 +2187,7 @@ test.skip("Writer invites can't reveal parent read keys to child groups", () =>
|
|
|
2190
2187
|
group.addMember(writerInvite, "writerInvite");
|
|
2191
2188
|
|
|
2192
2189
|
const groupAsWriterInvite = expectGroup(
|
|
2193
|
-
group.core.contentInClonedNodeWithDifferentAccount(writerInvite),
|
|
2190
|
+
await group.core.contentInClonedNodeWithDifferentAccount(writerInvite),
|
|
2194
2191
|
);
|
|
2195
2192
|
|
|
2196
2193
|
groupAsWriterInvite.set(
|
|
@@ -2203,7 +2200,7 @@ test.skip("Writer invites can't reveal parent read keys to child groups", () =>
|
|
|
2203
2200
|
).toBeUndefined();
|
|
2204
2201
|
});
|
|
2205
2202
|
|
|
2206
|
-
test.skip("Reader invites can't reveal parent read keys to child groups", () => {
|
|
2203
|
+
test.skip("Reader invites can't reveal parent read keys to child groups", async () => {
|
|
2207
2204
|
const { group, node } = newGroupHighLevel();
|
|
2208
2205
|
const parentGroup = node.createGroup();
|
|
2209
2206
|
|
|
@@ -2224,7 +2221,7 @@ test.skip("Reader invites can't reveal parent read keys to child groups", () =>
|
|
|
2224
2221
|
group.addMember(readerInvite, "readerInvite");
|
|
2225
2222
|
|
|
2226
2223
|
const groupAsReaderInvite = expectGroup(
|
|
2227
|
-
group.core.contentInClonedNodeWithDifferentAccount(readerInvite),
|
|
2224
|
+
await group.core.contentInClonedNodeWithDifferentAccount(readerInvite),
|
|
2228
2225
|
);
|
|
2229
2226
|
|
|
2230
2227
|
groupAsReaderInvite.set(
|
|
@@ -2237,7 +2234,7 @@ test.skip("Reader invites can't reveal parent read keys to child groups", () =>
|
|
|
2237
2234
|
).toBeUndefined();
|
|
2238
2235
|
});
|
|
2239
2236
|
|
|
2240
|
-
test("Writers and readers in a parent group can read from an object owned by a child group", () => {
|
|
2237
|
+
test("Writers and readers in a parent group can read from an object owned by a child group", async () => {
|
|
2241
2238
|
const { group, node } = newGroupHighLevel();
|
|
2242
2239
|
const parentGroup = node.createGroup();
|
|
2243
2240
|
|
|
@@ -2287,19 +2284,19 @@ test("Writers and readers in a parent group can read from an object owned by a c
|
|
|
2287
2284
|
expect(childContent.get("foo")).toEqual("bar");
|
|
2288
2285
|
|
|
2289
2286
|
const childContentAsWriter = expectMap(
|
|
2290
|
-
childObject.contentInClonedNodeWithDifferentAccount(writer),
|
|
2287
|
+
await childObject.contentInClonedNodeWithDifferentAccount(writer),
|
|
2291
2288
|
);
|
|
2292
2289
|
|
|
2293
2290
|
expect(childContentAsWriter.get("foo")).toEqual("bar");
|
|
2294
2291
|
|
|
2295
2292
|
const childContentAsReader = expectMap(
|
|
2296
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
2293
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
2297
2294
|
);
|
|
2298
2295
|
|
|
2299
2296
|
expect(childContentAsReader.get("foo")).toEqual("bar");
|
|
2300
2297
|
});
|
|
2301
2298
|
|
|
2302
|
-
test("Writers in a parent group can write to an object owned by a child group", () => {
|
|
2299
|
+
test("Writers in a parent group can write to an object owned by a child group", async () => {
|
|
2303
2300
|
const { group, node } = newGroupHighLevel();
|
|
2304
2301
|
const parentGroup = node.createGroup();
|
|
2305
2302
|
|
|
@@ -2342,7 +2339,7 @@ test("Writers in a parent group can write to an object owned by a child group",
|
|
|
2342
2339
|
});
|
|
2343
2340
|
|
|
2344
2341
|
const childContentAsWriter = expectMap(
|
|
2345
|
-
childObject.contentInClonedNodeWithDifferentAccount(writer),
|
|
2342
|
+
await childObject.contentInClonedNodeWithDifferentAccount(writer),
|
|
2346
2343
|
);
|
|
2347
2344
|
|
|
2348
2345
|
childContentAsWriter.set("foo", "bar", "private");
|
|
@@ -2490,7 +2487,7 @@ test("When rotating the key of a grand-parent group, the keys of all child and g
|
|
|
2490
2487
|
expect(newChildReadKeyID).not.toEqual(currentChildReadKeyID);
|
|
2491
2488
|
});
|
|
2492
2489
|
|
|
2493
|
-
test("Calling extend on group sets up parent and child references and reveals child key to parent", () => {
|
|
2490
|
+
test("Calling extend on group sets up parent and child references and reveals child key to parent", async () => {
|
|
2494
2491
|
const { group, node } = newGroupHighLevel();
|
|
2495
2492
|
const parentGroup = node.createGroup();
|
|
2496
2493
|
|
|
@@ -2525,13 +2522,13 @@ test("Calling extend on group sets up parent and child references and reveals ch
|
|
|
2525
2522
|
childMap.set("foo", "bar", "private");
|
|
2526
2523
|
|
|
2527
2524
|
const childContentAsReader = expectMap(
|
|
2528
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
2525
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
2529
2526
|
);
|
|
2530
2527
|
|
|
2531
2528
|
expect(childContentAsReader.get("foo")).toEqual("bar");
|
|
2532
2529
|
});
|
|
2533
2530
|
|
|
2534
|
-
test("Calling extend to create grand-child groups parent and child references and reveals child key to parent(s)", () => {
|
|
2531
|
+
test("Calling extend to create grand-child groups parent and child references and reveals child key to parent(s)", async () => {
|
|
2535
2532
|
const { group, node } = newGroupHighLevel();
|
|
2536
2533
|
const parentGroup = node.createGroup();
|
|
2537
2534
|
const grandParentGroup = node.createGroup();
|
|
@@ -2558,7 +2555,7 @@ test("Calling extend to create grand-child groups parent and child references an
|
|
|
2558
2555
|
childMap.set("foo", "bar", "private");
|
|
2559
2556
|
|
|
2560
2557
|
const childContentAsReader = expectMap(
|
|
2561
|
-
childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
2558
|
+
await childObject.contentInClonedNodeWithDifferentAccount(reader),
|
|
2562
2559
|
);
|
|
2563
2560
|
|
|
2564
2561
|
expect(childContentAsReader.get("foo")).toEqual("bar");
|
|
@@ -2666,7 +2663,7 @@ test("revoking write access to parent group", async () => {
|
|
|
2666
2663
|
...Crypto.createdNowUnique(),
|
|
2667
2664
|
});
|
|
2668
2665
|
const bobMap = expectMap(
|
|
2669
|
-
mapCore.contentInClonedNodeWithDifferentAccount(bob),
|
|
2666
|
+
await mapCore.contentInClonedNodeWithDifferentAccount(bob),
|
|
2670
2667
|
);
|
|
2671
2668
|
|
|
2672
2669
|
// `bob` sets `foo` to `bar`
|
|
@@ -2675,7 +2672,7 @@ test("revoking write access to parent group", async () => {
|
|
|
2675
2672
|
expect(bobMap.get("foo")).toEqual("bar");
|
|
2676
2673
|
|
|
2677
2674
|
const aliceMap = expectMap(
|
|
2678
|
-
mapCore.contentInClonedNodeWithDifferentAccount(alice),
|
|
2675
|
+
await mapCore.contentInClonedNodeWithDifferentAccount(alice),
|
|
2679
2676
|
);
|
|
2680
2677
|
// `alice` sets `foo` to `baz`
|
|
2681
2678
|
aliceMap.set("foo", "baz", "private");
|
|
@@ -2691,7 +2688,7 @@ test("revoking write access to parent group", async () => {
|
|
|
2691
2688
|
expect(bobMap.get("foo")).toEqual("abc");
|
|
2692
2689
|
|
|
2693
2690
|
const aliceMapAfterUnextend = expectMap(
|
|
2694
|
-
mapCore.contentInClonedNodeWithDifferentAccount(alice),
|
|
2691
|
+
await mapCore.contentInClonedNodeWithDifferentAccount(alice),
|
|
2695
2692
|
);
|
|
2696
2693
|
// `alice` attempts to set `foo` to `def`, but fails
|
|
2697
2694
|
expect(() => aliceMapAfterUnextend.set("foo", "def", "private")).toThrow(
|
|
@@ -2847,7 +2844,7 @@ test("High-level permissions work correctly when a group is extended", async ()
|
|
|
2847
2844
|
map.set("foo", "bar", "private");
|
|
2848
2845
|
|
|
2849
2846
|
const mapAsReader = expectMap(
|
|
2850
|
-
mapCore.contentInClonedNodeWithDifferentAccount(reader),
|
|
2847
|
+
await mapCore.contentInClonedNodeWithDifferentAccount(reader),
|
|
2851
2848
|
);
|
|
2852
2849
|
|
|
2853
2850
|
expect(mapAsReader.get("foo")).toEqual("bar");
|
|
@@ -2862,7 +2859,7 @@ test("High-level permissions work correctly when a group is extended", async ()
|
|
|
2862
2859
|
map.set("foo", "baz", "private");
|
|
2863
2860
|
|
|
2864
2861
|
const mapAsReaderAfterRemove = expectMap(
|
|
2865
|
-
mapCore.contentInClonedNodeWithDifferentAccount(reader),
|
|
2862
|
+
await mapCore.contentInClonedNodeWithDifferentAccount(reader),
|
|
2866
2863
|
);
|
|
2867
2864
|
|
|
2868
2865
|
expect(mapAsReaderAfterRemove.get("foo")).not.toEqual("baz");
|
|
@@ -2946,7 +2943,7 @@ test("Can revoke read permission from 'everyone'", async () => {
|
|
|
2946
2943
|
// Create a new account to verify access
|
|
2947
2944
|
const newAccount = new ControlledAgent(Crypto.newRandomAgentSecret(), Crypto);
|
|
2948
2945
|
const childContent = expectMap(
|
|
2949
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
2946
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(newAccount),
|
|
2950
2947
|
);
|
|
2951
2948
|
|
|
2952
2949
|
// Verify the new account can read
|
|
@@ -2963,7 +2960,7 @@ test("Can revoke read permission from 'everyone'", async () => {
|
|
|
2963
2960
|
Crypto,
|
|
2964
2961
|
);
|
|
2965
2962
|
const childContent2 = expectMap(
|
|
2966
|
-
childObject.core.contentInClonedNodeWithDifferentAccount(newAccount2),
|
|
2963
|
+
await childObject.core.contentInClonedNodeWithDifferentAccount(newAccount2),
|
|
2967
2964
|
);
|
|
2968
2965
|
|
|
2969
2966
|
// Verify the new account cannot read after revocation
|