cojson 0.0.6 → 0.0.8
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 +11 -8
- package/dist/coValue.d.ts +97 -0
- package/dist/coValue.js +341 -401
- package/dist/coValue.js.map +1 -0
- package/dist/coValue.test.d.ts +1 -0
- package/dist/coValue.test.js +69 -113
- package/dist/coValue.test.js.map +1 -0
- package/dist/contentType.d.ts +15 -0
- package/dist/contentType.js +5 -5
- package/dist/contentType.js.map +1 -0
- package/dist/contentType.test.d.ts +1 -0
- package/dist/contentType.test.js +138 -168
- package/dist/contentType.test.js.map +1 -0
- package/dist/contentTypes/coList.d.ts +11 -0
- package/dist/contentTypes/coList.js +14 -16
- package/dist/contentTypes/coList.js.map +1 -0
- package/dist/contentTypes/coMap.d.ts +56 -0
- package/dist/contentTypes/coMap.js +112 -112
- package/dist/contentTypes/coMap.js.map +1 -0
- package/dist/contentTypes/coStream.d.ts +11 -0
- package/dist/contentTypes/coStream.js +14 -16
- package/dist/contentTypes/coStream.js.map +1 -0
- package/dist/contentTypes/static.d.ts +11 -0
- package/dist/contentTypes/static.js +12 -14
- package/dist/contentTypes/static.js.map +1 -0
- package/dist/crypto.d.ts +97 -0
- package/dist/crypto.js +100 -151
- package/dist/crypto.js.map +1 -0
- package/dist/crypto.test.d.ts +1 -0
- package/dist/crypto.test.js +94 -134
- package/dist/crypto.test.js.map +1 -0
- package/dist/ids.d.ts +7 -0
- package/dist/ids.js +2 -1
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +10 -18
- package/dist/index.js.map +1 -0
- package/dist/jsonValue.d.ts +7 -0
- package/dist/jsonValue.js +2 -1
- package/dist/jsonValue.js.map +1 -0
- package/dist/node.d.ts +33 -0
- package/dist/node.js +102 -133
- package/dist/node.js.map +1 -0
- package/dist/permissions.d.ts +54 -0
- package/dist/permissions.js +202 -228
- package/dist/permissions.js.map +1 -0
- package/dist/permissions.test.d.ts +1 -0
- package/dist/permissions.test.js +724 -915
- package/dist/permissions.test.js.map +1 -0
- package/dist/sync.d.ts +80 -0
- package/dist/sync.js +247 -294
- package/dist/sync.js.map +1 -0
- package/dist/sync.test.d.ts +1 -0
- package/dist/sync.test.js +763 -798
- package/dist/sync.test.js.map +1 -0
- package/package.json +7 -4
- package/src/coValue.test.ts +3 -4
- package/src/coValue.ts +11 -17
- package/src/contentType.test.ts +3 -3
- package/src/contentType.ts +6 -6
- package/src/contentTypes/coList.ts +4 -4
- package/src/contentTypes/coMap.ts +6 -6
- package/src/contentTypes/coStream.ts +4 -4
- package/src/contentTypes/static.ts +5 -5
- package/src/crypto.test.ts +1 -1
- package/src/crypto.ts +2 -2
- package/src/index.ts +9 -7
- package/src/jsonValue.ts +1 -1
- package/src/node.ts +6 -7
- package/src/permissions.test.ts +5 -5
- package/src/permissions.ts +7 -7
- package/src/sync.test.ts +7 -7
- package/src/sync.ts +6 -6
- package/tsconfig.json +1 -7
package/dist/permissions.js
CHANGED
|
@@ -1,244 +1,218 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
createdNowUnique,
|
|
4
|
-
newRandomKeySecret,
|
|
5
|
-
seal,
|
|
6
|
-
sealKeySecret
|
|
7
|
-
} from "./crypto";
|
|
8
|
-
import {
|
|
9
|
-
agentIDfromSessionID
|
|
10
|
-
} from "./coValue";
|
|
1
|
+
import { createdNowUnique, newRandomKeySecret, seal, sealKeySecret, } from './crypto.js';
|
|
2
|
+
import { agentIDfromSessionID, } from './coValue.js';
|
|
11
3
|
export function determineValidTransactions(coValue) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
4
|
+
if (coValue.header.ruleset.type === "team") {
|
|
5
|
+
const allTrustingTransactionsSorted = Object.entries(coValue.sessions).flatMap(([sessionID, sessionLog]) => {
|
|
6
|
+
return sessionLog.transactions
|
|
7
|
+
.map((tx, txIndex) => ({ sessionID, txIndex, tx }))
|
|
8
|
+
.filter(({ tx }) => {
|
|
9
|
+
if (tx.privacy === "trusting") {
|
|
10
|
+
return true;
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
console.warn("Unexpected private transaction in Team");
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
allTrustingTransactionsSorted.sort((a, b) => {
|
|
19
|
+
return a.tx.madeAt - b.tx.madeAt;
|
|
20
|
+
});
|
|
21
|
+
const initialAdmin = coValue.header.ruleset.initialAdmin;
|
|
22
|
+
if (!initialAdmin) {
|
|
23
|
+
throw new Error("Team must have initialAdmin");
|
|
22
24
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
25
|
+
const memberState = {};
|
|
26
|
+
const validTransactions = [];
|
|
27
|
+
for (const { sessionID, txIndex, tx, } of allTrustingTransactionsSorted) {
|
|
28
|
+
// console.log("before", { memberState, validTransactions });
|
|
29
|
+
const transactor = agentIDfromSessionID(sessionID);
|
|
30
|
+
const change = tx.changes[0];
|
|
31
|
+
if (tx.changes.length !== 1) {
|
|
32
|
+
console.warn("Team transaction must have exactly one change");
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (change.op !== "insert") {
|
|
36
|
+
console.warn("Team transaction must set a role or readKey");
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (change.key === "readKey") {
|
|
40
|
+
if (memberState[transactor] !== "admin") {
|
|
41
|
+
console.warn("Only admins can set readKeys");
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
// TODO: check validity of agents who the key is revealed to?
|
|
45
|
+
validTransactions.push({ txID: { sessionID, txIndex }, tx });
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const affectedMember = change.key;
|
|
49
|
+
const assignedRole = change.value;
|
|
50
|
+
if (change.value !== "admin" &&
|
|
51
|
+
change.value !== "writer" &&
|
|
52
|
+
change.value !== "reader" &&
|
|
53
|
+
change.value !== "revoked") {
|
|
54
|
+
console.warn("Team transaction must set a valid role");
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const isFirstSelfAppointment = !memberState[transactor] &&
|
|
58
|
+
transactor === initialAdmin &&
|
|
59
|
+
change.op === "insert" &&
|
|
60
|
+
change.key === transactor &&
|
|
61
|
+
change.value === "admin";
|
|
62
|
+
if (!isFirstSelfAppointment) {
|
|
63
|
+
if (memberState[transactor] !== "admin") {
|
|
64
|
+
console.warn("Team transaction must be made by current admin");
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (memberState[affectedMember] === "admin" &&
|
|
68
|
+
affectedMember !== transactor &&
|
|
69
|
+
assignedRole !== "admin") {
|
|
70
|
+
console.warn("Admins can only demote themselves.");
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
memberState[affectedMember] = change.value;
|
|
75
|
+
validTransactions.push({ txID: { sessionID, txIndex }, tx });
|
|
76
|
+
// console.log("after", { memberState, validTransactions });
|
|
70
77
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
return validTransactions;
|
|
79
|
+
}
|
|
80
|
+
else if (coValue.header.ruleset.type === "ownedByTeam") {
|
|
81
|
+
const teamContent = coValue.node.expectCoValueLoaded(coValue.header.ruleset.team, "Determining valid transaction in owned object but its team wasn't loaded").getCurrentContent();
|
|
82
|
+
if (teamContent.type !== "comap") {
|
|
83
|
+
throw new Error("Team must be a map");
|
|
74
84
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
return Object.entries(coValue.sessions).flatMap(([sessionID, sessionLog]) => {
|
|
86
|
+
const transactor = agentIDfromSessionID(sessionID);
|
|
87
|
+
return sessionLog.transactions
|
|
88
|
+
.filter((tx) => {
|
|
89
|
+
const transactorRoleAtTxTime = teamContent.getAtTime(transactor, tx.madeAt);
|
|
90
|
+
return (transactorRoleAtTxTime === "admin" ||
|
|
91
|
+
transactorRoleAtTxTime === "writer");
|
|
92
|
+
})
|
|
93
|
+
.map((tx, txIndex) => ({
|
|
94
|
+
txID: { sessionID: sessionID, txIndex },
|
|
95
|
+
tx,
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
else if (coValue.header.ruleset.type === "unsafeAllowAll") {
|
|
100
|
+
return Object.entries(coValue.sessions).flatMap(([sessionID, sessionLog]) => {
|
|
101
|
+
return sessionLog.transactions.map((tx, txIndex) => ({
|
|
102
|
+
txID: { sessionID: sessionID, txIndex },
|
|
103
|
+
tx,
|
|
104
|
+
}));
|
|
105
|
+
});
|
|
78
106
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (teamContent.type !== "comap") {
|
|
86
|
-
throw new Error("Team must be a map");
|
|
107
|
+
else if (coValue.header.ruleset.type === "agent") {
|
|
108
|
+
// TODO
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
throw new Error("Unknown ruleset type " + coValue.header.ruleset.type);
|
|
87
113
|
}
|
|
88
|
-
return Object.entries(coValue.sessions).flatMap(
|
|
89
|
-
([sessionID, sessionLog]) => {
|
|
90
|
-
const transactor = agentIDfromSessionID(sessionID);
|
|
91
|
-
return sessionLog.transactions.filter((tx) => {
|
|
92
|
-
const transactorRoleAtTxTime = teamContent.getAtTime(
|
|
93
|
-
transactor,
|
|
94
|
-
tx.madeAt
|
|
95
|
-
);
|
|
96
|
-
return transactorRoleAtTxTime === "admin" || transactorRoleAtTxTime === "writer";
|
|
97
|
-
}).map((tx, txIndex) => ({
|
|
98
|
-
txID: { sessionID, txIndex },
|
|
99
|
-
tx
|
|
100
|
-
}));
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
} else if (coValue.header.ruleset.type === "unsafeAllowAll") {
|
|
104
|
-
return Object.entries(coValue.sessions).flatMap(
|
|
105
|
-
([sessionID, sessionLog]) => {
|
|
106
|
-
return sessionLog.transactions.map((tx, txIndex) => ({
|
|
107
|
-
txID: { sessionID, txIndex },
|
|
108
|
-
tx
|
|
109
|
-
}));
|
|
110
|
-
}
|
|
111
|
-
);
|
|
112
|
-
} else if (coValue.header.ruleset.type === "agent") {
|
|
113
|
-
return [];
|
|
114
|
-
} else {
|
|
115
|
-
throw new Error("Unknown ruleset type " + coValue.header.ruleset.type);
|
|
116
|
-
}
|
|
117
114
|
}
|
|
118
115
|
export function expectTeamContent(content) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
if (content.type !== "comap") {
|
|
117
|
+
throw new Error("Expected map");
|
|
118
|
+
}
|
|
119
|
+
return content;
|
|
123
120
|
}
|
|
124
121
|
export class Team {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
this.teamMap = teamMap;
|
|
129
|
-
this.node = node;
|
|
130
|
-
}
|
|
131
|
-
get id() {
|
|
132
|
-
return this.teamMap.id;
|
|
133
|
-
}
|
|
134
|
-
addMember(agentID, role) {
|
|
135
|
-
this.teamMap = this.teamMap.edit((map) => {
|
|
136
|
-
const agent = this.node.expectAgentLoaded(agentID, "Expected to know agent to add them to team");
|
|
137
|
-
if (!agent) {
|
|
138
|
-
throw new Error("Unknown agent " + agentID);
|
|
139
|
-
}
|
|
140
|
-
map.set(agentID, role, "trusting");
|
|
141
|
-
if (map.get(agentID) !== role) {
|
|
142
|
-
throw new Error("Failed to set role");
|
|
143
|
-
}
|
|
144
|
-
const currentReadKey = this.teamMap.coValue.getCurrentReadKey();
|
|
145
|
-
if (!currentReadKey.secret) {
|
|
146
|
-
throw new Error("Can't add member without read key secret");
|
|
147
|
-
}
|
|
148
|
-
const revelation = seal(
|
|
149
|
-
currentReadKey.secret,
|
|
150
|
-
this.teamMap.coValue.node.agentCredential.recipientSecret,
|
|
151
|
-
/* @__PURE__ */ new Set([agent.recipientID]),
|
|
152
|
-
{
|
|
153
|
-
in: this.teamMap.coValue.id,
|
|
154
|
-
tx: this.teamMap.coValue.nextTransactionID()
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
map.set(
|
|
158
|
-
"readKey",
|
|
159
|
-
{ keyID: currentReadKey.id, revelation },
|
|
160
|
-
"trusting"
|
|
161
|
-
);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
rotateReadKey() {
|
|
165
|
-
const currentlyPermittedReaders = this.teamMap.keys().filter((key) => {
|
|
166
|
-
if (key.startsWith("co_agent")) {
|
|
167
|
-
const role = this.teamMap.get(key);
|
|
168
|
-
return role === "admin" || role === "writer" || role === "reader";
|
|
169
|
-
} else {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
const maybeCurrentReadKey = this.teamMap.coValue.getCurrentReadKey();
|
|
174
|
-
if (!maybeCurrentReadKey.secret) {
|
|
175
|
-
throw new Error("Can't rotate read key secret we don't have access to");
|
|
122
|
+
constructor(teamMap, node) {
|
|
123
|
+
this.teamMap = teamMap;
|
|
124
|
+
this.node = node;
|
|
176
125
|
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
126
|
+
get id() {
|
|
127
|
+
return this.teamMap.id;
|
|
128
|
+
}
|
|
129
|
+
addMember(agentID, role) {
|
|
130
|
+
this.teamMap = this.teamMap.edit((map) => {
|
|
131
|
+
const agent = this.node.expectAgentLoaded(agentID, "Expected to know agent to add them to team");
|
|
132
|
+
if (!agent) {
|
|
133
|
+
throw new Error("Unknown agent " + agentID);
|
|
134
|
+
}
|
|
135
|
+
map.set(agentID, role, "trusting");
|
|
136
|
+
if (map.get(agentID) !== role) {
|
|
137
|
+
throw new Error("Failed to set role");
|
|
138
|
+
}
|
|
139
|
+
const currentReadKey = this.teamMap.coValue.getCurrentReadKey();
|
|
140
|
+
if (!currentReadKey.secret) {
|
|
141
|
+
throw new Error("Can't add member without read key secret");
|
|
142
|
+
}
|
|
143
|
+
const revelation = seal(currentReadKey.secret, this.teamMap.coValue.node.agentCredential.recipientSecret, new Set([agent.recipientID]), {
|
|
144
|
+
in: this.teamMap.coValue.id,
|
|
145
|
+
tx: this.teamMap.coValue.nextTransactionID(),
|
|
146
|
+
});
|
|
147
|
+
map.set("readKey", { keyID: currentReadKey.id, revelation }, "trusting");
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
rotateReadKey() {
|
|
151
|
+
const currentlyPermittedReaders = this.teamMap.keys().filter((key) => {
|
|
152
|
+
if (key.startsWith("co_agent")) {
|
|
153
|
+
const role = this.teamMap.get(key);
|
|
154
|
+
return (role === "admin" || role === "writer" || role === "reader");
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
const maybeCurrentReadKey = this.teamMap.coValue.getCurrentReadKey();
|
|
161
|
+
if (!maybeCurrentReadKey.secret) {
|
|
162
|
+
throw new Error("Can't rotate read key secret we don't have access to");
|
|
163
|
+
}
|
|
164
|
+
const currentReadKey = {
|
|
165
|
+
id: maybeCurrentReadKey.id,
|
|
166
|
+
secret: maybeCurrentReadKey.secret,
|
|
167
|
+
};
|
|
168
|
+
const newReadKey = newRandomKeySecret();
|
|
169
|
+
const newReadKeyRevelation = seal(newReadKey.secret, this.teamMap.coValue.node.agentCredential.recipientSecret, new Set(currentlyPermittedReaders.map((reader) => {
|
|
188
170
|
const readerAgent = this.node.expectAgentLoaded(reader, "Expected to know currently permitted reader");
|
|
189
171
|
if (!readerAgent) {
|
|
190
|
-
|
|
172
|
+
throw new Error("Unknown agent " + reader);
|
|
191
173
|
}
|
|
192
174
|
return readerAgent.recipientID;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
testWithDifferentCredentials(credential, sessionId) {
|
|
237
|
-
return new Team(
|
|
238
|
-
expectTeamContent(
|
|
239
|
-
this.teamMap.coValue.testWithDifferentCredentials(credential, sessionId).getCurrentContent()
|
|
240
|
-
),
|
|
241
|
-
this.node
|
|
242
|
-
);
|
|
243
|
-
}
|
|
175
|
+
})), {
|
|
176
|
+
in: this.teamMap.coValue.id,
|
|
177
|
+
tx: this.teamMap.coValue.nextTransactionID(),
|
|
178
|
+
});
|
|
179
|
+
this.teamMap = this.teamMap.edit((map) => {
|
|
180
|
+
map.set("readKey", {
|
|
181
|
+
keyID: newReadKey.id,
|
|
182
|
+
revelation: newReadKeyRevelation,
|
|
183
|
+
previousKeys: {
|
|
184
|
+
[currentReadKey.id]: sealKeySecret({
|
|
185
|
+
sealing: newReadKey,
|
|
186
|
+
toSeal: currentReadKey,
|
|
187
|
+
}).encrypted,
|
|
188
|
+
},
|
|
189
|
+
}, "trusting");
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
removeMember(agentID) {
|
|
193
|
+
this.teamMap = this.teamMap.edit((map) => {
|
|
194
|
+
map.set(agentID, "revoked", "trusting");
|
|
195
|
+
});
|
|
196
|
+
this.rotateReadKey();
|
|
197
|
+
}
|
|
198
|
+
createMap(meta) {
|
|
199
|
+
return this.node
|
|
200
|
+
.createCoValue({
|
|
201
|
+
type: "comap",
|
|
202
|
+
ruleset: {
|
|
203
|
+
type: "ownedByTeam",
|
|
204
|
+
team: this.teamMap.id,
|
|
205
|
+
},
|
|
206
|
+
meta: meta || null,
|
|
207
|
+
...createdNowUnique(),
|
|
208
|
+
publicNickname: "map",
|
|
209
|
+
})
|
|
210
|
+
.getCurrentContent();
|
|
211
|
+
}
|
|
212
|
+
testWithDifferentCredentials(credential, sessionId) {
|
|
213
|
+
return new Team(expectTeamContent(this.teamMap.coValue
|
|
214
|
+
.testWithDifferentCredentials(credential, sessionId)
|
|
215
|
+
.getCurrentContent()), this.node);
|
|
216
|
+
}
|
|
244
217
|
}
|
|
218
|
+
//# sourceMappingURL=permissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAGA,OAAO,EAOH,gBAAgB,EAChB,kBAAkB,EAClB,IAAI,EACJ,aAAa,GAChB,MAAM,aAAa,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