mindoodb 0.0.66 → 0.0.69

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 (86) hide show
  1. package/README-server.md +77 -16
  2. package/README.md +41 -58
  3. package/dist/appendonlystores/network/HttpTransport.d.ts +2 -0
  4. package/dist/appendonlystores/network/HttpTransport.d.ts.map +1 -1
  5. package/dist/appendonlystores/network/HttpTransport.js +31 -6
  6. package/dist/appendonlystores/network/HttpTransport.js.map +1 -1
  7. package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts +18 -8
  8. package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.d.ts.map +1 -1
  9. package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js +30 -16
  10. package/dist/appendonlystores/network/ServerNetworkContentAddressedStore.js.map +1 -1
  11. package/dist/browser/index.mjs +29 -0
  12. package/dist/core/BaseMindooDB.d.ts +168 -8
  13. package/dist/core/BaseMindooDB.d.ts.map +1 -1
  14. package/dist/core/BaseMindooDB.js +763 -74
  15. package/dist/core/BaseMindooDB.js.map +1 -1
  16. package/dist/core/appendonlystores/network/IrohNetworkTransport.d.ts.map +1 -1
  17. package/dist/core/appendonlystores/network/IrohNetworkTransport.js +5 -1
  18. package/dist/core/appendonlystores/network/IrohNetworkTransport.js.map +1 -1
  19. package/dist/core/appendonlystores/network/IrohStreamIO.d.ts +10 -0
  20. package/dist/core/appendonlystores/network/IrohStreamIO.d.ts.map +1 -1
  21. package/dist/core/appendonlystores/network/IrohStreamIO.js.map +1 -1
  22. package/dist/core/appendonlystores/network/types.d.ts +20 -0
  23. package/dist/core/appendonlystores/network/types.d.ts.map +1 -1
  24. package/dist/core/appendonlystores/network/types.js +33 -0
  25. package/dist/core/appendonlystores/network/types.js.map +1 -1
  26. package/dist/core/appendonlystores/syncStores.d.ts +80 -2
  27. package/dist/core/appendonlystores/syncStores.d.ts.map +1 -1
  28. package/dist/core/appendonlystores/syncStores.js +82 -9
  29. package/dist/core/appendonlystores/syncStores.js.map +1 -1
  30. package/dist/core/appendonlystores/types.d.ts +88 -6
  31. package/dist/core/appendonlystores/types.d.ts.map +1 -1
  32. package/dist/core/appendonlystores/types.js +61 -1
  33. package/dist/core/appendonlystores/types.js.map +1 -1
  34. package/dist/core/builtinDbInvariants.d.ts +8 -5
  35. package/dist/core/builtinDbInvariants.d.ts.map +1 -1
  36. package/dist/core/builtinDbInvariants.js +8 -5
  37. package/dist/core/builtinDbInvariants.js.map +1 -1
  38. package/dist/core/expressions/evaluateExpression.d.ts.map +1 -1
  39. package/dist/core/expressions/evaluateExpression.js +7 -1
  40. package/dist/core/expressions/evaluateExpression.js.map +1 -1
  41. package/dist/core/index.d.ts +8 -0
  42. package/dist/core/index.d.ts.map +1 -1
  43. package/dist/core/index.js +45 -11
  44. package/dist/core/index.js.map +1 -1
  45. package/dist/core/indexing/summary/DocumentSummaryStore.d.ts +26 -3
  46. package/dist/core/indexing/summary/DocumentSummaryStore.d.ts.map +1 -1
  47. package/dist/core/indexing/summary/DocumentSummaryStore.js +100 -15
  48. package/dist/core/indexing/summary/DocumentSummaryStore.js.map +1 -1
  49. package/dist/core/indexing/summary/extractSummaryFields.d.ts +10 -1
  50. package/dist/core/indexing/summary/extractSummaryFields.d.ts.map +1 -1
  51. package/dist/core/indexing/summary/extractSummaryFields.js +34 -7
  52. package/dist/core/indexing/summary/extractSummaryFields.js.map +1 -1
  53. package/dist/core/indexing/summary/types.d.ts +6 -0
  54. package/dist/core/indexing/summary/types.d.ts.map +1 -1
  55. package/dist/core/indexing/summary/types.js +8 -1
  56. package/dist/core/indexing/summary/types.js.map +1 -1
  57. package/dist/core/quarantine/QuarantineDocument.d.ts +211 -0
  58. package/dist/core/quarantine/QuarantineDocument.d.ts.map +1 -0
  59. package/dist/core/quarantine/QuarantineDocument.js +314 -0
  60. package/dist/core/quarantine/QuarantineDocument.js.map +1 -0
  61. package/dist/core/quarantine/QuarantineView.d.ts +90 -0
  62. package/dist/core/quarantine/QuarantineView.d.ts.map +1 -0
  63. package/dist/core/quarantine/QuarantineView.js +106 -0
  64. package/dist/core/quarantine/QuarantineView.js.map +1 -0
  65. package/dist/core/quarantine/recordPushRejections.d.ts +73 -0
  66. package/dist/core/quarantine/recordPushRejections.d.ts.map +1 -0
  67. package/dist/core/quarantine/recordPushRejections.js +112 -0
  68. package/dist/core/quarantine/recordPushRejections.js.map +1 -0
  69. package/dist/core/quarantine/resubmitQuarantined.d.ts +81 -0
  70. package/dist/core/quarantine/resubmitQuarantined.d.ts.map +1 -0
  71. package/dist/core/quarantine/resubmitQuarantined.js +120 -0
  72. package/dist/core/quarantine/resubmitQuarantined.js.map +1 -0
  73. package/dist/core/types.d.ts +132 -4
  74. package/dist/core/types.d.ts.map +1 -1
  75. package/dist/core/types.js.map +1 -1
  76. package/dist/core/values.d.ts +72 -0
  77. package/dist/core/values.d.ts.map +1 -0
  78. package/dist/core/values.js +107 -0
  79. package/dist/core/values.js.map +1 -0
  80. package/dist/node/server/MindooDBServer.d.ts.map +1 -1
  81. package/dist/node/server/MindooDBServer.js +6 -1
  82. package/dist/node/server/MindooDBServer.js.map +1 -1
  83. package/dist/node/server/peer/PeerReplicator.d.ts.map +1 -1
  84. package/dist/node/server/peer/PeerReplicator.js +35 -15
  85. package/dist/node/server/peer/PeerReplicator.js.map +1 -1
  86. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"extractSummaryFields.js","sourceRoot":"","sources":["../../../../src/core/indexing/summary/extractSummaryFields.ts"],"names":[],"mappings":";;;AASA,4CAYC;AA2BD,8CAaC;AAkID,oDA2DC;AAOD,oDAQC;AAaD,8DA0CC;AAYD,gDA8BC;AA1WD,4DAA+D;AAI/D;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAA6B,EAAE,IAAY;IAC1E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,CA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C,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,GAAG,GAAG,CAAC,EAAE,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9E,0EAA0E;IAC1E,6EAA6E;IAC7E,IAAI,QAAQ,KAAK,yBAAiB,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC,kBAAkB,CAAC;IACnC,CAAC;IACD,IAAI,QAAQ,KAAK,+BAAiB,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC,iBAAiB,CAAC;IAClC,CAAC;IACD,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,sEAAsE;QACtE,mEAAmE;QACnE,IAAI,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"extractSummaryFields.js","sourceRoot":"","sources":["../../../../src/core/indexing/summary/extractSummaryFields.ts"],"names":[],"mappings":";;;AASA,4CAYC;AAkBD,wCAkBC;AAkBD,8CAaC;AAmID,oDA4DC;AAOD,oDAQC;AAaD,8DA0CC;AAYD,gDA8BC;AAvYD,4DAA+D;AAI/D;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAA6B,EAAE,IAAY;IAC1E,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC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G,GAAG,CAAC,EAAE,CAAC;YACzD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9E,0EAA0E;IAC1E,6EAA6E;IAC7E,IAAI,QAAQ,KAAK,yBAAiB,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC,kBAAkB,CAAC;IACnC,CAAC;IACD,IAAI,QAAQ,KAAK,+BAAiB,EAAE,CAAC;QACnC,OAAO,MAAM,CAAC,iBAAiB,CAAC;IAClC,CAAC;IACD,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,CAAC,WAAW,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACpD,sEAAsE;QACtE,mEAAmE;QACnE,IAAI,0BAA0B,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -100,6 +100,12 @@ export declare function sanitizeSummaryConfig(value: unknown): SummaryConfig | u
100
100
  * point: entries extracted before the field existed do not carry it, so
101
101
  * serving them while reporting the field as covered would be a coverage lie.
102
102
  */
103
+ /**
104
+ * Bumped when extraction changes what an unchanged configuration stores, so
105
+ * persisted buffers from older builds are rebuilt instead of silently lacking
106
+ * fields. 2: timestamps are auto-included as ISO 8601 strings.
107
+ */
108
+ export declare const SUMMARY_EXTRACTION_VERSION = 2;
103
109
  export declare function computeSummaryConfigFingerprint(config: ResolvedSummaryConfig): string;
104
110
  /** One document's entry in the summary buffer. */
105
111
  export interface DocumentSummaryEntry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B,GAAG,IAAI,CAAC;CAC7C"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_SUMMARY_MAX_VALUE_BYTES = exports.SUMMARY_SETUP_FIELD = exports.DB_SETUP_DOC_ID = void 0;
3
+ exports.SUMMARY_EXTRACTION_VERSION = exports.DEFAULT_SUMMARY_MAX_VALUE_BYTES = exports.SUMMARY_SETUP_FIELD = exports.DB_SETUP_DOC_ID = void 0;
4
4
  exports.resolveSummaryConfig = resolveSummaryConfig;
5
5
  exports.sanitizeSummaryConfig = sanitizeSummaryConfig;
6
6
  exports.computeSummaryConfigFingerprint = computeSummaryConfigFingerprint;
@@ -78,8 +78,15 @@ function sanitizeSummaryConfig(value) {
78
78
  * point: entries extracted before the field existed do not carry it, so
79
79
  * serving them while reporting the field as covered would be a coverage lie.
80
80
  */
81
+ /**
82
+ * Bumped when extraction changes what an unchanged configuration stores, so
83
+ * persisted buffers from older builds are rebuilt instead of silently lacking
84
+ * fields. 2: timestamps are auto-included as ISO 8601 strings.
85
+ */
86
+ exports.SUMMARY_EXTRACTION_VERSION = 2;
81
87
  function computeSummaryConfigFingerprint(config) {
82
88
  return JSON.stringify({
89
+ extractionVersion: exports.SUMMARY_EXTRACTION_VERSION,
83
90
  autoInclude: config.autoInclude,
84
91
  maxValueBytes: config.maxValueBytes,
85
92
  include: [...config.include].sort(),
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/core/indexing/summary/types.ts"],"names":[],"mappings":";;;AA6FA,oDASC;AAUD,sDA+BC;AAYD,0EASC;AAlKD;;;;;;GAMG;AACU,QAAA,eAAe,GAAG,SAAS,CAAC;AAEzC;;;;GAIG;AACU,QAAA,mBAAmB,GAAG,cAAc,CAAC;AA2ErC,QAAA,+BAA+B,GAAG,IAAI,CAAC;AAEpD,SAAgB,oBAAoB,CAAC,MAAsB;IACzD,OAAO;QACL,WAAW,EAAE,MAAM,E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+ /**
2
+ * Quarantine records: how a device remembers a write the server turned away,
3
+ * so it can be found again and offered again.
4
+ *
5
+ * A device that pushes an entry and gets a `"policy"` rejection back is holding
6
+ * something awkward: an entry that was legitimate when it was written, is
7
+ * cryptographically sound, and is refused only because a right was withdrawn in
8
+ * the meantime. It must not be dropped — the right may come back — and it must
9
+ * not block the database's push either. So the push moves on and leaves a
10
+ * record here.
11
+ *
12
+ * This matters most for entries that arrived over peer-to-peer sync: a device
13
+ * can hold, and have already merged, a change it did not write itself and whose
14
+ * author has since lost the right to write it. Without a record, the refusal
15
+ * would be a line in a log that disappears on reload.
16
+ *
17
+ * ## Why `userdirectory`
18
+ *
19
+ * The record deliberately does *not* live in the database it is about. The
20
+ * whole reason it exists is that someone lost their write right there, so
21
+ * writing the record there would earn the same refusal as the entry it
22
+ * documents. `userdirectory` is a database every member can write their own
23
+ * documents in without an administrator approving anything.
24
+ *
25
+ * - **`qtn_` prefix** — makes it a *personal document* (see
26
+ * {@link PERSONAL_DOC_ID_PREFIXES}), so the write invariant lets its creator
27
+ * change and delete it, and the admin delete it.
28
+ * - **`default` key, not `$publicinfos`** — the hoster holds the
29
+ * `$publicinfos` key, and which of a tenant's writes were refused is none of
30
+ * the hoster's business. `default` keeps it readable for every member, so it
31
+ * can serve as an audit trail, and opaque to the server.
32
+ *
33
+ * ## One record per author, database, document and class
34
+ *
35
+ * The id is derived rather than random, which makes recording idempotent: a
36
+ * retry that fails the same way updates the record in place instead of adding
37
+ * another. A cascade of refused entries on one document therefore collapses
38
+ * into one record holding a capped list of entry ids.
39
+ *
40
+ * The **author's key fingerprint is part of the derivation**, and that is
41
+ * load-bearing rather than decorative. Without it, two members refused on the
42
+ * same document for the same reason would derive the same id — and since the
43
+ * personal-document invariant only lets the *creator* write a document, the
44
+ * second member's record would be refused by the very invariant that is
45
+ * supposed to protect it. Folding the author in makes id and ownership agree.
46
+ *
47
+ * ## Why records must be verified on read
48
+ *
49
+ * Any tenant member can write a `qtn_` document claiming anything. Since these
50
+ * records say "this person tried to write something they were not allowed to
51
+ * write", an unverified one is a way to put words in someone else's mouth.
52
+ * {@link verifyQuarantineRecord} accepts a record only when:
53
+ *
54
+ * 1. the doc id is derived from the payload's own fields, including the
55
+ * fingerprint of the `signingPublicKey` it names,
56
+ * 2. the `doc_create` entry was signed by exactly that key, and
57
+ * 3. that key is an active (non-revoked) grant in the tenant.
58
+ *
59
+ * **Known limit — a record is evidence of an honest client, not of an honest
60
+ * one's absence.** Nothing compels a device to write a record, so the absence
61
+ * of one proves nothing. Like the `dev_` records, this is useful for auditing
62
+ * cooperating devices, not for catching a malicious one.
63
+ */
64
+ import type { MindooDB, MindooDoc, SigningKeyPair } from "../types";
65
+ import type { PutRejectionClass } from "../appendonlystores/types";
66
+ export declare const QUARANTINE_DOC_ID_PREFIX = "qtn_";
67
+ export declare const QUARANTINE_FORM = "userdirectory";
68
+ export declare const QUARANTINE_TYPE = "quarantine";
69
+ export declare const QUARANTINE_SCHEMA_VERSION = 1;
70
+ /**
71
+ * How many entry ids one record carries.
72
+ *
73
+ * A quarantined write usually drags its causal dependents along, so one
74
+ * refusal can mean a long list. The list is for finding the entries again, and
75
+ * a bounded one does that just as well while keeping the record — which syncs
76
+ * to every member of the tenant — from growing without limit.
77
+ */
78
+ export declare const MAX_QUARANTINED_ENTRY_IDS = 200;
79
+ /** Payload of a `qtn_` document. Encrypted with {@link DEFAULT_TENANT_KEY_ID}. */
80
+ export interface QuarantineDocumentPayload {
81
+ form: typeof QUARANTINE_FORM;
82
+ type: typeof QUARANTINE_TYPE;
83
+ schemaVersion: number;
84
+ /**
85
+ * Signing public key (PEM) of the device that recorded this. The whole
86
+ * verification chain hangs off this field.
87
+ */
88
+ signingPublicKey: string;
89
+ /** Database the refused entries belong to. Not `userdirectory` itself. */
90
+ dbid: string;
91
+ /** Document the refused entries belong to. */
92
+ quarantinedDocId: string;
93
+ /** Why the target refused them. */
94
+ rejectionClass: PutRejectionClass;
95
+ /** The target's own wording, kept verbatim for the audit view. */
96
+ reason: string;
97
+ /** Refused entry ids, capped at {@link MAX_QUARANTINED_ENTRY_IDS}. */
98
+ entryIds: string[];
99
+ /** How many refused entries did not fit into {@link entryIds}. */
100
+ omittedEntryCount?: number;
101
+ firstSeenAt: number;
102
+ updatedAt: number;
103
+ }
104
+ /** A record that passed {@link verifyQuarantineRecord}. */
105
+ export interface QuarantineRecordDoc {
106
+ docId: string;
107
+ signingPublicKey: string;
108
+ /** Fingerprint of {@link signingPublicKey}, colon-separated hex. */
109
+ signingKeyFingerprint: string;
110
+ dbid: string;
111
+ quarantinedDocId: string;
112
+ rejectionClass: PutRejectionClass;
113
+ reason: string;
114
+ entryIds: string[];
115
+ omittedEntryCount: number;
116
+ firstSeenAt: number;
117
+ updatedAt: number;
118
+ }
119
+ /** The directory calls a quarantine record needs to verify a claim. */
120
+ export interface QuarantineDirectory {
121
+ /** True when the key belongs to an active, non-revoked grant. */
122
+ validatePublicSigningKey(publicKey: string, opts?: {
123
+ forceRefresh?: boolean;
124
+ }): Promise<boolean>;
125
+ }
126
+ /** What identifies one quarantine record. */
127
+ export interface QuarantineRecordKey {
128
+ /** Fingerprint of the recording device's signing key, colon-separated hex. */
129
+ signingKeyFingerprint: string;
130
+ dbid: string;
131
+ quarantinedDocId: string;
132
+ rejectionClass: PutRejectionClass;
133
+ }
134
+ /** Is this a quarantine record id? */
135
+ export declare function isQuarantineDocId(docId: string | undefined | null): boolean;
136
+ /**
137
+ * Deterministic document id for one (author, database, document, class).
138
+ *
139
+ * Deterministic so that recording the same refusal again updates the record
140
+ * instead of accumulating one per attempt. Hashed rather than concatenated
141
+ * because custom ids must match `^[a-z][a-z0-9_]*$` (`CUSTOM_DOC_ID_REGEX`) and
142
+ * a document id can hold anything.
143
+ */
144
+ export declare function quarantineDocumentId(key: QuarantineRecordKey, subtle: SubtleCrypto): Promise<string>;
145
+ /** Thrown when a caller tries to record a quarantine about a quarantine record. */
146
+ export declare class QuarantineRecursionError extends Error {
147
+ constructor(docId: string);
148
+ }
149
+ /**
150
+ * Record (or extend) the quarantine for one document's refused entries.
151
+ *
152
+ * Idempotent in the sense that matters: calling it again with entry ids the
153
+ * record already holds writes nothing at all. That is not an optimisation. A
154
+ * write here appends an entry, which syncs, which can trigger the next push,
155
+ * which would record again — so a record that rewrote itself on every attempt
156
+ * would feed a loop the user pays for in bandwidth and history size.
157
+ *
158
+ * @throws QuarantineRecursionError when asked to record a `qtn_` document,
159
+ * which would let one refusal generate an unbounded chain of records.
160
+ */
161
+ export declare function recordPushQuarantine(input: {
162
+ /** The tenant's `userdirectory`, not the database the entries belong to. */
163
+ db: MindooDB;
164
+ /** Signing public key (PEM) of this device — must match the identity writing the document. */
165
+ signingPublicKey: string;
166
+ dbid: string;
167
+ quarantinedDocId: string;
168
+ rejectionClass: PutRejectionClass;
169
+ reason: string;
170
+ entryIds: readonly string[];
171
+ subtle: SubtleCrypto;
172
+ signingKeyPair?: SigningKeyPair;
173
+ signingKeyPassword?: string;
174
+ now?: number;
175
+ }): Promise<MindooDoc>;
176
+ /**
177
+ * Withdraw a record, because the entries were finally accepted or the user gave
178
+ * up on them.
179
+ */
180
+ export declare function clearQuarantineRecord(input: {
181
+ db: MindooDB;
182
+ key: QuarantineRecordKey;
183
+ subtle: SubtleCrypto;
184
+ }): Promise<void>;
185
+ /**
186
+ * Check one record's claim. Returns the verified record, or `null` when any step
187
+ * of the chain described in the module docs fails.
188
+ */
189
+ export declare function verifyQuarantineRecord(input: {
190
+ db: MindooDB;
191
+ directory: QuarantineDirectory;
192
+ doc: MindooDoc;
193
+ subtle: SubtleCrypto;
194
+ }): Promise<QuarantineRecordDoc | null>;
195
+ /**
196
+ * Every verified quarantine record in this `userdirectory` replica.
197
+ *
198
+ * Requires the tenant `default` key to be unlocked; records that cannot be
199
+ * decrypted are simply absent. Unverifiable records are skipped silently —
200
+ * they are the expected shape of an attack, not an error to surface.
201
+ */
202
+ export declare function listQuarantineRecords(input: {
203
+ db: MindooDB;
204
+ directory: QuarantineDirectory;
205
+ subtle: SubtleCrypto;
206
+ /** Restrict to one database, e.g. for the sync view of a single database. */
207
+ dbid?: string;
208
+ /** Restrict to records this device wrote itself. */
209
+ signingKeyFingerprint?: string;
210
+ }): Promise<QuarantineRecordDoc[]>;
211
+ //# sourceMappingURL=QuarantineDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuarantineDocument.d.ts","sourceRoot":"","sources":["../../../src/core/quarantine/QuarantineDocument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAGnE,eAAO,MAAM,wBAAwB,SAAS,CAAC;AAC/C,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAC/C,eAAO,MAAM,eAAe,eAAe,CAAC;AAC5C,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,kFAAkF;AAClF,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,IAAI,EAAE,OAAO,eAAe,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,gBAAgB,EAAE,MAAM,CAAC;IACzB,mCAAmC;IACnC,cAAc,EAAE,iBAAiB,CAAC;IAClC,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW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a device remembers a write the server turned away,
4
+ * so it can be found again and offered again.
5
+ *
6
+ * A device that pushes an entry and gets a `"policy"` rejection back is holding
7
+ * something awkward: an entry that was legitimate when it was written, is
8
+ * cryptographically sound, and is refused only because a right was withdrawn in
9
+ * the meantime. It must not be dropped — the right may come back — and it must
10
+ * not block the database's push either. So the push moves on and leaves a
11
+ * record here.
12
+ *
13
+ * This matters most for entries that arrived over peer-to-peer sync: a device
14
+ * can hold, and have already merged, a change it did not write itself and whose
15
+ * author has since lost the right to write it. Without a record, the refusal
16
+ * would be a line in a log that disappears on reload.
17
+ *
18
+ * ## Why `userdirectory`
19
+ *
20
+ * The record deliberately does *not* live in the database it is about. The
21
+ * whole reason it exists is that someone lost their write right there, so
22
+ * writing the record there would earn the same refusal as the entry it
23
+ * documents. `userdirectory` is a database every member can write their own
24
+ * documents in without an administrator approving anything.
25
+ *
26
+ * - **`qtn_` prefix** — makes it a *personal document* (see
27
+ * {@link PERSONAL_DOC_ID_PREFIXES}), so the write invariant lets its creator
28
+ * change and delete it, and the admin delete it.
29
+ * - **`default` key, not `$publicinfos`** — the hoster holds the
30
+ * `$publicinfos` key, and which of a tenant's writes were refused is none of
31
+ * the hoster's business. `default` keeps it readable for every member, so it
32
+ * can serve as an audit trail, and opaque to the server.
33
+ *
34
+ * ## One record per author, database, document and class
35
+ *
36
+ * The id is derived rather than random, which makes recording idempotent: a
37
+ * retry that fails the same way updates the record in place instead of adding
38
+ * another. A cascade of refused entries on one document therefore collapses
39
+ * into one record holding a capped list of entry ids.
40
+ *
41
+ * The **author's key fingerprint is part of the derivation**, and that is
42
+ * load-bearing rather than decorative. Without it, two members refused on the
43
+ * same document for the same reason would derive the same id — and since the
44
+ * personal-document invariant only lets the *creator* write a document, the
45
+ * second member's record would be refused by the very invariant that is
46
+ * supposed to protect it. Folding the author in makes id and ownership agree.
47
+ *
48
+ * ## Why records must be verified on read
49
+ *
50
+ * Any tenant member can write a `qtn_` document claiming anything. Since these
51
+ * records say "this person tried to write something they were not allowed to
52
+ * write", an unverified one is a way to put words in someone else's mouth.
53
+ * {@link verifyQuarantineRecord} accepts a record only when:
54
+ *
55
+ * 1. the doc id is derived from the payload's own fields, including the
56
+ * fingerprint of the `signingPublicKey` it names,
57
+ * 2. the `doc_create` entry was signed by exactly that key, and
58
+ * 3. that key is an active (non-revoked) grant in the tenant.
59
+ *
60
+ * **Known limit — a record is evidence of an honest client, not of an honest
61
+ * one's absence.** Nothing compels a device to write a record, so the absence
62
+ * of one proves nothing. Like the `dev_` records, this is useful for auditing
63
+ * cooperating devices, not for catching a malicious one.
64
+ */
65
+ Object.defineProperty(exports, "__esModule", { value: true });
66
+ exports.QuarantineRecursionError = exports.MAX_QUARANTINED_ENTRY_IDS = exports.QUARANTINE_SCHEMA_VERSION = exports.QUARANTINE_TYPE = exports.QUARANTINE_FORM = exports.QUARANTINE_DOC_ID_PREFIX = void 0;
67
+ exports.isQuarantineDocId = isQuarantineDocId;
68
+ exports.quarantineDocumentId = quarantineDocumentId;
69
+ exports.recordPushQuarantine = recordPushQuarantine;
70
+ exports.clearQuarantineRecord = clearQuarantineRecord;
71
+ exports.verifyQuarantineRecord = verifyQuarantineRecord;
72
+ exports.listQuarantineRecords = listQuarantineRecords;
73
+ const types_1 = require("../types");
74
+ const fingerprint_1 = require("../userkeys/fingerprint");
75
+ exports.QUARANTINE_DOC_ID_PREFIX = "qtn_";
76
+ exports.QUARANTINE_FORM = "userdirectory";
77
+ exports.QUARANTINE_TYPE = "quarantine";
78
+ exports.QUARANTINE_SCHEMA_VERSION = 1;
79
+ /**
80
+ * How many entry ids one record carries.
81
+ *
82
+ * A quarantined write usually drags its causal dependents along, so one
83
+ * refusal can mean a long list. The list is for finding the entries again, and
84
+ * a bounded one does that just as well while keeping the record — which syncs
85
+ * to every member of the tenant — from growing without limit.
86
+ */
87
+ exports.MAX_QUARANTINED_ENTRY_IDS = 200;
88
+ /** Is this a quarantine record id? */
89
+ function isQuarantineDocId(docId) {
90
+ return typeof docId === "string" && docId.startsWith(exports.QUARANTINE_DOC_ID_PREFIX);
91
+ }
92
+ /**
93
+ * Deterministic document id for one (author, database, document, class).
94
+ *
95
+ * Deterministic so that recording the same refusal again updates the record
96
+ * instead of accumulating one per attempt. Hashed rather than concatenated
97
+ * because custom ids must match `^[a-z][a-z0-9_]*$` (`CUSTOM_DOC_ID_REGEX`) and
98
+ * a document id can hold anything.
99
+ */
100
+ async function quarantineDocumentId(key, subtle) {
101
+ const material = [
102
+ key.signingKeyFingerprint.replace(/:/g, "").toLowerCase(),
103
+ key.dbid,
104
+ key.quarantinedDocId,
105
+ key.rejectionClass,
106
+ ].join("\u0000");
107
+ const digest = await subtle.digest("SHA-256", new TextEncoder().encode(material));
108
+ const hex = [...new Uint8Array(digest)]
109
+ .map((byte) => byte.toString(16).padStart(2, "0"))
110
+ .join("");
111
+ return `${exports.QUARANTINE_DOC_ID_PREFIX}${hex.slice(0, 40)}`;
112
+ }
113
+ /** Thrown when a caller tries to record a quarantine about a quarantine record. */
114
+ class QuarantineRecursionError extends Error {
115
+ constructor(docId) {
116
+ super(`Refusing to record a quarantine for ${docId}: quarantine records are not themselves quarantined`);
117
+ this.name = "QuarantineRecursionError";
118
+ }
119
+ }
120
+ exports.QuarantineRecursionError = QuarantineRecursionError;
121
+ /**
122
+ * Record (or extend) the quarantine for one document's refused entries.
123
+ *
124
+ * Idempotent in the sense that matters: calling it again with entry ids the
125
+ * record already holds writes nothing at all. That is not an optimisation. A
126
+ * write here appends an entry, which syncs, which can trigger the next push,
127
+ * which would record again — so a record that rewrote itself on every attempt
128
+ * would feed a loop the user pays for in bandwidth and history size.
129
+ *
130
+ * @throws QuarantineRecursionError when asked to record a `qtn_` document,
131
+ * which would let one refusal generate an unbounded chain of records.
132
+ */
133
+ async function recordPushQuarantine(input) {
134
+ if (isQuarantineDocId(input.quarantinedDocId)) {
135
+ throw new QuarantineRecursionError(input.quarantinedDocId);
136
+ }
137
+ const fingerprint = await (0, fingerprint_1.fingerprintPublicKeyPem)(input.signingPublicKey, input.subtle);
138
+ const docId = await quarantineDocumentId({
139
+ signingKeyFingerprint: fingerprint,
140
+ dbid: input.dbid,
141
+ quarantinedDocId: input.quarantinedDocId,
142
+ rejectionClass: input.rejectionClass,
143
+ }, input.subtle);
144
+ const doc = (await input.db.getDocument(docId).catch(() => null)) ??
145
+ // Not `assumeUniqueId`: the id is derived rather than random, so two
146
+ // replicas creating it concurrently must share Automerge ancestry to
147
+ // converge instead of forking. That path also forbids `initialValues`,
148
+ // which is why the payload goes in through `changeDoc` below — the same
149
+ // call that extends an existing record.
150
+ (await input.db.createDocument({
151
+ id: docId,
152
+ decryptionKeyId: types_1.DEFAULT_TENANT_KEY_ID,
153
+ signingKeyPair: input.signingKeyPair,
154
+ signingKeyPassword: input.signingKeyPassword,
155
+ }));
156
+ const current = doc.getData();
157
+ const known = new Set(Array.isArray(current.entryIds) ? current.entryIds : []);
158
+ const added = input.entryIds.filter((id) => !known.has(id));
159
+ const alreadyDescribed = current.type === exports.QUARANTINE_TYPE &&
160
+ current.schemaVersion === exports.QUARANTINE_SCHEMA_VERSION &&
161
+ current.signingPublicKey === input.signingPublicKey &&
162
+ current.dbid === input.dbid &&
163
+ current.quarantinedDocId === input.quarantinedDocId &&
164
+ current.rejectionClass === input.rejectionClass &&
165
+ current.reason === input.reason;
166
+ if (alreadyDescribed && added.length === 0) {
167
+ return doc;
168
+ }
169
+ const merged = [...known, ...added];
170
+ const kept = merged.slice(0, exports.MAX_QUARANTINED_ENTRY_IDS);
171
+ const omitted = (current.omittedEntryCount ?? 0) + (merged.length - kept.length);
172
+ const now = input.now ?? Date.now();
173
+ await input.db.changeDoc(doc, (editable) => {
174
+ const data = editable.getData();
175
+ data.form = exports.QUARANTINE_FORM;
176
+ data.type = exports.QUARANTINE_TYPE;
177
+ data.schemaVersion = exports.QUARANTINE_SCHEMA_VERSION;
178
+ data.signingPublicKey = input.signingPublicKey;
179
+ data.dbid = input.dbid;
180
+ data.quarantinedDocId = input.quarantinedDocId;
181
+ data.rejectionClass = input.rejectionClass;
182
+ data.reason = input.reason;
183
+ data.entryIds = kept;
184
+ if (omitted > 0) {
185
+ data.omittedEntryCount = omitted;
186
+ }
187
+ data.firstSeenAt = typeof current.firstSeenAt === "number" ? current.firstSeenAt : now;
188
+ data.updatedAt = now;
189
+ });
190
+ return doc;
191
+ }
192
+ /**
193
+ * Withdraw a record, because the entries were finally accepted or the user gave
194
+ * up on them.
195
+ */
196
+ async function clearQuarantineRecord(input) {
197
+ const docId = await quarantineDocumentId(input.key, input.subtle);
198
+ await input.db.deleteDocument(docId).catch(() => {
199
+ // Already gone, or never recorded from this device.
200
+ });
201
+ }
202
+ /**
203
+ * Check one record's claim. Returns the verified record, or `null` when any step
204
+ * of the chain described in the module docs fails.
205
+ */
206
+ async function verifyQuarantineRecord(input) {
207
+ const docId = input.doc.getId();
208
+ const data = input.doc.getData();
209
+ const signingPublicKey = typeof data.signingPublicKey === "string" ? data.signingPublicKey : "";
210
+ const dbid = typeof data.dbid === "string" ? data.dbid : "";
211
+ const quarantinedDocId = typeof data.quarantinedDocId === "string" ? data.quarantinedDocId : "";
212
+ const rejectionClass = data.rejectionClass;
213
+ if (data.type !== exports.QUARANTINE_TYPE ||
214
+ !signingPublicKey ||
215
+ !dbid ||
216
+ !quarantinedDocId ||
217
+ typeof rejectionClass !== "string") {
218
+ return null;
219
+ }
220
+ // 1. The id must be derived from the payload's own fields, so a record cannot
221
+ // sit under an id describing a different author, database or document than
222
+ // the one it names.
223
+ const fingerprint = await (0, fingerprint_1.fingerprintPublicKeyPem)(signingPublicKey, input.subtle);
224
+ const expectedId = await quarantineDocumentId({
225
+ signingKeyFingerprint: fingerprint,
226
+ dbid,
227
+ quarantinedDocId,
228
+ rejectionClass: rejectionClass,
229
+ }, input.subtle);
230
+ if (expectedId !== docId) {
231
+ return null;
232
+ }
233
+ // 2. That key must be the one that actually created the document. Without
234
+ // this, any member could record a refusal in someone else's name.
235
+ const creatorKey = await resolveCreateSigner(input.db, docId);
236
+ if (!creatorKey || normalizePem(creatorKey) !== normalizePem(signingPublicKey)) {
237
+ return null;
238
+ }
239
+ // 3. And it must still be a live grant, so revoked devices drop out.
240
+ if (!(await input.directory.validatePublicSigningKey(signingPublicKey).catch(() => false))) {
241
+ return null;
242
+ }
243
+ return {
244
+ docId,
245
+ signingPublicKey,
246
+ signingKeyFingerprint: fingerprint,
247
+ dbid,
248
+ quarantinedDocId,
249
+ rejectionClass: rejectionClass,
250
+ reason: typeof data.reason === "string" ? data.reason : "",
251
+ entryIds: Array.isArray(data.entryIds)
252
+ ? data.entryIds.filter((id) => typeof id === "string")
253
+ : [],
254
+ omittedEntryCount: typeof data.omittedEntryCount === "number" ? data.omittedEntryCount : 0,
255
+ firstSeenAt: typeof data.firstSeenAt === "number" ? data.firstSeenAt : 0,
256
+ updatedAt: typeof data.updatedAt === "number" ? data.updatedAt : 0,
257
+ };
258
+ }
259
+ /**
260
+ * Every verified quarantine record in this `userdirectory` replica.
261
+ *
262
+ * Requires the tenant `default` key to be unlocked; records that cannot be
263
+ * decrypted are simply absent. Unverifiable records are skipped silently —
264
+ * they are the expected shape of an attack, not an error to surface.
265
+ */
266
+ async function listQuarantineRecords(input) {
267
+ // `idPrefix` matching is boundary-aware: "qtn" matches `qtn_…`, not `qtnx…`.
268
+ const docIds = await input.db.getAllDocumentIds({ idPrefix: "qtn" });
269
+ const records = [];
270
+ for (const docId of docIds) {
271
+ if (!isQuarantineDocId(docId)) {
272
+ continue;
273
+ }
274
+ const doc = await input.db.getDocument(docId).catch(() => null);
275
+ if (!doc) {
276
+ continue;
277
+ }
278
+ const record = await verifyQuarantineRecord({
279
+ db: input.db,
280
+ directory: input.directory,
281
+ doc,
282
+ subtle: input.subtle,
283
+ });
284
+ if (!record) {
285
+ continue;
286
+ }
287
+ if (input.dbid !== undefined && record.dbid !== input.dbid) {
288
+ continue;
289
+ }
290
+ if (input.signingKeyFingerprint !== undefined &&
291
+ record.signingKeyFingerprint !== input.signingKeyFingerprint) {
292
+ continue;
293
+ }
294
+ records.push(record);
295
+ }
296
+ return records;
297
+ }
298
+ /** Signing key that wrote the `doc_create` entry, or null when it is not here yet. */
299
+ async function resolveCreateSigner(db, docId) {
300
+ try {
301
+ // History is ordered causally, so `doc_create` is on the first page.
302
+ const page = await db.getDocumentHistoryPage(docId, { limit: 10 });
303
+ const create = page.entries.find((entry) => entry.entryType === "doc_create");
304
+ return create?.changeCreatedByPublicKey ?? null;
305
+ }
306
+ catch {
307
+ return null;
308
+ }
309
+ }
310
+ /** PEM formatting varies by transport; compare the key material, not the wrapping. */
311
+ function normalizePem(pem) {
312
+ return pem.replace(/\s+/g, "");
313
+ }
314
+ //# sourceMappingURL=QuarantineDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuarantineDocument.js","sourceRoot":"","sources":["../../../src/core/quarantine/QuarantineDocument.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;;;AAgFH,8CAEC;AAUD,oDAeC;AAwBD,oDAmFC;AAMD,sDASC;AAMD,wDAoEC;AASD,sDAyCC;AA/VD,oCAAiD;AAGjD,yDAAkE;AAErD,QAAA,wBAAwB,GAAG,MAAM,CAAC;AAClC,QAAA,eAAe,GAAG,eAAe,CAAC;AAClC,QAAA,eAAe,GAAG,YAAY,CAAC;AAC/B,QAAA,yBAAyB,GAAG,CAAC,CAAC;AAE3C;;;;;;;GAOG;AACU,QAAA,yBAAyB,GAAG,GAAG,CAAC;AA2D7C,sCAAsC;AACtC,SAAgB,iBAAiB,CAAC,KAAgC;IAChE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,gCAAwB,CAAC,CAAC;AACjF,CAAC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,oBAAoB,CACxC,GAAwB,EACxB,MAAoB;IAEpB,MAAM,QAAQ,GAAG;QACf,GAAG,CAAC,qBAAq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