@noy-db/hub 0.2.0-pre.30 → 0.2.0-pre.31

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 (143) hide show
  1. package/dist/adapter/index.d.ts +9 -0
  2. package/dist/adapter/index.js +14 -0
  3. package/dist/attestation/index.d.ts +1 -1
  4. package/dist/attestation/index.js +3 -3
  5. package/dist/blobs/index.d.ts +3 -3
  6. package/dist/bundle/index.d.ts +3 -3
  7. package/dist/bundle/index.js +1 -1
  8. package/dist/{chunk-Y6YUWZTS.js → chunk-L5HHBOMS.js} +2 -2
  9. package/dist/{chunk-BVKLJBJJ.js → chunk-W5NVNJDX.js} +2 -1
  10. package/dist/{chunk-BVKLJBJJ.js.map → chunk-W5NVNJDX.js.map} +1 -1
  11. package/dist/consent/index.d.ts +2 -2
  12. package/dist/{decrypt-partition-Mhjh6nnG.d.ts → decrypt-partition-CXS5KopB.d.ts} +1 -1
  13. package/dist/derivations/index.d.ts +3 -3
  14. package/dist/{dev-unlock-DJ3IhgY9.d.ts → dev-unlock-CnHTTVea.d.ts} +1 -1
  15. package/dist/guards/index.d.ts +3 -3
  16. package/dist/{hash-DLwkYf1d.d.ts → hash-oc5paYl0.d.ts} +1 -1
  17. package/dist/history/index.d.ts +3 -3
  18. package/dist/i18n/index.d.ts +2 -2
  19. package/dist/{index-CMRIx_zx.d.ts → index-BmhGztUi.d.ts} +1 -1
  20. package/dist/index.d.ts +11 -11
  21. package/dist/index.js +2 -2
  22. package/dist/kernel/index.d.ts +2 -2
  23. package/dist/materialized-views/index.d.ts +3 -3
  24. package/dist/{mime-magic-CacDBwYp.d.ts → mime-magic-JeLKHRng.d.ts} +1 -1
  25. package/dist/{noydb-5MIBD77B.js → noydb-NAU2DTFP.js} +2 -2
  26. package/dist/noydb-NAU2DTFP.js.map +1 -0
  27. package/dist/overlay-views/index.d.ts +3 -3
  28. package/dist/periods/index.d.ts +2 -2
  29. package/dist/session/index.d.ts +3 -3
  30. package/dist/shadow/index.d.ts +2 -2
  31. package/dist/snapshots/index.d.ts +2 -2
  32. package/dist/store/index.d.ts +2 -2
  33. package/dist/sync/index.d.ts +1 -1
  34. package/dist/team/index.d.ts +2 -2
  35. package/dist/{transition-guard-J04-jime.d.ts → transition-guard-Dy3NioQr.d.ts} +1 -1
  36. package/dist/tx/index.d.ts +2 -2
  37. package/dist/{with-materialized-view-DNfzC5lH.d.ts → with-materialized-view-DIVeez0W.d.ts} +1 -1
  38. package/dist/{with-overlayed-view-qk3lbhOd.d.ts → with-overlayed-view-DVZrc5Hb.d.ts} +1 -1
  39. package/dist/{with-rollup-Dd3_ZG4b.d.ts → with-rollup-CbU-O4wP.d.ts} +1 -1
  40. package/package.json +62 -221
  41. package/dist/aggregate/index.cjs +0 -1144
  42. package/dist/aggregate/index.cjs.map +0 -1
  43. package/dist/aggregate/index.d.cts +0 -39
  44. package/dist/attestation/index.cjs +0 -305
  45. package/dist/attestation/index.cjs.map +0 -1
  46. package/dist/attestation/index.d.cts +0 -54
  47. package/dist/blobs/index.cjs +0 -1967
  48. package/dist/blobs/index.cjs.map +0 -1
  49. package/dist/blobs/index.d.cts +0 -48
  50. package/dist/bundle/index.cjs +0 -41045
  51. package/dist/bundle/index.cjs.map +0 -1
  52. package/dist/bundle/index.d.cts +0 -187
  53. package/dist/consent/index.cjs +0 -204
  54. package/dist/consent/index.cjs.map +0 -1
  55. package/dist/consent/index.d.cts +0 -27
  56. package/dist/crdt/index.cjs +0 -152
  57. package/dist/crdt/index.cjs.map +0 -1
  58. package/dist/crdt/index.d.cts +0 -30
  59. package/dist/decrypt-partition-C0iDpbSd.d.cts +0 -558
  60. package/dist/derivations/index.cjs +0 -469
  61. package/dist/derivations/index.cjs.map +0 -1
  62. package/dist/derivations/index.d.cts +0 -74
  63. package/dist/dev-unlock-0Z6yxfS7.d.cts +0 -263
  64. package/dist/discriminant-BN9REW3o.d.cts +0 -60
  65. package/dist/errors-BAWO5Z5a.d.cts +0 -1500
  66. package/dist/forget/index.cjs +0 -43
  67. package/dist/forget/index.cjs.map +0 -1
  68. package/dist/forget/index.d.cts +0 -1
  69. package/dist/guards/index.cjs +0 -455
  70. package/dist/guards/index.cjs.map +0 -1
  71. package/dist/guards/index.d.cts +0 -39
  72. package/dist/hash-Db8ncXGr.d.cts +0 -63
  73. package/dist/history/index.cjs +0 -1245
  74. package/dist/history/index.cjs.map +0 -1
  75. package/dist/history/index.d.cts +0 -65
  76. package/dist/i18n/index.cjs +0 -1280
  77. package/dist/i18n/index.cjs.map +0 -1
  78. package/dist/i18n/index.d.cts +0 -41
  79. package/dist/index-BMmajblo.d.cts +0 -362
  80. package/dist/index-C1SC1EPe.d.cts +0 -1325
  81. package/dist/index-xJEPkvMb.d.cts +0 -93
  82. package/dist/index.cjs +0 -48100
  83. package/dist/index.cjs.map +0 -1
  84. package/dist/index.d.cts +0 -1050
  85. package/dist/indexing/index.cjs +0 -803
  86. package/dist/indexing/index.cjs.map +0 -1
  87. package/dist/indexing/index.d.cts +0 -36
  88. package/dist/kernel/index.cjs +0 -751
  89. package/dist/kernel/index.cjs.map +0 -1
  90. package/dist/kernel/index.d.cts +0 -11
  91. package/dist/lazy-builder-eYZzLEL1.d.cts +0 -304
  92. package/dist/materialized-views/index.cjs +0 -1518
  93. package/dist/materialized-views/index.cjs.map +0 -1
  94. package/dist/materialized-views/index.d.cts +0 -187
  95. package/dist/mime-magic-sdMzsfVK.d.cts +0 -103
  96. package/dist/overlay-views/index.cjs +0 -399
  97. package/dist/overlay-views/index.cjs.map +0 -1
  98. package/dist/overlay-views/index.d.cts +0 -102
  99. package/dist/periods/index.cjs +0 -1041
  100. package/dist/periods/index.cjs.map +0 -1
  101. package/dist/periods/index.d.cts +0 -24
  102. package/dist/predicate-BmhBSPCH.d.cts +0 -267
  103. package/dist/query/index.cjs +0 -3480
  104. package/dist/query/index.cjs.map +0 -1
  105. package/dist/query/index.d.cts +0 -4
  106. package/dist/sealed-record/index.cjs +0 -139
  107. package/dist/sealed-record/index.cjs.map +0 -1
  108. package/dist/sealed-record/index.d.cts +0 -123
  109. package/dist/session/index.cjs +0 -495
  110. package/dist/session/index.cjs.map +0 -1
  111. package/dist/session/index.d.cts +0 -48
  112. package/dist/shadow/index.cjs +0 -133
  113. package/dist/shadow/index.cjs.map +0 -1
  114. package/dist/shadow/index.d.cts +0 -19
  115. package/dist/snapshots/index.cjs +0 -937
  116. package/dist/snapshots/index.cjs.map +0 -1
  117. package/dist/snapshots/index.d.cts +0 -30
  118. package/dist/store/index.cjs +0 -1091
  119. package/dist/store/index.cjs.map +0 -1
  120. package/dist/store/index.d.cts +0 -501
  121. package/dist/strategy-BSxFXGzb.d.cts +0 -110
  122. package/dist/strategy-mJExw4LQ.d.cts +0 -1069
  123. package/dist/sync/index.cjs +0 -1062
  124. package/dist/sync/index.cjs.map +0 -1
  125. package/dist/sync/index.d.cts +0 -45
  126. package/dist/team/index.cjs +0 -2805
  127. package/dist/team/index.cjs.map +0 -1
  128. package/dist/team/index.d.cts +0 -120
  129. package/dist/transition-guard-tWZIsaXe.d.cts +0 -165
  130. package/dist/tx/index.cjs +0 -614
  131. package/dist/tx/index.cjs.map +0 -1
  132. package/dist/tx/index.d.cts +0 -39
  133. package/dist/types-CdVfiQgt.d.cts +0 -15275
  134. package/dist/ulid-DRH25k3y.d.cts +0 -66
  135. package/dist/util/index.cjs +0 -237
  136. package/dist/util/index.cjs.map +0 -1
  137. package/dist/util/index.d.cts +0 -79
  138. package/dist/with-materialized-view-DfgPcvi9.d.cts +0 -27
  139. package/dist/with-overlayed-view-Cvfkx1lg.d.cts +0 -13
  140. package/dist/with-rollup-nIxo7h9z.d.cts +0 -47
  141. /package/dist/{noydb-5MIBD77B.js.map → adapter/index.js.map} +0 -0
  142. /package/dist/{chunk-Y6YUWZTS.js.map → chunk-L5HHBOMS.js.map} +0 -0
  143. /package/dist/{types-DHn9lEP0.d.ts → index-DHn9lEP0.d.ts} +0 -0
@@ -1,39 +0,0 @@
1
- import { A as AggregateStrategy } from '../strategy-mJExw4LQ.cjs';
2
- export { j as AggregateResult, k as AggregateSpec, l as Aggregation, m as AggregationUpstream, G as GROUPBY_MAX_CARDINALITY, n as GROUPBY_WARN_CARDINALITY, o as GroupedAggregation, p as GroupedQuery, q as GroupedQueryN, t as GroupedRow, u as GroupedRowN, w as LiveAggregation, x as Reducer, y as ReducerOptions, z as avg, B as buildLiveAggregation, C as count, D as groupAndReduce, E as max, F as min, H as reduceRecords, J as resetGroupByWarnings, K as sum } from '../strategy-mJExw4LQ.cjs';
3
- import '../errors-BAWO5Z5a.cjs';
4
-
5
- /**
6
- * Active aggregate strategy factory. Calling `withAggregate()` returns
7
- * an `AggregateStrategy` whose methods construct real `Aggregation` /
8
- * `GroupedQuery` instances and run the streaming reducer protocol.
9
- *
10
- * This module is only reachable through the `@noy-db/hub/aggregate`
11
- * subpath — a consumer that never imports the subpath ships none of
12
- * this (ESM tree-shaking + hub's `"sideEffects": false`).
13
- */
14
-
15
- /**
16
- * Build the default aggregate strategy. Pass into
17
- * `createNoydb({ aggregateStrategy: withAggregate() })` to light up
18
- * `.aggregate()` and `.groupBy()` on `Query` and `ScanBuilder`.
19
- *
20
- * @example
21
- * ```ts
22
- * import { createNoydb } from '@noy-db/hub'
23
- * import { withAggregate, sum, count } from '@noy-db/hub/aggregate'
24
- *
25
- * const db = await createNoydb({
26
- * store, user, secret,
27
- * aggregateStrategy: withAggregate(),
28
- * })
29
- *
30
- * const totals = invoices.query()
31
- * .where('status', '==', 'paid')
32
- * .groupBy('clientId')
33
- * .aggregate({ amount: sum('amount'), n: count() })
34
- * .run()
35
- * ```
36
- */
37
- declare function withAggregate(): AggregateStrategy;
38
-
39
- export { AggregateStrategy, withAggregate };
@@ -1,305 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/attestation/index.ts
21
- var attestation_exports = {};
22
- __export(attestation_exports, {
23
- ATTESTATIONS_COLLECTION: () => ATTESTATIONS_COLLECTION,
24
- AttestationError: () => AttestationError,
25
- decodeQr: () => import_attestation4.decodeQr,
26
- getRevokedDocIdsCore: () => getRevokedDocIdsCore,
27
- isRevoked: () => import_attestation4.isRevoked,
28
- issueAttestationCore: () => issueAttestationCore,
29
- publishRevocationListCore: () => publishRevocationListCore,
30
- revokeDocCore: () => revokeDocCore,
31
- signRevocationList: () => import_attestation4.signRevocationList,
32
- unrevokeDocCore: () => unrevokeDocCore,
33
- verifyAttestation: () => import_attestation4.verifyAttestation,
34
- verifyRevocationList: () => import_attestation4.verifyRevocationList
35
- });
36
- module.exports = __toCommonJS(attestation_exports);
37
-
38
- // src/types.ts
39
- var NOYDB_FORMAT_VERSION = 1;
40
-
41
- // src/errors.ts
42
- var NoydbError = class extends Error {
43
- /** Machine-readable error code. Stable across library versions. */
44
- code;
45
- constructor(code, message) {
46
- super(message);
47
- this.name = "NoydbError";
48
- this.code = code;
49
- }
50
- };
51
- var DecryptionError = class extends NoydbError {
52
- constructor(message = "Decryption failed") {
53
- super("DECRYPTION_FAILED", message);
54
- this.name = "DecryptionError";
55
- }
56
- };
57
- var TamperedError = class extends NoydbError {
58
- constructor(message = "Data integrity check failed \u2014 record may have been tampered with") {
59
- super("TAMPERED", message);
60
- this.name = "TamperedError";
61
- }
62
- };
63
- var ConflictError = class extends NoydbError {
64
- /** The actual stored version at the time of conflict. */
65
- version;
66
- constructor(version, message = "Version conflict") {
67
- super("CONFLICT", message);
68
- this.name = "ConflictError";
69
- this.version = version;
70
- }
71
- };
72
- var AttestationError = class extends NoydbError {
73
- constructor(message) {
74
- super("ATTESTATION", message);
75
- this.name = "AttestationError";
76
- }
77
- };
78
-
79
- // src/crypto.ts
80
- var IV_BYTES = 12;
81
- var subtle = globalThis.crypto.subtle;
82
- async function encrypt(plaintext, dek) {
83
- const iv = generateIV();
84
- const encoded = new TextEncoder().encode(plaintext);
85
- const ciphertext = await subtle.encrypt(
86
- { name: "AES-GCM", iv },
87
- dek,
88
- encoded
89
- );
90
- return {
91
- iv: bufferToBase64(iv),
92
- data: bufferToBase64(ciphertext)
93
- };
94
- }
95
- async function decrypt(ivBase64, dataBase64, dek) {
96
- const iv = base64ToBuffer(ivBase64);
97
- const ciphertext = base64ToBuffer(dataBase64);
98
- try {
99
- const plaintext = await subtle.decrypt(
100
- { name: "AES-GCM", iv },
101
- dek,
102
- ciphertext
103
- );
104
- return new TextDecoder().decode(plaintext);
105
- } catch (err) {
106
- if (err instanceof Error && err.name === "OperationError") {
107
- throw new TamperedError();
108
- }
109
- throw new DecryptionError(
110
- err instanceof Error ? err.message : "Decryption failed"
111
- );
112
- }
113
- }
114
- function generateIV() {
115
- return globalThis.crypto.getRandomValues(new Uint8Array(IV_BYTES));
116
- }
117
- function bufferToBase64(buffer) {
118
- const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
119
- let binary = "";
120
- for (let i = 0; i < bytes.length; i++) {
121
- binary += String.fromCharCode(bytes[i]);
122
- }
123
- return btoa(binary);
124
- }
125
- function base64ToBuffer(base64) {
126
- const binary = atob(base64);
127
- const bytes = new Uint8Array(binary.length);
128
- for (let i = 0; i < binary.length; i++) {
129
- bytes[i] = binary.charCodeAt(i);
130
- }
131
- return bytes;
132
- }
133
-
134
- // src/bundle/ulid.ts
135
- var CROCKFORD_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
136
- function encodeBase32(value, length) {
137
- let out = "";
138
- let v = value;
139
- for (let i = 0; i < length; i++) {
140
- out = CROCKFORD_ALPHABET[v % 32] + out;
141
- v = Math.floor(v / 32);
142
- }
143
- return out;
144
- }
145
- function generateULID() {
146
- const now = Date.now();
147
- const timestampHigh = Math.floor(now / 16777216);
148
- const timestampLow = now & 16777215;
149
- const tsPart = encodeBase32(timestampHigh, 5) + encodeBase32(timestampLow, 5);
150
- const randBytes = new Uint8Array(10);
151
- crypto.getRandomValues(randBytes);
152
- const rand1 = randBytes[0] * 2 ** 32 + (randBytes[1] << 24 >>> 0) + (randBytes[2] << 16) + (randBytes[3] << 8) + randBytes[4];
153
- const rand2 = randBytes[5] * 2 ** 32 + (randBytes[6] << 24 >>> 0) + (randBytes[7] << 16) + (randBytes[8] << 8) + randBytes[9];
154
- const randPart = encodeBase32(rand1, 8) + encodeBase32(rand2, 8);
155
- return tsPart + randPart;
156
- }
157
-
158
- // src/attestation/signer.ts
159
- var import_attestation = require("@noy-db/attestation");
160
- var ATTESTATIONS_COLLECTION = "_attestations";
161
- var SIGNER_RECORD_ID = "_signer";
162
- var REVOKED_RECORD_ID = "_revoked";
163
- async function loadSigner(store, vault, getDEK) {
164
- const existing = await store.get(vault, ATTESTATIONS_COLLECTION, SIGNER_RECORD_ID);
165
- if (!existing) return null;
166
- const dek = await getDEK(ATTESTATIONS_COLLECTION);
167
- const json = await decrypt(existing._iv, existing._data, dek);
168
- return JSON.parse(json);
169
- }
170
- async function loadOrCreateSigner(store, vault, getDEK) {
171
- const existing = await loadSigner(store, vault, getDEK);
172
- if (existing) return existing;
173
- const dek = await getDEK(ATTESTATIONS_COLLECTION);
174
- const signer = await (0, import_attestation.generateDocSigningKeyPair)();
175
- const { iv, data } = await encrypt(JSON.stringify(signer), dek);
176
- const env = {
177
- _noydb: NOYDB_FORMAT_VERSION,
178
- _v: 1,
179
- _ts: (/* @__PURE__ */ new Date()).toISOString(),
180
- _iv: iv,
181
- _data: data
182
- };
183
- try {
184
- await store.put(vault, ATTESTATIONS_COLLECTION, SIGNER_RECORD_ID, env, 0);
185
- return signer;
186
- } catch (e) {
187
- if (!(e instanceof ConflictError)) throw e;
188
- const winner = await loadSigner(store, vault, getDEK);
189
- if (!winner) {
190
- throw new ConflictError(0, "loadOrCreateSigner: signer mint lost a concurrent race but the winning record could not be re-read.");
191
- }
192
- return winner;
193
- }
194
- }
195
-
196
- // src/attestation/issue.ts
197
- var import_attestation2 = require("@noy-db/attestation");
198
- async function issueAttestationCore(ctx, args) {
199
- if (ctx.role !== "owner") {
200
- throw new AttestationError(`issueAttestation requires the 'owner' role; caller is '${ctx.role}'. Issuing a signed attestation is the firm's identity operation.`);
201
- }
202
- const src = await ctx.readRecord(args.collection, args.id);
203
- if (!src) throw new AttestationError(`issueAttestation: source record '${args.collection}/${args.id}' not found.`);
204
- const dek = await ctx.getDEK();
205
- const signer = await loadOrCreateSigner(ctx.store, ctx.vault, () => Promise.resolve(dek));
206
- const saltB64 = (0, import_attestation2.bytesToB64url)(crypto.getRandomValues(new Uint8Array(16)));
207
- let fieldHashes;
208
- try {
209
- fieldHashes = await (0, import_attestation2.computeFieldHashes)(saltB64, args.fieldSchema, src.record);
210
- } catch (e) {
211
- throw new AttestationError(`issueAttestation: ${e.message}`);
212
- }
213
- const docId = generateULID();
214
- const sig = await (0, import_attestation2.signPayloadCore)({ v: 1, docId, salt: saltB64, keyId: signer.keyId, fieldHashes }, signer.privateKeyPkcs8B64);
215
- const payload = { v: 1, docId, salt: saltB64, alg: "ed25519", keyId: signer.keyId, fieldHashes, sig };
216
- const index = {
217
- docId,
218
- issuedAt: (/* @__PURE__ */ new Date()).toISOString(),
219
- keyId: signer.keyId,
220
- fieldPaths: args.fieldSchema.fields.map((f) => f.path),
221
- sourceRefs: [{ collection: args.collection, id: args.id, version: src.version }]
222
- };
223
- const { iv, data } = await encrypt(JSON.stringify(index), dek);
224
- const env = { _noydb: NOYDB_FORMAT_VERSION, _v: 1, _ts: index.issuedAt, _iv: iv, _data: data };
225
- await ctx.store.put(ctx.vault, ATTESTATIONS_COLLECTION, docId, env);
226
- return { docId, qr: (0, import_attestation2.encodeQr)(payload), payload, keyId: signer.keyId, publicKeyB64: signer.publicKeyB64 };
227
- }
228
-
229
- // src/attestation/revoke.ts
230
- var import_attestation3 = require("@noy-db/attestation");
231
- function requireOwner(ctx, op) {
232
- if (ctx.role !== "owner") {
233
- throw new AttestationError(`${op} requires the 'owner' role; caller is '${ctx.role}'. Revocation is the firm's identity operation.`);
234
- }
235
- }
236
- async function readSet(store, vault, dek) {
237
- const env = await store.get(vault, ATTESTATIONS_COLLECTION, REVOKED_RECORD_ID);
238
- if (!env) return { docIds: /* @__PURE__ */ new Set(), version: void 0 };
239
- const set = JSON.parse(await decrypt(env._iv, env._data, dek));
240
- return { docIds: new Set(set.docIds), version: env._v };
241
- }
242
- async function mutateSet(ctx, mutate) {
243
- const dek = await ctx.getDEK();
244
- for (let attempt = 0; attempt < 2; attempt++) {
245
- const { docIds, version } = await readSet(ctx.store, ctx.vault, dek);
246
- mutate(docIds);
247
- const payload = { docIds: [...docIds].sort(), updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
248
- const { iv, data } = await encrypt(JSON.stringify(payload), dek);
249
- const expectedVersion = version ?? 0;
250
- const env = {
251
- _noydb: NOYDB_FORMAT_VERSION,
252
- _v: expectedVersion + 1,
253
- _ts: payload.updatedAt,
254
- _iv: iv,
255
- _data: data
256
- };
257
- try {
258
- await ctx.store.put(ctx.vault, ATTESTATIONS_COLLECTION, REVOKED_RECORD_ID, env, expectedVersion);
259
- return;
260
- } catch (e) {
261
- if (e instanceof ConflictError && attempt === 0) continue;
262
- throw e;
263
- }
264
- }
265
- }
266
- async function revokeDocCore(ctx, docId) {
267
- requireOwner(ctx, "revokeAttestation");
268
- const issued = await ctx.store.get(ctx.vault, ATTESTATIONS_COLLECTION, docId);
269
- if (!issued) throw new AttestationError(`revokeAttestation: attestation '${docId}' not found (was it issued by this vault?).`);
270
- await mutateSet(ctx, (ids) => ids.add(docId));
271
- }
272
- async function unrevokeDocCore(ctx, docId) {
273
- requireOwner(ctx, "unrevokeAttestation");
274
- await mutateSet(ctx, (ids) => ids.delete(docId));
275
- }
276
- async function getRevokedDocIdsCore(ctx) {
277
- const dek = await ctx.getDEK();
278
- const { docIds } = await readSet(ctx.store, ctx.vault, dek);
279
- return [...docIds].sort();
280
- }
281
- async function publishRevocationListCore(ctx) {
282
- requireOwner(ctx, "publishRevocationList");
283
- const docIds = await getRevokedDocIdsCore(ctx);
284
- const signer = await loadOrCreateSigner(ctx.store, ctx.vault, () => ctx.getDEK());
285
- return (0, import_attestation3.signRevocationList)(docIds, (/* @__PURE__ */ new Date()).toISOString(), signer.keyId, signer.privateKeyPkcs8B64);
286
- }
287
-
288
- // src/attestation/index.ts
289
- var import_attestation4 = require("@noy-db/attestation");
290
- // Annotate the CommonJS export names for ESM import in node:
291
- 0 && (module.exports = {
292
- ATTESTATIONS_COLLECTION,
293
- AttestationError,
294
- decodeQr,
295
- getRevokedDocIdsCore,
296
- isRevoked,
297
- issueAttestationCore,
298
- publishRevocationListCore,
299
- revokeDocCore,
300
- signRevocationList,
301
- unrevokeDocCore,
302
- verifyAttestation,
303
- verifyRevocationList
304
- });
305
- //# sourceMappingURL=index.cjs.map