@peerbit/log 4.0.4 → 4.0.5
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/src/clock.d.ts.map +1 -1
- package/dist/src/clock.js +20 -11
- package/dist/src/clock.js.map +1 -1
- package/dist/src/entry-create.d.ts +26 -0
- package/dist/src/entry-create.d.ts.map +1 -0
- package/dist/src/entry-create.js +5 -0
- package/dist/src/entry-create.js.map +1 -0
- package/dist/src/entry-index.d.ts +2 -1
- package/dist/src/entry-index.d.ts.map +1 -1
- package/dist/src/entry-index.js +2 -1
- package/dist/src/entry-index.js.map +1 -1
- package/dist/src/entry-shallow.d.ts +29 -0
- package/dist/src/entry-shallow.d.ts.map +1 -0
- package/dist/src/entry-shallow.js +75 -0
- package/dist/src/entry-shallow.js.map +1 -0
- package/dist/src/entry-type.d.ts +5 -0
- package/dist/src/entry-type.d.ts.map +1 -0
- package/dist/src/entry-type.js +6 -0
- package/dist/src/entry-type.js.map +1 -0
- package/dist/src/entry-v0.d.ts +121 -0
- package/dist/src/entry-v0.d.ts.map +1 -0
- package/dist/src/entry-v0.js +465 -0
- package/dist/src/entry-v0.js.map +1 -0
- package/dist/src/entry.d.ts +31 -153
- package/dist/src/entry.d.ts.map +1 -1
- package/dist/src/entry.js +24 -581
- package/dist/src/entry.js.map +1 -1
- package/dist/src/heads-cache.d.ts +1 -1
- package/dist/src/heads-cache.d.ts.map +1 -1
- package/dist/src/heads-cache.js +0 -1
- package/dist/src/heads-cache.js.map +1 -1
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/log.d.ts +6 -4
- package/dist/src/log.d.ts.map +1 -1
- package/dist/src/log.js +22 -82
- package/dist/src/log.js.map +1 -1
- package/dist/src/payload.d.ts +17 -0
- package/dist/src/payload.d.ts.map +1 -0
- package/dist/src/payload.js +53 -0
- package/dist/src/payload.js.map +1 -0
- package/dist/src/trim.d.ts +2 -1
- package/dist/src/trim.d.ts.map +1 -1
- package/dist/src/trim.js.map +1 -1
- package/package.json +3 -3
- package/src/clock.ts +3 -2
- package/src/entry-create.ts +30 -0
- package/src/entry-index.ts +3 -6
- package/src/entry-shallow.ts +61 -0
- package/src/entry-type.ts +4 -0
- package/src/entry-v0.ts +594 -0
- package/src/entry.ts +50 -693
- package/src/heads-cache.ts +1 -1
- package/src/index.ts +5 -0
- package/src/log.ts +23 -94
- package/src/payload.ts +44 -0
- package/src/trim.ts +2 -1
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var EntryV0_1;
|
|
11
|
+
import { field, fixedArray, option, serialize, variant, vec, } from "@dao-xyz/borsh";
|
|
12
|
+
import {} from "@peerbit/blocks-interface";
|
|
13
|
+
import { AccessError, DecryptedThing, Ed25519PublicKey, MaybeEncrypted, PublicSignKey, SignatureWithKey, X25519Keypair, X25519PublicKey, randomBytes, sha256Base64, } from "@peerbit/crypto";
|
|
14
|
+
import { verify } from "@peerbit/crypto";
|
|
15
|
+
import {} from "@peerbit/keychain";
|
|
16
|
+
import { compare } from "uint8arrays";
|
|
17
|
+
import { LamportClock as Clock, HLC, Timestamp } from "./clock.js";
|
|
18
|
+
import { NO_ENCODING } from "./encoding.js";
|
|
19
|
+
import { ShallowEntry, ShallowMeta } from "./entry-shallow.js";
|
|
20
|
+
import { EntryType } from "./entry-type.js";
|
|
21
|
+
import { Entry } from "./entry.js";
|
|
22
|
+
import { logger } from "./logger.js";
|
|
23
|
+
import { Payload } from "./payload.js";
|
|
24
|
+
import { equals } from "./utils.js";
|
|
25
|
+
const isMaybeEryptionPublicKey = (o) => {
|
|
26
|
+
if (!o) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (o instanceof X25519PublicKey || o instanceof Ed25519PublicKey) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(o)) {
|
|
33
|
+
return true; // assume entries are either X25519PublicKey or Ed25519PublicKey
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
37
|
+
let Meta = class Meta {
|
|
38
|
+
clock;
|
|
39
|
+
gid; // graph id
|
|
40
|
+
next;
|
|
41
|
+
type;
|
|
42
|
+
data; // Optional metadata
|
|
43
|
+
constructor(properties) {
|
|
44
|
+
this.gid = properties.gid;
|
|
45
|
+
this.clock = properties.clock;
|
|
46
|
+
this.type = properties.type;
|
|
47
|
+
this.data = properties.data;
|
|
48
|
+
this.next = properties.next;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
__decorate([
|
|
52
|
+
field({ type: Clock }),
|
|
53
|
+
__metadata("design:type", Clock)
|
|
54
|
+
], Meta.prototype, "clock", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
field({ type: "string" }),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], Meta.prototype, "gid", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
field({ type: vec("string") }),
|
|
61
|
+
__metadata("design:type", Array)
|
|
62
|
+
], Meta.prototype, "next", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
field({ type: "u8" }),
|
|
65
|
+
__metadata("design:type", Number)
|
|
66
|
+
], Meta.prototype, "type", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
field({ type: option(Uint8Array) }),
|
|
69
|
+
__metadata("design:type", Uint8Array)
|
|
70
|
+
], Meta.prototype, "data", void 0);
|
|
71
|
+
Meta = __decorate([
|
|
72
|
+
variant(0),
|
|
73
|
+
__metadata("design:paramtypes", [Object])
|
|
74
|
+
], Meta);
|
|
75
|
+
export { Meta };
|
|
76
|
+
let Signatures = class Signatures {
|
|
77
|
+
signatures;
|
|
78
|
+
constructor(properties) {
|
|
79
|
+
if (properties) {
|
|
80
|
+
this.signatures = properties.signatures;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
equals(other) {
|
|
84
|
+
if (this.signatures.length !== other.signatures.length) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
for (let i = 0; i < this.signatures.length; i++) {
|
|
88
|
+
if (!this.signatures[i].equals(other.signatures[i])) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
__decorate([
|
|
96
|
+
field({ type: vec(MaybeEncrypted) }),
|
|
97
|
+
__metadata("design:type", Array)
|
|
98
|
+
], Signatures.prototype, "signatures", void 0);
|
|
99
|
+
Signatures = __decorate([
|
|
100
|
+
variant(0),
|
|
101
|
+
__metadata("design:paramtypes", [Object])
|
|
102
|
+
], Signatures);
|
|
103
|
+
export { Signatures };
|
|
104
|
+
const maybeEncrypt = (thing, keypair, receiver) => {
|
|
105
|
+
const receivers = receiver
|
|
106
|
+
? Array.isArray(receiver)
|
|
107
|
+
? receiver
|
|
108
|
+
: [receiver]
|
|
109
|
+
: undefined;
|
|
110
|
+
if (receivers?.length && receivers?.length > 0) {
|
|
111
|
+
if (!keypair) {
|
|
112
|
+
throw new Error("Keypair not provided");
|
|
113
|
+
}
|
|
114
|
+
return new DecryptedThing({
|
|
115
|
+
data: serialize(thing),
|
|
116
|
+
value: thing,
|
|
117
|
+
}).encrypt(keypair, receivers);
|
|
118
|
+
}
|
|
119
|
+
return new DecryptedThing({
|
|
120
|
+
data: serialize(thing),
|
|
121
|
+
value: thing,
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
let EntryV0 = EntryV0_1 = class EntryV0 extends Entry {
|
|
125
|
+
_meta;
|
|
126
|
+
_payload;
|
|
127
|
+
_reserved;
|
|
128
|
+
_signatures;
|
|
129
|
+
hash; // "zd...Foo", we'll set the hash after persisting the entry
|
|
130
|
+
createdLocally;
|
|
131
|
+
_keychain;
|
|
132
|
+
_encoding;
|
|
133
|
+
constructor(obj) {
|
|
134
|
+
super();
|
|
135
|
+
this._meta = obj.meta;
|
|
136
|
+
this._payload = obj.payload;
|
|
137
|
+
this._signatures = obj.signatures;
|
|
138
|
+
this._reserved = new Uint8Array([0, 0, 0, 0]);
|
|
139
|
+
this.createdLocally = obj.createdLocally;
|
|
140
|
+
}
|
|
141
|
+
init(props) {
|
|
142
|
+
if (props instanceof Entry) {
|
|
143
|
+
this._keychain = props._keychain;
|
|
144
|
+
this._encoding = props._encoding;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this._keychain = props.keychain;
|
|
148
|
+
this._encoding = props.encoding;
|
|
149
|
+
}
|
|
150
|
+
return this;
|
|
151
|
+
}
|
|
152
|
+
get encoding() {
|
|
153
|
+
if (!this._encoding) {
|
|
154
|
+
throw new Error("Not initialized");
|
|
155
|
+
}
|
|
156
|
+
return this._encoding;
|
|
157
|
+
}
|
|
158
|
+
get meta() {
|
|
159
|
+
return this._meta.decrypted.getValue(Meta);
|
|
160
|
+
}
|
|
161
|
+
async getMeta() {
|
|
162
|
+
await this._meta.decrypt(this._keychain);
|
|
163
|
+
return this.meta;
|
|
164
|
+
}
|
|
165
|
+
async getClock() {
|
|
166
|
+
return (await this.getMeta()).clock;
|
|
167
|
+
}
|
|
168
|
+
get gid() {
|
|
169
|
+
return this._meta.decrypted.getValue(Meta).gid;
|
|
170
|
+
}
|
|
171
|
+
async getGid() {
|
|
172
|
+
return (await this.getMeta()).gid;
|
|
173
|
+
}
|
|
174
|
+
get payload() {
|
|
175
|
+
const payload = this._payload.decrypted.getValue(Payload);
|
|
176
|
+
payload.encoding = payload.encoding || this.encoding;
|
|
177
|
+
return payload;
|
|
178
|
+
}
|
|
179
|
+
async getPayload() {
|
|
180
|
+
if (this._payload instanceof DecryptedThing) {
|
|
181
|
+
return this.payload;
|
|
182
|
+
}
|
|
183
|
+
await this._payload.decrypt(this._keychain);
|
|
184
|
+
return this.payload;
|
|
185
|
+
}
|
|
186
|
+
async getPayloadValue() {
|
|
187
|
+
const payload = await this.getPayload();
|
|
188
|
+
return payload.isDecoded ? payload.value : payload.getValue(this.encoding);
|
|
189
|
+
}
|
|
190
|
+
get publicKeys() {
|
|
191
|
+
return this.signatures.map((x) => x.publicKey);
|
|
192
|
+
}
|
|
193
|
+
get next() {
|
|
194
|
+
return this.meta.next;
|
|
195
|
+
}
|
|
196
|
+
async getNext() {
|
|
197
|
+
return (await this.getMeta()).next;
|
|
198
|
+
}
|
|
199
|
+
_size;
|
|
200
|
+
set size(number) {
|
|
201
|
+
this._size = number;
|
|
202
|
+
}
|
|
203
|
+
get size() {
|
|
204
|
+
if (this._size == null) {
|
|
205
|
+
throw new Error("Size not set. Size is set when entry is, created, loaded or joined");
|
|
206
|
+
}
|
|
207
|
+
return this._size;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Will only return signatures I can decrypt
|
|
211
|
+
* @returns signatures
|
|
212
|
+
*/
|
|
213
|
+
get signatures() {
|
|
214
|
+
const signatures = this._signatures.signatures.filter((x) => {
|
|
215
|
+
try {
|
|
216
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
217
|
+
x.decrypted;
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
return false;
|
|
222
|
+
}
|
|
223
|
+
}).map((x) => x.decrypted.getValue(SignatureWithKey));
|
|
224
|
+
if (signatures.length === 0) {
|
|
225
|
+
this._signatures?.signatures.forEach((x) => x.clear());
|
|
226
|
+
throw new Error("Failed to resolve any signature");
|
|
227
|
+
}
|
|
228
|
+
return signatures;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Will only return signatures I can decrypt
|
|
232
|
+
* @returns signatures
|
|
233
|
+
*/
|
|
234
|
+
async getSignatures() {
|
|
235
|
+
const results = await Promise.allSettled(this._signatures.signatures.map((x) => x.decrypt(this._keychain)));
|
|
236
|
+
if (logger.level === "debug" || logger.level === "trace") {
|
|
237
|
+
for (const [i, result] of results.entries()) {
|
|
238
|
+
if (result.status === "rejected") {
|
|
239
|
+
logger.debug("Failed to decrypt signature with index: " + i);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return this.signatures;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Will only verify signatures I can decrypt
|
|
247
|
+
* @returns true if all are verified
|
|
248
|
+
*/
|
|
249
|
+
async verifySignatures() {
|
|
250
|
+
const signatures = await this.getSignatures();
|
|
251
|
+
if (signatures.length === 0) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
const signable = EntryV0_1.toSignable(this);
|
|
255
|
+
const signableBytes = serialize(signable);
|
|
256
|
+
for (const signature of signatures) {
|
|
257
|
+
if (!(await verify(signature, signableBytes))) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
static toSignable(entry) {
|
|
264
|
+
// TODO fix types
|
|
265
|
+
const trimmed = new EntryV0_1({
|
|
266
|
+
meta: entry._meta,
|
|
267
|
+
payload: entry._payload,
|
|
268
|
+
reserved: entry._reserved,
|
|
269
|
+
signatures: undefined,
|
|
270
|
+
hash: undefined,
|
|
271
|
+
});
|
|
272
|
+
return trimmed;
|
|
273
|
+
}
|
|
274
|
+
toSignable() {
|
|
275
|
+
if (this._signatures) {
|
|
276
|
+
throw new Error("Expected signatures to be undefined");
|
|
277
|
+
}
|
|
278
|
+
if (this.hash) {
|
|
279
|
+
throw new Error("Expected hash to be undefined");
|
|
280
|
+
}
|
|
281
|
+
return EntryV0_1.toSignable(this);
|
|
282
|
+
}
|
|
283
|
+
equals(other) {
|
|
284
|
+
if (other instanceof EntryV0_1) {
|
|
285
|
+
return (equals(this._reserved, other._reserved) &&
|
|
286
|
+
this._meta.equals(other._meta) &&
|
|
287
|
+
this._signatures.equals(other._signatures) &&
|
|
288
|
+
this._payload.equals(other._payload)); // dont compare hashes because the hash is a function of the other properties
|
|
289
|
+
}
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
async delete(store) {
|
|
293
|
+
if (!this.hash) {
|
|
294
|
+
throw new Error("Missing hash");
|
|
295
|
+
}
|
|
296
|
+
await store.rm(this.hash);
|
|
297
|
+
}
|
|
298
|
+
static createGid(seed) {
|
|
299
|
+
return sha256Base64(seed || randomBytes(32));
|
|
300
|
+
}
|
|
301
|
+
static async create(properties) {
|
|
302
|
+
if (!properties.encoding || !properties?.meta?.next) {
|
|
303
|
+
properties = {
|
|
304
|
+
...properties,
|
|
305
|
+
meta: {
|
|
306
|
+
...properties?.meta,
|
|
307
|
+
next: properties.meta?.next ? properties.meta?.next : [],
|
|
308
|
+
},
|
|
309
|
+
encoding: properties.encoding ? properties.encoding : NO_ENCODING,
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
if (!properties.encoding) {
|
|
313
|
+
throw new Error("Missing encoding options");
|
|
314
|
+
}
|
|
315
|
+
if (properties.data == null)
|
|
316
|
+
throw new Error("Entry requires data");
|
|
317
|
+
if (properties.meta?.next == null || !Array.isArray(properties.meta.next))
|
|
318
|
+
throw new Error("'next' argument is not an array");
|
|
319
|
+
// Clean the next objects and convert to hashes
|
|
320
|
+
const nexts = properties.meta?.next;
|
|
321
|
+
const payloadToSave = new Payload({
|
|
322
|
+
data: properties.encoding.encoder(properties.data),
|
|
323
|
+
value: properties.data,
|
|
324
|
+
encoding: properties.encoding,
|
|
325
|
+
});
|
|
326
|
+
let clock = properties.meta?.clock;
|
|
327
|
+
if (!clock) {
|
|
328
|
+
const hlc = new HLC();
|
|
329
|
+
for (const next of nexts) {
|
|
330
|
+
hlc.update(next.meta.clock.timestamp);
|
|
331
|
+
}
|
|
332
|
+
if (properties.encryption?.receiver.signatures &&
|
|
333
|
+
properties.encryption?.receiver.meta) {
|
|
334
|
+
throw new Error("Signature is to be encrypted yet the clock is not, which contains the publicKey as id. Either provide a custom Clock value that is not sensitive or set the receiver (encryption target) for the clock");
|
|
335
|
+
}
|
|
336
|
+
clock = new Clock({
|
|
337
|
+
id: properties.identity.publicKey.bytes,
|
|
338
|
+
timestamp: hlc.now(),
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
const cv = clock;
|
|
343
|
+
// check if nexts, that all nexts are happening BEFORE this clock value (else clock make no sense)
|
|
344
|
+
for (const n of nexts) {
|
|
345
|
+
if (Timestamp.compare(n.meta.clock.timestamp, cv.timestamp) >= 0) {
|
|
346
|
+
throw new Error("Expecting next(s) to happen before entry, got: " +
|
|
347
|
+
n.meta.clock.timestamp +
|
|
348
|
+
" > " +
|
|
349
|
+
cv.timestamp);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const nextHashes = [];
|
|
354
|
+
let maxChainLength = 0n;
|
|
355
|
+
let gid = null;
|
|
356
|
+
if (nexts?.length > 0) {
|
|
357
|
+
// take min gid as our gid
|
|
358
|
+
if (properties.meta?.gid) {
|
|
359
|
+
throw new Error("Expecting '.meta.gid' property to be undefined if '.meta.next' is provided");
|
|
360
|
+
}
|
|
361
|
+
for (const n of nexts) {
|
|
362
|
+
if (!n.hash) {
|
|
363
|
+
throw new Error("Expecting hash to be defined to next entries");
|
|
364
|
+
}
|
|
365
|
+
nextHashes.push(n.hash);
|
|
366
|
+
gid =
|
|
367
|
+
gid == null
|
|
368
|
+
? n.meta.gid
|
|
369
|
+
: n.meta.gid < gid
|
|
370
|
+
? n.meta.gid
|
|
371
|
+
: gid;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
gid =
|
|
376
|
+
properties.meta?.gid ||
|
|
377
|
+
(await EntryV0_1.createGid(properties.meta?.gidSeed));
|
|
378
|
+
}
|
|
379
|
+
maxChainLength += 1n; // include this
|
|
380
|
+
const metadataEncrypted = await maybeEncrypt(new Meta({
|
|
381
|
+
clock,
|
|
382
|
+
gid: gid,
|
|
383
|
+
type: properties.meta?.type ?? EntryType.APPEND,
|
|
384
|
+
data: properties.meta?.data,
|
|
385
|
+
next: nextHashes,
|
|
386
|
+
}), properties.encryption?.keypair, properties.encryption?.receiver.meta);
|
|
387
|
+
const payload = await maybeEncrypt(payloadToSave, properties.encryption?.keypair, properties.encryption?.receiver.payload);
|
|
388
|
+
// Sign id, encrypted payload, clock, nexts, refs
|
|
389
|
+
const entry = new EntryV0_1({
|
|
390
|
+
meta: metadataEncrypted,
|
|
391
|
+
payload,
|
|
392
|
+
signatures: undefined,
|
|
393
|
+
createdLocally: true,
|
|
394
|
+
});
|
|
395
|
+
const signers = properties.signers || [
|
|
396
|
+
properties.identity.sign.bind(properties.identity),
|
|
397
|
+
];
|
|
398
|
+
const signableBytes = serialize(entry.toSignable());
|
|
399
|
+
let signatures = await Promise.all(signers.map((signer) => signer(signableBytes)));
|
|
400
|
+
signatures = signatures.sort((a, b) => compare(a.signature, b.signature));
|
|
401
|
+
const encryptedSignatures = [];
|
|
402
|
+
const encryptAllSignaturesWithSameKey = isMaybeEryptionPublicKey(properties.encryption?.receiver?.signatures);
|
|
403
|
+
for (const signature of signatures) {
|
|
404
|
+
const encryptionRecievers = encryptAllSignaturesWithSameKey
|
|
405
|
+
? properties.encryption?.receiver?.signatures
|
|
406
|
+
: properties.encryption?.receiver?.signatures?.[signature.publicKey.hashcode()]; // TODO types
|
|
407
|
+
const signatureEncrypted = await maybeEncrypt(signature, properties.encryption?.keypair, encryptionRecievers);
|
|
408
|
+
encryptedSignatures.push(signatureEncrypted);
|
|
409
|
+
}
|
|
410
|
+
entry._signatures = new Signatures({
|
|
411
|
+
signatures: encryptedSignatures,
|
|
412
|
+
});
|
|
413
|
+
if (properties.canAppend && !(await properties.canAppend(entry))) {
|
|
414
|
+
throw new AccessError();
|
|
415
|
+
}
|
|
416
|
+
// Append hash
|
|
417
|
+
entry.hash = await Entry.toMultihash(properties.store, entry);
|
|
418
|
+
entry.init({ encoding: properties.encoding });
|
|
419
|
+
return entry;
|
|
420
|
+
}
|
|
421
|
+
get payloadByteLength() {
|
|
422
|
+
return this._payload.byteLength;
|
|
423
|
+
}
|
|
424
|
+
toShallow(isHead) {
|
|
425
|
+
return new ShallowEntry({
|
|
426
|
+
hash: this.hash,
|
|
427
|
+
payloadSize: this._payload.byteLength,
|
|
428
|
+
head: isHead,
|
|
429
|
+
meta: new ShallowMeta({
|
|
430
|
+
gid: this.meta.gid,
|
|
431
|
+
data: this.meta.data,
|
|
432
|
+
clock: this.meta.clock,
|
|
433
|
+
next: this.meta.next,
|
|
434
|
+
type: this.meta.type,
|
|
435
|
+
}),
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
__decorate([
|
|
440
|
+
field({ type: MaybeEncrypted }),
|
|
441
|
+
__metadata("design:type", MaybeEncrypted)
|
|
442
|
+
], EntryV0.prototype, "_meta", void 0);
|
|
443
|
+
__decorate([
|
|
444
|
+
field({ type: MaybeEncrypted }),
|
|
445
|
+
__metadata("design:type", MaybeEncrypted)
|
|
446
|
+
], EntryV0.prototype, "_payload", void 0);
|
|
447
|
+
__decorate([
|
|
448
|
+
field({ type: fixedArray("u8", 4) }),
|
|
449
|
+
__metadata("design:type", Uint8Array)
|
|
450
|
+
], EntryV0.prototype, "_reserved", void 0);
|
|
451
|
+
__decorate([
|
|
452
|
+
field({ type: option(Signatures) }),
|
|
453
|
+
__metadata("design:type", Signatures)
|
|
454
|
+
], EntryV0.prototype, "_signatures", void 0);
|
|
455
|
+
__decorate([
|
|
456
|
+
field({ type: option("string") }) // we do option because we serialize and store this in a block without the hash, to receive the hash, which we later set
|
|
457
|
+
,
|
|
458
|
+
__metadata("design:type", String)
|
|
459
|
+
], EntryV0.prototype, "hash", void 0);
|
|
460
|
+
EntryV0 = EntryV0_1 = __decorate([
|
|
461
|
+
variant(0),
|
|
462
|
+
__metadata("design:paramtypes", [Object])
|
|
463
|
+
], EntryV0);
|
|
464
|
+
export { EntryV0 };
|
|
465
|
+
//# sourceMappingURL=entry-v0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry-v0.js","sourceRoot":"","sources":["../../src/entry-v0.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EACN,KAAK,EACL,UAAU,EACV,MAAM,EACN,SAAS,EACT,OAAO,EACP,GAAG,GACH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,MAAM,2BAA2B,CAAC;AACxD,OAAO,EACN,WAAW,EACX,cAAc,EACd,gBAAgB,EAEhB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,WAAW,EACX,YAAY,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAiB,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,YAAY,IAAI,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAiB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAkB,KAAK,EAAE,MAAM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