@pkcprotocol/pkc-js 0.0.158 → 0.0.159

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 (126) hide show
  1. package/README.md +3 -0
  2. package/dist/browser/clients/base-client-manager.js +24 -11
  3. package/dist/browser/clients/base-client-manager.js.map +1 -1
  4. package/dist/browser/clients/rpc-client/pkc-rpc-client.js +17 -9
  5. package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  6. package/dist/browser/clients/rpc-client/schema.d.ts +1 -0
  7. package/dist/browser/community/schema.d.ts +13 -0
  8. package/dist/browser/detached-guard.d.ts +5 -0
  9. package/dist/browser/detached-guard.js +50 -0
  10. package/dist/browser/detached-guard.js.map +1 -0
  11. package/dist/browser/errors.d.ts +2 -0
  12. package/dist/browser/errors.js +2 -0
  13. package/dist/browser/errors.js.map +1 -1
  14. package/dist/browser/generated-version.d.ts +1 -1
  15. package/dist/browser/generated-version.js +1 -1
  16. package/dist/browser/helia/helia-for-pkc.js +6 -5
  17. package/dist/browser/helia/helia-for-pkc.js.map +1 -1
  18. package/dist/browser/index-with-compile-cache.d.ts +2 -0
  19. package/dist/browser/index.d.ts +4 -0
  20. package/dist/browser/pages/schema.d.ts +3 -0
  21. package/dist/browser/pkc-error.d.ts +1 -1
  22. package/dist/browser/publications/comment/comment.d.ts +1 -0
  23. package/dist/browser/publications/comment/comment.js +1 -0
  24. package/dist/browser/publications/comment/comment.js.map +1 -1
  25. package/dist/browser/publications/comment/schema.d.ts +4 -2
  26. package/dist/browser/publications/comment/schema.js +11 -1
  27. package/dist/browser/publications/comment/schema.js.map +1 -1
  28. package/dist/browser/publications/publication.js +26 -32
  29. package/dist/browser/publications/publication.js.map +1 -1
  30. package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +2 -0
  31. package/dist/browser/rpc/src/schema.d.ts +12 -0
  32. package/dist/browser/runtime/node/community/db-handler.js +5 -4
  33. package/dist/browser/runtime/node/community/db-handler.js.map +1 -1
  34. package/dist/browser/runtime/node/community/local-community/comment-updates.js +36 -0
  35. package/dist/browser/runtime/node/community/local-community/comment-updates.js.map +1 -1
  36. package/dist/browser/runtime/node/community/local-community/db-fault.d.ts +3 -0
  37. package/dist/browser/runtime/node/community/local-community/db-fault.js +13 -0
  38. package/dist/browser/runtime/node/community/local-community/db-fault.js.map +1 -0
  39. package/dist/browser/runtime/node/community/local-community/lifecycle.js +36 -2
  40. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  41. package/dist/browser/runtime/node/community/local-community.d.ts +4 -0
  42. package/dist/browser/runtime/node/community/local-community.js +7 -0
  43. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  44. package/dist/browser/runtime/node/test/helpers/hanging-runner.js +7 -3
  45. package/dist/browser/runtime/node/test/helpers/hanging-runner.js.map +1 -1
  46. package/dist/browser/runtime/node/test/helpers/run-hanging-node.js +6 -1
  47. package/dist/browser/runtime/node/test/helpers/run-hanging-node.js.map +1 -1
  48. package/dist/browser/schema/schema-util.d.ts +5 -0
  49. package/dist/browser/schema.d.ts +16 -0
  50. package/dist/browser/signer/pseudonymity-author-tag.d.ts +8 -0
  51. package/dist/browser/signer/pseudonymity-author-tag.js +39 -0
  52. package/dist/browser/signer/pseudonymity-author-tag.js.map +1 -0
  53. package/dist/browser/signer/signatures.js +16 -0
  54. package/dist/browser/signer/signatures.js.map +1 -1
  55. package/dist/browser/test/test-util.d.ts +5 -0
  56. package/dist/browser/version.js +1 -1
  57. package/dist/bundled/bundle-manifest.json +45 -40
  58. package/dist/bundled/challenges.js +1 -1
  59. package/dist/bundled/chunks/{helia-for-pkc-D3uvabO4.js → helia-for-pkc-CP5A7i4M.js} +5 -4
  60. package/dist/bundled/chunks/{local-community-SgssDrxj.js → local-community-0xsjgulY.js} +180 -9
  61. package/dist/bundled/chunks/{local-community-ChB5dbEH.js → local-community-CUDfHfH_.js} +1 -1
  62. package/dist/bundled/chunks/{node-Bx3xTqFv.js → node-Bv7hIiW_.js} +39 -38
  63. package/dist/bundled/chunks/{page-sort-scoring-CZmdHvps.js → page-sort-scoring-I02fuGkI.js} +1 -1
  64. package/dist/bundled/chunks/{rpc-local-community-D66Be62U.js → rpc-local-community-Bo4Z7ilA.js} +57 -13
  65. package/dist/bundled/chunks/{util-BuTE1Bd1.js → util-BZuCmqxu.js} +7 -3
  66. package/dist/bundled/chunks/{util-CodXreIl.js → util-xhgmI11L.js} +1 -1
  67. package/dist/bundled/chunks/{validate-package-factories-Bc4uoozL.js → validate-package-factories-BsSEIr__.js} +2 -2
  68. package/dist/bundled/index.js +1 -1
  69. package/dist/bundled/page-sorts.js +1 -1
  70. package/dist/bundled/rpc/src/index.js +4 -4
  71. package/dist/node/clients/base-client-manager.js +24 -11
  72. package/dist/node/clients/base-client-manager.js.map +1 -1
  73. package/dist/node/clients/rpc-client/pkc-rpc-client.js +17 -9
  74. package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  75. package/dist/node/clients/rpc-client/schema.d.ts +1 -0
  76. package/dist/node/community/schema.d.ts +13 -0
  77. package/dist/node/detached-guard.d.ts +5 -0
  78. package/dist/node/detached-guard.js +50 -0
  79. package/dist/node/detached-guard.js.map +1 -0
  80. package/dist/node/errors.d.ts +2 -0
  81. package/dist/node/errors.js +2 -0
  82. package/dist/node/errors.js.map +1 -1
  83. package/dist/node/generated-version.d.ts +1 -1
  84. package/dist/node/generated-version.js +1 -1
  85. package/dist/node/helia/helia-for-pkc.js +6 -5
  86. package/dist/node/helia/helia-for-pkc.js.map +1 -1
  87. package/dist/node/index-with-compile-cache.d.ts +2 -0
  88. package/dist/node/index.d.ts +4 -0
  89. package/dist/node/pages/schema.d.ts +3 -0
  90. package/dist/node/pkc-error.d.ts +1 -1
  91. package/dist/node/publications/comment/comment.d.ts +1 -0
  92. package/dist/node/publications/comment/comment.js +1 -0
  93. package/dist/node/publications/comment/comment.js.map +1 -1
  94. package/dist/node/publications/comment/schema.d.ts +4 -2
  95. package/dist/node/publications/comment/schema.js +11 -1
  96. package/dist/node/publications/comment/schema.js.map +1 -1
  97. package/dist/node/publications/publication.js +26 -32
  98. package/dist/node/publications/publication.js.map +1 -1
  99. package/dist/node/rpc/src/lib/pkc-js/index.d.ts +2 -0
  100. package/dist/node/rpc/src/schema.d.ts +12 -0
  101. package/dist/node/runtime/node/community/db-handler.js +5 -4
  102. package/dist/node/runtime/node/community/db-handler.js.map +1 -1
  103. package/dist/node/runtime/node/community/local-community/comment-updates.js +36 -0
  104. package/dist/node/runtime/node/community/local-community/comment-updates.js.map +1 -1
  105. package/dist/node/runtime/node/community/local-community/db-fault.d.ts +3 -0
  106. package/dist/node/runtime/node/community/local-community/db-fault.js +13 -0
  107. package/dist/node/runtime/node/community/local-community/db-fault.js.map +1 -0
  108. package/dist/node/runtime/node/community/local-community/lifecycle.js +36 -2
  109. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  110. package/dist/node/runtime/node/community/local-community.d.ts +4 -0
  111. package/dist/node/runtime/node/community/local-community.js +7 -0
  112. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  113. package/dist/node/runtime/node/test/helpers/hanging-runner.js +7 -3
  114. package/dist/node/runtime/node/test/helpers/hanging-runner.js.map +1 -1
  115. package/dist/node/runtime/node/test/helpers/run-hanging-node.js +6 -1
  116. package/dist/node/runtime/node/test/helpers/run-hanging-node.js.map +1 -1
  117. package/dist/node/schema/schema-util.d.ts +5 -0
  118. package/dist/node/schema.d.ts +16 -0
  119. package/dist/node/signer/pseudonymity-author-tag.d.ts +8 -0
  120. package/dist/node/signer/pseudonymity-author-tag.js +39 -0
  121. package/dist/node/signer/pseudonymity-author-tag.js.map +1 -0
  122. package/dist/node/signer/signatures.js +16 -0
  123. package/dist/node/signer/signatures.js.map +1 -1
  124. package/dist/node/test/test-util.d.ts +5 -0
  125. package/dist/node/version.js +1 -1
  126. package/package.json +3 -2
@@ -3,7 +3,7 @@
3
3
  "challenges.js": {
4
4
  "isEntry": true,
5
5
  "imports": [
6
- "chunks/validate-package-factories-Bc4uoozL.js"
6
+ "chunks/validate-package-factories-BsSEIr__.js"
7
7
  ],
8
8
  "dynamicImports": [],
9
9
  "inputs": [
@@ -16,7 +16,7 @@
16
16
  "node:module"
17
17
  ],
18
18
  "dynamicImports": [
19
- "chunks/node-Bx3xTqFv.js"
19
+ "chunks/node-Bv7hIiW_.js"
20
20
  ],
21
21
  "inputs": [
22
22
  "dist/node/runtime/node/compile-cache.js",
@@ -26,7 +26,7 @@
26
26
  "index.js": {
27
27
  "isEntry": true,
28
28
  "imports": [
29
- "chunks/node-Bx3xTqFv.js"
29
+ "chunks/node-Bv7hIiW_.js"
30
30
  ],
31
31
  "dynamicImports": [],
32
32
  "inputs": []
@@ -34,7 +34,7 @@
34
34
  "page-sorts.js": {
35
35
  "isEntry": true,
36
36
  "imports": [
37
- "chunks/validate-package-factories-Bc4uoozL.js"
37
+ "chunks/validate-package-factories-BsSEIr__.js"
38
38
  ],
39
39
  "dynamicImports": [],
40
40
  "inputs": [
@@ -44,10 +44,10 @@
44
44
  "rpc/src/index.js": {
45
45
  "isEntry": true,
46
46
  "imports": [
47
- "chunks/rpc-local-community-D66Be62U.js",
48
- "chunks/node-Bx3xTqFv.js",
49
- "chunks/util-BuTE1Bd1.js",
50
- "chunks/local-community-SgssDrxj.js",
47
+ "chunks/rpc-local-community-Bo4Z7ilA.js",
48
+ "chunks/node-Bv7hIiW_.js",
49
+ "chunks/util-BZuCmqxu.js",
50
+ "chunks/local-community-0xsjgulY.js",
51
51
  "node:url",
52
52
  "path",
53
53
  "assert",
@@ -77,12 +77,12 @@
77
77
  "\u0000rolldown/runtime.js"
78
78
  ]
79
79
  },
80
- "chunks/helia-for-pkc-D3uvabO4.js": {
80
+ "chunks/helia-for-pkc-CP5A7i4M.js": {
81
81
  "isEntry": false,
82
82
  "imports": [
83
83
  "chunks/chunk-2rV9d50f.js",
84
- "chunks/util-BuTE1Bd1.js",
85
- "chunks/util-CodXreIl.js",
84
+ "chunks/util-BZuCmqxu.js",
85
+ "chunks/util-xhgmI11L.js",
86
86
  "chunks/src-DKntVmyX.js",
87
87
  "chunks/src-Cpx2Sts8.js",
88
88
  "node:url",
@@ -204,21 +204,13 @@
204
204
  "dist/node/helia/helia-for-pkc.js"
205
205
  ]
206
206
  },
207
- "chunks/local-community-ChB5dbEH.js": {
208
- "isEntry": false,
209
- "imports": [
210
- "chunks/local-community-SgssDrxj.js"
211
- ],
212
- "dynamicImports": [],
213
- "inputs": []
214
- },
215
- "chunks/local-community-SgssDrxj.js": {
207
+ "chunks/local-community-0xsjgulY.js": {
216
208
  "isEntry": false,
217
209
  "imports": [
218
210
  "chunks/chunk-2rV9d50f.js",
219
- "chunks/rpc-local-community-D66Be62U.js",
220
- "chunks/util-BuTE1Bd1.js",
221
- "chunks/page-sort-scoring-CZmdHvps.js",
211
+ "chunks/rpc-local-community-Bo4Z7ilA.js",
212
+ "chunks/util-BZuCmqxu.js",
213
+ "chunks/page-sort-scoring-I02fuGkI.js",
222
214
  "chunks/src-BSYNGtIQ.js",
223
215
  "chunks/src-CAvdjq_i.js",
224
216
  "node:perf_hooks",
@@ -234,6 +226,7 @@
234
226
  "multiformats/cid",
235
227
  "@libp2p/peer-id",
236
228
  "typestub-ipfs-only-hash",
229
+ "uint8arrays",
237
230
  "node:v8",
238
231
  "multiformats/hashes/sha2",
239
232
  "@multiformats/murmur3"
@@ -249,6 +242,8 @@
249
242
  "node_modules/remeda/dist/uniqueBy.js",
250
243
  "dist/node/runtime/node/community/local-community/identity.js",
251
244
  "dist/node/runtime/node/community/local-community/anchor-publishing.js",
245
+ "node_modules/@noble/hashes/hkdf.js",
246
+ "dist/node/signer/pseudonymity-author-tag.js",
252
247
  "dist/node/runtime/node/community/comment-update-row.js",
253
248
  "node_modules/uuid/dist-node/rng.js",
254
249
  "node_modules/uuid/dist-node/stringify.js",
@@ -271,6 +266,7 @@
271
266
  "dist/node/runtime/node/community/local-community/registry-sync.js",
272
267
  "dist/node/runtime/node/community/local-community/ipns-publishing.js",
273
268
  "dist/node/runtime/node/event-loop-watch.js",
269
+ "dist/node/runtime/node/community/local-community/db-fault.js",
274
270
  "dist/node/runtime/node/community/local-community/reprovide-on-address-change.js",
275
271
  "dist/node/runtime/node/community/local-community/lifecycle.js",
276
272
  "dist/node/runtime/node/community/local-community/editing.js",
@@ -278,13 +274,21 @@
278
274
  "dist/node/runtime/node/community/local-community.js"
279
275
  ]
280
276
  },
281
- "chunks/node-Bx3xTqFv.js": {
277
+ "chunks/local-community-CUDfHfH_.js": {
278
+ "isEntry": false,
279
+ "imports": [
280
+ "chunks/local-community-0xsjgulY.js"
281
+ ],
282
+ "dynamicImports": [],
283
+ "inputs": []
284
+ },
285
+ "chunks/node-Bv7hIiW_.js": {
282
286
  "isEntry": false,
283
287
  "imports": [
284
288
  "chunks/chunk-2rV9d50f.js",
285
- "chunks/rpc-local-community-D66Be62U.js",
286
- "chunks/util-BuTE1Bd1.js",
287
- "chunks/util-CodXreIl.js",
289
+ "chunks/rpc-local-community-Bo4Z7ilA.js",
290
+ "chunks/util-BZuCmqxu.js",
291
+ "chunks/util-xhgmI11L.js",
288
292
  "path",
289
293
  "assert",
290
294
  "fs",
@@ -295,8 +299,8 @@
295
299
  "rpc-websockets"
296
300
  ],
297
301
  "dynamicImports": [
298
- "chunks/helia-for-pkc-D3uvabO4.js",
299
- "chunks/local-community-SgssDrxj.js"
302
+ "chunks/helia-for-pkc-CP5A7i4M.js",
303
+ "chunks/local-community-0xsjgulY.js"
300
304
  ],
301
305
  "inputs": [
302
306
  "dist/node/zod-error-map.js",
@@ -456,22 +460,22 @@
456
460
  "dist/node/index.js"
457
461
  ]
458
462
  },
459
- "chunks/page-sort-scoring-CZmdHvps.js": {
463
+ "chunks/page-sort-scoring-I02fuGkI.js": {
460
464
  "isEntry": false,
461
465
  "imports": [
462
- "chunks/util-BuTE1Bd1.js"
466
+ "chunks/util-BZuCmqxu.js"
463
467
  ],
464
468
  "dynamicImports": [],
465
469
  "inputs": [
466
470
  "dist/node/pages/page-sort-scoring.js"
467
471
  ]
468
472
  },
469
- "chunks/rpc-local-community-D66Be62U.js": {
473
+ "chunks/rpc-local-community-Bo4Z7ilA.js": {
470
474
  "isEntry": false,
471
475
  "imports": [
472
476
  "chunks/chunk-2rV9d50f.js",
473
- "chunks/util-BuTE1Bd1.js",
474
- "chunks/page-sort-scoring-CZmdHvps.js",
477
+ "chunks/util-BZuCmqxu.js",
478
+ "chunks/page-sort-scoring-I02fuGkI.js",
475
479
  "chunks/src-CYIMjhjK.js",
476
480
  "node:crypto",
477
481
  "node:url",
@@ -1082,6 +1086,7 @@
1082
1086
  "dist/node/signer/encryption.js",
1083
1087
  "dist/node/signer/ipns-record.js",
1084
1088
  "dist/node/signer/index.js",
1089
+ "dist/node/detached-guard.js",
1085
1090
  "node_modules/tiny-typed-emitter/lib/index.js",
1086
1091
  "node_modules/@noble/hashes/hmac.js",
1087
1092
  "node_modules/@noble/curves/abstract/der.js",
@@ -1592,7 +1597,7 @@
1592
1597
  "node_modules/kubo-rpc-client/dist/src/index.js"
1593
1598
  ]
1594
1599
  },
1595
- "chunks/util-BuTE1Bd1.js": {
1600
+ "chunks/util-BZuCmqxu.js": {
1596
1601
  "isEntry": false,
1597
1602
  "imports": [
1598
1603
  "chunks/chunk-2rV9d50f.js",
@@ -1687,10 +1692,10 @@
1687
1692
  "dist/node/util.js"
1688
1693
  ]
1689
1694
  },
1690
- "chunks/util-CodXreIl.js": {
1695
+ "chunks/util-xhgmI11L.js": {
1691
1696
  "isEntry": false,
1692
1697
  "imports": [
1693
- "chunks/util-BuTE1Bd1.js",
1698
+ "chunks/util-BZuCmqxu.js",
1694
1699
  "ipns/selector",
1695
1700
  "ipns/validator",
1696
1701
  "ipns",
@@ -1702,11 +1707,11 @@
1702
1707
  "dist/node/helia/util.js"
1703
1708
  ]
1704
1709
  },
1705
- "chunks/validate-package-factories-Bc4uoozL.js": {
1710
+ "chunks/validate-package-factories-BsSEIr__.js": {
1706
1711
  "isEntry": false,
1707
1712
  "imports": [
1708
- "chunks/util-BuTE1Bd1.js",
1709
- "chunks/page-sort-scoring-CZmdHvps.js"
1713
+ "chunks/util-BZuCmqxu.js",
1714
+ "chunks/page-sort-scoring-I02fuGkI.js"
1710
1715
  ],
1711
1716
  "dynamicImports": [],
1712
1717
  "inputs": [
@@ -1,2 +1,2 @@
1
- import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-Bc4uoozL.js";
1
+ import { t as validateChallengeFileFactory } from "./chunks/validate-package-factories-BsSEIr__.js";
2
2
  export { validateChallengeFileFactory };
@@ -1,6 +1,6 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { C as hideClassPrivateProps, T as ipnsNameToIpnsOverPubsubTopic, Vr as logger_default, n as binaryKeyToPubsubTopic, zr as PKCError } from "./util-BuTE1Bd1.js";
3
- import { a as directFetchIpnsRecordFromProviders, c as readFreshCachedIpnsRecordFromPubsubLocalStore, i as connectToPubsubPeers, l as selectBitswapSessionSeedPeers, n as REACHABILITY_DOCS_URL, o as fetchBlockWithStalledSessionFailover, r as cacheIpnsRecordInPubsubLocalStore, s as getHeliaDebugContext, u as summarizeProviderReachability } from "./util-CodXreIl.js";
2
+ import { C as hideClassPrivateProps, T as ipnsNameToIpnsOverPubsubTopic, Vr as logger_default, n as binaryKeyToPubsubTopic, zr as PKCError } from "./util-BZuCmqxu.js";
3
+ import { a as directFetchIpnsRecordFromProviders, c as readFreshCachedIpnsRecordFromPubsubLocalStore, i as connectToPubsubPeers, l as selectBitswapSessionSeedPeers, n as REACHABILITY_DOCS_URL, o as fetchBlockWithStalledSessionFailover, r as cacheIpnsRecordInPubsubLocalStore, s as getHeliaDebugContext, u as summarizeProviderReachability } from "./util-xhgmI11L.js";
4
4
  import { t as map } from "./src-Cpx2Sts8.js";
5
5
  import { t as parallelBatch } from "./src-DKntVmyX.js";
6
6
  import { fileURLToPath } from "node:url";
@@ -6496,6 +6496,7 @@ const pkcDialAddressSorter = (a, b) => loopbackAddressLast(a.multiaddr, b.multia
6496
6496
  const log = logger_default("pkc-js:libp2p-js");
6497
6497
  const libp2pJsClients = {};
6498
6498
  const creatingLibp2pJsClients = {};
6499
+ const asUnixfsRoot = (rootCidString) => rootCidString;
6499
6500
  const DELEGATED_ROUTING_CONCURRENT_REQUESTS = 32;
6500
6501
  const DELEGATED_ROUTING_CACHE_NAME = "delegated-routing-v1-cache";
6501
6502
  function deleteLeftoverDelegatedRoutingCache() {
@@ -7011,7 +7012,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
7011
7012
  const session = createSeededBitswapSession(rootCid, bitswapSessionSeedScopeIpnsPubsubTopic);
7012
7013
  let yieldedAnyBytes = false;
7013
7014
  try {
7014
- const catIterable = unixfs({ blockstore: session }).cat(rootCid, {
7015
+ const catIterable = unixfs({ blockstore: session }).cat(asUnixfsRoot(rootCidString), {
7015
7016
  ...unixfsCatOptions,
7016
7017
  path: ipfsSubPath,
7017
7018
  signal: controller.signal
@@ -7105,7 +7106,7 @@ async function createLibp2pJsClientOrUseExistingOne(pkcOptions) {
7105
7106
  for (let attempt = 0;; attempt++) {
7106
7107
  const session = createSeededBitswapSession(rootCid, options?.bitswapSessionSeedScopeIpnsPubsubTopic);
7107
7108
  try {
7108
- return `/ipfs/${(await unixfs({ blockstore: session }).stat(rootCid, {
7109
+ return `/ipfs/${(await unixfs({ blockstore: session }).stat(asUnixfsRoot(rootCidString), {
7109
7110
  path: subPathSegments.length > 0 ? subPathSegments.join("/") : void 0,
7110
7111
  signal: controller.signal
7111
7112
  })).cid.toString()}`;
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM } from "./chunk-2rV9d50f.js";
2
- import { $n as CommentEditsTableRowSchema, Ar as t$4, At as ChallengeAnswerMessageSchema, B as pubsubTopicToDhtKey, Br as messages, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Cr as e$1, Ct as trackUpdatingCommunity, Dr as t$3, Dt as require_sha256, En as VotePubsubReservedFields, Er as r$1, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeBlocksFromKuboNode, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, J as removeNullUndefinedValues, Jt as version_default, K as removeMfsFilesSafely, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, Nr as require_retry, On as VoteTablesRowSchema, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Sr as t$6, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Vn as CommentUpdateTableRowSchema, Vr as logger_default, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Zn as CommentEditReservedFields, _ as genToArray, b as getIpnsRecordInLocalKuboNode, br as n$2, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as withSortedKeysDeep, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, o as calculateUnixFsDagSizeCidV0, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, ri as ZodError, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$3, wr as e, wt as untrackStartedCommunity, xr as t$5, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$7, zn as CommentUpdateSchema, zr as PKCError, zt as DecryptedChallengeRequestPublicationSchema } from "./util-BuTE1Bd1.js";
3
- import { $ as coerceSchemaRowJson, $n as getAuthorNameFromWire, $r as n$5, Ar as getDefaultCommunityDbConfig, Bn as verifyCommentPubsubMessage, Br as resolveDbPostsCidRefs, Cn as signChallengeVerification, Dn as signCommentUpdate, Dr as deriveDbReplies, Er as deriveDbPosts, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Fn as verifyChallengeRequest, Gn as verifyVote, Gr as markCommunityDbAsBeingWritten, H as listSubscribedPubsubTopicsShared, Hn as verifyCommunity, K as pLimit, Kr as findCommunitiesEntry, Ln as verifyCommentEdit, Lr as moveCommunityDbToDeletedDirectory, Mr as getThumbnailPropsOfLink, N as MAX_PAGE_SIZE_BYTES, Nn as verifyChallengeAnswer, Nr as importSignerIntoKuboNode, On as signCommentUpdateForChallengeVerification, Q as coerceSchemaRowBoolean, Qr as t$8, Rn as verifyCommentIpfs, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sr as calculateInlineRepliesBudget, Tn as signCommentEdit, Tr as deriveCommentIpfsFromCommentTableRow, Un as verifyCommunityEdit, Ur as unregisterLocalCommunity, V as SHARED_KUBO_READ_TIMEOUT_MS, Vn as verifyCommentUpdate, Wr as getCommunitiesRegistry, Xn as buildRuntimeAuthor, Xr as t$11, Yr as t$10, Zn as cleanWireAuthor, Zr as r$2, _ as createAuthorIdentityMatcher, _n as encryptEd25519AesGcmPublicKeyBuffer, _r as getPKCAddressFromPublicKeySync, a as generatePagesReportingFailedSorts, ar as crosspostChainDepthUpTo, b as KeyvBetterSqlite3, br as backupCommunityDb, c as resolvePageSortsOrThrow, ci as require_lodash_merge, d as getChallengeVerification, dn as SignerWithPublicKeyAddress, ei as n$4, et as collectSchemaRowCoercions, f as getCommunityChallengeFromCommunityChallengeSettings, fr as decode, g as authorNameResolveFailureReason, gr as getPKCAddressFromPublicKey, h as authorIdentityMatcherForRequest, hn as decryptEd25519AesGcmPublicKeyBuffer, hr as getIpfsKeyFromPrivateKey, ht as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, i as derivePublicPageSorts, j as iterateOverPageCidsToFindAllCids, kn as signCommunity, kr as forgetCommunityThatFailedToBeDeleted, kt as parseJsonWithPKCErrorIfFails, ln as verifyAuthorWalletEntry, lr as getCommunityNameFromWire, m as pkcJsChallenges, ni as t$9, o as loadPageSortsForStartedCommunity, or as effectiveMaxCrosspostDepth, p as loadChallengeFileFromCommunityChallengeSettings, pr as encode, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, qn as forbiddenKeysOf, r as computePageSortsFingerprint, s as lookupPageSortFactories, si as STORAGE_KEYS, t as RpcLocalCommunity, tr as stringify, tt as createSchemaRowParser, u as deriveCommunityChallengesOrThrow, ur as getCommunityPublicKeyFromWire, v as TrackedInstanceRegistry, vn as _validateSignatureOfPKCRecord, vr as getPublicKeyFromPrivateKey, w as TIMEFRAMES_TO_SECONDS, wn as signComment, wr as deleteOldCommunityInWindows, xn as signChallengeMessage, xr as calculateExpectedSignatureSize, y as LRUCache, yn as cleanUpBeforePublishing, yr as BackupAbortError, zn as verifyCommentModeration, zr as removeFileRetryingWhileBusy } from "./rpc-local-community-D66Be62U.js";
4
- import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-CZmdHvps.js";
2
+ import { $n as CommentEditsTableRowSchema, Ar as t$4, At as ChallengeAnswerMessageSchema, B as pubsubTopicToDhtKey, Br as messages, Bt as DecryptedChallengeRequestSchema, C as hideClassPrivateProps, Cr as e$1, Ct as trackUpdatingCommunity, Dr as t$3, Dt as require_sha256, En as VotePubsubReservedFields, Er as r$1, Et as untrackUpdatingCommunity, F as isLinkOfVideo, G as removeBlocksFromKuboNode, Hn as CommentsTableRowSchema, I as isLinkValid, It as ChallengeVerificationMessageSchema, J as removeNullUndefinedValues, Jt as version_default, K as removeMfsFilesSafely, M as isLinkOfAudio, Mn as CommentPubsubMessageReservedFields, Mt as ChallengeMessageSchema, N as isLinkOfImage, Nr as require_retry, On as VoteTablesRowSchema, P as isLinkOfMedia, Pt as ChallengeRequestMessageSchema, Q as retryKuboBlockPutPinAndProvidePubsubTopic, Sr as t$6, T as ipnsNameToIpnsOverPubsubTopic, Tn as VotePubsubMessagePublicationSchema, Vn as CommentUpdateTableRowSchema, Vr as logger_default, Xn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Xt as CommunityEditPublicationPubsubReservedFields, Yn as CommentEditPubsubMessagePublicationSchema, Zn as CommentEditReservedFields, _ as genToArray, b as getIpnsRecordInLocalKuboNode, br as n$2, bt as syncCommunityRegistryEntry, c as contentContainsMarkdownImages, ct as withSortedKeys, dt as findStartedCommunity, et as retryKuboIpfsAddAndProvide, f as derivePublicationFromChallengeRequest, g as findMalformedUnicodeString, gr as isStringDomain, i as calculateStringSizeSameAsIpfsAddCidV0, in as CommentModerationsTableRowSchema, ir as AuthorReservedFields, it as statMfsPathSafely, j as isLinkOfAnimatedImage, jn as CommentIpfsSchema, jr as t$2, kt as pTimeout, l as contentContainsMarkdownVideos, lt as withSortedKeysDeep, mn as CommunitySignedPropertyNames, nn as CommentModerationReservedFields, o as calculateUnixFsDagSizeCidV0, ot as timestamp, p as doesDomainAddressHaveCapitalLetter, pn as CommunityIpfsSchema, pt as findUpdatingCommunity, r as calculateIpfsCidV0, ri as ZodError, rt as sleepUntilTimeoutOrAbort, s as contentContainsMarkdownAudio, tn as CommentModerationPubsubMessagePublicationSchema, ut as findCommunityInRegistry, v as getEquivalentCommunityAddresses, vr as n$3, wr as e, wt as untrackStartedCommunity, xr as t$5, xt as trackStartedCommunity, y as getErrorCodeFromMessage, yr as t$7, zn as CommentUpdateSchema, zr as PKCError, zt as DecryptedChallengeRequestPublicationSchema } from "./util-BZuCmqxu.js";
3
+ import { $ as coerceSchemaRowJson, $n as cleanWireAuthor, $r as getCommunitiesRegistry, An as signCommentUpdateForChallengeVerification, Ar as calculateExpectedSignatureSize, Bn as verifyCommentIpfs, Cn as signChallengeMessage, Cr as sha256$6, Dn as signCommentEdit, Dr as clean, En as signComment, Er as anumber, Et as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, Fn as verifyChallengeAnswer, Fr as deriveDbPosts, Gn as verifyCommunityEdit, H as listSubscribedPubsubTopicsShared, Hn as verifyCommentPubsubMessage, Hr as importSignerIntoKuboNode, Ir as deriveDbReplies, Jr as removeFileRetryingWhileBusy, K as pLimit, Kr as moveCommunityDbToDeletedDirectory, Ln as verifyChallengeRequest, N as MAX_PAGE_SIZE_BYTES, Nr as deleteOldCommunityInWindows, Or as BackupAbortError, Pr as deriveCommentIpfsFromCommentTableRow, Q as coerceSchemaRowBoolean, Qn as buildRuntimeAuthor, Qr as unregisterLocalCommunity, Rr as forgetCommunityThatFailedToBeDeleted, S as MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS, Sr as x25519, Tn as signChallengeVerification, Tr as ahash, Un as verifyCommentUpdate, V as SHARED_KUBO_READ_TIMEOUT_MS, Vn as verifyCommentModeration, Vr as getThumbnailPropsOfLink, Wn as verifyCommunity, Yn as forbiddenKeysOf, Yr as resolveDbPostsCidRefs, _ as createAuthorIdentityMatcher, _i as require_lodash_merge, _n as decryptEd25519AesGcmPublicKeyBuffer, _r as getIpfsKeyFromPrivateKey, a as generatePagesReportingFailedSorts, ai as t$11, b as KeyvBetterSqlite3, bn as _validateSignatureOfPKCRecord, br as getPublicKeyFromPrivateKey, c as resolvePageSortsOrThrow, ci as n$5, cr as effectiveMaxCrosspostDepth, d as getChallengeVerification, di as t$9, dr as getCommunityNameFromWire, ei as markCommunityDbAsBeingWritten, et as collectSchemaRowCoercions, f as getCommunityChallengeFromCommunityChallengeSettings, fr as getCommunityPublicKeyFromWire, g as authorNameResolveFailureReason, gi as STORAGE_KEYS, h as authorIdentityMatcherForRequest, hr as encode, ht as parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails, i as derivePublicPageSorts, ii as t$10, j as iterateOverPageCidsToFindAllCids, jn as signCommunity, jr as calculateInlineRepliesBudget, kn as signCommentUpdate, kr as backupCommunityDb, kt as parseJsonWithPKCErrorIfFails, li as n$4, ln as verifyAuthorWalletEntry, m as pkcJsChallenges, mr as decode, o as loadPageSortsForStartedCommunity, oi as r$2, p as loadChallengeFileFromCommunityChallengeSettings, pn as SignerWithPublicKeyAddress, pt as parseCommunityEditOptionsSchemaWithPKCErrorIfItFails, qn as verifyVote, r as computePageSortsFingerprint, rr as stringify, s as lookupPageSortFactories, si as t$8, sr as crosspostChainDepthUpTo, t as RpcLocalCommunity, ti as findCommunitiesEntry, tr as getAuthorNameFromWire, tt as createSchemaRowParser, u as deriveCommunityChallengesOrThrow, un as hmac, v as TrackedInstanceRegistry, vr as getPKCAddressFromPublicKey, w as TIMEFRAMES_TO_SECONDS, wr as abytes, xn as cleanUpBeforePublishing, xr as ed25519, y as LRUCache, yn as encryptEd25519AesGcmPublicKeyBuffer, yr as getPKCAddressFromPublicKeySync, zn as verifyCommentEdit, zr as getDefaultCommunityDbConfig } from "./rpc-local-community-Bo4Z7ilA.js";
4
+ import { a as scorePageCommentsWithFile, i as partitionPageCommentsForSort, n as filterRepliesForPageSort, o as stripRepliesFromPageComment, r as orderPageCommentsByScore, t as createDescendantsLookup } from "./page-sort-scoring-I02fuGkI.js";
5
5
  import { c as prepare, n as decode$1, r as encode$1 } from "./src-BSYNGtIQ.js";
6
6
  import { t as UnixFS } from "./src-CAvdjq_i.js";
7
7
  import { monitorEventLoopDelay } from "node:perf_hooks";
@@ -17,6 +17,7 @@ import Database from "better-sqlite3";
17
17
  import { CID } from "multiformats/cid";
18
18
  import { peerIdFromString } from "@libp2p/peer-id";
19
19
  import { of } from "typestub-ipfs-only-hash";
20
+ import { fromString, toString } from "uint8arrays";
20
21
  import v8 from "node:v8";
21
22
  import { sha256 } from "multiformats/hashes/sha2";
22
23
  import { murmur3128 } from "@multiformats/murmur3";
@@ -188,6 +189,118 @@ async function reprovideAnchorRecordIfDue(community) {
188
189
  await reprovideAnchorRecordIfNeeded(community);
189
190
  }
190
191
  //#endregion
192
+ //#region node_modules/@noble/hashes/hkdf.js
193
+ /**
194
+ * HKDF (RFC 5869): extract + expand in one step.
195
+ * See {@link https://soatok.blog/2021/11/17/understanding-hkdf/}.
196
+ * @module
197
+ */
198
+ const HKDF_COUNTER = /* @__PURE__ */ Uint8Array.of(0);
199
+ const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of();
200
+ /**
201
+ * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM`
202
+ * @param hash - hash function that would be used (e.g. sha256)
203
+ * @param prk - a pseudorandom key of at least HashLen octets
204
+ * (usually, the output from the extract step)
205
+ * @param info - optional context and application specific information (can be a zero-length string)
206
+ * @param length - length of output keying material in bytes.
207
+ * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` returns an empty OKM.
208
+ * @param _recycled - Internal destroyed extract hashes owned by the combined `hkdf()` call.
209
+ * @returns Output keying material with the requested length.
210
+ * @throws If the requested output length exceeds the HKDF limit
211
+ * for the selected hash. {@link Error}
212
+ * @example
213
+ * Run the HKDF expand step.
214
+ * ```ts
215
+ * import { expand } from '@noble/hashes/hkdf.js';
216
+ * import { sha256 } from '@noble/hashes/sha2.js';
217
+ * expand(sha256, new Uint8Array(32), new Uint8Array([1, 2, 3]), 16);
218
+ * ```
219
+ */
220
+ function expand(hash, prk, info, length = 32, _recycled) {
221
+ ahash(hash);
222
+ anumber(length, "length");
223
+ abytes(prk, void 0, "prk");
224
+ const olen = hash.outputLen;
225
+ if (prk.length < olen) throw new Error("\"prk\" must be at least HashLen octets");
226
+ if (length > 255 * olen) throw new Error("Length must be <= 255*HashLen");
227
+ const blocks = Math.ceil(length / olen);
228
+ if (info === void 0) info = EMPTY_BUFFER;
229
+ else abytes(info, void 0, "info");
230
+ if (!blocks) {
231
+ if (_recycled) clean(prk);
232
+ return new Uint8Array();
233
+ }
234
+ const okm = _recycled && blocks === 1 ? prk : new Uint8Array(blocks * olen);
235
+ const { iHash, oHash } = hmac.create(hash, prk);
236
+ const T = _recycled ? prk : new Uint8Array(olen);
237
+ const worker = blocks > 1 ? _recycled?.iHash || hash.create() : void 0;
238
+ for (let counter = 0; counter < blocks - 1; counter++) {
239
+ HKDF_COUNTER[0] = counter + 1;
240
+ const iWork = iHash._cloneInto(worker);
241
+ if (counter) iWork.update(T);
242
+ iWork.update(info).update(HKDF_COUNTER).digestInto(T);
243
+ oHash._cloneInto(worker).update(T).digestInto(T);
244
+ okm.set(T, olen * counter);
245
+ }
246
+ HKDF_COUNTER[0] = blocks;
247
+ if (blocks > 1) iHash.update(T);
248
+ iHash.update(info).update(HKDF_COUNTER).digestInto(T);
249
+ oHash.update(T).digestInto(T);
250
+ okm.set(T, olen * (blocks - 1));
251
+ iHash.destroy();
252
+ oHash.destroy();
253
+ worker?.destroy();
254
+ if (T !== okm) clean(T);
255
+ clean(HKDF_COUNTER);
256
+ if (length === okm.length) return okm;
257
+ const res = okm.slice(0, length);
258
+ clean(okm);
259
+ return res;
260
+ }
261
+ /**
262
+ * HKDF (RFC 5869): derive keys from an initial input.
263
+ * Combines hkdf_extract + hkdf_expand in one step
264
+ * @param hash - hash function that would be used (e.g. sha256)
265
+ * @param ikm - input keying material, the initial key
266
+ * @param salt - optional salt value (a non-secret random value)
267
+ * @param info - optional context and application specific information bytes
268
+ * @param length - length of output keying material in bytes.
269
+ * RFC 5869 §2.3 allows `0..255*HashLen`, so `0` returns an empty OKM.
270
+ * @returns Output keying material derived from the input key.
271
+ * @throws If the requested output length exceeds the HKDF limit
272
+ * for the selected hash. {@link Error}
273
+ * @example
274
+ * HKDF (RFC 5869): derive keys from an initial input.
275
+ * ```ts
276
+ * import { hkdf } from '@noble/hashes/hkdf.js';
277
+ * import { sha256 } from '@noble/hashes/sha2.js';
278
+ * import { randomBytes, utf8ToBytes } from '@noble/hashes/utils.js';
279
+ * const inputKey = randomBytes(32);
280
+ * const salt = randomBytes(32);
281
+ * const info = utf8ToBytes('application-key');
282
+ * const okm = hkdf(sha256, inputKey, salt, info, 32);
283
+ * ```
284
+ */
285
+ const hkdf = (hash, ikm, salt, info, length) => {
286
+ ahash(hash);
287
+ if (salt === void 0) salt = new Uint8Array(hash.outputLen);
288
+ const HMAC = hmac.create(hash, salt).update(ikm);
289
+ return expand(hash, HMAC.digest(), info, length, HMAC);
290
+ };
291
+ //#endregion
292
+ //#region dist/node/signer/pseudonymity-author-tag.js
293
+ const HKDF_INFO = fromString("pkc-pseudonymity-author-tag-v1", "utf8");
294
+ const TAG_BYTE_LENGTH = 16;
295
+ function derivePseudonymityTagSharedKey(opts) {
296
+ const communityPrivateKey = fromString(opts.communityPrivateKeyBase64, "base64");
297
+ const authorPublicKey = fromString(opts.authorPublicKeyBase64, "base64");
298
+ return hkdf(sha256$6, x25519.getSharedSecret(ed25519.utils.toMontgomerySecret(communityPrivateKey), ed25519.utils.toMontgomery(authorPublicKey)), void 0, HKDF_INFO, 32);
299
+ }
300
+ function computePseudonymityAuthorTag(opts) {
301
+ return toString(hmac(sha256$6, opts.sharedKey, fromString(opts.commentCid, "utf8")).subarray(0, TAG_BYTE_LENGTH), "base64");
302
+ }
303
+ //#endregion
191
304
  //#region dist/node/runtime/node/community/comment-update-row.js
192
305
  const commentUpdateSchemaKeys = new Set(Object.keys(CommentUpdateSchema.shape));
193
306
  function commentUpdateExtraKeys(update) {
@@ -1717,7 +1830,8 @@ var DbHandler = class {
1717
1830
  author TEXT NULLABLE, -- JSON
1718
1831
  replies TEXT NULLABLE, -- JSON: CID refs per sort (DbRepliesSchema)
1719
1832
  lastChildCid TEXT NULLABLE,
1720
- lastReplyTimestamp INTEGER NULLABLE,
1833
+ lastReplyTimestamp INTEGER NULLABLE,
1834
+ pseudonymityAuthorTag TEXT NULLABLE, -- own-post recognition tag on aliased comments (issue #381); a signed CommentUpdate field
1721
1835
  postUpdatesBucket INTEGER NULLABLE,
1722
1836
  publishedToPostUpdatesMFS INTEGER NOT NULL, -- BOOLEAN (0/1)
1723
1837
  insertedAt INTEGER NOT NULL,
@@ -2323,8 +2437,8 @@ var DbHandler = class {
2323
2437
  const columnNames = this._getColumnNames(TABLES.COMMENT_UPDATES);
2324
2438
  const stmt = this._prepareCached(`
2325
2439
  INSERT INTO ${TABLES.COMMENT_UPDATES}
2326
- (cid, edit, upvoteCount, downvoteCount, replyCount, childCount, number, postNumber, flairs, spoiler, nsfw, pinned, locked, archived, removed, approved, reason, authorBanExpiresAt, updatedAt, protocolVersion, signature, author, replies, lastChildCid, lastReplyTimestamp, postUpdatesBucket, publishedToPostUpdatesMFS, insertedAt, extraProps)
2327
- VALUES (@cid, @edit, @upvoteCount, @downvoteCount, @replyCount, @childCount, @number, @postNumber, @flairs, @spoiler, @nsfw, @pinned, @locked, @archived, @removed, @approved, @reason, @authorBanExpiresAt, @updatedAt, @protocolVersion, @signature, @author, @replies, @lastChildCid, @lastReplyTimestamp, @postUpdatesBucket, @publishedToPostUpdatesMFS, @insertedAt, @extraProps)
2440
+ (cid, edit, upvoteCount, downvoteCount, replyCount, childCount, number, postNumber, flairs, spoiler, nsfw, pinned, locked, archived, removed, approved, reason, authorBanExpiresAt, updatedAt, protocolVersion, signature, author, replies, lastChildCid, lastReplyTimestamp, pseudonymityAuthorTag, postUpdatesBucket, publishedToPostUpdatesMFS, insertedAt, extraProps)
2441
+ VALUES (@cid, @edit, @upvoteCount, @downvoteCount, @replyCount, @childCount, @number, @postNumber, @flairs, @spoiler, @nsfw, @pinned, @locked, @archived, @removed, @approved, @reason, @authorBanExpiresAt, @updatedAt, @protocolVersion, @signature, @author, @replies, @lastChildCid, @lastReplyTimestamp, @pseudonymityAuthorTag, @postUpdatesBucket, @publishedToPostUpdatesMFS, @insertedAt, @extraProps)
2328
2442
  ON CONFLICT(cid) DO UPDATE SET
2329
2443
  edit = excluded.edit, upvoteCount = excluded.upvoteCount, downvoteCount = excluded.downvoteCount, replyCount = excluded.replyCount, childCount = excluded.childCount,
2330
2444
  number = COALESCE(excluded.number, ${TABLES.COMMENT_UPDATES}.number),
@@ -2332,7 +2446,7 @@ var DbHandler = class {
2332
2446
  flairs = excluded.flairs, spoiler = excluded.spoiler, nsfw = excluded.nsfw, pinned = excluded.pinned, locked = excluded.locked, archived = excluded.archived,
2333
2447
  removed = excluded.removed, approved = excluded.approved, reason = excluded.reason, authorBanExpiresAt = excluded.authorBanExpiresAt, updatedAt = excluded.updatedAt, protocolVersion = excluded.protocolVersion,
2334
2448
  signature = excluded.signature, author = excluded.author, replies = excluded.replies, lastChildCid = excluded.lastChildCid,
2335
- lastReplyTimestamp = excluded.lastReplyTimestamp, postUpdatesBucket = excluded.postUpdatesBucket,
2449
+ lastReplyTimestamp = excluded.lastReplyTimestamp, pseudonymityAuthorTag = excluded.pseudonymityAuthorTag, postUpdatesBucket = excluded.postUpdatesBucket,
2336
2450
  publishedToPostUpdatesMFS = excluded.publishedToPostUpdatesMFS,
2337
2451
  insertedAt = excluded.insertedAt,
2338
2452
  extraProps = excluded.extraProps
@@ -4788,6 +4902,32 @@ function calculateLocalMfsPathForCommentUpdate(community, postDbComment, timesta
4788
4902
  "update"
4789
4903
  ].join("/");
4790
4904
  }
4905
+ function computePseudonymityAuthorTagForComment(community, commentCid, log) {
4906
+ const aliasRow = community._dbHandler.queryPseudonymityAliasByCommentCid(commentCid);
4907
+ if (!aliasRow) return void 0;
4908
+ const authorPublicKeyBase64 = aliasRow.originalAuthorPublicKey;
4909
+ const signerPublicKey = community.signer.publicKey;
4910
+ try {
4911
+ let cached = community._pseudonymityTagKeyCache.get(authorPublicKeyBase64);
4912
+ if (!cached || cached.signerPublicKey !== signerPublicKey) {
4913
+ cached = {
4914
+ signerPublicKey,
4915
+ sharedKey: derivePseudonymityTagSharedKey({
4916
+ communityPrivateKeyBase64: community.signer.privateKey,
4917
+ authorPublicKeyBase64
4918
+ })
4919
+ };
4920
+ community._pseudonymityTagKeyCache.set(authorPublicKeyBase64, cached);
4921
+ }
4922
+ return computePseudonymityAuthorTag({
4923
+ sharedKey: cached.sharedKey,
4924
+ commentCid
4925
+ });
4926
+ } catch (e) {
4927
+ log.error(`Failed to derive pseudonymityAuthorTag for comment (${commentCid}) with author public key (${authorPublicKeyBase64}); publishing the CommentUpdate without a tag`, e);
4928
+ return;
4929
+ }
4930
+ }
4791
4931
  async function calculateNewCommentUpdate(opts) {
4792
4932
  const { community, comment, batchStartTimestamp, precomputed } = opts;
4793
4933
  const log = logger_default("pkc-js:local-community:_calculateNewCommentUpdate");
@@ -4805,6 +4945,8 @@ async function calculateNewCommentUpdate(opts) {
4805
4945
  updatedAt: newUpdatedAt,
4806
4946
  protocolVersion: version_default.PROTOCOL_VERSION
4807
4947
  }) };
4948
+ const pseudonymityAuthorTag = computePseudonymityAuthorTagForComment(community, comment.cid, log);
4949
+ if (pseudonymityAuthorTag) commentUpdatePriorToSigning.pseudonymityAuthorTag = pseudonymityAuthorTag;
4808
4950
  const inlineRepliesBudget = calculateInlineRepliesBudget({
4809
4951
  comment,
4810
4952
  commentUpdateWithoutReplies: commentUpdatePriorToSigning
@@ -7212,6 +7354,16 @@ function holdEventLoopWatch() {
7212
7354
  };
7213
7355
  }
7214
7356
  //#endregion
7357
+ //#region dist/node/runtime/node/community/local-community/db-fault.js
7358
+ function classifyDbFault(error) {
7359
+ const code = error?.code;
7360
+ const message = error?.message;
7361
+ const name = typeof code === "string" ? code : typeof message === "string" ? message.match(/^SQLITE_[A-Z_]+/)?.[0] ?? "" : "";
7362
+ if (name.startsWith("SQLITE_BUSY") || name.startsWith("SQLITE_LOCKED")) return "busy";
7363
+ if (name.startsWith("SQLITE_IOERR")) return "maybe-transient";
7364
+ return "final";
7365
+ }
7366
+ //#endregion
7215
7367
  //#region dist/node/runtime/node/community/local-community/reprovide-on-address-change.js
7216
7368
  const ADDRESS_REPROVIDE_POLL_INTERVAL_MS = 60 * 1e3;
7217
7369
  function normalizeSelfAddrsForProvider(addrs, peerId) {
@@ -7328,14 +7480,28 @@ async function reprovideOnAddressChangeIfDue(community) {
7328
7480
  //#endregion
7329
7481
  //#region dist/node/runtime/node/community/local-community/lifecycle.js
7330
7482
  const MIN_MS_BETWEEN_PUBLISH_CYCLES = 100;
7483
+ const MS_BETWEEN_DB_READ_RETRIES = 100;
7331
7484
  async function publishLoop(community, syncIntervalMs) {
7332
7485
  const log = logger_default("pkc-js:local-community:_publishLoop");
7333
7486
  let syncFailedSinceStop = false;
7334
7487
  const shouldStopPublishLoop = () => {
7335
7488
  return community.state !== "started" || community._stopHasBeenCalled && (community._pendingEditProps.length === 0 || syncFailedSinceStop);
7336
7489
  };
7490
+ const readUpdateTriggerRidingOutDbFaults = async () => {
7491
+ let consecutiveIoErrors = 0;
7492
+ while (true) try {
7493
+ calculateLatestUpdateTrigger(community);
7494
+ return;
7495
+ } catch (error) {
7496
+ const kind = classifyDbFault(error);
7497
+ if (!(kind === "busy" || kind === "maybe-transient" && ++consecutiveIoErrors <= 5)) throw error;
7498
+ if (shouldStopPublishLoop()) return;
7499
+ log(`The DB of community (${community.address}) could not be read (${kind}), reading again in ${MS_BETWEEN_DB_READ_RETRIES}ms`);
7500
+ await new Promise((resolve) => setTimeout(resolve, MS_BETWEEN_DB_READ_RETRIES));
7501
+ }
7502
+ };
7337
7503
  const waitUntilNextSync = async ({ lastSyncFailed }) => {
7338
- calculateLatestUpdateTrigger(community);
7504
+ await readUpdateTriggerRidingOutDbFaults();
7339
7505
  if (shouldStopPublishLoop()) return;
7340
7506
  const recordAlreadyRequested = !lastSyncFailed && community._communityUpdateTrigger;
7341
7507
  const minPauseMs = Math.min(MIN_MS_BETWEEN_PUBLISH_CYCLES, syncIntervalMs);
@@ -7541,7 +7707,11 @@ async function startCommunity({ community, releaseMark }) {
7541
7707
  }
7542
7708
  community._publishLoopPromise = publishLoop(community, community._pkc.publishInterval).catch((err) => {
7543
7709
  log.error(err);
7544
- community.emit("error", err);
7710
+ try {
7711
+ community.emit("error", err);
7712
+ } finally {
7713
+ community.stop().catch((e) => log.error(`Failed to stop community (${community.address}) after its publish loop ended`, e));
7714
+ }
7545
7715
  });
7546
7716
  }
7547
7717
  async function initMirroringStartedOrUpdatingCommunity(community, startedCommunity) {
@@ -8462,6 +8632,7 @@ var LocalCommunity = class extends RpcLocalCommunity {
8462
8632
  this._challengeExchangesFromLocalPublishers = {};
8463
8633
  this._inFlightPublicationExchanges = /* @__PURE__ */ new Map();
8464
8634
  this._pseudonymityAliasLocks = /* @__PURE__ */ new Map();
8635
+ this._pseudonymityTagKeyCache = /* @__PURE__ */ new Map();
8465
8636
  this._challengeExchangeTtlMs = CHALLENGE_EXCHANGE_TTL_MS;
8466
8637
  this._slowGetChallengeWarningMs = SLOW_GET_CHALLENGE_WARNING_MS;
8467
8638
  this._cidsToUnPin = /* @__PURE__ */ new Set();
@@ -1,2 +1,2 @@
1
- import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-SgssDrxj.js";
1
+ import { n as createNewLocalCommunityDb, r as updateInstancePropsWithStartedCommunityOrDb, t as LocalCommunity } from "./local-community-0xsjgulY.js";
2
2
  export { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb };