@cero-base/core 2.11.0 → 3.0.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.
Files changed (39) hide show
  1. package/package.json +8 -8
  2. package/src/blobs/codec.js +25 -0
  3. package/src/blobs/index.js +5 -2
  4. package/src/blobs/server.js +2 -2
  5. package/src/database/dispatch.js +805 -208
  6. package/src/database/encryption.js +25 -21
  7. package/src/database/index.js +747 -124
  8. package/src/database/rotation.js +333 -38
  9. package/src/lib/constants.js +10 -0
  10. package/src/lib/errors.js +8 -0
  11. package/src/lib/schema.js +12 -2
  12. package/src/lib/spec/index.js +10 -5
  13. package/src/lib/spec/schema.json +13 -1
  14. package/src/lib/utils.js +24 -3
  15. package/src/mailbox/inbox.js +368 -41
  16. package/src/mailbox/index.js +75 -20
  17. package/src/mailbox/post.js +13 -8
  18. package/src/network/index.js +12 -5
  19. package/src/pairing/index.js +347 -57
  20. package/src/pairing/invite.js +36 -12
  21. package/src/pairing/response.js +78 -0
  22. package/src/push/index.js +20 -2
  23. package/types/blobs/codec.d.ts +13 -0
  24. package/types/blobs/index.d.ts +2 -0
  25. package/types/database/dispatch.d.ts +52 -7
  26. package/types/database/encryption.d.ts +13 -5
  27. package/types/database/index.d.ts +199 -19
  28. package/types/database/rotation.d.ts +85 -2
  29. package/types/lib/constants.d.ts +4 -0
  30. package/types/lib/errors.d.ts +6 -0
  31. package/types/lib/schema.d.ts +11 -0
  32. package/types/lib/utils.d.ts +2 -0
  33. package/types/mailbox/inbox.d.ts +78 -10
  34. package/types/mailbox/index.d.ts +42 -16
  35. package/types/mailbox/post.d.ts +7 -5
  36. package/types/pairing/index.d.ts +53 -8
  37. package/types/pairing/invite.d.ts +27 -8
  38. package/types/pairing/response.d.ts +50 -0
  39. package/types/push/index.d.ts +12 -2
@@ -8,6 +8,9 @@ import { getEncoding } from '../lib/spec/index.js'
8
8
  import { CeroError } from '../lib/errors.js'
9
9
 
10
10
  const VERSION = 1
11
+ // an invite past its database's start, or with an address of its own: a release from before the
12
+ // stamp refuses it instead of joining
13
+ export const STAMPED = 2
11
14
  const Encoding = getEncoding('@cero/invite')
12
15
  const [NS_KEY, NS_PROOF] = crypto.namespace('cero/invite', 2)
13
16
 
@@ -15,27 +18,43 @@ const [NS_KEY, NS_PROOF] = crypto.namespace('cero/invite', 2)
15
18
  * @typedef {object} InviteFields
16
19
  * @property {number} expires Absolute expiry timestamp; `0` means never.
17
20
  * @property {Uint8Array} key Key of the database the invite opens.
18
- * @property {Uint8Array} address The database's address: a join is sealed to it.
21
+ * @property {Uint8Array} address Where a join is sealed to: the invite's own address, or the database's.
19
22
  * @property {Uint8Array} seed The invite's secret; its keypair proves a join.
20
23
  * @property {{ key: Uint8Array, length: number } | null} link The node that added its record: a join links it, so no member applies the join first.
21
24
  * @property {Uint8Array | null} [data] The app's payload, readable before joining. Unsigned: a hint, not proof.
25
+ * @property {number} [stamp] The stamp its record was written with, which its joins take; `0` for none.
26
+ * @property {number} [version] The invite's form: `STAMPED` once the stamp is past its database's start, or with an address of its own.
27
+ * @property {boolean} [own] Whether the address is the invite's own: its join names it and its answers are tagged.
22
28
  */
23
29
 
24
30
  /**
25
- * An invite: the database it opens, the address a join is sealed to, and a seed whose keypair
26
- * proves the joiner holds the invite. Role and expiry come from the database's own record;
27
- * `expires` is here so a joiner fails fast.
31
+ * An invite: the database it opens, the address a join is sealed to, its own or the database's,
32
+ * and a seed whose keypair proves the joiner holds the invite. Role and expiry come from the
33
+ * database's own record; `expires` is here so a joiner fails fast.
28
34
  */
29
35
  export class Invite {
30
36
  /** @param {InviteFields & { _str?: string }} fields */
31
- constructor({ expires, key, address, seed, link = null, data = null, _str = null }) {
32
- this.version = VERSION
37
+ constructor({
38
+ version = VERSION,
39
+ expires,
40
+ key,
41
+ address,
42
+ seed,
43
+ link = null,
44
+ data = null,
45
+ stamp = 0,
46
+ own = false,
47
+ _str = null
48
+ }) {
49
+ this.version = version
33
50
  this.expires = expires
34
51
  this.key = key
35
52
  this.address = address
36
53
  this.seed = seed
37
54
  this.link = link
38
55
  this.data = data
56
+ this.stamp = stamp
57
+ this.own = own
39
58
  /** @private */
40
59
  this._str = _str
41
60
  /** @private */
@@ -95,10 +114,10 @@ export class Invite {
95
114
  /**
96
115
  * A new invite with a fresh seed.
97
116
  *
98
- * @param {{ ttl?: number | string, key: Uint8Array, address: Uint8Array, link?: { key: Uint8Array, length: number } | null, data?: Uint8Array | null }} opts
117
+ * @param {{ ttl?: number | string, key: Uint8Array, address: Uint8Array, link?: { key: Uint8Array, length: number } | null, data?: Uint8Array | null, own?: boolean }} opts
99
118
  * @returns {Invite}
100
119
  */
101
- static create({ ttl = 0, key, address, link = null, data = null }) {
120
+ static create({ ttl = 0, key, address, link = null, data = null, own = false }) {
102
121
  if (key?.byteLength !== 32) throw CeroError.INVALID('key must be a 32-byte buffer')
103
122
  if (address?.byteLength !== 32) throw CeroError.INVALID('address must be a 32-byte buffer')
104
123
  if (!sealable(address)) throw CeroError.INVALID('address cannot be sealed to')
@@ -110,7 +129,8 @@ export class Invite {
110
129
  address,
111
130
  seed: crypto.randomBytes(32),
112
131
  link,
113
- data
132
+ data,
133
+ own
114
134
  })
115
135
  }
116
136
 
@@ -128,7 +148,9 @@ export class Invite {
128
148
  } catch {
129
149
  throw CeroError.INVALID_INVITE('not an invite')
130
150
  }
131
- if (fields.version !== VERSION) throw CeroError.INVALID_INVITE('unknown invite version')
151
+ if (fields.version !== VERSION && fields.version !== STAMPED) {
152
+ throw CeroError.INVALID_INVITE('unknown invite version')
153
+ }
132
154
  if (!sealable(fields.address)) throw CeroError.INVALID_INVITE('address cannot be sealed to')
133
155
  return new Invite({ ...fields, _str: str })
134
156
  }
@@ -147,9 +169,11 @@ function sealable(address) {
147
169
 
148
170
  const EMPTY = b4a.alloc(0)
149
171
 
150
- // ms, or a duration like '12h' or '2d'
172
+ // ms, or a duration like '12h' or '2d'; the expiry is a uint on the wire
151
173
  function toMs(ttl) {
152
174
  const value = typeof ttl === 'string' ? ms(ttl) : ttl
153
- if (!Number.isFinite(value)) throw CeroError.INVALID(`ttl '${ttl}' is not a duration`)
175
+ if (!Number.isSafeInteger(value) || value <= 0 || !Number.isSafeInteger(Date.now() + value)) {
176
+ throw CeroError.INVALID(`ttl '${ttl}' is not a duration`)
177
+ }
154
178
  return value
155
179
  }
@@ -1,8 +1,86 @@
1
+ import sodium from 'sodium-universal'
2
+ import crypto from 'hypercore-crypto'
3
+ import b4a from 'b4a'
4
+
1
5
  import { getEncoding } from '../lib/spec/index.js'
2
6
 
3
7
  export const STATUS_ACCEPTED = 0
4
8
  export const STATUS_DENIED = 1
5
9
 
10
+ const [NS_ANSWER] = crypto.namespace('cero/answer', 1)
11
+ const [NS_KEYS] = crypto.namespace('cero/keys', 1)
12
+ const TAG = 32
13
+ const SIGNED = 32 + 64
14
+
6
15
  // an accept and a deny both ride this response
7
16
  /** @type {import('compact-encoding').Encoder<{ status: number, reason?: string, key?: Uint8Array | null, encryptionKey?: Uint8Array | null, epochs?: Array<{ epoch: number, stamp: number, entropy: Uint8Array }> | null }>} */
8
17
  export const Response = getEncoding('@cero/confirm')
18
+
19
+ /**
20
+ * The tag of an encoded answer, keyed by what the invite's address and the joiner's reply address
21
+ * share: each end makes it from its own secret key and the other's address, and nobody else can.
22
+ *
23
+ * @param {Uint8Array} answer The answer as it is sent.
24
+ * @param {Uint8Array} secretKey This end's secret key.
25
+ * @param {Uint8Array} publicKey The other end's address.
26
+ * @returns {Uint8Array | null} Null for an address that shares nothing.
27
+ */
28
+ export function tag(answer, secretKey, publicKey) {
29
+ const shared = b4a.alloc(sodium.crypto_scalarmult_BYTES)
30
+ try {
31
+ sodium.crypto_scalarmult(shared, secretKey, publicKey)
32
+ } catch {
33
+ return null
34
+ }
35
+ const out = b4a.alloc(TAG)
36
+ sodium.crypto_generichash(out, answer, crypto.hash([NS_ANSWER, shared]))
37
+ return out
38
+ }
39
+
40
+ /**
41
+ * The answer in a message that starts with its tag: the bytes after it, null when the tag is not
42
+ * the one its two ends make over them.
43
+ *
44
+ * @param {Uint8Array} message
45
+ * @param {Uint8Array} secretKey
46
+ * @param {Uint8Array} publicKey
47
+ * @returns {Uint8Array | null}
48
+ */
49
+ export function proven(message, secretKey, publicKey) {
50
+ if (message.byteLength <= TAG) return null
51
+ const answer = message.subarray(TAG)
52
+ const expected = tag(answer, secretKey, publicKey)
53
+ return expected && sodium.sodium_memcmp(message.subarray(0, TAG), expected) ? answer : null
54
+ }
55
+
56
+ /**
57
+ * Keys sent to a device that asked, as they are sent: the sender's writer key, then its device's
58
+ * signature over the room, the writer they go to and the answer, then the answer.
59
+ *
60
+ * @param {Uint8Array} answer
61
+ * @param {{ room: Uint8Array, to: Uint8Array, writer: Uint8Array, secretKey: Uint8Array }} opts
62
+ * @returns {Uint8Array}
63
+ */
64
+ export function signed(answer, { room, to, writer, secretKey }) {
65
+ const signature = crypto.sign(crypto.hash([NS_KEYS, room, to, answer]), secretKey)
66
+ return b4a.concat([writer, signature, answer])
67
+ }
68
+
69
+ /**
70
+ * The sender and the answer of signed keys, null unless the device key `keyOf` gives for the
71
+ * sender's writer signed them for this room and this writer.
72
+ *
73
+ * @param {Uint8Array} message
74
+ * @param {{ room: Uint8Array, to: Uint8Array }} opts
75
+ * @param {(writer: Uint8Array) => Uint8Array | null | undefined} keyOf
76
+ * @returns {{ writer: Uint8Array, answer: Uint8Array } | null}
77
+ */
78
+ export function signer(message, { room, to }, keyOf) {
79
+ if (message.byteLength <= SIGNED) return null
80
+ const writer = message.subarray(0, 32)
81
+ const answer = message.subarray(SIGNED)
82
+ const key = keyOf(writer)
83
+ const digest = crypto.hash([NS_KEYS, room, to, answer])
84
+ if (!key || !crypto.verify(digest, message.subarray(32, SIGNED), key)) return null
85
+ return { writer, answer }
86
+ }
package/src/push/index.js CHANGED
@@ -11,14 +11,30 @@ const { AutobeeEncryption, WriterEncryption } = autobeeEncryption
11
11
  const { decodeOplog } = autobeeEncoding
12
12
 
13
13
  /**
14
- * @typedef {{ id: string, key: Uint8Array }} Handle A handle this device holds: its id and its database key.
14
+ * @typedef {{ id: string, key: Uint8Array, writers?: Uint8Array[] }} Handle A handle this device holds: its id, its database key and the writer keys that may write to it now, none when not given.
15
15
  * @typedef {{ index: number, value: Uint8Array, writer: Uint8Array }} Block The block a push carries when it fits: its index, its bytes as the writer's core holds them, and the writer's key.
16
16
  * @typedef {Handle & { length: number, newer: boolean, ref: string | null, block: Block | null }} Hit The handle a push is about, the length it proves, whether this device is behind it, the ref the write was on, and the block when it rode along.
17
17
  */
18
18
 
19
+ /**
20
+ * The topic a push names: its handle's discovery key in hex, the string a device subscribes to.
21
+ * Null when the payload does not decode.
22
+ *
23
+ * @param {Uint8Array} payload
24
+ * @returns {string | null}
25
+ */
26
+ export function topic(payload) {
27
+ try {
28
+ return b4a.toHex(decode(payload).discoveryKey)
29
+ } catch {
30
+ return null
31
+ }
32
+ }
33
+
19
34
  /**
20
35
  * Verify a push payload against this device's storage: the one the gateway sent, decoded from the
21
- * platform's message. Null when it is about no handle given, is forged, or does not decode.
36
+ * platform's message. Null when it is about no handle given, is forged, comes from a core that is
37
+ * not among the handle's writers, or does not decode.
22
38
  *
23
39
  * @param {import('hypercore-storage')} storage The corestore's storage; may be opened read-only.
24
40
  * @param {Uint8Array} payload
@@ -43,6 +59,8 @@ export async function verify(storage, payload, handles) {
43
59
  if (!read) return null
44
60
  const ref = read.extra?.length ? b4a.toString(read.extra) : null
45
61
  const { block, key: writer } = read.result
62
+ // any core the device stores proves its blocks: a removed member's, or a stranger's join
63
+ if (!handle.writers?.some((w) => b4a.equals(w, writer))) return null
46
64
  return {
47
65
  ...handle,
48
66
  length: read.result.length,
@@ -4,6 +4,19 @@ export type RawBlobId = {
4
4
  byteOffset: number;
5
5
  byteLength: number;
6
6
  };
7
+ /**
8
+ * Refuse a type a new file id cannot carry: one that is not printable text.
9
+ *
10
+ * @param {unknown} type
11
+ */
12
+ export declare function checkType(type: unknown): void;
13
+ /**
14
+ * The type to serve a file with: one an earlier build stored that a header cannot carry is left out.
15
+ *
16
+ * @param {string} type
17
+ * @returns {string}
18
+ */
19
+ export declare function servedType(type: string): string;
7
20
  /**
8
21
  * Encode a coreKey + raw hyperblobs blobId + type into a durable string id.
9
22
  *
@@ -41,6 +41,8 @@ export declare class Blobs extends ReadyResource {
41
41
  name: string;
42
42
  /** @private */
43
43
  _coreKey;
44
+ /** @private */
45
+ _ns;
44
46
  /** @type {import('hypercore') | null} */
45
47
  core: import('hypercore') | null;
46
48
  /** @type {import('hyperblobs') | null} */
@@ -1,25 +1,47 @@
1
1
  export declare const BESPOKE: Set<string>;
2
+ export declare const chainOf: ({ key, proof }: {
3
+ key: any;
4
+ proof: any;
5
+ }) => any[];
6
+ export declare const linkOf: (proof: any) => any;
7
+ export declare const leftId: (memberId: any) => string;
8
+ export declare const toldId: (memberId: any) => string;
9
+ /**
10
+ * 32-byte keys back to back, or none when they are not that.
11
+ *
12
+ * @param {Uint8Array | null} [buf]
13
+ * @returns {Uint8Array[]}
14
+ */
15
+ export declare function keysOf(buf?: Uint8Array | null): Uint8Array[];
16
+ export declare const seatChain: (device: any) => any[];
2
17
  /**
3
18
  * Build the hyperdispatch router for a spec: wires membership, builtin, and
4
19
  * spec-defined collection/action ops, returning the router plus an apply loop.
5
20
  *
6
21
  * @param {object} opts
7
- * @param {{ dispatch: { Router: Function, encode: (name: string, value: unknown) => Uint8Array }, meta?: { refs?: Record<string, { kind?: string, internal?: boolean, own?: boolean, verb?: string, fields?: string[], required?: Record<string, string> }> } }} opts.spec Generated hyperdispatch spec.
22
+ * @param {{ dispatch: { Router: Function, encode: (name: string, value: unknown, opts?: { version?: number }) => Uint8Array }, meta?: { refs?: Record<string, { kind?: string, internal?: boolean, own?: boolean, verb?: string, fields?: string[], required?: Record<string, string> }>, encoding?: Record<string, number> } }} opts.spec Generated hyperdispatch spec.
8
23
  * @param {string} opts.ns Namespace prefix for collection and op names.
24
+ * @param {number} opts.start The version of a database that holds no version row.
25
+ * @param {() => number} opts.contract This build's contract: an op whose effective stamp is past it is skipped.
26
+ * @param {(stamp: number) => void} opts.onskip Called with the effective stamp of each op skipped as past the contract.
27
+ * @param {() => number[]} opts.build The row describing this build, kept in the view it applies: its database, rules, contract and the lowest version it skipped.
9
28
  * @param {(err: Error) => void} opts.onerror Called when a malformed node is skipped.
10
29
  * @param {() => Uint8Array | null} opts.key The database key, null until the bee booted.
11
30
  * @param {(row: { epoch: number, stamp: number, wrapped: Uint8Array, commit: Uint8Array }) => Promise<void>} opts.onepoch Per-peer side of an applied rotation (skipped in dry runs).
12
- * @param {() => { publicKey: Uint8Array, secretKey: Uint8Array } | null} opts.room The keypair behind the database's address, which joins are sealed to.
31
+ * @param {() => { publicKey: Uint8Array, secretKey: Uint8Array } | null} opts.room The keypair behind the database's address, which joins that name no invite are sealed to.
32
+ * @param {boolean} [opts.root] The identity's own database, where a device key past a removed one stands while seated.
13
33
  * @param {(phase: 'before' | 'after', op: string) => Function[]} opts.hooks Registered hooks for an op, run inside its transaction.
14
- * @param {(name: string) => void} opts.touch Marks a ref written by a hook, so its watchers tick.
34
+ * @param {(name: string) => void} opts.touch Marks a ref written by a hook, once its batch commits, so its watchers tick.
15
35
  * @param {(view: object, name: string, query?: string | import('./index.js').Query) => Promise<import('./index.js').SingleResult | import('./index.js').ListResult>} opts.read Planned read against a given view, for a hook's `ctx.get`.
16
- * @returns {{ dispatch: (value: Buffer, ctx: object) => Promise<void>, apply: (nodes: Array<{ value: Buffer, key: Buffer }>, view: object, host: object) => Promise<void> }}
36
+ * @returns {{ encode: (route: string, value: unknown, stamp: number) => Uint8Array, cut: (route: string, value: Record<string, unknown>, stamp: number) => Record<string, unknown>, dispatch: (value: Buffer, ctx: object) => Promise<void>, role: (view: object, writer: Uint8Array) => Promise<string | null>, stands: (view: object, chain: Uint8Array[], telling?: { removed?: Uint8Array, standing?: Uint8Array }) => Promise<boolean>, version: (view: object) => Promise<number>, built: (view: object) => Promise<Array<number | null> | null>, apply: (nodes: Array<{ value: Buffer, key: Buffer, version: number }>, view: object, host: object) => Promise<{ landed: Array<{ value: Buffer, key: Buffer, version: number }>, changed: boolean }> }} `apply` takes each op with its author's stamp, runs it at its effective stamp, and resolves to the nodes that landed and whether they changed a row.
17
37
  */
18
- export declare function makeDispatcher({ spec, ns, onerror, key, onepoch, room, hooks, touch, read }: {
38
+ export declare function makeDispatcher({ spec, ns, start, contract, onskip, build, onerror, key, onepoch, room, root, hooks, touch, read }: {
19
39
  spec: {
20
40
  dispatch: {
21
41
  Router: Function;
22
- encode: (name: string, value: unknown) => Uint8Array;
42
+ encode: (name: string, value: unknown, opts?: {
43
+ version?: number;
44
+ }) => Uint8Array;
23
45
  };
24
46
  meta?: {
25
47
  refs?: Record<string, {
@@ -30,9 +52,14 @@ export declare function makeDispatcher({ spec, ns, onerror, key, onepoch, room,
30
52
  fields?: string[];
31
53
  required?: Record<string, string>;
32
54
  }>;
55
+ encoding?: Record<string, number>;
33
56
  };
34
57
  };
35
58
  ns: string;
59
+ start: number;
60
+ contract: () => number;
61
+ onskip: (stamp: number) => void;
62
+ build: () => number[];
36
63
  onerror: (err: Error) => void;
37
64
  key: () => Uint8Array | null;
38
65
  onepoch: (row: {
@@ -45,13 +72,31 @@ export declare function makeDispatcher({ spec, ns, onerror, key, onepoch, room,
45
72
  publicKey: Uint8Array;
46
73
  secretKey: Uint8Array;
47
74
  } | null;
75
+ root?: boolean;
48
76
  hooks: (phase: 'before' | 'after', op: string) => Function[];
49
77
  touch: (name: string) => void;
50
78
  read: (view: object, name: string, query?: string | import('./index.js').Query) => Promise<import('./index.js').SingleResult | import('./index.js').ListResult>;
51
79
  }): {
80
+ encode: (route: string, value: unknown, stamp: number) => Uint8Array;
81
+ cut: (route: string, value: Record<string, unknown>, stamp: number) => Record<string, unknown>;
52
82
  dispatch: (value: Buffer, ctx: object) => Promise<void>;
83
+ role: (view: object, writer: Uint8Array) => Promise<string | null>;
84
+ stands: (view: object, chain: Uint8Array[], telling?: {
85
+ removed?: Uint8Array;
86
+ standing?: Uint8Array;
87
+ }) => Promise<boolean>;
88
+ version: (view: object) => Promise<number>;
89
+ built: (view: object) => Promise<Array<number | null> | null>;
53
90
  apply: (nodes: Array<{
54
91
  value: Buffer;
55
92
  key: Buffer;
56
- }>, view: object, host: object) => Promise<void>;
93
+ version: number;
94
+ }>, view: object, host: object) => Promise<{
95
+ landed: Array<{
96
+ value: Buffer;
97
+ key: Buffer;
98
+ version: number;
99
+ }>;
100
+ changed: boolean;
101
+ }>;
57
102
  };
@@ -6,6 +6,12 @@ import Autobee from 'autobee';
6
6
  * @returns {Uint8Array}
7
7
  */
8
8
  export declare function blobEpochKey(entropy: Uint8Array): Uint8Array;
9
+ /**
10
+ * @param {Uint8Array} key The writer core's key.
11
+ * @param {number} index
12
+ * @returns {string}
13
+ */
14
+ export declare function plainId(key: Uint8Array, index: number): string;
9
15
  /**
10
16
  * Prime a keyring from a local core's persisted epoch stash.
11
17
  *
@@ -59,14 +65,14 @@ export declare class Keyring {
59
65
  entropies: Map<number, Uint8Array>;
60
66
  /** @type {Map<number, number>} stamp → apply-order sequence */
61
67
  seqs: Map<number, number>;
62
- /** stamp used for new blocks — the adopted epoch with the highest seq */
68
+ /** stamp used for new blocks, picked from the epoch rows (rotation.js) */
63
69
  current: number;
64
- /** highest adopted apply-order sequence (0 = base era) */
70
+ /** sequence of the current epoch (0 = base era) */
65
71
  seq: number;
66
- /** bumped on every add/remove — cheap change detection */
67
- version: number;
68
72
  /** @type {(() => void) | null} called when an epoch is learned or dropped */
69
73
  onchange: (() => void) | null;
74
+ /** @type {((stamp: number) => Uint8Array | null) | null} asked for a key a block needs and it lacks */
75
+ onmiss: ((stamp: number) => Uint8Array | null) | null;
70
76
  constructor();
71
77
  /** @returns {Array<{ epoch: number, stamp: number, entropy: Uint8Array }>} ascending by seq */
72
78
  all(): Array<{
@@ -77,7 +83,7 @@ export declare class Keyring {
77
83
  /**
78
84
  * @param {number} stamp
79
85
  * @param {Uint8Array} entropy
80
- * @param {number} [seq] Apply-order sequence; drives `current` selection.
86
+ * @param {number} [seq] Apply-order sequence.
81
87
  */
82
88
  add(stamp: number, entropy: Uint8Array, seq?: number): void;
83
89
  /**
@@ -100,6 +106,8 @@ export declare class Keyring {
100
106
  export declare class EpochAutobee extends Autobee {
101
107
  /** @type {Keyring | null} */
102
108
  keyring: Keyring | null;
109
+ /** @type {Set<string>} the writer blocks read in plain, by `plainId` */
110
+ plain: Set<string>;
103
111
  /** @private */
104
112
  _epochStalled;
105
113
  /** @private */