cojson 0.7.33 → 0.7.34-neverthrow.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/.eslintrc.cjs +4 -3
- package/.turbo/turbo-test.log +246 -254
- package/CHANGELOG.md +6 -0
- package/dist/coValueCore.js +101 -87
- package/dist/coValueCore.js.map +1 -1
- package/dist/coValues/account.js +14 -10
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/group.js +4 -2
- package/dist/coValues/group.js.map +1 -1
- package/dist/localNode.js +45 -20
- package/dist/localNode.js.map +1 -1
- package/dist/permissions.js +7 -1
- package/dist/permissions.js.map +1 -1
- package/dist/sync.js +16 -9
- package/dist/sync.js.map +1 -1
- package/dist/tests/coValueCore.test.js +14 -4
- package/dist/tests/coValueCore.test.js.map +1 -1
- package/dist/tests/permissions.test.js +28 -28
- package/dist/tests/permissions.test.js.map +1 -1
- package/package.json +3 -1
- package/src/coValueCore.ts +176 -153
- package/src/coValues/account.ts +37 -22
- package/src/coValues/group.ts +4 -2
- package/src/localNode.ts +78 -36
- package/src/permissions.ts +15 -1
- package/src/sync.ts +38 -24
- package/src/tests/coValueCore.test.ts +26 -20
- package/src/tests/permissions.test.ts +28 -28
package/src/localNode.ts
CHANGED
|
@@ -22,9 +22,11 @@ import {
|
|
|
22
22
|
AccountID,
|
|
23
23
|
RawProfile,
|
|
24
24
|
RawAccountMigration,
|
|
25
|
+
InvalidAccountAgentIDError,
|
|
25
26
|
} from "./coValues/account.js";
|
|
26
27
|
import { Profile, RawCoValue } from "./index.js";
|
|
27
28
|
import { expectGroup } from "./typeUtils/expectGroup.js";
|
|
29
|
+
import { err, ok, okAsync, Result, ResultAsync } from "neverthrow";
|
|
28
30
|
|
|
29
31
|
/** A `LocalNode` represents a local view of a set of loaded `CoValue`s, from the perspective of a particular account (or primitive cryptographic agent).
|
|
30
32
|
|
|
@@ -243,7 +245,9 @@ export class LocalNode {
|
|
|
243
245
|
/** @internal */
|
|
244
246
|
createCoValue(header: CoValueHeader): CoValueCore {
|
|
245
247
|
if (this.crashed) {
|
|
246
|
-
throw new Error("Trying to create CoValue after node has crashed", {
|
|
248
|
+
throw new Error("Trying to create CoValue after node has crashed", {
|
|
249
|
+
cause: this.crashed,
|
|
250
|
+
});
|
|
247
251
|
}
|
|
248
252
|
|
|
249
253
|
const coValue = new CoValueCore(header, this);
|
|
@@ -264,7 +268,9 @@ export class LocalNode {
|
|
|
264
268
|
} = {},
|
|
265
269
|
): Promise<CoValueCore | "unavailable"> {
|
|
266
270
|
if (this.crashed) {
|
|
267
|
-
throw new Error("Trying to load CoValue after node has crashed", {
|
|
271
|
+
throw new Error("Trying to load CoValue after node has crashed", {
|
|
272
|
+
cause: this.crashed,
|
|
273
|
+
});
|
|
268
274
|
}
|
|
269
275
|
|
|
270
276
|
let entry = this.coValues[id];
|
|
@@ -529,9 +535,9 @@ export class LocalNode {
|
|
|
529
535
|
resolveAccountAgent(
|
|
530
536
|
id: AccountID | AgentID,
|
|
531
537
|
expectation?: string,
|
|
532
|
-
): AgentID {
|
|
538
|
+
): Result<AgentID, ResolveAccountAgentError> {
|
|
533
539
|
if (isAgentID(id)) {
|
|
534
|
-
return id;
|
|
540
|
+
return ok(id);
|
|
535
541
|
}
|
|
536
542
|
|
|
537
543
|
const coValue = this.expectCoValueLoaded(id, expectation);
|
|
@@ -543,49 +549,58 @@ export class LocalNode {
|
|
|
543
549
|
!("type" in coValue.header.meta) ||
|
|
544
550
|
coValue.header.meta.type !== "account"
|
|
545
551
|
) {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
);
|
|
552
|
+
return err({
|
|
553
|
+
type: "UnexpectedlyNotAccount",
|
|
554
|
+
expectation,
|
|
555
|
+
id,
|
|
556
|
+
} satisfies UnexpectedlyNotAccountError);
|
|
551
557
|
}
|
|
552
558
|
|
|
553
559
|
return (coValue.getCurrentContent() as RawAccount).currentAgentID();
|
|
554
560
|
}
|
|
555
561
|
|
|
556
|
-
|
|
562
|
+
resolveAccountAgentAsync(
|
|
557
563
|
id: AccountID | AgentID,
|
|
558
564
|
expectation?: string,
|
|
559
|
-
):
|
|
565
|
+
): ResultAsync<AgentID, ResolveAccountAgentError> {
|
|
560
566
|
if (isAgentID(id)) {
|
|
561
|
-
return id;
|
|
567
|
+
return okAsync(id);
|
|
562
568
|
}
|
|
563
569
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
expectation
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
570
|
+
return ResultAsync.fromPromise(
|
|
571
|
+
this.loadCoValueCore(id),
|
|
572
|
+
(e) =>
|
|
573
|
+
({
|
|
574
|
+
type: "ErrorLoadingCoValueCore",
|
|
575
|
+
expectation,
|
|
576
|
+
id,
|
|
577
|
+
error: e,
|
|
578
|
+
}) satisfies LoadCoValueCoreError,
|
|
579
|
+
).andThen((coValue) => {
|
|
580
|
+
if (coValue === "unavailable") {
|
|
581
|
+
return err({
|
|
582
|
+
type: "AccountUnavailableFromAllPeers" as const,
|
|
583
|
+
expectation,
|
|
584
|
+
id,
|
|
585
|
+
} satisfies AccountUnavailableFromAllPeersError);
|
|
586
|
+
}
|
|
573
587
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
expectation
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
588
|
+
if (
|
|
589
|
+
coValue.header.type !== "comap" ||
|
|
590
|
+
coValue.header.ruleset.type !== "group" ||
|
|
591
|
+
!coValue.header.meta ||
|
|
592
|
+
!("type" in coValue.header.meta) ||
|
|
593
|
+
coValue.header.meta.type !== "account"
|
|
594
|
+
) {
|
|
595
|
+
return err({
|
|
596
|
+
type: "UnexpectedlyNotAccount" as const,
|
|
597
|
+
expectation,
|
|
598
|
+
id,
|
|
599
|
+
} satisfies UnexpectedlyNotAccountError);
|
|
600
|
+
}
|
|
587
601
|
|
|
588
|
-
|
|
602
|
+
return (coValue.getCurrentContent() as RawAccount).currentAgentID();
|
|
603
|
+
});
|
|
589
604
|
}
|
|
590
605
|
|
|
591
606
|
/**
|
|
@@ -610,7 +625,9 @@ export class LocalNode {
|
|
|
610
625
|
this.crypto.seal({
|
|
611
626
|
message: readKey.secret,
|
|
612
627
|
from: this.account.currentSealerSecret(),
|
|
613
|
-
to: this.account
|
|
628
|
+
to: this.account
|
|
629
|
+
.currentSealerID()
|
|
630
|
+
._unsafeUnwrap({ withStackTrace: true }),
|
|
614
631
|
nOnceMaterial: {
|
|
615
632
|
in: groupCoValue.id,
|
|
616
633
|
tx: groupCoValue.nextTransactionID(),
|
|
@@ -710,6 +727,31 @@ type CoValueState =
|
|
|
710
727
|
onProgress?: (progress: number) => void;
|
|
711
728
|
};
|
|
712
729
|
|
|
730
|
+
export type LoadCoValueCoreError = {
|
|
731
|
+
type: "ErrorLoadingCoValueCore";
|
|
732
|
+
error: unknown;
|
|
733
|
+
expectation?: string;
|
|
734
|
+
id: AccountID;
|
|
735
|
+
};
|
|
736
|
+
|
|
737
|
+
export type AccountUnavailableFromAllPeersError = {
|
|
738
|
+
type: "AccountUnavailableFromAllPeers";
|
|
739
|
+
expectation?: string;
|
|
740
|
+
id: AccountID;
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
export type UnexpectedlyNotAccountError = {
|
|
744
|
+
type: "UnexpectedlyNotAccount";
|
|
745
|
+
expectation?: string;
|
|
746
|
+
id: AccountID;
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
export type ResolveAccountAgentError =
|
|
750
|
+
| InvalidAccountAgentIDError
|
|
751
|
+
| LoadCoValueCoreError
|
|
752
|
+
| AccountUnavailableFromAllPeersError
|
|
753
|
+
| UnexpectedlyNotAccountError;
|
|
754
|
+
|
|
713
755
|
/** @internal */
|
|
714
756
|
export function newLoadingState(
|
|
715
757
|
currentPeerIds: Set<PeerID>,
|
package/src/permissions.ts
CHANGED
|
@@ -249,8 +249,22 @@ export function determineValidTransactions(
|
|
|
249
249
|
const effectiveTransactor =
|
|
250
250
|
transactor === groupContent.id &&
|
|
251
251
|
groupAtTime instanceof RawAccount
|
|
252
|
-
? groupAtTime.currentAgentID()
|
|
252
|
+
? groupAtTime.currentAgentID().match(
|
|
253
|
+
(agentID) => agentID,
|
|
254
|
+
(e) => {
|
|
255
|
+
console.error(
|
|
256
|
+
"Error while determining current agent ID in valid transactions",
|
|
257
|
+
e,
|
|
258
|
+
);
|
|
259
|
+
return undefined;
|
|
260
|
+
},
|
|
261
|
+
)
|
|
253
262
|
: transactor;
|
|
263
|
+
|
|
264
|
+
if (!effectiveTransactor) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
|
|
254
268
|
const transactorRoleAtTxTime =
|
|
255
269
|
groupAtTime.get(effectiveTransactor) ||
|
|
256
270
|
groupAtTime.get(EVERYONE);
|
package/src/sync.ts
CHANGED
|
@@ -392,22 +392,31 @@ export class SyncManager {
|
|
|
392
392
|
}
|
|
393
393
|
};
|
|
394
394
|
|
|
395
|
-
processMessages()
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
395
|
+
processMessages()
|
|
396
|
+
.then(() => {
|
|
397
|
+
if (peer.crashOnClose) {
|
|
398
|
+
console.error("Unexepcted close from peer", peer.id);
|
|
399
|
+
this.local.crashed = new Error(
|
|
400
|
+
"Unexpected close from peer",
|
|
401
|
+
);
|
|
402
|
+
throw new Error("Unexpected close from peer");
|
|
403
|
+
}
|
|
404
|
+
})
|
|
405
|
+
.catch((e) => {
|
|
406
|
+
console.error(
|
|
407
|
+
"Error processing messages from peer",
|
|
408
|
+
peer.id,
|
|
409
|
+
e,
|
|
410
|
+
);
|
|
411
|
+
if (peer.crashOnClose) {
|
|
412
|
+
this.local.crashed = e;
|
|
413
|
+
throw new Error(e);
|
|
414
|
+
}
|
|
415
|
+
})
|
|
416
|
+
.finally(() => {
|
|
417
|
+
peer.outgoing.close();
|
|
418
|
+
delete this.peers[peer.id];
|
|
419
|
+
});
|
|
411
420
|
}
|
|
412
421
|
|
|
413
422
|
trySendToPeer(peer: PeerState, msg: SyncMessage) {
|
|
@@ -552,9 +561,10 @@ export class SyncManager {
|
|
|
552
561
|
let entry = this.local.coValues[msg.id];
|
|
553
562
|
|
|
554
563
|
if (!entry) {
|
|
555
|
-
|
|
564
|
+
console.error(
|
|
556
565
|
`Expected coValue entry for ${msg.id} to be created on new content, missing subscribe?`,
|
|
557
566
|
);
|
|
567
|
+
return;
|
|
558
568
|
}
|
|
559
569
|
|
|
560
570
|
let resolveAfterDone: ((coValue: CoValueCore) => void) | undefined;
|
|
@@ -562,14 +572,16 @@ export class SyncManager {
|
|
|
562
572
|
const peerOptimisticKnownState = peer.optimisticKnownStates[msg.id];
|
|
563
573
|
|
|
564
574
|
if (!peerOptimisticKnownState) {
|
|
565
|
-
|
|
575
|
+
console.error(
|
|
566
576
|
"Expected optimisticKnownState to be set for coValue we receive new content for",
|
|
567
577
|
);
|
|
578
|
+
return;
|
|
568
579
|
}
|
|
569
580
|
|
|
570
581
|
if (entry.state === "loading") {
|
|
571
582
|
if (!msg.header) {
|
|
572
|
-
|
|
583
|
+
console.error("Expected header to be sent in first message");
|
|
584
|
+
return;
|
|
573
585
|
}
|
|
574
586
|
|
|
575
587
|
const firstPeerStateEntry = entry.firstPeerState[peer.id];
|
|
@@ -621,7 +633,8 @@ export class SyncManager {
|
|
|
621
633
|
}
|
|
622
634
|
|
|
623
635
|
const before = performance.now();
|
|
624
|
-
|
|
636
|
+
// eslint-disable-next-line neverthrow/must-use-result
|
|
637
|
+
const result = await coValue.tryAddTransactionsAsync(
|
|
625
638
|
sessionID,
|
|
626
639
|
newTransactions,
|
|
627
640
|
undefined,
|
|
@@ -657,13 +670,14 @@ export class SyncManager {
|
|
|
657
670
|
|
|
658
671
|
entry.onProgress?.(ourTotalnTxs / theirTotalnTxs);
|
|
659
672
|
|
|
660
|
-
if (
|
|
673
|
+
if (result.isErr()) {
|
|
661
674
|
console.error(
|
|
662
675
|
"Failed to add transactions",
|
|
676
|
+
result.error,
|
|
663
677
|
msg.id,
|
|
664
|
-
newTransactions.length +
|
|
665
|
-
|
|
666
|
-
|
|
678
|
+
newTransactions.length + " new transactions",
|
|
679
|
+
"we have" + ourTotalnTxs,
|
|
680
|
+
"they have" + theirTotalnTxs,
|
|
667
681
|
);
|
|
668
682
|
continue;
|
|
669
683
|
}
|
|
@@ -36,12 +36,14 @@ test("Can create coValue with new agent credentials and add transaction to it",
|
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
expect(
|
|
39
|
-
coValue
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
coValue
|
|
40
|
+
.tryAddTransactions(
|
|
41
|
+
node.currentSessionID,
|
|
42
|
+
[transaction],
|
|
43
|
+
expectedNewHash,
|
|
44
|
+
Crypto.sign(account.currentSignerSecret(), expectedNewHash),
|
|
45
|
+
)
|
|
46
|
+
._unsafeUnwrap(),
|
|
45
47
|
).toBe(true);
|
|
46
48
|
});
|
|
47
49
|
|
|
@@ -72,8 +74,9 @@ test("transactions with wrong signature are rejected", () => {
|
|
|
72
74
|
[transaction],
|
|
73
75
|
);
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
// eslint-disable-next-line neverthrow/must-use-result
|
|
78
|
+
coValue
|
|
79
|
+
.tryAddTransactions(
|
|
77
80
|
node.currentSessionID,
|
|
78
81
|
[transaction],
|
|
79
82
|
expectedNewHash,
|
|
@@ -81,8 +84,8 @@ test("transactions with wrong signature are rejected", () => {
|
|
|
81
84
|
Crypto.getAgentSignerSecret(wrongAgent),
|
|
82
85
|
expectedNewHash,
|
|
83
86
|
),
|
|
84
|
-
)
|
|
85
|
-
|
|
87
|
+
)
|
|
88
|
+
._unsafeUnwrapErr({ withStackTrace: true });
|
|
86
89
|
});
|
|
87
90
|
|
|
88
91
|
test("transactions with correctly signed, but wrong hash are rejected", () => {
|
|
@@ -121,14 +124,15 @@ test("transactions with correctly signed, but wrong hash are rejected", () => {
|
|
|
121
124
|
],
|
|
122
125
|
);
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
// eslint-disable-next-line neverthrow/must-use-result
|
|
128
|
+
coValue
|
|
129
|
+
.tryAddTransactions(
|
|
126
130
|
node.currentSessionID,
|
|
127
131
|
[transaction],
|
|
128
132
|
expectedNewHash,
|
|
129
133
|
Crypto.sign(account.currentSignerSecret(), expectedNewHash),
|
|
130
|
-
)
|
|
131
|
-
|
|
134
|
+
)
|
|
135
|
+
._unsafeUnwrapErr({ withStackTrace: true });
|
|
132
136
|
});
|
|
133
137
|
|
|
134
138
|
test("New transactions in a group correctly update owned values, including subscriptions", async () => {
|
|
@@ -174,12 +178,14 @@ test("New transactions in a group correctly update owned values, including subsc
|
|
|
174
178
|
|
|
175
179
|
expect(map.core.getValidSortedTransactions().length).toBe(1);
|
|
176
180
|
|
|
177
|
-
const manuallyAdddedTxSuccess = group.core
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
const manuallyAdddedTxSuccess = group.core
|
|
182
|
+
.tryAddTransactions(
|
|
183
|
+
node.currentSessionID,
|
|
184
|
+
[resignationThatWeJustLearnedAbout],
|
|
185
|
+
expectedNewHash,
|
|
186
|
+
signature,
|
|
187
|
+
)
|
|
188
|
+
._unsafeUnwrap({ withStackTrace: true });
|
|
183
189
|
|
|
184
190
|
expect(manuallyAdddedTxSuccess).toBe(true);
|
|
185
191
|
|
|
@@ -354,7 +354,7 @@ test("Admins can set group read key and then use it to create and read private t
|
|
|
354
354
|
const revelation = Crypto.seal({
|
|
355
355
|
message: readKey,
|
|
356
356
|
from: admin.currentSealerSecret(),
|
|
357
|
-
to: admin.currentSealerID(),
|
|
357
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
358
358
|
nOnceMaterial: {
|
|
359
359
|
in: groupCore.id,
|
|
360
360
|
tx: groupCore.nextTransactionID(),
|
|
@@ -410,7 +410,7 @@ test("Admins can set group read key and then writers can use it to create and re
|
|
|
410
410
|
const revelation1 = Crypto.seal({
|
|
411
411
|
message: readKey,
|
|
412
412
|
from: admin.currentSealerSecret(),
|
|
413
|
-
to: admin.currentSealerID(),
|
|
413
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
414
414
|
nOnceMaterial: {
|
|
415
415
|
in: groupCore.id,
|
|
416
416
|
tx: groupCore.nextTransactionID(),
|
|
@@ -422,7 +422,7 @@ test("Admins can set group read key and then writers can use it to create and re
|
|
|
422
422
|
const revelation2 = Crypto.seal({
|
|
423
423
|
message: readKey,
|
|
424
424
|
from: admin.currentSealerSecret(),
|
|
425
|
-
to: writer.currentSealerID(),
|
|
425
|
+
to: writer.currentSealerID()._unsafeUnwrap(),
|
|
426
426
|
nOnceMaterial: {
|
|
427
427
|
in: groupCore.id,
|
|
428
428
|
tx: groupCore.nextTransactionID(),
|
|
@@ -489,7 +489,7 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
489
489
|
const revelation1 = Crypto.seal({
|
|
490
490
|
message: readKey,
|
|
491
491
|
from: admin.currentSealerSecret(),
|
|
492
|
-
to: admin.currentSealerID(),
|
|
492
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
493
493
|
nOnceMaterial: {
|
|
494
494
|
in: groupCore.id,
|
|
495
495
|
tx: groupCore.nextTransactionID(),
|
|
@@ -501,7 +501,7 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
501
501
|
const revelation2 = Crypto.seal({
|
|
502
502
|
message: readKey,
|
|
503
503
|
from: admin.currentSealerSecret(),
|
|
504
|
-
to: reader.currentSealerID(),
|
|
504
|
+
to: reader.currentSealerID()._unsafeUnwrap(),
|
|
505
505
|
nOnceMaterial: {
|
|
506
506
|
in: groupCore.id,
|
|
507
507
|
tx: groupCore.nextTransactionID(),
|
|
@@ -576,7 +576,7 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
576
576
|
const revelation1 = Crypto.seal({
|
|
577
577
|
message: readKey,
|
|
578
578
|
from: admin.currentSealerSecret(),
|
|
579
|
-
to: admin.currentSealerID(),
|
|
579
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
580
580
|
nOnceMaterial: {
|
|
581
581
|
in: groupCore.id,
|
|
582
582
|
tx: groupCore.nextTransactionID(),
|
|
@@ -588,7 +588,7 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
588
588
|
const revelation2 = Crypto.seal({
|
|
589
589
|
message: readKey,
|
|
590
590
|
from: admin.currentSealerSecret(),
|
|
591
|
-
to: reader1.currentSealerID(),
|
|
591
|
+
to: reader1.currentSealerID()._unsafeUnwrap(),
|
|
592
592
|
nOnceMaterial: {
|
|
593
593
|
in: groupCore.id,
|
|
594
594
|
tx: groupCore.nextTransactionID(),
|
|
@@ -627,7 +627,7 @@ test("Admins can set group read key and then use it to create private transactio
|
|
|
627
627
|
const revelation3 = Crypto.seal({
|
|
628
628
|
message: readKey,
|
|
629
629
|
from: admin.currentSealerSecret(),
|
|
630
|
-
to: reader2.currentSealerID(),
|
|
630
|
+
to: reader2.currentSealerID()._unsafeUnwrap(),
|
|
631
631
|
nOnceMaterial: {
|
|
632
632
|
in: groupCore.id,
|
|
633
633
|
tx: groupCore.nextTransactionID(),
|
|
@@ -692,7 +692,7 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
692
692
|
const revelation1 = Crypto.seal({
|
|
693
693
|
message: readKey,
|
|
694
694
|
from: admin.currentSealerSecret(),
|
|
695
|
-
to: admin.currentSealerID(),
|
|
695
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
696
696
|
nOnceMaterial: {
|
|
697
697
|
in: groupCore.id,
|
|
698
698
|
tx: groupCore.nextTransactionID(),
|
|
@@ -722,7 +722,7 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
722
722
|
const revelation2 = Crypto.seal({
|
|
723
723
|
message: readKey2,
|
|
724
724
|
from: admin.currentSealerSecret(),
|
|
725
|
-
to: admin.currentSealerID(),
|
|
725
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
726
726
|
nOnceMaterial: {
|
|
727
727
|
in: groupCore.id,
|
|
728
728
|
tx: groupCore.nextTransactionID(),
|
|
@@ -775,7 +775,7 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
775
775
|
const revelation = Crypto.seal({
|
|
776
776
|
message: readKey,
|
|
777
777
|
from: admin.currentSealerSecret(),
|
|
778
|
-
to: admin.currentSealerID(),
|
|
778
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
779
779
|
nOnceMaterial: {
|
|
780
780
|
in: groupCore.id,
|
|
781
781
|
tx: groupCore.nextTransactionID(),
|
|
@@ -802,7 +802,7 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
802
802
|
const revelation2 = Crypto.seal({
|
|
803
803
|
message: readKey2,
|
|
804
804
|
from: admin.currentSealerSecret(),
|
|
805
|
-
to: admin.currentSealerID(),
|
|
805
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
806
806
|
nOnceMaterial: {
|
|
807
807
|
in: groupCore.id,
|
|
808
808
|
tx: groupCore.nextTransactionID(),
|
|
@@ -814,7 +814,7 @@ test("Admins can set group read key, make a private transaction in an owned obje
|
|
|
814
814
|
const revelation3 = Crypto.seal({
|
|
815
815
|
message: readKey2,
|
|
816
816
|
from: admin.currentSealerSecret(),
|
|
817
|
-
to: reader.currentSealerID(),
|
|
817
|
+
to: reader.currentSealerID()._unsafeUnwrap(),
|
|
818
818
|
nOnceMaterial: {
|
|
819
819
|
in: groupCore.id,
|
|
820
820
|
tx: groupCore.nextTransactionID(),
|
|
@@ -910,7 +910,7 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
910
910
|
const revelation1 = Crypto.seal({
|
|
911
911
|
message: readKey,
|
|
912
912
|
from: admin.currentSealerSecret(),
|
|
913
|
-
to: admin.currentSealerID(),
|
|
913
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
914
914
|
nOnceMaterial: {
|
|
915
915
|
in: groupCore.id,
|
|
916
916
|
tx: groupCore.nextTransactionID(),
|
|
@@ -922,7 +922,7 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
922
922
|
const revelation2 = Crypto.seal({
|
|
923
923
|
message: readKey,
|
|
924
924
|
from: admin.currentSealerSecret(),
|
|
925
|
-
to: reader.currentSealerID(),
|
|
925
|
+
to: reader.currentSealerID()._unsafeUnwrap(),
|
|
926
926
|
nOnceMaterial: {
|
|
927
927
|
in: groupCore.id,
|
|
928
928
|
tx: groupCore.nextTransactionID(),
|
|
@@ -934,7 +934,7 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
934
934
|
const revelation3 = Crypto.seal({
|
|
935
935
|
message: readKey,
|
|
936
936
|
from: admin.currentSealerSecret(),
|
|
937
|
-
to: reader2.currentSealerID(),
|
|
937
|
+
to: reader2.currentSealerID()._unsafeUnwrap(),
|
|
938
938
|
nOnceMaterial: {
|
|
939
939
|
in: groupCore.id,
|
|
940
940
|
tx: groupCore.nextTransactionID(),
|
|
@@ -980,7 +980,7 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
980
980
|
const newRevelation1 = Crypto.seal({
|
|
981
981
|
message: readKey2,
|
|
982
982
|
from: admin.currentSealerSecret(),
|
|
983
|
-
to: admin.currentSealerID(),
|
|
983
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
984
984
|
nOnceMaterial: {
|
|
985
985
|
in: groupCore.id,
|
|
986
986
|
tx: groupCore.nextTransactionID(),
|
|
@@ -996,7 +996,7 @@ test("Admins can set group read rey, make a private transaction in an owned obje
|
|
|
996
996
|
const newRevelation2 = Crypto.seal({
|
|
997
997
|
message: readKey2,
|
|
998
998
|
from: admin.currentSealerSecret(),
|
|
999
|
-
to: reader2.currentSealerID(),
|
|
999
|
+
to: reader2.currentSealerID()._unsafeUnwrap(),
|
|
1000
1000
|
nOnceMaterial: {
|
|
1001
1001
|
in: groupCore.id,
|
|
1002
1002
|
tx: groupCore.nextTransactionID(),
|
|
@@ -1121,7 +1121,7 @@ test("Admins can create an adminInvite, which can add an admin", () => {
|
|
|
1121
1121
|
const revelation = Crypto.seal({
|
|
1122
1122
|
message: readKey,
|
|
1123
1123
|
from: admin.currentSealerSecret(),
|
|
1124
|
-
to: admin.currentSealerID(),
|
|
1124
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
1125
1125
|
nOnceMaterial: {
|
|
1126
1126
|
in: groupCore.id,
|
|
1127
1127
|
tx: groupCore.nextTransactionID(),
|
|
@@ -1231,7 +1231,7 @@ test("Admins can create a writerInvite, which can add a writer", () => {
|
|
|
1231
1231
|
const revelation = Crypto.seal({
|
|
1232
1232
|
message: readKey,
|
|
1233
1233
|
from: admin.currentSealerSecret(),
|
|
1234
|
-
to: admin.currentSealerID(),
|
|
1234
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
1235
1235
|
nOnceMaterial: {
|
|
1236
1236
|
in: groupCore.id,
|
|
1237
1237
|
tx: groupCore.nextTransactionID(),
|
|
@@ -1334,7 +1334,7 @@ test("Admins can create a readerInvite, which can add a reader", () => {
|
|
|
1334
1334
|
const revelation = Crypto.seal({
|
|
1335
1335
|
message: readKey,
|
|
1336
1336
|
from: admin.currentSealerSecret(),
|
|
1337
|
-
to: admin.currentSealerID(),
|
|
1337
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
1338
1338
|
nOnceMaterial: {
|
|
1339
1339
|
in: groupCore.id,
|
|
1340
1340
|
tx: groupCore.nextTransactionID(),
|
|
@@ -1427,7 +1427,7 @@ test("WriterInvites can not invite admins", () => {
|
|
|
1427
1427
|
const revelation = Crypto.seal({
|
|
1428
1428
|
message: readKey,
|
|
1429
1429
|
from: admin.currentSealerSecret(),
|
|
1430
|
-
to: admin.currentSealerID(),
|
|
1430
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
1431
1431
|
nOnceMaterial: {
|
|
1432
1432
|
in: groupCore.id,
|
|
1433
1433
|
tx: groupCore.nextTransactionID(),
|
|
@@ -1481,7 +1481,7 @@ test("ReaderInvites can not invite admins", () => {
|
|
|
1481
1481
|
const revelation = Crypto.seal({
|
|
1482
1482
|
message: readKey,
|
|
1483
1483
|
from: admin.currentSealerSecret(),
|
|
1484
|
-
to: admin.currentSealerID(),
|
|
1484
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
1485
1485
|
nOnceMaterial: {
|
|
1486
1486
|
in: groupCore.id,
|
|
1487
1487
|
tx: groupCore.nextTransactionID(),
|
|
@@ -1535,7 +1535,7 @@ test("ReaderInvites can not invite writers", () => {
|
|
|
1535
1535
|
const revelation = Crypto.seal({
|
|
1536
1536
|
message: readKey,
|
|
1537
1537
|
from: admin.currentSealerSecret(),
|
|
1538
|
-
to: admin.currentSealerID(),
|
|
1538
|
+
to: admin.currentSealerID()._unsafeUnwrap(),
|
|
1539
1539
|
nOnceMaterial: {
|
|
1540
1540
|
in: groupCore.id,
|
|
1541
1541
|
tx: groupCore.nextTransactionID(),
|
|
@@ -1610,7 +1610,7 @@ test("Can give read permission to 'everyone'", () => {
|
|
|
1610
1610
|
childObject
|
|
1611
1611
|
.testWithDifferentAccount(
|
|
1612
1612
|
newAccount,
|
|
1613
|
-
newRandomSessionID(newAccount.currentAgentID()),
|
|
1613
|
+
newRandomSessionID(newAccount.currentAgentID()._unsafeUnwrap()),
|
|
1614
1614
|
)
|
|
1615
1615
|
.getCurrentContent(),
|
|
1616
1616
|
);
|
|
@@ -1639,7 +1639,7 @@ test("Can give read permissions to 'everyone' (high-level)", async () => {
|
|
|
1639
1639
|
childObject.core
|
|
1640
1640
|
.testWithDifferentAccount(
|
|
1641
1641
|
new ControlledAgent(Crypto.newRandomAgentSecret(), Crypto),
|
|
1642
|
-
newRandomSessionID(newAccount.currentAgentID()),
|
|
1642
|
+
newRandomSessionID(newAccount.currentAgentID()._unsafeUnwrap()),
|
|
1643
1643
|
)
|
|
1644
1644
|
.getCurrentContent(),
|
|
1645
1645
|
);
|
|
@@ -1680,7 +1680,7 @@ test("Can give write permission to 'everyone'", async () => {
|
|
|
1680
1680
|
childObject
|
|
1681
1681
|
.testWithDifferentAccount(
|
|
1682
1682
|
newAccount,
|
|
1683
|
-
newRandomSessionID(newAccount.currentAgentID()),
|
|
1683
|
+
newRandomSessionID(newAccount.currentAgentID()._unsafeUnwrap()),
|
|
1684
1684
|
)
|
|
1685
1685
|
.getCurrentContent(),
|
|
1686
1686
|
);
|
|
@@ -1715,7 +1715,7 @@ test("Can give write permissions to 'everyone' (high-level)", async () => {
|
|
|
1715
1715
|
childObject.core
|
|
1716
1716
|
.testWithDifferentAccount(
|
|
1717
1717
|
newAccount,
|
|
1718
|
-
newRandomSessionID(newAccount.currentAgentID()),
|
|
1718
|
+
newRandomSessionID(newAccount.currentAgentID()._unsafeUnwrap()),
|
|
1719
1719
|
)
|
|
1720
1720
|
.getCurrentContent(),
|
|
1721
1721
|
);
|