cojson 0.2.3 → 0.3.0-alpha.0
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/account.d.ts +1 -1
- package/dist/coValue.d.ts +5 -13
- package/dist/coValue.js +14 -7
- package/dist/coValue.js.map +1 -1
- package/dist/coValueCore.d.ts +6 -6
- package/dist/coValueCore.js +11 -14
- package/dist/coValueCore.js.map +1 -1
- package/dist/coValues/coList.d.ts +99 -34
- package/dist/coValues/coList.js +162 -72
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.d.ts +96 -31
- package/dist/coValues/coMap.js +157 -114
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.d.ts +67 -23
- package/dist/coValues/coStream.js +131 -59
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/crypto.d.ts +8 -3
- package/dist/crypto.js +6 -6
- package/dist/crypto.js.map +1 -1
- package/dist/group.d.ts +57 -23
- package/dist/group.js +75 -33
- package/dist/group.js.map +1 -1
- package/dist/index.d.ts +8 -6
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/{node.d.ts → localNode.d.ts} +16 -8
- package/dist/{node.js → localNode.js} +48 -40
- package/dist/localNode.js.map +1 -0
- package/dist/permissions.js +6 -3
- package/dist/permissions.js.map +1 -1
- package/dist/queriedCoValues/queriedCoList.d.ts +66 -0
- package/dist/queriedCoValues/queriedCoList.js +120 -0
- package/dist/queriedCoValues/queriedCoList.js.map +1 -0
- package/dist/queriedCoValues/queriedCoMap.d.ts +47 -0
- package/dist/queriedCoValues/queriedCoMap.js +83 -0
- package/dist/queriedCoValues/queriedCoMap.js.map +1 -0
- package/dist/queriedCoValues/queriedCoStream.d.ts +40 -0
- package/dist/queriedCoValues/queriedCoStream.js +72 -0
- package/dist/queriedCoValues/queriedCoStream.js.map +1 -0
- package/dist/queries.d.ts +29 -112
- package/dist/queries.js +44 -227
- package/dist/queries.js.map +1 -1
- package/dist/sync.d.ts +1 -1
- package/dist/sync.js +1 -1
- package/dist/sync.js.map +1 -1
- package/dist/tests/testUtils.d.ts +1 -1
- package/dist/tests/testUtils.js +3 -3
- package/dist/tests/testUtils.js.map +1 -1
- package/package.json +2 -2
- package/src/account.ts +1 -1
- package/src/coValue.ts +25 -20
- package/src/coValueCore.ts +17 -21
- package/src/coValues/coList.ts +242 -128
- package/src/coValues/coMap.ts +293 -162
- package/src/coValues/coStream.ts +227 -94
- package/src/crypto.ts +37 -24
- package/src/group.ts +90 -63
- package/src/index.ts +35 -25
- package/src/{node.ts → localNode.ts} +64 -64
- package/src/permissions.ts +15 -18
- package/src/queriedCoValues/queriedCoList.ts +248 -0
- package/src/queriedCoValues/queriedCoMap.ts +180 -0
- package/src/queriedCoValues/queriedCoStream.ts +125 -0
- package/src/queries.ts +83 -460
- package/src/sync.ts +2 -2
- package/src/tests/account.test.ts +3 -6
- package/src/tests/coValue.test.ts +116 -110
- package/src/tests/coValueCore.test.ts +1 -1
- package/src/tests/crypto.test.ts +19 -21
- package/src/tests/permissions.test.ts +255 -242
- package/src/tests/queries.test.ts +57 -40
- package/src/tests/sync.test.ts +30 -30
- package/src/tests/testUtils.ts +3 -3
- package/dist/coValues/static.d.ts +0 -14
- package/dist/coValues/static.js +0 -20
- package/dist/coValues/static.js.map +0 -1
- package/dist/node.js.map +0 -1
- package/src/coValues/static.ts +0 -31
|
@@ -39,7 +39,9 @@ test("Added admin can add a third admin to a group", () => {
|
|
|
39
39
|
newRandomSessionID(otherAdmin.id)
|
|
40
40
|
);
|
|
41
41
|
|
|
42
|
-
let otherContent = expectGroupContent(
|
|
42
|
+
let otherContent = expectGroupContent(
|
|
43
|
+
groupAsOtherAdmin.getCurrentContent()
|
|
44
|
+
);
|
|
43
45
|
|
|
44
46
|
expect(otherContent.get(otherAdmin.id)).toEqual("admin");
|
|
45
47
|
|
|
@@ -112,9 +114,9 @@ test("Admins can't demote other admins in a group (high level)", () => {
|
|
|
112
114
|
newRandomSessionID(otherAdmin.id)
|
|
113
115
|
);
|
|
114
116
|
|
|
115
|
-
expect(() =>
|
|
116
|
-
|
|
117
|
-
);
|
|
117
|
+
expect(() =>
|
|
118
|
+
groupAsOtherAdmin.addMemberInternal(admin.id, "writer")
|
|
119
|
+
).toThrow("Failed to set role");
|
|
118
120
|
|
|
119
121
|
expect(groupAsOtherAdmin.underlyingMap.get(admin.id)).toEqual("admin");
|
|
120
122
|
});
|
|
@@ -157,7 +159,9 @@ test("Admins an add writers to a group, who can't add admins, writers, or reader
|
|
|
157
159
|
expect(editable.get(otherAgent.id)).toBeUndefined();
|
|
158
160
|
});
|
|
159
161
|
|
|
160
|
-
groupContentAsWriter = expectGroupContent(
|
|
162
|
+
groupContentAsWriter = expectGroupContent(
|
|
163
|
+
groupAsWriter.getCurrentContent()
|
|
164
|
+
);
|
|
161
165
|
|
|
162
166
|
expect(groupContentAsWriter.get(otherAgent.id)).toBeUndefined();
|
|
163
167
|
});
|
|
@@ -230,7 +234,9 @@ test("Admins can add readers to a group, who can't add admins, writers, or reade
|
|
|
230
234
|
expect(editable.get(otherAgent.id)).toBeUndefined();
|
|
231
235
|
});
|
|
232
236
|
|
|
233
|
-
groupContentAsReader = expectGroupContent(
|
|
237
|
+
groupContentAsReader = expectGroupContent(
|
|
238
|
+
groupAsReader.getCurrentContent()
|
|
239
|
+
);
|
|
234
240
|
|
|
235
241
|
expect(groupContentAsReader.get(otherAgent.id)).toBeUndefined();
|
|
236
242
|
});
|
|
@@ -425,15 +431,15 @@ test("Admins can set group read key and then use it to create and read private t
|
|
|
425
431
|
|
|
426
432
|
groupContent.edit((editable) => {
|
|
427
433
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
428
|
-
const revelation = seal(
|
|
429
|
-
readKey,
|
|
430
|
-
admin.currentSealerSecret(),
|
|
431
|
-
admin.currentSealerID(),
|
|
432
|
-
{
|
|
434
|
+
const revelation = seal({
|
|
435
|
+
message: readKey,
|
|
436
|
+
from: admin.currentSealerSecret(),
|
|
437
|
+
to: admin.currentSealerID(),
|
|
438
|
+
nOnceMaterial: {
|
|
433
439
|
in: group.id,
|
|
434
440
|
tx: group.nextTransactionID(),
|
|
435
|
-
}
|
|
436
|
-
);
|
|
441
|
+
},
|
|
442
|
+
});
|
|
437
443
|
|
|
438
444
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
439
445
|
|
|
@@ -492,27 +498,27 @@ test("Admins can set group read key and then writers can use it to create and re
|
|
|
492
498
|
editable.set(writer.id, "writer", "trusting");
|
|
493
499
|
expect(editable.get(writer.id)).toEqual("writer");
|
|
494
500
|
|
|
495
|
-
const revelation1 = seal(
|
|
496
|
-
readKey,
|
|
497
|
-
admin.currentSealerSecret(),
|
|
498
|
-
admin.currentSealerID(),
|
|
499
|
-
{
|
|
501
|
+
const revelation1 = seal({
|
|
502
|
+
message: readKey,
|
|
503
|
+
from: admin.currentSealerSecret(),
|
|
504
|
+
to: admin.currentSealerID(),
|
|
505
|
+
nOnceMaterial: {
|
|
500
506
|
in: group.id,
|
|
501
507
|
tx: group.nextTransactionID(),
|
|
502
|
-
}
|
|
503
|
-
);
|
|
508
|
+
},
|
|
509
|
+
});
|
|
504
510
|
|
|
505
511
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation1, "trusting");
|
|
506
512
|
|
|
507
|
-
const revelation2 = seal(
|
|
508
|
-
readKey,
|
|
509
|
-
admin.currentSealerSecret(),
|
|
510
|
-
writer.currentSealerID(),
|
|
511
|
-
{
|
|
513
|
+
const revelation2 = seal({
|
|
514
|
+
message: readKey,
|
|
515
|
+
from: admin.currentSealerSecret(),
|
|
516
|
+
to: writer.currentSealerID(),
|
|
517
|
+
nOnceMaterial: {
|
|
512
518
|
in: group.id,
|
|
513
519
|
tx: group.nextTransactionID(),
|
|
514
|
-
}
|
|
515
|
-
);
|
|
520
|
+
},
|
|
521
|
+
});
|
|
516
522
|
|
|
517
523
|
editable.set(`${readKeyID}_for_${writer.id}`, revelation2, "trusting");
|
|
518
524
|
|
|
@@ -583,27 +589,27 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
583
589
|
editable.set(reader.id, "reader", "trusting");
|
|
584
590
|
expect(editable.get(reader.id)).toEqual("reader");
|
|
585
591
|
|
|
586
|
-
const revelation1 = seal(
|
|
587
|
-
readKey,
|
|
588
|
-
admin.currentSealerSecret(),
|
|
589
|
-
admin.currentSealerID(),
|
|
590
|
-
{
|
|
592
|
+
const revelation1 = seal({
|
|
593
|
+
message: readKey,
|
|
594
|
+
from: admin.currentSealerSecret(),
|
|
595
|
+
to: admin.currentSealerID(),
|
|
596
|
+
nOnceMaterial: {
|
|
591
597
|
in: group.id,
|
|
592
598
|
tx: group.nextTransactionID(),
|
|
593
|
-
}
|
|
594
|
-
);
|
|
599
|
+
},
|
|
600
|
+
});
|
|
595
601
|
|
|
596
602
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation1, "trusting");
|
|
597
603
|
|
|
598
|
-
const revelation2 = seal(
|
|
599
|
-
readKey,
|
|
600
|
-
admin.currentSealerSecret(),
|
|
601
|
-
reader.currentSealerID(),
|
|
602
|
-
{
|
|
604
|
+
const revelation2 = seal({
|
|
605
|
+
message: readKey,
|
|
606
|
+
from: admin.currentSealerSecret(),
|
|
607
|
+
to: reader.currentSealerID(),
|
|
608
|
+
nOnceMaterial: {
|
|
603
609
|
in: group.id,
|
|
604
610
|
tx: group.nextTransactionID(),
|
|
605
|
-
}
|
|
606
|
-
);
|
|
611
|
+
},
|
|
612
|
+
});
|
|
607
613
|
|
|
608
614
|
editable.set(`${readKeyID}_for_${reader.id}`, revelation2, "trusting");
|
|
609
615
|
|
|
@@ -674,27 +680,27 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
674
680
|
editable.set(reader1.id, "reader", "trusting");
|
|
675
681
|
expect(editable.get(reader1.id)).toEqual("reader");
|
|
676
682
|
|
|
677
|
-
const revelation1 = seal(
|
|
678
|
-
readKey,
|
|
679
|
-
admin.currentSealerSecret(),
|
|
680
|
-
admin.currentSealerID(),
|
|
681
|
-
{
|
|
683
|
+
const revelation1 = seal({
|
|
684
|
+
message: readKey,
|
|
685
|
+
from: admin.currentSealerSecret(),
|
|
686
|
+
to: admin.currentSealerID(),
|
|
687
|
+
nOnceMaterial: {
|
|
682
688
|
in: group.id,
|
|
683
689
|
tx: group.nextTransactionID(),
|
|
684
|
-
}
|
|
685
|
-
);
|
|
690
|
+
},
|
|
691
|
+
});
|
|
686
692
|
|
|
687
693
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation1, "trusting");
|
|
688
694
|
|
|
689
|
-
const revelation2 = seal(
|
|
690
|
-
readKey,
|
|
691
|
-
admin.currentSealerSecret(),
|
|
692
|
-
reader1.currentSealerID(),
|
|
693
|
-
{
|
|
695
|
+
const revelation2 = seal({
|
|
696
|
+
message: readKey,
|
|
697
|
+
from: admin.currentSealerSecret(),
|
|
698
|
+
to: reader1.currentSealerID(),
|
|
699
|
+
nOnceMaterial: {
|
|
694
700
|
in: group.id,
|
|
695
701
|
tx: group.nextTransactionID(),
|
|
696
|
-
}
|
|
697
|
-
);
|
|
702
|
+
},
|
|
703
|
+
});
|
|
698
704
|
|
|
699
705
|
editable.set(`${readKeyID}_for_${reader1.id}`, revelation2, "trusting");
|
|
700
706
|
|
|
@@ -727,15 +733,15 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
727
733
|
expect(childContentAsReader1.get("foo")).toEqual("bar");
|
|
728
734
|
|
|
729
735
|
groupContent.edit((editable) => {
|
|
730
|
-
const revelation3 = seal(
|
|
731
|
-
readKey,
|
|
732
|
-
admin.currentSealerSecret(),
|
|
733
|
-
reader2.currentSealerID(),
|
|
734
|
-
{
|
|
736
|
+
const revelation3 = seal({
|
|
737
|
+
message: readKey,
|
|
738
|
+
from: admin.currentSealerSecret(),
|
|
739
|
+
to: reader2.currentSealerID(),
|
|
740
|
+
nOnceMaterial: {
|
|
735
741
|
in: group.id,
|
|
736
742
|
tx: group.nextTransactionID(),
|
|
737
|
-
}
|
|
738
|
-
);
|
|
743
|
+
},
|
|
744
|
+
});
|
|
739
745
|
|
|
740
746
|
editable.set(`${readKeyID}_for_${reader2.id}`, revelation3, "trusting");
|
|
741
747
|
});
|
|
@@ -796,15 +802,15 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
796
802
|
|
|
797
803
|
groupContent.edit((editable) => {
|
|
798
804
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
799
|
-
const revelation = seal(
|
|
800
|
-
readKey,
|
|
801
|
-
admin.currentSealerSecret(),
|
|
802
|
-
admin.currentSealerID(),
|
|
803
|
-
{
|
|
805
|
+
const revelation = seal({
|
|
806
|
+
message: readKey,
|
|
807
|
+
from: admin.currentSealerSecret(),
|
|
808
|
+
to: admin.currentSealerID(),
|
|
809
|
+
nOnceMaterial: {
|
|
804
810
|
in: group.id,
|
|
805
811
|
tx: group.nextTransactionID(),
|
|
806
|
-
}
|
|
807
|
-
);
|
|
812
|
+
},
|
|
813
|
+
});
|
|
808
814
|
|
|
809
815
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
810
816
|
|
|
@@ -833,15 +839,15 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
833
839
|
groupContent.edit((editable) => {
|
|
834
840
|
const { secret: readKey2, id: readKeyID2 } = newRandomKeySecret();
|
|
835
841
|
|
|
836
|
-
const revelation = seal(
|
|
837
|
-
readKey2,
|
|
838
|
-
admin.currentSealerSecret(),
|
|
839
|
-
admin.currentSealerID(),
|
|
840
|
-
{
|
|
842
|
+
const revelation = seal({
|
|
843
|
+
message: readKey2,
|
|
844
|
+
from: admin.currentSealerSecret(),
|
|
845
|
+
to: admin.currentSealerID(),
|
|
846
|
+
nOnceMaterial: {
|
|
841
847
|
in: group.id,
|
|
842
848
|
tx: group.nextTransactionID(),
|
|
843
|
-
}
|
|
844
|
-
);
|
|
849
|
+
},
|
|
850
|
+
});
|
|
845
851
|
|
|
846
852
|
editable.set(`${readKeyID2}_for_${admin.id}`, revelation, "trusting");
|
|
847
853
|
|
|
@@ -903,15 +909,15 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
903
909
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
904
910
|
|
|
905
911
|
groupContent.edit((editable) => {
|
|
906
|
-
const revelation = seal(
|
|
907
|
-
readKey,
|
|
908
|
-
admin.currentSealerSecret(),
|
|
909
|
-
admin.currentSealerID(),
|
|
910
|
-
{
|
|
912
|
+
const revelation = seal({
|
|
913
|
+
message: readKey,
|
|
914
|
+
from: admin.currentSealerSecret(),
|
|
915
|
+
to: admin.currentSealerID(),
|
|
916
|
+
nOnceMaterial: {
|
|
911
917
|
in: group.id,
|
|
912
918
|
tx: group.nextTransactionID(),
|
|
913
|
-
}
|
|
914
|
-
);
|
|
919
|
+
},
|
|
920
|
+
});
|
|
915
921
|
|
|
916
922
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
917
923
|
|
|
@@ -935,27 +941,27 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
935
941
|
const { secret: readKey2, id: readKeyID2 } = newRandomKeySecret();
|
|
936
942
|
|
|
937
943
|
groupContent.edit((editable) => {
|
|
938
|
-
const revelation2 = seal(
|
|
939
|
-
readKey2,
|
|
940
|
-
admin.currentSealerSecret(),
|
|
941
|
-
admin.currentSealerID(),
|
|
942
|
-
{
|
|
944
|
+
const revelation2 = seal({
|
|
945
|
+
message: readKey2,
|
|
946
|
+
from: admin.currentSealerSecret(),
|
|
947
|
+
to: admin.currentSealerID(),
|
|
948
|
+
nOnceMaterial: {
|
|
943
949
|
in: group.id,
|
|
944
950
|
tx: group.nextTransactionID(),
|
|
945
|
-
}
|
|
946
|
-
);
|
|
951
|
+
},
|
|
952
|
+
});
|
|
947
953
|
|
|
948
954
|
editable.set(`${readKeyID2}_for_${admin.id}`, revelation2, "trusting");
|
|
949
955
|
|
|
950
|
-
const revelation3 = seal(
|
|
951
|
-
readKey2,
|
|
952
|
-
admin.currentSealerSecret(),
|
|
953
|
-
reader.currentSealerID(),
|
|
954
|
-
{
|
|
956
|
+
const revelation3 = seal({
|
|
957
|
+
message: readKey2,
|
|
958
|
+
from: admin.currentSealerSecret(),
|
|
959
|
+
to: reader.currentSealerID(),
|
|
960
|
+
nOnceMaterial: {
|
|
955
961
|
in: group.id,
|
|
956
962
|
tx: group.nextTransactionID(),
|
|
957
|
-
}
|
|
958
|
-
);
|
|
963
|
+
},
|
|
964
|
+
});
|
|
959
965
|
|
|
960
966
|
editable.set(`${readKeyID2}_for_${reader.id}`, revelation3, "trusting");
|
|
961
967
|
|
|
@@ -1051,39 +1057,39 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
1051
1057
|
const reader2 = node.createAccount("reader2");
|
|
1052
1058
|
|
|
1053
1059
|
groupContent.edit((editable) => {
|
|
1054
|
-
const revelation1 = seal(
|
|
1055
|
-
readKey,
|
|
1056
|
-
admin.currentSealerSecret(),
|
|
1057
|
-
admin.currentSealerID(),
|
|
1058
|
-
{
|
|
1060
|
+
const revelation1 = seal({
|
|
1061
|
+
message: readKey,
|
|
1062
|
+
from: admin.currentSealerSecret(),
|
|
1063
|
+
to: admin.currentSealerID(),
|
|
1064
|
+
nOnceMaterial: {
|
|
1059
1065
|
in: group.id,
|
|
1060
1066
|
tx: group.nextTransactionID(),
|
|
1061
|
-
}
|
|
1062
|
-
);
|
|
1067
|
+
},
|
|
1068
|
+
});
|
|
1063
1069
|
|
|
1064
1070
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation1, "trusting");
|
|
1065
1071
|
|
|
1066
|
-
const revelation2 = seal(
|
|
1067
|
-
readKey,
|
|
1068
|
-
admin.currentSealerSecret(),
|
|
1069
|
-
reader.currentSealerID(),
|
|
1070
|
-
{
|
|
1072
|
+
const revelation2 = seal({
|
|
1073
|
+
message: readKey,
|
|
1074
|
+
from: admin.currentSealerSecret(),
|
|
1075
|
+
to: reader.currentSealerID(),
|
|
1076
|
+
nOnceMaterial: {
|
|
1071
1077
|
in: group.id,
|
|
1072
1078
|
tx: group.nextTransactionID(),
|
|
1073
|
-
}
|
|
1074
|
-
);
|
|
1079
|
+
},
|
|
1080
|
+
});
|
|
1075
1081
|
|
|
1076
1082
|
editable.set(`${readKeyID}_for_${reader.id}`, revelation2, "trusting");
|
|
1077
1083
|
|
|
1078
|
-
const revelation3 = seal(
|
|
1079
|
-
readKey,
|
|
1080
|
-
admin.currentSealerSecret(),
|
|
1081
|
-
reader2.currentSealerID(),
|
|
1082
|
-
{
|
|
1084
|
+
const revelation3 = seal({
|
|
1085
|
+
message: readKey,
|
|
1086
|
+
from: admin.currentSealerSecret(),
|
|
1087
|
+
to: reader2.currentSealerID(),
|
|
1088
|
+
nOnceMaterial: {
|
|
1083
1089
|
in: group.id,
|
|
1084
1090
|
tx: group.nextTransactionID(),
|
|
1085
|
-
}
|
|
1086
|
-
);
|
|
1091
|
+
},
|
|
1092
|
+
});
|
|
1087
1093
|
|
|
1088
1094
|
editable.set(`${readKeyID}_for_${reader2.id}`, revelation3, "trusting");
|
|
1089
1095
|
|
|
@@ -1128,15 +1134,15 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
1128
1134
|
const { secret: readKey2, id: readKeyID2 } = newRandomKeySecret();
|
|
1129
1135
|
|
|
1130
1136
|
groupContent.edit((editable) => {
|
|
1131
|
-
const newRevelation1 = seal(
|
|
1132
|
-
readKey2,
|
|
1133
|
-
admin.currentSealerSecret(),
|
|
1134
|
-
admin.currentSealerID(),
|
|
1135
|
-
{
|
|
1137
|
+
const newRevelation1 = seal({
|
|
1138
|
+
message: readKey2,
|
|
1139
|
+
from: admin.currentSealerSecret(),
|
|
1140
|
+
to: admin.currentSealerID(),
|
|
1141
|
+
nOnceMaterial: {
|
|
1136
1142
|
in: group.id,
|
|
1137
1143
|
tx: group.nextTransactionID(),
|
|
1138
|
-
}
|
|
1139
|
-
);
|
|
1144
|
+
},
|
|
1145
|
+
});
|
|
1140
1146
|
|
|
1141
1147
|
editable.set(
|
|
1142
1148
|
`${readKeyID2}_for_${admin.id}`,
|
|
@@ -1144,15 +1150,15 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
1144
1150
|
"trusting"
|
|
1145
1151
|
);
|
|
1146
1152
|
|
|
1147
|
-
const newRevelation2 = seal(
|
|
1148
|
-
readKey2,
|
|
1149
|
-
admin.currentSealerSecret(),
|
|
1150
|
-
reader2.currentSealerID(),
|
|
1151
|
-
{
|
|
1153
|
+
const newRevelation2 = seal({
|
|
1154
|
+
message: readKey2,
|
|
1155
|
+
from: admin.currentSealerSecret(),
|
|
1156
|
+
to: reader2.currentSealerID(),
|
|
1157
|
+
nOnceMaterial: {
|
|
1152
1158
|
in: group.id,
|
|
1153
1159
|
tx: group.nextTransactionID(),
|
|
1154
|
-
}
|
|
1155
|
-
);
|
|
1160
|
+
},
|
|
1161
|
+
});
|
|
1156
1162
|
|
|
1157
1163
|
editable.set(
|
|
1158
1164
|
`${readKeyID2}_for_${reader2.id}`,
|
|
@@ -1281,15 +1287,15 @@ test("Admins can create an adminInvite, which can add an admin", () => {
|
|
|
1281
1287
|
|
|
1282
1288
|
expectGroupContent(group.getCurrentContent()).edit((editable) => {
|
|
1283
1289
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
1284
|
-
const revelation = seal(
|
|
1285
|
-
readKey,
|
|
1286
|
-
admin.currentSealerSecret(),
|
|
1287
|
-
admin.currentSealerID(),
|
|
1288
|
-
{
|
|
1290
|
+
const revelation = seal({
|
|
1291
|
+
message: readKey,
|
|
1292
|
+
from: admin.currentSealerSecret(),
|
|
1293
|
+
to: admin.currentSealerID(),
|
|
1294
|
+
nOnceMaterial: {
|
|
1289
1295
|
in: group.id,
|
|
1290
1296
|
tx: group.nextTransactionID(),
|
|
1291
|
-
}
|
|
1292
|
-
);
|
|
1297
|
+
},
|
|
1298
|
+
});
|
|
1293
1299
|
|
|
1294
1300
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
1295
1301
|
editable.set("readKey", readKeyID, "trusting");
|
|
@@ -1298,15 +1304,15 @@ test("Admins can create an adminInvite, which can add an admin", () => {
|
|
|
1298
1304
|
|
|
1299
1305
|
expect(editable.get(inviteID)).toEqual("adminInvite");
|
|
1300
1306
|
|
|
1301
|
-
const revelationForInvite = seal(
|
|
1302
|
-
readKey,
|
|
1303
|
-
admin.currentSealerSecret(),
|
|
1304
|
-
getAgentSealerID(inviteID),
|
|
1305
|
-
{
|
|
1307
|
+
const revelationForInvite = seal({
|
|
1308
|
+
message: readKey,
|
|
1309
|
+
from: admin.currentSealerSecret(),
|
|
1310
|
+
to: getAgentSealerID(inviteID),
|
|
1311
|
+
nOnceMaterial: {
|
|
1306
1312
|
in: group.id,
|
|
1307
1313
|
tx: group.nextTransactionID(),
|
|
1308
|
-
}
|
|
1309
|
-
);
|
|
1314
|
+
},
|
|
1315
|
+
});
|
|
1310
1316
|
|
|
1311
1317
|
editable.set(
|
|
1312
1318
|
`${readKeyID}_for_${inviteID}`,
|
|
@@ -1332,15 +1338,15 @@ test("Admins can create an adminInvite, which can add an admin", () => {
|
|
|
1332
1338
|
|
|
1333
1339
|
expect(readKey.secret).toBeDefined();
|
|
1334
1340
|
|
|
1335
|
-
const revelation = seal(
|
|
1336
|
-
readKey.secret!,
|
|
1337
|
-
getAgentSealerSecret(invitedAdminSecret),
|
|
1338
|
-
getAgentSealerID(invitedAdminID),
|
|
1339
|
-
{
|
|
1341
|
+
const revelation = seal({
|
|
1342
|
+
message: readKey.secret!,
|
|
1343
|
+
from: getAgentSealerSecret(invitedAdminSecret),
|
|
1344
|
+
to: getAgentSealerID(invitedAdminID),
|
|
1345
|
+
nOnceMaterial: {
|
|
1340
1346
|
in: group.id,
|
|
1341
1347
|
tx: group.nextTransactionID(),
|
|
1342
|
-
}
|
|
1343
|
-
);
|
|
1348
|
+
},
|
|
1349
|
+
});
|
|
1344
1350
|
|
|
1345
1351
|
editable.set(
|
|
1346
1352
|
`${readKey.id}_for_${invitedAdminID}`,
|
|
@@ -1377,14 +1383,18 @@ test("Admins can create an adminInvite, which can add an admin (high-level)", as
|
|
|
1377
1383
|
nodeAsInvitedAdmin
|
|
1378
1384
|
);
|
|
1379
1385
|
|
|
1380
|
-
expect(groupAsInvitedAdmin.underlyingMap.get(invitedAdminID)).toEqual(
|
|
1386
|
+
expect(groupAsInvitedAdmin.underlyingMap.get(invitedAdminID)).toEqual(
|
|
1387
|
+
"admin"
|
|
1388
|
+
);
|
|
1381
1389
|
expect(
|
|
1382
1390
|
groupAsInvitedAdmin.underlyingMap.core.getCurrentReadKey().secret
|
|
1383
1391
|
).toBeDefined();
|
|
1384
1392
|
|
|
1385
1393
|
groupAsInvitedAdmin.addMemberInternal(thirdAdminID, "admin");
|
|
1386
1394
|
|
|
1387
|
-
expect(groupAsInvitedAdmin.underlyingMap.get(thirdAdminID)).toEqual(
|
|
1395
|
+
expect(groupAsInvitedAdmin.underlyingMap.get(thirdAdminID)).toEqual(
|
|
1396
|
+
"admin"
|
|
1397
|
+
);
|
|
1388
1398
|
});
|
|
1389
1399
|
|
|
1390
1400
|
test("Admins can create a writerInvite, which can add a writer", () => {
|
|
@@ -1395,15 +1405,15 @@ test("Admins can create a writerInvite, which can add a writer", () => {
|
|
|
1395
1405
|
|
|
1396
1406
|
expectGroupContent(group.getCurrentContent()).edit((editable) => {
|
|
1397
1407
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
1398
|
-
const revelation = seal(
|
|
1399
|
-
readKey,
|
|
1400
|
-
admin.currentSealerSecret(),
|
|
1401
|
-
admin.currentSealerID(),
|
|
1402
|
-
{
|
|
1408
|
+
const revelation = seal({
|
|
1409
|
+
message: readKey,
|
|
1410
|
+
from: admin.currentSealerSecret(),
|
|
1411
|
+
to: admin.currentSealerID(),
|
|
1412
|
+
nOnceMaterial: {
|
|
1403
1413
|
in: group.id,
|
|
1404
1414
|
tx: group.nextTransactionID(),
|
|
1405
|
-
}
|
|
1406
|
-
);
|
|
1415
|
+
},
|
|
1416
|
+
});
|
|
1407
1417
|
|
|
1408
1418
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
1409
1419
|
editable.set("readKey", readKeyID, "trusting");
|
|
@@ -1412,15 +1422,15 @@ test("Admins can create a writerInvite, which can add a writer", () => {
|
|
|
1412
1422
|
|
|
1413
1423
|
expect(editable.get(inviteID)).toEqual("writerInvite");
|
|
1414
1424
|
|
|
1415
|
-
const revelationForInvite = seal(
|
|
1416
|
-
readKey,
|
|
1417
|
-
admin.currentSealerSecret(),
|
|
1418
|
-
getAgentSealerID(inviteID),
|
|
1419
|
-
{
|
|
1425
|
+
const revelationForInvite = seal({
|
|
1426
|
+
message: readKey,
|
|
1427
|
+
from: admin.currentSealerSecret(),
|
|
1428
|
+
to: getAgentSealerID(inviteID),
|
|
1429
|
+
nOnceMaterial: {
|
|
1420
1430
|
in: group.id,
|
|
1421
1431
|
tx: group.nextTransactionID(),
|
|
1422
|
-
}
|
|
1423
|
-
);
|
|
1432
|
+
},
|
|
1433
|
+
});
|
|
1424
1434
|
|
|
1425
1435
|
editable.set(
|
|
1426
1436
|
`${readKeyID}_for_${inviteID}`,
|
|
@@ -1446,15 +1456,15 @@ test("Admins can create a writerInvite, which can add a writer", () => {
|
|
|
1446
1456
|
|
|
1447
1457
|
expect(readKey.secret).toBeDefined();
|
|
1448
1458
|
|
|
1449
|
-
const revelation = seal(
|
|
1450
|
-
readKey.secret!,
|
|
1451
|
-
getAgentSealerSecret(invitedWriterSecret),
|
|
1452
|
-
getAgentSealerID(invitedWriterID),
|
|
1453
|
-
{
|
|
1459
|
+
const revelation = seal({
|
|
1460
|
+
message: readKey.secret!,
|
|
1461
|
+
from: getAgentSealerSecret(invitedWriterSecret),
|
|
1462
|
+
to: getAgentSealerID(invitedWriterID),
|
|
1463
|
+
nOnceMaterial: {
|
|
1454
1464
|
in: group.id,
|
|
1455
1465
|
tx: group.nextTransactionID(),
|
|
1456
|
-
}
|
|
1457
|
-
);
|
|
1466
|
+
},
|
|
1467
|
+
});
|
|
1458
1468
|
|
|
1459
1469
|
editable.set(
|
|
1460
1470
|
`${readKey.id}_for_${invitedWriterID}`,
|
|
@@ -1488,13 +1498,14 @@ test("Admins can create a writerInvite, which can add a writer (high-level)", as
|
|
|
1488
1498
|
nodeAsInvitedWriter
|
|
1489
1499
|
);
|
|
1490
1500
|
|
|
1491
|
-
expect(groupAsInvitedWriter.underlyingMap.get(invitedWriterID)).toEqual(
|
|
1501
|
+
expect(groupAsInvitedWriter.underlyingMap.get(invitedWriterID)).toEqual(
|
|
1502
|
+
"writer"
|
|
1503
|
+
);
|
|
1492
1504
|
expect(
|
|
1493
1505
|
groupAsInvitedWriter.underlyingMap.core.getCurrentReadKey().secret
|
|
1494
1506
|
).toBeDefined();
|
|
1495
1507
|
});
|
|
1496
1508
|
|
|
1497
|
-
|
|
1498
1509
|
test("Admins can create a readerInvite, which can add a reader", () => {
|
|
1499
1510
|
const { node, group, admin } = newGroup();
|
|
1500
1511
|
|
|
@@ -1503,15 +1514,15 @@ test("Admins can create a readerInvite, which can add a reader", () => {
|
|
|
1503
1514
|
|
|
1504
1515
|
expectGroupContent(group.getCurrentContent()).edit((editable) => {
|
|
1505
1516
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
1506
|
-
const revelation = seal(
|
|
1507
|
-
readKey,
|
|
1508
|
-
admin.currentSealerSecret(),
|
|
1509
|
-
admin.currentSealerID(),
|
|
1510
|
-
{
|
|
1517
|
+
const revelation = seal({
|
|
1518
|
+
message: readKey,
|
|
1519
|
+
from: admin.currentSealerSecret(),
|
|
1520
|
+
to: admin.currentSealerID(),
|
|
1521
|
+
nOnceMaterial: {
|
|
1511
1522
|
in: group.id,
|
|
1512
1523
|
tx: group.nextTransactionID(),
|
|
1513
|
-
}
|
|
1514
|
-
);
|
|
1524
|
+
},
|
|
1525
|
+
});
|
|
1515
1526
|
|
|
1516
1527
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
1517
1528
|
editable.set("readKey", readKeyID, "trusting");
|
|
@@ -1520,15 +1531,15 @@ test("Admins can create a readerInvite, which can add a reader", () => {
|
|
|
1520
1531
|
|
|
1521
1532
|
expect(editable.get(inviteID)).toEqual("readerInvite");
|
|
1522
1533
|
|
|
1523
|
-
const revelationForInvite = seal(
|
|
1524
|
-
readKey,
|
|
1525
|
-
admin.currentSealerSecret(),
|
|
1526
|
-
getAgentSealerID(inviteID),
|
|
1527
|
-
{
|
|
1534
|
+
const revelationForInvite = seal({
|
|
1535
|
+
message: readKey,
|
|
1536
|
+
from: admin.currentSealerSecret(),
|
|
1537
|
+
to: getAgentSealerID(inviteID),
|
|
1538
|
+
nOnceMaterial: {
|
|
1528
1539
|
in: group.id,
|
|
1529
1540
|
tx: group.nextTransactionID(),
|
|
1530
|
-
}
|
|
1531
|
-
);
|
|
1541
|
+
},
|
|
1542
|
+
});
|
|
1532
1543
|
|
|
1533
1544
|
editable.set(
|
|
1534
1545
|
`${readKeyID}_for_${inviteID}`,
|
|
@@ -1554,15 +1565,15 @@ test("Admins can create a readerInvite, which can add a reader", () => {
|
|
|
1554
1565
|
|
|
1555
1566
|
expect(readKey.secret).toBeDefined();
|
|
1556
1567
|
|
|
1557
|
-
const revelation = seal(
|
|
1558
|
-
readKey.secret!,
|
|
1559
|
-
getAgentSealerSecret(invitedReaderSecret),
|
|
1560
|
-
getAgentSealerID(invitedReaderID),
|
|
1561
|
-
{
|
|
1568
|
+
const revelation = seal({
|
|
1569
|
+
message: readKey.secret!,
|
|
1570
|
+
from: getAgentSealerSecret(invitedReaderSecret),
|
|
1571
|
+
to: getAgentSealerID(invitedReaderID),
|
|
1572
|
+
nOnceMaterial: {
|
|
1562
1573
|
in: group.id,
|
|
1563
1574
|
tx: group.nextTransactionID(),
|
|
1564
|
-
}
|
|
1565
|
-
);
|
|
1575
|
+
},
|
|
1576
|
+
});
|
|
1566
1577
|
|
|
1567
1578
|
editable.set(
|
|
1568
1579
|
`${readKey.id}_for_${invitedReaderID}`,
|
|
@@ -1596,7 +1607,9 @@ test("Admins can create a readerInvite, which can add a reader (high-level)", as
|
|
|
1596
1607
|
nodeAsInvitedReader
|
|
1597
1608
|
);
|
|
1598
1609
|
|
|
1599
|
-
expect(groupAsInvitedReader.underlyingMap.get(invitedReaderID)).toEqual(
|
|
1610
|
+
expect(groupAsInvitedReader.underlyingMap.get(invitedReaderID)).toEqual(
|
|
1611
|
+
"reader"
|
|
1612
|
+
);
|
|
1600
1613
|
expect(
|
|
1601
1614
|
groupAsInvitedReader.underlyingMap.core.getCurrentReadKey().secret
|
|
1602
1615
|
).toBeDefined();
|
|
@@ -1610,15 +1623,15 @@ test("WriterInvites can not invite admins", () => {
|
|
|
1610
1623
|
|
|
1611
1624
|
expectGroupContent(group.getCurrentContent()).edit((editable) => {
|
|
1612
1625
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
1613
|
-
const revelation = seal(
|
|
1614
|
-
readKey,
|
|
1615
|
-
admin.currentSealerSecret(),
|
|
1616
|
-
admin.currentSealerID(),
|
|
1617
|
-
{
|
|
1626
|
+
const revelation = seal({
|
|
1627
|
+
message: readKey,
|
|
1628
|
+
from: admin.currentSealerSecret(),
|
|
1629
|
+
to: admin.currentSealerID(),
|
|
1630
|
+
nOnceMaterial: {
|
|
1618
1631
|
in: group.id,
|
|
1619
1632
|
tx: group.nextTransactionID(),
|
|
1620
|
-
}
|
|
1621
|
-
);
|
|
1633
|
+
},
|
|
1634
|
+
});
|
|
1622
1635
|
|
|
1623
1636
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
1624
1637
|
editable.set("readKey", readKeyID, "trusting");
|
|
@@ -1627,15 +1640,15 @@ test("WriterInvites can not invite admins", () => {
|
|
|
1627
1640
|
|
|
1628
1641
|
expect(editable.get(inviteID)).toEqual("writerInvite");
|
|
1629
1642
|
|
|
1630
|
-
const revelationForInvite = seal(
|
|
1631
|
-
readKey,
|
|
1632
|
-
admin.currentSealerSecret(),
|
|
1633
|
-
getAgentSealerID(inviteID),
|
|
1634
|
-
{
|
|
1643
|
+
const revelationForInvite = seal({
|
|
1644
|
+
message: readKey,
|
|
1645
|
+
from: admin.currentSealerSecret(),
|
|
1646
|
+
to: getAgentSealerID(inviteID),
|
|
1647
|
+
nOnceMaterial: {
|
|
1635
1648
|
in: group.id,
|
|
1636
1649
|
tx: group.nextTransactionID(),
|
|
1637
|
-
}
|
|
1638
|
-
);
|
|
1650
|
+
},
|
|
1651
|
+
});
|
|
1639
1652
|
|
|
1640
1653
|
editable.set(
|
|
1641
1654
|
`${readKeyID}_for_${inviteID}`,
|
|
@@ -1666,15 +1679,15 @@ test("ReaderInvites can not invite admins", () => {
|
|
|
1666
1679
|
|
|
1667
1680
|
expectGroupContent(group.getCurrentContent()).edit((editable) => {
|
|
1668
1681
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
1669
|
-
const revelation = seal(
|
|
1670
|
-
readKey,
|
|
1671
|
-
admin.currentSealerSecret(),
|
|
1672
|
-
admin.currentSealerID(),
|
|
1673
|
-
{
|
|
1682
|
+
const revelation = seal({
|
|
1683
|
+
message: readKey,
|
|
1684
|
+
from: admin.currentSealerSecret(),
|
|
1685
|
+
to: admin.currentSealerID(),
|
|
1686
|
+
nOnceMaterial: {
|
|
1674
1687
|
in: group.id,
|
|
1675
1688
|
tx: group.nextTransactionID(),
|
|
1676
|
-
}
|
|
1677
|
-
);
|
|
1689
|
+
},
|
|
1690
|
+
});
|
|
1678
1691
|
|
|
1679
1692
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
1680
1693
|
editable.set("readKey", readKeyID, "trusting");
|
|
@@ -1683,15 +1696,15 @@ test("ReaderInvites can not invite admins", () => {
|
|
|
1683
1696
|
|
|
1684
1697
|
expect(editable.get(inviteID)).toEqual("readerInvite");
|
|
1685
1698
|
|
|
1686
|
-
const revelationForInvite = seal(
|
|
1687
|
-
readKey,
|
|
1688
|
-
admin.currentSealerSecret(),
|
|
1689
|
-
getAgentSealerID(inviteID),
|
|
1690
|
-
{
|
|
1699
|
+
const revelationForInvite = seal({
|
|
1700
|
+
message: readKey,
|
|
1701
|
+
from: admin.currentSealerSecret(),
|
|
1702
|
+
to: getAgentSealerID(inviteID),
|
|
1703
|
+
nOnceMaterial: {
|
|
1691
1704
|
in: group.id,
|
|
1692
1705
|
tx: group.nextTransactionID(),
|
|
1693
|
-
}
|
|
1694
|
-
);
|
|
1706
|
+
},
|
|
1707
|
+
});
|
|
1695
1708
|
|
|
1696
1709
|
editable.set(
|
|
1697
1710
|
`${readKeyID}_for_${inviteID}`,
|
|
@@ -1722,15 +1735,15 @@ test("ReaderInvites can not invite writers", () => {
|
|
|
1722
1735
|
|
|
1723
1736
|
expectGroupContent(group.getCurrentContent()).edit((editable) => {
|
|
1724
1737
|
const { secret: readKey, id: readKeyID } = newRandomKeySecret();
|
|
1725
|
-
const revelation = seal(
|
|
1726
|
-
readKey,
|
|
1727
|
-
admin.currentSealerSecret(),
|
|
1728
|
-
admin.currentSealerID(),
|
|
1729
|
-
{
|
|
1738
|
+
const revelation = seal({
|
|
1739
|
+
message: readKey,
|
|
1740
|
+
from: admin.currentSealerSecret(),
|
|
1741
|
+
to: admin.currentSealerID(),
|
|
1742
|
+
nOnceMaterial: {
|
|
1730
1743
|
in: group.id,
|
|
1731
1744
|
tx: group.nextTransactionID(),
|
|
1732
|
-
}
|
|
1733
|
-
);
|
|
1745
|
+
},
|
|
1746
|
+
});
|
|
1734
1747
|
|
|
1735
1748
|
editable.set(`${readKeyID}_for_${admin.id}`, revelation, "trusting");
|
|
1736
1749
|
editable.set("readKey", readKeyID, "trusting");
|
|
@@ -1739,15 +1752,15 @@ test("ReaderInvites can not invite writers", () => {
|
|
|
1739
1752
|
|
|
1740
1753
|
expect(editable.get(inviteID)).toEqual("readerInvite");
|
|
1741
1754
|
|
|
1742
|
-
const revelationForInvite = seal(
|
|
1743
|
-
readKey,
|
|
1744
|
-
admin.currentSealerSecret(),
|
|
1745
|
-
getAgentSealerID(inviteID),
|
|
1746
|
-
{
|
|
1755
|
+
const revelationForInvite = seal({
|
|
1756
|
+
message: readKey,
|
|
1757
|
+
from: admin.currentSealerSecret(),
|
|
1758
|
+
to: getAgentSealerID(inviteID),
|
|
1759
|
+
nOnceMaterial: {
|
|
1747
1760
|
in: group.id,
|
|
1748
1761
|
tx: group.nextTransactionID(),
|
|
1749
|
-
}
|
|
1750
|
-
);
|
|
1762
|
+
},
|
|
1763
|
+
});
|
|
1751
1764
|
|
|
1752
1765
|
editable.set(
|
|
1753
1766
|
`${readKeyID}_for_${inviteID}`,
|