@pkcprotocol/pkc-js 0.0.74 → 0.0.76

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 (192) hide show
  1. package/README.md +34 -1
  2. package/dist/browser/clients/rpc-client/pkc-rpc-client.d.ts +3 -1
  3. package/dist/browser/clients/rpc-client/pkc-rpc-client.js +12 -1
  4. package/dist/browser/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  5. package/dist/browser/clients/rpc-client/rpc-schema-util.d.ts +18 -0
  6. package/dist/browser/clients/rpc-client/rpc-schema-util.js +5 -1
  7. package/dist/browser/clients/rpc-client/rpc-schema-util.js.map +1 -1
  8. package/dist/browser/clients/rpc-client/schema.d.ts +15 -0
  9. package/dist/browser/clients/rpc-client/schema.js +20 -0
  10. package/dist/browser/clients/rpc-client/schema.js.map +1 -1
  11. package/dist/browser/clients/rpc-client/types.d.ts +3 -2
  12. package/dist/browser/community/community-client-manager.js +9 -9
  13. package/dist/browser/community/community-client-manager.js.map +1 -1
  14. package/dist/browser/community/rpc-local-community.d.ts +6 -1
  15. package/dist/browser/community/rpc-local-community.js +32 -0
  16. package/dist/browser/community/rpc-local-community.js.map +1 -1
  17. package/dist/browser/community/schema.d.ts +15 -0
  18. package/dist/browser/community/schema.js +16 -1
  19. package/dist/browser/community/schema.js.map +1 -1
  20. package/dist/browser/community/types.d.ts +14 -1
  21. package/dist/browser/constants.d.ts +3 -1
  22. package/dist/browser/constants.js +9 -1
  23. package/dist/browser/constants.js.map +1 -1
  24. package/dist/browser/errors.d.ts +10 -0
  25. package/dist/browser/errors.js +10 -0
  26. package/dist/browser/errors.js.map +1 -1
  27. package/dist/browser/generated-version.d.ts +1 -1
  28. package/dist/browser/generated-version.js +1 -1
  29. package/dist/browser/helia/helia-for-pkc.d.ts +1 -1
  30. package/dist/browser/helia/helia-for-pkc.js +41 -5
  31. package/dist/browser/helia/helia-for-pkc.js.map +1 -1
  32. package/dist/browser/helia/lru-blockstore.d.ts +92 -0
  33. package/dist/browser/helia/lru-blockstore.js +224 -0
  34. package/dist/browser/helia/lru-blockstore.js.map +1 -0
  35. package/dist/browser/index-with-compile-cache.d.ts +2 -0
  36. package/dist/browser/index-with-compile-cache.js +1 -0
  37. package/dist/browser/index-with-compile-cache.js.map +1 -1
  38. package/dist/browser/index.d.ts +3 -0
  39. package/dist/browser/index.js +8 -0
  40. package/dist/browser/index.js.map +1 -1
  41. package/dist/browser/pkc/pkc.js +41 -4
  42. package/dist/browser/pkc/pkc.js.map +1 -1
  43. package/dist/browser/pkc-error.d.ts +1 -1
  44. package/dist/browser/rpc/src/index.d.ts +4 -1
  45. package/dist/browser/rpc/src/index.js +29 -1
  46. package/dist/browser/rpc/src/index.js.map +1 -1
  47. package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +1 -0
  48. package/dist/browser/rpc/src/schema.d.ts +16 -0
  49. package/dist/browser/runtime/browser/blockstore.d.ts +25 -0
  50. package/dist/browser/runtime/browser/blockstore.js +40 -0
  51. package/dist/browser/runtime/browser/blockstore.js.map +1 -0
  52. package/dist/browser/runtime/node/blockstore.d.ts +32 -0
  53. package/dist/browser/runtime/node/blockstore.js +42 -0
  54. package/dist/browser/runtime/node/blockstore.js.map +1 -0
  55. package/dist/browser/runtime/node/community/local-community/anchor-publishing.d.ts +9 -0
  56. package/dist/browser/runtime/node/community/local-community/anchor-publishing.js +197 -0
  57. package/dist/browser/runtime/node/community/local-community/anchor-publishing.js.map +1 -0
  58. package/dist/browser/runtime/node/community/local-community/db-state.js +22 -4
  59. package/dist/browser/runtime/node/community/local-community/db-state.js.map +1 -1
  60. package/dist/browser/runtime/node/community/local-community/identity.d.ts +2 -0
  61. package/dist/browser/runtime/node/community/local-community/identity.js +13 -0
  62. package/dist/browser/runtime/node/community/local-community/identity.js.map +1 -0
  63. package/dist/browser/runtime/node/community/local-community/lifecycle.js +24 -0
  64. package/dist/browser/runtime/node/community/local-community/lifecycle.js.map +1 -1
  65. package/dist/browser/runtime/node/community/local-community/publication-store.js +7 -3
  66. package/dist/browser/runtime/node/community/local-community/publication-store.js.map +1 -1
  67. package/dist/browser/runtime/node/community/local-community/publication-validation.js +6 -2
  68. package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
  69. package/dist/browser/runtime/node/community/local-community.d.ts +5 -1
  70. package/dist/browser/runtime/node/community/local-community.js +47 -6
  71. package/dist/browser/runtime/node/community/local-community.js.map +1 -1
  72. package/dist/browser/schema/schema-util.d.ts +6 -0
  73. package/dist/browser/schema/schema.d.ts +1 -0
  74. package/dist/browser/schema/schema.js +11 -0
  75. package/dist/browser/schema/schema.js.map +1 -1
  76. package/dist/browser/schema.d.ts +20 -0
  77. package/dist/browser/schema.js +11 -1
  78. package/dist/browser/schema.js.map +1 -1
  79. package/dist/browser/signer/index.d.ts +1 -0
  80. package/dist/browser/signer/index.js +1 -0
  81. package/dist/browser/signer/index.js.map +1 -1
  82. package/dist/browser/signer/ipns-record.d.ts +7 -0
  83. package/dist/browser/signer/ipns-record.js +34 -0
  84. package/dist/browser/signer/ipns-record.js.map +1 -0
  85. package/dist/browser/signer/signatures.d.ts +2 -2
  86. package/dist/browser/signer/signatures.js +18 -6
  87. package/dist/browser/signer/signatures.js.map +1 -1
  88. package/dist/browser/test/test-util.d.ts +4 -0
  89. package/dist/bundled/bundle-manifest.json +204 -92
  90. package/dist/bundled/chunks/helia-for-pkc-cKp6JSwA.js +6915 -0
  91. package/dist/bundled/chunks/{local-community-Br1ipu1Z.js → local-community-B3Fhrtiy.js} +205 -38
  92. package/dist/bundled/chunks/{local-community-CIVs_iuS.js → local-community-DerKPzJm.js} +1 -1
  93. package/dist/bundled/chunks/{node-Cn7VaPDJ.js → node-DffqRPit.js} +43 -9
  94. package/dist/bundled/chunks/{rpc-local-community-DtdeJBOq.js → rpc-local-community-BdNiruAf.js} +96 -38
  95. package/dist/bundled/chunks/{schema-B1Ot-kux.js → schema-BvBJX6m7.js} +29 -5
  96. package/dist/bundled/chunks/{src-o_MYSn-E.js → src-B2CwDTfy.js} +2 -142
  97. package/dist/bundled/chunks/{src-4u0f92eE.js → src-BEjAH2gY.js} +3 -128
  98. package/dist/bundled/chunks/src-Cpx2Sts8.js +127 -0
  99. package/dist/bundled/chunks/src-DKntVmyX.js +142 -0
  100. package/dist/bundled/chunks/{util-B6v5HAdy.js → util-BRxHPb9G.js} +1 -1
  101. package/dist/bundled/index-with-compile-cache.js +2 -1
  102. package/dist/bundled/index.js +2 -2
  103. package/dist/bundled/rpc/src/index.js +27 -4
  104. package/dist/node/clients/rpc-client/pkc-rpc-client.d.ts +3 -1
  105. package/dist/node/clients/rpc-client/pkc-rpc-client.js +12 -1
  106. package/dist/node/clients/rpc-client/pkc-rpc-client.js.map +1 -1
  107. package/dist/node/clients/rpc-client/rpc-schema-util.d.ts +18 -0
  108. package/dist/node/clients/rpc-client/rpc-schema-util.js +5 -1
  109. package/dist/node/clients/rpc-client/rpc-schema-util.js.map +1 -1
  110. package/dist/node/clients/rpc-client/schema.d.ts +15 -0
  111. package/dist/node/clients/rpc-client/schema.js +20 -0
  112. package/dist/node/clients/rpc-client/schema.js.map +1 -1
  113. package/dist/node/clients/rpc-client/types.d.ts +3 -2
  114. package/dist/node/community/community-client-manager.js +9 -9
  115. package/dist/node/community/community-client-manager.js.map +1 -1
  116. package/dist/node/community/rpc-local-community.d.ts +6 -1
  117. package/dist/node/community/rpc-local-community.js +32 -0
  118. package/dist/node/community/rpc-local-community.js.map +1 -1
  119. package/dist/node/community/schema.d.ts +15 -0
  120. package/dist/node/community/schema.js +16 -1
  121. package/dist/node/community/schema.js.map +1 -1
  122. package/dist/node/community/types.d.ts +14 -1
  123. package/dist/node/constants.d.ts +3 -1
  124. package/dist/node/constants.js +9 -1
  125. package/dist/node/constants.js.map +1 -1
  126. package/dist/node/errors.d.ts +10 -0
  127. package/dist/node/errors.js +10 -0
  128. package/dist/node/errors.js.map +1 -1
  129. package/dist/node/generated-version.d.ts +1 -1
  130. package/dist/node/generated-version.js +1 -1
  131. package/dist/node/helia/helia-for-pkc.d.ts +1 -1
  132. package/dist/node/helia/helia-for-pkc.js +41 -5
  133. package/dist/node/helia/helia-for-pkc.js.map +1 -1
  134. package/dist/node/helia/lru-blockstore.d.ts +92 -0
  135. package/dist/node/helia/lru-blockstore.js +224 -0
  136. package/dist/node/helia/lru-blockstore.js.map +1 -0
  137. package/dist/node/index-with-compile-cache.d.ts +2 -0
  138. package/dist/node/index-with-compile-cache.js +1 -0
  139. package/dist/node/index-with-compile-cache.js.map +1 -1
  140. package/dist/node/index.d.ts +3 -0
  141. package/dist/node/index.js +8 -0
  142. package/dist/node/index.js.map +1 -1
  143. package/dist/node/pkc/pkc.js +41 -4
  144. package/dist/node/pkc/pkc.js.map +1 -1
  145. package/dist/node/pkc-error.d.ts +1 -1
  146. package/dist/node/rpc/src/index.d.ts +4 -1
  147. package/dist/node/rpc/src/index.js +29 -1
  148. package/dist/node/rpc/src/index.js.map +1 -1
  149. package/dist/node/rpc/src/lib/pkc-js/index.d.ts +1 -0
  150. package/dist/node/rpc/src/schema.d.ts +16 -0
  151. package/dist/node/runtime/browser/blockstore.d.ts +25 -0
  152. package/dist/node/runtime/browser/blockstore.js +40 -0
  153. package/dist/node/runtime/browser/blockstore.js.map +1 -0
  154. package/dist/node/runtime/node/blockstore.d.ts +32 -0
  155. package/dist/node/runtime/node/blockstore.js +42 -0
  156. package/dist/node/runtime/node/blockstore.js.map +1 -0
  157. package/dist/node/runtime/node/community/local-community/anchor-publishing.d.ts +9 -0
  158. package/dist/node/runtime/node/community/local-community/anchor-publishing.js +197 -0
  159. package/dist/node/runtime/node/community/local-community/anchor-publishing.js.map +1 -0
  160. package/dist/node/runtime/node/community/local-community/db-state.js +22 -4
  161. package/dist/node/runtime/node/community/local-community/db-state.js.map +1 -1
  162. package/dist/node/runtime/node/community/local-community/identity.d.ts +2 -0
  163. package/dist/node/runtime/node/community/local-community/identity.js +13 -0
  164. package/dist/node/runtime/node/community/local-community/identity.js.map +1 -0
  165. package/dist/node/runtime/node/community/local-community/lifecycle.js +24 -0
  166. package/dist/node/runtime/node/community/local-community/lifecycle.js.map +1 -1
  167. package/dist/node/runtime/node/community/local-community/publication-store.js +7 -3
  168. package/dist/node/runtime/node/community/local-community/publication-store.js.map +1 -1
  169. package/dist/node/runtime/node/community/local-community/publication-validation.js +6 -2
  170. package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
  171. package/dist/node/runtime/node/community/local-community.d.ts +5 -1
  172. package/dist/node/runtime/node/community/local-community.js +47 -6
  173. package/dist/node/runtime/node/community/local-community.js.map +1 -1
  174. package/dist/node/schema/schema-util.d.ts +6 -0
  175. package/dist/node/schema/schema.d.ts +1 -0
  176. package/dist/node/schema/schema.js +11 -0
  177. package/dist/node/schema/schema.js.map +1 -1
  178. package/dist/node/schema.d.ts +20 -0
  179. package/dist/node/schema.js +11 -1
  180. package/dist/node/schema.js.map +1 -1
  181. package/dist/node/signer/index.d.ts +1 -0
  182. package/dist/node/signer/index.js +1 -0
  183. package/dist/node/signer/index.js.map +1 -1
  184. package/dist/node/signer/ipns-record.d.ts +7 -0
  185. package/dist/node/signer/ipns-record.js +34 -0
  186. package/dist/node/signer/ipns-record.js.map +1 -0
  187. package/dist/node/signer/signatures.d.ts +2 -2
  188. package/dist/node/signer/signatures.js +18 -6
  189. package/dist/node/signer/signatures.js.map +1 -1
  190. package/dist/node/test/test-util.d.ts +4 -0
  191. package/package.json +8 -5
  192. package/dist/bundled/chunks/helia-for-pkc-B-75U9z9.js +0 -495
@@ -1,7 +1,7 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { B as isIpfsCid, Cn as CommentUpdateForChallengeVerificationSchema, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dt as refreshTrackedCommentAliases, E as createAbortError, En as CommentUpdateSchema, Et as listUpdatingCommunities, Fr as stringifyPrimitive, H as isIpns, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Nr as joinValues, Pr as parsedType, Pt as untrackUpdatingComment, Q as isStringDomain, Qn as n$1, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sr as setErrorMap, St as findUpdatingComment, Tt as listUpdatingComments, Xn as n$2, _r as PKCError, _t as timestamp, a as ChallengeRequestMessageSchema, b as areEquivalentCommunityAddresses, br as require_supports_color, cn as PubsubTopicSchema, ct as resolveWhenPredicateIsTrue, dr as require_retry, er as t$1, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, ir as r, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, mt as sleepUntilTimeoutOrAbort, nn as CommunityIpfsSchema, nr as e$1, ot as removeUndefinedValuesRecursively, pt as shortifyCid, r as ChallengeMessageSchema, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as e, ut as retryKuboIpfsAdd, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wt as listStartedCommunities, xt as findStartedCommunity, y as version_default, yr as logger_default, z as isAbortError } from "./schema-B1Ot-kux.js";
3
- import { $ as RepliesPages, $n as t$5, $t as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, An as RpcCidParamSchema, At as verifyCommunityEdit, B as setNativeFunctions$1, Bn as RpcFetchCidResultSchema, Bt as getCommunityPublicKeyFromWire, Cn as parseRpcCommentEventWithPKCErrorIfItFails, Ct as verifyChallengeVerification, D as createKuboRpcClient, Dn as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Dt as verifyCommentPubsubMessage, Et as verifyCommentModeration, Fn as RpcExportCommunityModLogsParamSchema, Gn as RpcUnsubscribeParamSchema, H as CommentClientsManager, Hn as RpcResolveAuthorNameResultSchema, Ht as decode, I as listCommunitiesSync, In as RpcExportCommunityModLogsResultSchema, It as normalizeCreatePublicationAuthor, Kn as t$4, L as monitorCommunitiesDirectory, Ln as RpcExportCommunityParamSchema, Lt as buildRuntimeCommunityFields, Mn as RpcCommunityIdentifierParamSchema, Mt as buildRuntimeAuthor, N as getDefaultDataPath, Nn as RpcCommunityPageParamSchema, Nt as cleanWireAuthor, On as RpcAuthorNameParamSchema, Ot as verifyCommentUpdate, Pn as RpcEditCommunityParamSchema, Pt as getAuthorNameFromRuntime, Q as parseRawPages, Qn as t$2, Rn as RpcExportCommunityResultSchema, Rt as getCommunityAddressFromRecord, Sn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Tn as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Tt as verifyCommentIpfs, Un as RpcSubscriptionIdResultSchema, V as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Vn as RpcPublishChallengeAnswersParamSchema, Vt as normalizeCommunityInputFromCommunity, Wn as RpcSuccessResultSchema, Wt as getBufferedPKCAddressFromPublicKey, X as findCommentInPageInstanceRecursively, Xn as n$3, Xt as parseCidStringSchemaWithPKCErrorIfItFails, Y as extractCommunityRuntimeFieldsFromParsedPages, Yn as t$3, _n as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, at as PKCTypedEmitter, bn as parseDecryptedChallengeWithPKCErrorIfItFails, c as AddressesRewriterProxyServer, ct as signChallengeAnswer, dn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, en as parseCommentIpfsSchemaWithPKCErrorIfItFails, et as PublicationClientsManager, f as KeyvBetterSqlite3, fn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, ft as signComment, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, hn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, in as parseCommunityAddressWithPKCErrorIfItFails, ir as require_undici, jn as RpcCommentRepliesPageParamSchema, jt as verifyVote, kn as RpcCancelExportParamSchema, ln as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, m as decodeRpcChallengePubsubMsg, mt as signCommentModeration, n as RpcRemoteCommunity, nn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, nt as InflightFetchManager, o as TrackedInstanceRegistry, ot as require_lib$1, p as decodeRpcChallengeAnswerPubsubMsg, pt as signCommentEdit, qt as getPKCAddressFromPublicKeySync, rn as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, rr as nativeFunctions$2, s as LRUCache, sn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, st as cleanUpBeforePublishing, t as RpcLocalCommunity, tt as PKCClientsManager, u as RemoteCommunity, un as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, ut as signChallengeRequest, v as createSigner, vn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, vt as signCommunityEdit, wn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, wt as verifyCommentEdit, x as encryptEd25519AesGcm, xn as parseJsonWithPKCErrorIfFails, xt as verifyChallengeMessage, y as decryptEd25519AesGcm, yn as parseDecryptedChallengeVerification, yt as signVote, zn as RpcFetchCidParamSchema, zt as getCommunityNameFromWire } from "./rpc-local-community-DtdeJBOq.js";
4
- import { o as getHeliaDebugContext } from "./util-B6v5HAdy.js";
2
+ import { $n as n$1, B as isIpfsCid, Cr as setErrorMap, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dt as refreshTrackedCommentAliases, E as createAbortError, Et as listUpdatingCommunities, Fr as parsedType, H as isIpns, Ir as stringifyPrimitive, It as require_sha256, L as hideClassPrivateProps, Lt as TimeoutError, Pr as joinValues, Pt as untrackUpdatingComment, Q as isStringDomain, Qt as CommunityAnchorSchema, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, St as findUpdatingComment, Tt as listUpdatingComments, Zn as n$2, _t as timestamp, a as ChallengeRequestMessageSchema, ar as r, b as areEquivalentCommunityAddresses, br as logger_default, ct as resolveWhenPredicateIsTrue, fr as require_retry, ft as shortifyAddress, jt as trackUpdatingComment, k as doesDomainAddressHaveCapitalLetter, ln as PubsubTopicSchema, mt as sleepUntilTimeoutOrAbort, nr as e, ot as removeUndefinedValuesRecursively, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, r as ChallengeMessageSchema, rn as CommunityIpfsSchema, rr as e$1, s as ChallengeVerificationMessageSchema, st as replaceXWithY, t as ChallengeAnswerMessageSchema, tr as t$1, ut as retryKuboIpfsAdd, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSchema, wt as listStartedCommunities, xr as require_supports_color, xt as findStartedCommunity, y as version_default, yn as CommentIpfsSchema, yr as messages, z as isAbortError } from "./schema-BvBJX6m7.js";
3
+ import { $ as parseRawPages, $n as t$3, An as RpcAuthorNameParamSchema, Bn as RpcExportCommunityResultSchema, Bt as getCommunityNameFromWire, Cn as parsePKCUserOptionsSchemaWithPKCErrorIfItFails, Dt as verifyCommentModeration, En as parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails, Et as verifyCommentIpfs, Fn as RpcCommunityPageParamSchema, Ft as getAuthorNameFromRuntime, Gn as RpcPublishedAnchorRecordResultSchema, Gt as getBufferedPKCAddressFromPublicKey, H as tryToDeleteCommunitiesThatFailedToBeDeletedBefore, Hn as RpcFetchCidResultSchema, Ht as normalizeCommunityInputFromCommunity, In as RpcEditCommunityParamSchema, Jn as RpcSuccessResultSchema, Jt as getPKCAddressFromPublicKeySync, Kn as RpcResolveAuthorNameResultSchema, L as listCommunitiesSync, Ln as RpcExportCommunityModLogsParamSchema, Lt as normalizeCreatePublicationAuthor, Mn as RpcCidParamSchema, Mt as verifyVote, Nn as RpcCommentRepliesPageParamSchema, Nt as buildRuntimeAuthor, O as createKuboRpcClient, On as parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails, Ot as verifyCommentPubsubMessage, P as getDefaultDataPath, Pn as RpcCommunityIdentifierParamSchema, Pt as cleanWireAuthor, R as monitorCommunitiesDirectory, Rn as RpcExportCommunityModLogsResultSchema, Rt as buildRuntimeCommunityFields, S as encryptEd25519AesGcm, Sn as parseJsonWithPKCErrorIfFails, St as verifyChallengeMessage, Tn as parseRpcCommentUpdateEventWithPKCErrorIfItFails, Tt as verifyCommentEdit, U as CommentClientsManager, Un as RpcPublishAnchorRecordParamSchema, Ut as decode, V as setNativeFunctions$1, Vn as RpcFetchCidParamSchema, Vt as getCommunityPublicKeyFromWire, Wn as RpcPublishChallengeAnswersParamSchema, X as extractCommunityRuntimeFieldsFromParsedPages, Xn as t$4, Yn as RpcUnsubscribeParamSchema, Z as findCommentInPageInstanceRecursively, Zt as parseCidStringSchemaWithPKCErrorIfItFails, _n as parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, a as pkcJsChallenges, an as parseCommunityAddressWithPKCErrorIfItFails, b as decryptEd25519AesGcm, bn as parseDecryptedChallengeVerification, bt as signVote, c as AddressesRewriterProxyServer, cn as parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, cr as require_undici, ct as cleanUpBeforePublishing, dn as parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails, dt as signChallengeRequest, en as parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails, er as n$3, et as RepliesPages, f as KeyvBetterSqlite3, fn as parseCreateCommentOptionsSchemaWithPKCErrorIfItFails, g as decodeRpcChallengeVerificationPubsubMsg, gn as parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails, h as decodeRpcChallengeRequestPubsubMsg, ht as signCommentModeration, in as parseCommentPubsubMessagePublicationWithPKCErrorIfItFails, jn as RpcCancelExportParamSchema, jt as verifyCommunityEdit, kn as RpcAnchorPublishPreparationResultSchema, kt as verifyCommentUpdate, lt as signChallengeAnswer, m as decodeRpcChallengePubsubMsg, mt as signCommentEdit, n as RpcRemoteCommunity, nr as t$2, nt as PKCClientsManager, o as TrackedInstanceRegistry, ot as PKCTypedEmitter, p as decodeRpcChallengeAnswerPubsubMsg, pn as parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails, pt as signComment, qn as RpcSubscriptionIdResultSchema, rn as parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails, rr as t$5, rt as InflightFetchManager, s as LRUCache, sr as nativeFunctions$2, st as require_lib$1, t as RpcLocalCommunity, tn as parseCommentIpfsSchemaWithPKCErrorIfItFails, tt as PublicationClientsManager, u as RemoteCommunity, un as parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails, v as createSigner, vn as parseCreateVoteOptionsSchemaWithPKCErrorIfItFails, wn as parseRpcCommentEventWithPKCErrorIfItFails, wt as verifyChallengeVerification, xn as parseDecryptedChallengeWithPKCErrorIfItFails, y as createAnchorIpnsRecord$1, yn as parseDecryptedChallengeAnswerWithPKCErrorIfItFails, yt as signCommunityEdit, zn as RpcExportCommunityParamSchema, zt as getCommunityAddressFromRecord } from "./rpc-local-community-BdNiruAf.js";
4
+ import { o as getHeliaDebugContext } from "./util-BRxHPb9G.js";
5
5
  import path from "path";
6
6
  import assert from "assert";
7
7
  import fs from "fs";
@@ -2118,6 +2118,9 @@ const parseRpcResolveAuthorNameResult = (result) => RpcResolveAuthorNameResultSc
2118
2118
  const parseRpcFetchCidResult = (result) => RpcFetchCidResultSchema.loose().parse(result);
2119
2119
  const parseRpcSuccessResult = (result) => RpcSuccessResultSchema.loose().parse(result);
2120
2120
  const parseRpcSubscriptionIdResult = (result) => RpcSubscriptionIdResultSchema.loose().parse(result);
2121
+ const parseRpcPublishAnchorRecordParam = (params) => RpcPublishAnchorRecordParamSchema.loose().parse(params);
2122
+ const parseRpcAnchorPublishPreparationResult = (result) => RpcAnchorPublishPreparationResultSchema.loose().parse(result);
2123
+ const parseRpcPublishedAnchorRecordResult = (result) => RpcPublishedAnchorRecordResultSchema.loose().parse(result);
2121
2124
  const parseRpcExportCommunityParam = (params) => RpcExportCommunityParamSchema.loose().parse(params);
2122
2125
  const parseRpcCancelExportParam = (params) => RpcCancelExportParamSchema.loose().parse(params);
2123
2126
  const parseRpcExportCommunityResult = (result) => RpcExportCommunityResultSchema.loose().parse(result);
@@ -2363,6 +2366,14 @@ var PKCRpcClient = class extends import_lib.TypedEmitter {
2363
2366
  const parsedStopCommunityArgs = parseRpcCommunityIdentifierParam(communityIdentifier);
2364
2367
  return parseRpcSuccessResult(await this._webSocketClient.call("stopCommunity", [parsedStopCommunityArgs]));
2365
2368
  }
2369
+ async prepareAnchorPublish(communityIdentifier) {
2370
+ const parsedArgs = parseRpcCommunityIdentifierParam(communityIdentifier);
2371
+ return parseRpcAnchorPublishPreparationResult(await this._webSocketClient.call("prepareAnchorPublish", [parsedArgs]));
2372
+ }
2373
+ async publishAnchorRecord(args) {
2374
+ const parsedArgs = parseRpcPublishAnchorRecordParam(args);
2375
+ return parseRpcPublishedAnchorRecordResult(await this._webSocketClient.call("publishAnchorRecord", [parsedArgs]));
2376
+ }
2366
2377
  async editCommunity(args) {
2367
2378
  parseRpcEditCommunityParam(args);
2368
2379
  const wireArgs = {
@@ -8901,11 +8912,12 @@ var PKC$1 = class extends PKCTypedEmitter {
8901
8912
  this.clients.libp2pJsClients = {};
8902
8913
  if (!this.libp2pJsClientsOptions) return;
8903
8914
  if (!this.httpRoutersOptions) throw Error("httpRoutersOptions is required for libp2pJsClient");
8904
- const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-B-75U9z9.js");
8915
+ const { createLibp2pJsClientOrUseExistingOne } = await import("./helia-for-pkc-cKp6JSwA.js");
8905
8916
  for (const clientOptions of this.libp2pJsClientsOptions) {
8906
8917
  const heliaNode = await createLibp2pJsClientOrUseExistingOne({
8907
8918
  ...clientOptions,
8908
- httpRoutersOptions: this.httpRoutersOptions
8919
+ httpRoutersOptions: this.httpRoutersOptions,
8920
+ dataPath: this.dataPath
8909
8921
  });
8910
8922
  this.clients.libp2pJsClients[clientOptions.key] = heliaNode;
8911
8923
  }
@@ -9149,7 +9161,7 @@ var PKC$1 = class extends PKCTypedEmitter {
9149
9161
  const log = logger_default("pkc-js:pkc:createLocalCommunity");
9150
9162
  log.trace("Received community options to create a local community instance:", options);
9151
9163
  if (!this._canCreateNewLocalCommunity()) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", { pkcOptions: this._userPKCOptions });
9152
- const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-CIVs_iuS.js");
9164
+ const { LocalCommunity, createNewLocalCommunityDb, updateInstancePropsWithStartedCommunityOrDb } = await import("./local-community-DerKPzJm.js");
9153
9165
  const isLocalCommunity = (await listCommunitiesSync(this)).includes(options.address);
9154
9166
  const community = new LocalCommunity(this);
9155
9167
  if (isLocalCommunity) {
@@ -9181,11 +9193,22 @@ var PKC$1 = class extends PKCTypedEmitter {
9181
9193
  const hasName = "name" in parsedOptions && typeof parsedOptions.name === "string";
9182
9194
  const hasPublicKey = "publicKey" in parsedOptions && typeof parsedOptions.publicKey === "string";
9183
9195
  const hasSigner = "signer" in parsedOptions && parsedOptions.signer !== void 0;
9196
+ const anchor = parsedOptions.anchor ?? void 0;
9197
+ const hasAnchor = anchor !== void 0;
9198
+ if (hasAnchor) {
9199
+ const parsedAnchor = CommunityAnchorSchema.safeParse(anchor);
9200
+ if (!parsedAnchor.success) throw new PKCError("ERR_ANCHOR_PUBLIC_KEY_IS_INVALID", {
9201
+ anchor,
9202
+ zodError: parsedAnchor.error
9203
+ });
9204
+ }
9205
+ if (hasAnchor && hasSigner) throw new PKCError("ERR_CAN_NOT_CREATE_A_COMMUNITY_WITH_BOTH_SIGNER_AND_ANCHOR", { ...parsedOptions });
9184
9206
  const hasIdentifier = hasAddress || hasName || hasPublicKey;
9207
+ if (hasAnchor && hasIdentifier) throw new PKCError("ERR_CAN_NOT_CREATE_A_COMMUNITY_WITH_BOTH_ANCHOR_AND_IDENTIFIER", { ...parsedOptions });
9185
9208
  const effectiveAddress = parsedOptions.address || parsedOptions.name || parsedOptions.publicKey;
9186
9209
  if (effectiveAddress && doesDomainAddressHaveCapitalLetter(effectiveAddress)) throw new PKCError("ERR_COMMUNITY_NAME_HAS_CAPITAL_LETTER", { ...parsedOptions });
9187
9210
  const canCreateLocalCommunity = this._canCreateNewLocalCommunity();
9188
- if (hasSigner && !canCreateLocalCommunity) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", {
9211
+ if ((hasSigner || hasAnchor) && !canCreateLocalCommunity) throw new PKCError("ERR_CAN_NOT_CREATE_A_LOCAL_COMMUNITY", {
9189
9212
  pkcOptions: this._userPKCOptions,
9190
9213
  isEnvNode: Boolean(process),
9191
9214
  hasDataPath: Boolean(this.dataPath)
@@ -9194,7 +9217,16 @@ var PKC$1 = class extends PKCTypedEmitter {
9194
9217
  const parsedRemoteOptions = parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails(options);
9195
9218
  return this._createRemoteCommunityInstance(parsedRemoteOptions);
9196
9219
  }
9197
- if (hasIdentifier && !hasSigner) {
9220
+ if (hasAnchor) {
9221
+ const minterSigner = await this.createSigner();
9222
+ const localOptions = {
9223
+ ...parsedOptions,
9224
+ signer: minterSigner,
9225
+ address: anchor.publicKey
9226
+ };
9227
+ log(`Creating a delegated local community with anchor (${anchor.publicKey}) and minter (${minterSigner.address})`);
9228
+ return this._createLocalCommunity(localOptions);
9229
+ } else if (hasIdentifier && !hasSigner) {
9198
9230
  const localCommunityAddress = (await listCommunitiesSync(this)).find((localAddr) => areEquivalentCommunityAddresses(localAddr, effectiveAddress));
9199
9231
  if (localCommunityAddress) return this._createLocalCommunity({ address: localCommunityAddress });
9200
9232
  else {
@@ -9667,10 +9699,12 @@ PKC.nativeFunctions = {
9667
9699
  PKC.getShortCid = getShortCidValue;
9668
9700
  PKC.getShortAddress = getShortAddressValue;
9669
9701
  PKC.challenges = pkcJsChallenges;
9702
+ PKC.createAnchorIpnsRecord = createAnchorIpnsRecord$1;
9670
9703
  const setNativeFunctions = PKC.setNativeFunctions;
9671
9704
  const nativeFunctions = PKC.nativeFunctions;
9672
9705
  const getShortCid = PKC.getShortCid;
9673
9706
  const getShortAddress = PKC.getShortAddress;
9674
9707
  const challenges = PKC.challenges;
9708
+ const createAnchorIpnsRecord = PKC.createAnchorIpnsRecord;
9675
9709
  //#endregion
9676
- export { parseRpcUnsubscribeParam as _, nativeFunctions as a, parseRpcCancelExportParam as c, parseRpcCommunityIdentifierParam as d, parseRpcCommunityPageParam as f, parseRpcPublishChallengeAnswersParam as g, parseRpcExportCommunityParam as h, getShortCid as i, parseRpcCidParam as l, parseRpcExportCommunityModLogsParam as m, challenges as n, setNativeFunctions as o, parseRpcEditCommunityParam as p, getShortAddress as r, parseRpcAuthorNameParam as s, PKC as t, parseRpcCommentRepliesPageParam as u };
9710
+ export { parseRpcPublishAnchorRecordParam as _, getShortCid as a, parseRpcAuthorNameParam as c, parseRpcCommentRepliesPageParam as d, parseRpcCommunityIdentifierParam as f, parseRpcExportCommunityParam as g, parseRpcExportCommunityModLogsParam as h, getShortAddress as i, parseRpcCancelExportParam as l, parseRpcEditCommunityParam as m, challenges as n, nativeFunctions as o, parseRpcCommunityPageParam as p, createAnchorIpnsRecord as r, setNativeFunctions as s, PKC as t, parseRpcCidParam as u, parseRpcPublishChallengeAnswersParam as v, parseRpcUnsubscribeParam as y };
@@ -1,24 +1,24 @@
1
1
  import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
2
- import { $ as pubsubTopicToDhtKey, $t as CommunityEditOptionsSchema, A as extractNetworkErrorDetails, An as CreateCommentOptionsWithRefinementSchema, Ar as record, At as trackStartedCommunity, B as isIpfsCid, Bn as CreateCommentEditOptionsWithRefinementSchema, Cr as _enum, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSignedPropertyNames, Dr as literal, E as createAbortError, En as CommentUpdateSchema, Er as custom, Et as listUpdatingCommunities, Ft as untrackUpdatingCommunity, Gn as CidPathSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorCommentIpfsReservedFields, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, In as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, It as require_sha256$1, Jn as CommunityAuthorChallengeReservedFieldNames, Jt as CommentModerationsTableRowSchema, Kn as CidStringSchema, L as hideClassPrivateProps, Mn as ModQueuePageIpfsSchema, Mt as trackUpdatingCommunity, Nn as PageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, Or as number, Ot as refreshTrackedCommunityAliases, Pn as CommentEditChallengeRequestToEncryptSchema, Q as isStringDomain, Qn as n$9, Qt as CommunityChallengeSettingSchema, R as ipnsNameToIpnsOverPubsubTopic, Rn as CommentEditSignedPropertyNames, Rt as pTimeout, Sn as CommentUpdateChallengeReservedFieldNames, St as findUpdatingComment, Tn as CommentUpdateReservedFields, Tr as boolean, U as isIpnsPath, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as AuthorAddressSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wn as ChallengeAnswersSchema, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as n$10, Xt as ChallengeFileFactorySchema, Yn as CreateSignerSchema, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentIpfsReservedFields, _r as PKCError, _t as timestamp, an as CreateRemoteCommunityFunctionArgumentSchema, ar as t$12, b as areEquivalentCommunityAddresses, bn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, br as require_supports_color, c as ChallengeVerificationMessageSignedPropertyNames, cr as t$10, ct as resolveWhenPredicateIsTrue, dn as VoteChallengeRequestToEncryptSchema, dr as require_retry$1, en as CommunityExportRecordsSchema, er as t$13, f as DecryptedChallengeSchema, fn as VotePubsubMessagePublicationSchema, fr as FailedToFetchCommentIpfsFromGatewaysError, ft as shortifyAddress, g as PKCParsedOptionsSchema, gn as CommentChallengeRequestToEncryptSchema, gr as FailedToFetchPageIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hr as FailedToFetchGenericIpfsFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CreateNewLocalCommunityUserOptionsSchema, ir as r$8, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as GetPageParamSchema, jr as string, k as doesDomainAddressHaveCapitalLetter, kr as object, l as DecryptedChallengeAnswerSchema, ln as RpcRemoteCommunityUpdateEventResultSchema, lr as t$9, m as NameResolveCacheOptionsSchema, mn as VoteSignedPropertyNames, mr as FailedToFetchCommunityFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsSchema, nr as e$5, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRpcCommunityFunctionArgumentSchema, or as n$8, p as DecryptedChallengeVerificationSchema, pr as FailedToFetchCommentUpdateFromGatewaysError, pt as shortifyCid, qn as CommunityAddressSchema, qt as CommentModerationSignedPropertyNames, rn as CommunitySignedPropertyNames, rr as t$11, sn as ExportCommunityModLogsOptionsSchema, sr as r$7, tn as CommunityIpfsReservedFields, tr as e$6, tt as raceAgainstAbort, un as CreateVoteUserOptionsWithRefinementSchema, ur as e$4, v as PKCUserOptionsSchema, vn as CommentIpfsSchema, vr as messages, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wn as CommentUpdateForChallengeVerificationSignedPropertyNames, wr as array, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentSignedPropertyNames, xr as require_ms$1, xt as findStartedCommunity, yr as logger_default, z as isAbortError, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-B1Ot-kux.js";
2
+ import { $ as pubsubTopicToDhtKey, $n as n$9, $t as CommunityChallengeSettingSchema, A as extractNetworkErrorDetails, Ar as object, At as trackStartedCommunity, B as isIpfsCid, Cn as CommentUpdateChallengeReservedFieldNames, Ct as findUpdatingCommunity, D as deepMergeRuntimeFields, Dn as CommentUpdateSchema, Dr as custom, E as createAbortError, En as CommentUpdateReservedFields, Er as boolean, Et as listUpdatingCommunities, Fn as CommentEditChallengeRequestToEncryptSchema, Ft as untrackUpdatingCommunity, Gn as ChallengeAnswersSchema, Gt as CommentModerationPubsubMessagePublicationSchema, H as isIpns, Hn as AuthorAddressSchema, Ht as CommunityEditPubsubMessagePublicationSchema, I as getPostUpdateTimestampRange, It as require_sha256$1, Jn as CommunityAddressSchema, Jt as CommentModerationsTableRowSchema, Kn as CidPathSchema, L as hideClassPrivateProps, Ln as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Mn as GetPageParamSchema, Mr as string, Mt as trackUpdatingCommunity, Nn as ModQueuePageIpfsSchema, Nt as untrackStartedCommunity, O as derivePublicationFromChallengeRequest, On as CommentUpdateSignedPropertyNames, Or as literal, Ot as refreshTrackedCommunityAliases, Pn as PageIpfsSchema, Q as isStringDomain, R as ipnsNameToIpnsOverPubsubTopic, Rt as pTimeout, Sn as CommentSignedPropertyNames, Sr as require_ms$1, St as findUpdatingComment, Tn as CommentUpdateForChallengeVerificationSignedPropertyNames, Tr as array, U as isIpnsPath, Un as AuthorCommentIpfsReservedFields, Ut as CreateCommunityEditPublicationOptionsWithRefinementSchema, V as isIpfsPath, Vn as CreateCommentEditOptionsWithRefinementSchema, Vt as CommunityEditPublicationSignedPropertyNames, Wt as CommentModerationChallengeRequestToEncryptSchema, X as isRequestPubsubPublicationOfPost, Xn as CreateSignerSchema, Xt as ChallengeFileFactorySchema, Yn as CommunityAuthorChallengeReservedFieldNames, Yt as CreateCommentModerationOptionsWithRefinementSchema, Z as isRequestPubsubPublicationOfReply, Zn as n$10, Zt as ChallengeFileSchema, _ as PKCUserOptionBaseSchema, _n as CommentChallengeRequestToEncryptSchema, _r as FailedToFetchPageIpfsFromGatewaysError, _t as timestamp, an as CreateNewLocalCommunityUserOptionsSchema, ar as r$8, b as areEquivalentCommunityAddresses, br as logger_default, c as ChallengeVerificationMessageSignedPropertyNames, cn as ExportCommunityModLogsOptionsSchema, cr as r$7, ct as resolveWhenPredicateIsTrue, dn as CreateVoteUserOptionsWithRefinementSchema, dr as e$4, en as CommunityEditOptionsSchema, f as DecryptedChallengeSchema, fn as VoteChallengeRequestToEncryptSchema, fr as require_retry$1, ft as shortifyAddress, g as PKCParsedOptionsSchema, gr as FailedToFetchGenericIpfsFromGatewaysError, gt as throwIfAbortSignalAborted, h as NameResolverSerializedSchema, hn as VoteSignedPropertyNames, hr as FailedToFetchCommunityFromGatewaysError, i as ChallengeMessageSignedPropertyNames, in as CommunitySignedPropertyNames, ir as t$11, it as removeNullUndefinedEmptyObjectsValuesRecursively, j as fetchAndValidateIpnsRecordFromGateway, jn as CreateCommentOptionsWithRefinementSchema, jr as record, k as doesDomainAddressHaveCapitalLetter, kr as number, l as DecryptedChallengeAnswerSchema, lr as t$10, m as NameResolveCacheOptionsSchema, mr as FailedToFetchCommentUpdateFromGatewaysError, mt as sleepUntilTimeoutOrAbort, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityIpfsReservedFields, nr as e$6, o as ChallengeRequestMessageSignedPropertyNames, on as CreateRemoteCommunityFunctionArgumentSchema, or as t$12, p as DecryptedChallengeVerificationSchema, pn as VotePubsubMessagePublicationSchema, pr as FailedToFetchCommentIpfsFromGatewaysError, pt as shortifyCid, qn as CidStringSchema, qt as CommentModerationSignedPropertyNames, rn as CommunityIpfsSchema, rr as e$5, sn as CreateRpcCommunityFunctionArgumentSchema, sr as n$8, tn as CommunityExportRecordsSchema, tr as t$13, tt as raceAgainstAbort, un as RpcRemoteCommunityUpdateEventResultSchema, ur as t$9, v as PKCUserOptionsSchema, vn as CommentIpfsReservedFields, vr as PKCError, vt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, wr as _enum, wt as listStartedCommunities, x as calculateIpfsCidV0, xn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, xr as require_supports_color, xt as findStartedCommunity, yn as CommentIpfsSchema, yr as messages, z as isAbortError, zn as CommentEditSignedPropertyNames, zt as CommunityEditPublicationChallengeRequestToEncryptSchema } from "./schema-BvBJX6m7.js";
3
3
  import { t as all } from "./src-CYIMjhjK.js";
4
4
  import http from "node:http";
5
5
  import { createHash } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import fsp from "node:fs/promises";
8
- import path from "node:path";
8
+ import Path from "node:path";
9
9
  import dns from "node:dns";
10
10
  import os from "os";
11
11
  import { closeSync, createReadStream, existsSync, openSync, promises, readSync, readdirSync, rm, watch } from "node:fs";
12
- import path$1 from "path";
12
+ import path from "path";
13
13
  import assert from "assert";
14
14
  import { Agent } from "https";
15
15
  import { Agent as Agent$1 } from "http";
16
16
  import Database from "better-sqlite3";
17
17
  import { CID } from "multiformats/cid";
18
+ import { peerIdFromMultihash, peerIdFromPrivateKey, peerIdFromPublicKey, peerIdFromString } from "@libp2p/peer-id";
18
19
  import * as Digest from "multiformats/hashes/digest";
19
20
  import { of } from "typestub-ipfs-only-hash";
20
21
  import { toString } from "uint8arrays/to-string";
21
- import { peerIdFromMultihash, peerIdFromPrivateKey, peerIdFromPublicKey, peerIdFromString } from "@libp2p/peer-id";
22
22
  import { privateKeyFromProtobuf, privateKeyFromRaw, privateKeyToProtobuf, publicKeyFromRaw, publicKeyToProtobuf } from "@libp2p/crypto/keys";
23
23
  import { fromString } from "uint8arrays/from-string";
24
24
  import { bases } from "multiformats/basics";
@@ -11928,8 +11928,8 @@ var require_snapshot_utils = /* @__PURE__ */ __commonJSMin(((exports, module) =>
11928
11928
  //#endregion
11929
11929
  //#region node_modules/undici/lib/mock/snapshot-recorder.js
11930
11930
  var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin(((exports, module) => {
11931
- const { writeFile, readFile: readFile$1, mkdir } = __require("node:fs/promises");
11932
- const { dirname, resolve } = __require("node:path");
11931
+ const { writeFile: writeFile$1, readFile: readFile$1, mkdir } = __require("node:fs/promises");
11932
+ const { dirname: dirname$1, resolve } = __require("node:path");
11933
11933
  const { setTimeout: setTimeout$1, clearTimeout: clearTimeout$1 } = __require("node:timers");
11934
11934
  const { InvalidArgumentError, UndiciError } = require_errors();
11935
11935
  const { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -12215,12 +12215,12 @@ var require_snapshot_recorder = /* @__PURE__ */ __commonJSMin(((exports, module)
12215
12215
  const path = filePath || this.#snapshotPath;
12216
12216
  if (!path) throw new InvalidArgumentError("Snapshot path is required");
12217
12217
  const resolvedPath = resolve(path);
12218
- await mkdir(dirname(resolvedPath), { recursive: true });
12218
+ await mkdir(dirname$1(resolvedPath), { recursive: true });
12219
12219
  const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
12220
12220
  hash,
12221
12221
  snapshot
12222
12222
  }));
12223
- await writeFile(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
12223
+ await writeFile$1(resolvedPath, JSON.stringify(data, null, 2), { flush: true });
12224
12224
  }
12225
12225
  /**
12226
12226
  * Clears all recorded snapshots
@@ -78248,7 +78248,7 @@ var require_querystring = /* @__PURE__ */ __commonJSMin(((exports) => {
78248
78248
  //#endregion
78249
78249
  //#region node_modules/needle/lib/multipart.js
78250
78250
  var require_multipart = /* @__PURE__ */ __commonJSMin(((exports) => {
78251
- var readFile = __require("fs").readFile, basename = __require("path").basename;
78251
+ var readFile = __require("fs").readFile, basename$1 = __require("path").basename;
78252
78252
  exports.build = function(data, boundary, callback) {
78253
78253
  if (typeof data != "object" || typeof data.pipe == "function") return callback(/* @__PURE__ */ new Error("Multipart builder expects data as key/val object."));
78254
78254
  var body = "", object = flatten(data), count = Object.keys(object).length;
@@ -78287,7 +78287,7 @@ var require_multipart = /* @__PURE__ */ __commonJSMin(((exports) => {
78287
78287
  callback(null, return_part + "\r\n");
78288
78288
  }
78289
78289
  if ((part.file || part.buffer) && part.content_type) {
78290
- var filename = part.filename ? part.filename : part.file ? basename(part.file) : name;
78290
+ var filename = part.filename ? part.filename : part.file ? basename$1(part.file) : name;
78291
78291
  if (part.buffer) return append(part.buffer, filename);
78292
78292
  readFile(part.file, function(err, data) {
78293
78293
  if (err) return callback(err);
@@ -91003,6 +91003,8 @@ var STORAGE_KEYS;
91003
91003
  STORAGE_KEYS[STORAGE_KEYS["LAST_IPNS_RECORD"] = 2] = "LAST_IPNS_RECORD";
91004
91004
  STORAGE_KEYS[STORAGE_KEYS["COMBINED_HASH_OF_PENDING_COMMENTS"] = 3] = "COMBINED_HASH_OF_PENDING_COMMENTS";
91005
91005
  STORAGE_KEYS[STORAGE_KEYS["EXPORTS"] = 4] = "EXPORTS";
91006
+ STORAGE_KEYS[STORAGE_KEYS["ANCHOR_IPNS_RECORD"] = 5] = "ANCHOR_IPNS_RECORD";
91007
+ STORAGE_KEYS[STORAGE_KEYS["HIGHEST_ACCEPTED_ANCHOR_SEQUENCE"] = 6] = "HIGHEST_ACCEPTED_ANCHOR_SEQUENCE";
91006
91008
  })(STORAGE_KEYS || (STORAGE_KEYS = {}));
91007
91009
  //#endregion
91008
91010
  //#region node_modules/safe-stable-stringify/index.js
@@ -91692,6 +91694,21 @@ const RpcCommunitiesChangeEventResultSchema = object({ communities: array(string
91692
91694
  const RpcFetchCidResultSchema = object({ content: string() });
91693
91695
  const RpcResolveAuthorNameResultSchema = object({ resolvedAuthorName: string().nullable() });
91694
91696
  const RpcSuccessResultSchema = object({ success: literal(true) });
91697
+ const RpcPublishAnchorRecordParamSchema = object({
91698
+ name: string().min(1).optional(),
91699
+ publicKey: string().min(1).optional(),
91700
+ recordBase64: string().min(1)
91701
+ }).refine((args) => args.name || args.publicKey, "At least one of name or publicKey must be provided");
91702
+ const RpcAnchorPublishPreparationResultSchema = object({
91703
+ nextSequence: string().min(1),
91704
+ currentAnchorRecordSequence: string().min(1),
91705
+ hasPersistedAnchorRecord: boolean()
91706
+ });
91707
+ const RpcPublishedAnchorRecordResultSchema = object({
91708
+ sequence: string().min(1),
91709
+ value: string().min(1),
91710
+ anchorPublicKey: string().min(1)
91711
+ });
91695
91712
  const RpcSubscriptionIdResultSchema = object({ subscriptionId: SubscriptionIdSchema });
91696
91713
  const RpcExportCommunityParamSchema = object({
91697
91714
  name: string().min(1).optional(),
@@ -97797,8 +97814,11 @@ function _allFieldsOfRecordInSignedPropertyNames(record) {
97797
97814
  for (const field of fieldsOfRecord) if (!record.signature.signedPropertyNames.includes(field)) return false;
97798
97815
  return true;
97799
97816
  }
97800
- async function verifyCommunity({ community, communityIpnsName, resolveAuthorNames, clientsManager, validatePages, cacheIfValid, abortSignal }) {
97817
+ async function verifyCommunity({ community, communityIpnsHops, resolveAuthorNames, clientsManager, validatePages, cacheIfValid, abortSignal }) {
97801
97818
  const log = logger_default("pkc-js:signatures:verifyCommunity");
97819
+ if (!Array.isArray(communityIpnsHops) || communityIpnsHops.length === 0) throw Error("verifyCommunity needs a non-empty communityIpnsHops to verify a community record against");
97820
+ const communityIdentityIpnsName = communityIpnsHops[0];
97821
+ const terminalIpnsName = communityIpnsHops[communityIpnsHops.length - 1];
97802
97822
  if (!_allFieldsOfRecordInSignedPropertyNames(community)) return {
97803
97823
  valid: false,
97804
97824
  reason: messages.ERR_COMMUNITY_RECORD_INCLUDES_FIELD_NOT_IN_SIGNED_PROPERTY_NAMES
@@ -97812,11 +97832,11 @@ async function verifyCommunity({ community, communityIpnsName, resolveAuthorName
97812
97832
  reason: messages.ERR_COMMUNITY_SIGNATURE_IS_INVALID
97813
97833
  };
97814
97834
  const cacheIfValidWithDefault = typeof cacheIfValid === "boolean" ? cacheIfValid : true;
97815
- const cacheKey = (0, import_sha256.sha256)(community.signature.signature + validatePages + communityIpnsName);
97835
+ const cacheKey = (0, import_sha256.sha256)(community.signature.signature + validatePages + communityIpnsHops.join(","));
97816
97836
  if (cacheIfValidWithDefault && clientsManager._pkc._memCaches.communityVerificationCache.get(cacheKey)) return { valid: true };
97817
- const communityAddress = community.name || getPKCAddressFromPublicKeySync(community.signature.publicKey);
97837
+ const communityAddress = community.name || communityIdentityIpnsName;
97818
97838
  const communityForPages = {
97819
- publicKey: getPKCAddressFromPublicKeySync(community.signature.publicKey),
97839
+ publicKey: communityIdentityIpnsName,
97820
97840
  name: community.name,
97821
97841
  signature: community.signature
97822
97842
  };
@@ -97848,7 +97868,7 @@ async function verifyCommunity({ community, communityIpnsName, resolveAuthorName
97848
97868
  };
97849
97869
  }
97850
97870
  }
97851
- const communityPeerId = peerIdFromString(communityIpnsName);
97871
+ const communityPeerId = peerIdFromString(terminalIpnsName);
97852
97872
  const signaturePeerId = getPeerIdFromPublicKey(community.signature.publicKey);
97853
97873
  if (!communityPeerId.equals(signaturePeerId)) return {
97854
97874
  valid: false,
@@ -101600,14 +101620,14 @@ var CommentClientsManager = class extends PublicationClientsManager {
101600
101620
  };
101601
101621
  //#endregion
101602
101622
  //#region dist/node/runtime/node/util.js
101603
- const getDefaultDataPath = () => path$1.join(process.cwd(), ".pkc");
101623
+ const getDefaultDataPath = () => path.join(process.cwd(), ".pkc");
101604
101624
  const getDefaultCommunityDbConfig = async (communityAddress, pkc) => {
101605
101625
  let filename;
101606
101626
  if (pkc.noData) filename = ":memory:";
101607
101627
  else {
101608
101628
  assert(typeof pkc.dataPath === "string", "pkc.dataPath need to be defined to get default community db config");
101609
- filename = path$1.join(pkc.dataPath, "communities", communityAddress);
101610
- await promises.mkdir(path$1.dirname(filename), { recursive: true });
101629
+ filename = path.join(pkc.dataPath, "communities", communityAddress);
101630
+ await promises.mkdir(path.dirname(filename), { recursive: true });
101611
101631
  }
101612
101632
  return {
101613
101633
  filename,
@@ -101706,7 +101726,7 @@ const setNativeFunctions = (newNativeFunctions) => {
101706
101726
  };
101707
101727
  const deleteOldCommunityInWindows = async (subPath, pkc) => {
101708
101728
  const log = logger_default("pkc-js:community:deleteStaleCommunityInWindows");
101709
- const communityAddress = path$1.basename(subPath);
101729
+ const communityAddress = path.basename(subPath);
101710
101730
  await new Promise((resolve) => setTimeout(resolve, 1e4));
101711
101731
  try {
101712
101732
  await promises.rm(subPath, { force: true });
@@ -101730,7 +101750,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101730
101750
  }
101731
101751
  const communitiesThatWereDeletedSuccessfully = [];
101732
101752
  for (const communityAddress of deletedPersistentCommunities) {
101733
- const communityPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101753
+ const communityPath = path.join(pkc.dataPath, "communities", communityAddress);
101734
101754
  try {
101735
101755
  await promises.rm(communityPath, { force: true });
101736
101756
  log(`Succeeded in deleting old db path (${communityAddress})`);
@@ -101754,7 +101774,7 @@ async function tryToDeleteCommunitiesThatFailedToBeDeletedBefore(pkc, log) {
101754
101774
  function listCommunitiesSync(pkc) {
101755
101775
  logger_default("pkc-js:listCommunitiesSync");
101756
101776
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath needs to be defined to listCommunities");
101757
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101777
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101758
101778
  const files = readdirSync(communitiesPath, {
101759
101779
  recursive: false,
101760
101780
  withFileTypes: false
@@ -101762,7 +101782,7 @@ function listCommunitiesSync(pkc) {
101762
101782
  const communityFilesWeDontNeedToCheck = pkc.communities ? files.filter((address) => pkc.communities.includes(address)) : [];
101763
101783
  const sqliteFiles = files.filter((address) => !communityFilesWeDontNeedToCheck.includes(address)).filter((address) => {
101764
101784
  try {
101765
- const filePath = path$1.join(communitiesPath, address);
101785
+ const filePath = path.join(communitiesPath, address);
101766
101786
  if (!existsSync(filePath)) return false;
101767
101787
  const fd = openSync(filePath, "r");
101768
101788
  const buffer = Buffer.alloc(16);
@@ -101843,7 +101863,7 @@ var BackupAbortError = class extends Error {
101843
101863
  async function backupCommunityDb(opts) {
101844
101864
  const { sourcePath, destPath, includePrivateKey, onProgress, signal } = opts;
101845
101865
  if (signal?.aborted) throw new BackupAbortError();
101846
- await promises.mkdir(path$1.dirname(destPath), { recursive: true });
101866
+ await promises.mkdir(path.dirname(destPath), { recursive: true });
101847
101867
  const partialPath = destPath + ".partial";
101848
101868
  try {
101849
101869
  await promises.unlink(partialPath);
@@ -101927,9 +101947,9 @@ async function statAndHashFile(filePath) {
101927
101947
  }
101928
101948
  async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
101929
101949
  if (typeof pkc.dataPath !== "string") throw Error("pkc.dataPath is not defined");
101930
- const oldPath = path$1.join(pkc.dataPath, "communities", communityAddress);
101931
- const newPath = path$1.join(pkc.dataPath, "communities", "deleted", communityAddress);
101932
- await promises.mkdir(path$1.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101950
+ const oldPath = path.join(pkc.dataPath, "communities", communityAddress);
101951
+ const newPath = path.join(pkc.dataPath, "communities", "deleted", communityAddress);
101952
+ await promises.mkdir(path.join(pkc.dataPath, "communities", "deleted"), { recursive: true });
101933
101953
  if (!existsSync(oldPath)) throw Error(`Source database ${oldPath} does not exist`);
101934
101954
  try {
101935
101955
  const sourceDb = new Database(oldPath, { fileMustExist: true });
@@ -101950,7 +101970,7 @@ async function moveCommunityDbToDeletedDirectory(communityAddress, pkc) {
101950
101970
  }
101951
101971
  async function createKuboRpcClient(kuboRpcClientOptions) {
101952
101972
  logger_default("pkc-js:pkc:createKuboRpcClient").trace("Creating a new kubo client on node with options", kuboRpcClientOptions);
101953
- const { create: CreateKuboRpcClient } = await import("./src-4u0f92eE.js");
101973
+ const { create: CreateKuboRpcClient } = await import("./src-BEjAH2gY.js");
101954
101974
  const Agent$2 = typeof kuboRpcClientOptions.url === "string" && kuboRpcClientOptions.url.startsWith("https") || kuboRpcClientOptions?.protocol === "https" || kuboRpcClientOptions.url instanceof URL && kuboRpcClientOptions?.url?.protocol === "https:" || kuboRpcClientOptions.url?.toString()?.includes("https") ? Agent : Agent$1;
101955
101975
  const onehourMs = 1e3 * 60 * 60;
101956
101976
  return CreateKuboRpcClient({
@@ -101965,7 +101985,7 @@ async function createKuboRpcClient(kuboRpcClientOptions) {
101965
101985
  }
101966
101986
  async function monitorCommunitiesDirectory(pkc) {
101967
101987
  const watchAbortController = new AbortController();
101968
- const communitiesPath = path$1.join(pkc.dataPath, "communities");
101988
+ const communitiesPath = path.join(pkc.dataPath, "communities");
101969
101989
  await promises.mkdir(communitiesPath, { recursive: true });
101970
101990
  const extensionsToIgnore = [
101971
101991
  ".lock",
@@ -124316,6 +124336,18 @@ const decryptEd25519AesGcmPublicKeyBuffer = async (encrypted, privateKeyBase64,
124316
124336
  return decrypted;
124317
124337
  };
124318
124338
  //#endregion
124339
+ //#region dist/node/signer/ipns-record.js
124340
+ const ANCHOR_IPNS_RECORD_LIFETIME_MS = 100 * 365 * 24 * 60 * 60 * 1e3;
124341
+ async function createAnchorIpnsRecord({ anchorSigner, minterIpnsName, sequence }) {
124342
+ const { createIPNSRecord, marshalIPNSRecord } = await import("ipns");
124343
+ if (typeof minterIpnsName !== "string" || !minterIpnsName) throw Error("minterIpnsName must be a non-empty IPNS name");
124344
+ peerIdFromString(minterIpnsName);
124345
+ const seq = BigInt(sequence);
124346
+ if (seq < 0n) throw Error("sequence of an anchor IPNS record can not be negative");
124347
+ const ipfsKey = await getIpfsKeyFromPrivateKey(anchorSigner.privateKey);
124348
+ return marshalIPNSRecord(await createIPNSRecord(privateKeyFromProtobuf(new Uint8Array(ipfsKey)), `/ipns/${minterIpnsName}`, seq, ANCHOR_IPNS_RECORD_LIFETIME_MS));
124349
+ }
124350
+ //#endregion
124319
124351
  //#region dist/node/signer/index.js
124320
124352
  var Signer = class {
124321
124353
  constructor(props) {
@@ -125017,7 +125049,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
125017
125049
  abortSignal: this._community._getStopAbortSignal()
125018
125050
  });
125019
125051
  this._community.ipnsHops = ipnsHops;
125020
- const terminalIpnsName = ipnsHops[ipnsHops.length - 1];
125052
+ ipnsHops[ipnsHops.length - 1];
125021
125053
  log.trace(`Resolved community IPNS`, ipnsName, `to CID`, latestCommunityCid, `via hops`, ipnsHops);
125022
125054
  if (this._updateCidsAlreadyLoaded.has(latestCommunityCid)) {
125023
125055
  log.trace("Resolved community IPNS", ipnsName, "to a cid that we already loaded before. No need to fetch its ipfs", latestCommunityCid);
@@ -125050,8 +125082,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
125050
125082
  const communityIpfs = parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails(parseJsonWithPKCErrorIfFails(rawCommunityJsonString));
125051
125083
  const errInRecord = await this._findErrorInCommunityRecord({
125052
125084
  communityJson: communityIpfs,
125053
- anchorIpnsName: ipnsName,
125054
- terminalIpnsName,
125085
+ communityIpnsHops: ipnsHops,
125055
125086
  cidOfCommunityIpns: latestCommunityCid
125056
125087
  });
125057
125088
  if (errInRecord) throw errInRecord;
@@ -125129,8 +125160,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
125129
125160
  gatewayFetches[gatewayUrl].ipnsHops = ipnsHops;
125130
125161
  const errorWithinRecord = await this._findErrorInCommunityRecord({
125131
125162
  communityJson: communityIpfs,
125132
- anchorIpnsName: ipnsName,
125133
- terminalIpnsName,
125163
+ communityIpnsHops: ipnsHops,
125134
125164
  cidOfCommunityIpns: calculatedCommunityCidFromBody
125135
125165
  });
125136
125166
  if (errorWithinRecord) {
@@ -125300,7 +125330,9 @@ var CommunityClientsManager = class extends PKCClientsManager {
125300
125330
  });
125301
125331
  }
125302
125332
  }
125303
- async _findErrorInCommunityRecord({ communityJson, anchorIpnsName, terminalIpnsName, cidOfCommunityIpns }) {
125333
+ async _findErrorInCommunityRecord({ communityJson, communityIpnsHops, cidOfCommunityIpns }) {
125334
+ const anchorIpnsName = communityIpnsHops[0];
125335
+ const terminalIpnsName = communityIpnsHops[communityIpnsHops.length - 1];
125304
125336
  const communityInstanceAddress = this._getCommunityAddressFromInstance();
125305
125337
  const recordAddress = this._deriveAddressFromWireRecord(communityJson);
125306
125338
  const addressMatchesInstance = this._areEquivalentCommunityAddresses(recordAddress, communityInstanceAddress);
@@ -125329,7 +125361,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
125329
125361
  });
125330
125362
  const verificationOpts = {
125331
125363
  community: communityJson,
125332
- communityIpnsName: terminalIpnsName,
125364
+ communityIpnsHops,
125333
125365
  resolveAuthorNames: this._pkc.resolveAuthorNames,
125334
125366
  clientsManager: this,
125335
125367
  validatePages: this._pkc.validatePages,
@@ -125868,11 +125900,11 @@ var AddressRewriterDatabase = class {
125868
125900
  if (kuboConfig && typeof kuboConfig === "object" && "host" in kuboConfig && "port" in kuboConfig) kuboIdentifier = `${kuboConfig.host}_${kuboConfig.port}`;
125869
125901
  const proxyIdentifier = `${proxyTarget.hostname}_${proxyTarget.port || (proxyTarget.protocol === "https:" ? "443" : "80")}`;
125870
125902
  const fileName = `address_rewriter_${kuboIdentifier}_${proxyIdentifier}.db`;
125871
- return path.join(dataPath, ".address-rewriter", fileName);
125903
+ return Path.join(dataPath, ".address-rewriter", fileName);
125872
125904
  }
125873
125905
  async initialize() {
125874
125906
  try {
125875
- const dbDir = path.dirname(this._dbPath);
125907
+ const dbDir = Path.dirname(this._dbPath);
125876
125908
  await fsp.mkdir(dbDir, { recursive: true });
125877
125909
  this._db = new Database(this._dbPath);
125878
125910
  this._db.exec(`
@@ -129421,6 +129453,8 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
129421
129453
  community: this.raw.communityIpfs,
129422
129454
  localCommunity: {
129423
129455
  signer: this.signer,
129456
+ anchor: this.anchor,
129457
+ anchorRecordSequence: this.anchorRecordSequence,
129424
129458
  settings: this.settings,
129425
129459
  _usingDefaultChallenge: this._usingDefaultChallenge,
129426
129460
  address: this.address,
@@ -129440,13 +129474,21 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
129440
129474
  ...this._toJSONIpfsBaseNoPosts(),
129441
129475
  address: this.address,
129442
129476
  signer: this.signer,
129477
+ anchor: this.anchor,
129478
+ anchorRecordSequence: this.anchorRecordSequence,
129443
129479
  settings: this.settings,
129444
129480
  _usingDefaultChallenge: this._usingDefaultChallenge,
129445
129481
  started: this.started,
129446
129482
  startedState: this.startedState
129447
129483
  } };
129448
129484
  }
129485
+ _replayAnchorIntoIpnsHops(localProps) {
129486
+ this.anchor = localProps.anchor;
129487
+ this.anchorRecordSequence = localProps.anchorRecordSequence;
129488
+ if (localProps.anchor) this.ipnsHops = [localProps.anchor.publicKey, localProps.signer.address];
129489
+ }
129449
129490
  initRpcInternalCommunityBeforeFirstUpdateNoMerge(newProps) {
129491
+ this._replayAnchorIntoIpnsHops(newProps.localCommunity);
129450
129492
  this.initRemoteCommunityPropsNoMerge(newProps.localCommunity);
129451
129493
  if (newProps.localCommunity.address) this.setAddress(newProps.localCommunity.address);
129452
129494
  this.signer = newProps.localCommunity.signer;
@@ -129456,6 +129498,7 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
129456
129498
  this.raw.localCommunity = newProps;
129457
129499
  }
129458
129500
  initRpcInternalCommunityAfterFirstUpdateNoMerge(newProps) {
129501
+ this._replayAnchorIntoIpnsHops(newProps.localCommunity);
129459
129502
  super.initCommunityIpfsPropsNoMerge(newProps.community);
129460
129503
  if (newProps.localCommunity.address) this.setAddress(newProps.localCommunity.address);
129461
129504
  this.signer = newProps.localCommunity.signer;
@@ -129583,6 +129626,21 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
129583
129626
  this.started = false;
129584
129627
  untrackStartedCommunity(this._pkc, this);
129585
129628
  }
129629
+ async prepareAnchorPublish() {
129630
+ return this._pkc._pkcRpcClient.prepareAnchorPublish({
129631
+ name: this.name,
129632
+ publicKey: this.publicKey
129633
+ });
129634
+ }
129635
+ async publishAnchorRecord(recordBytes) {
129636
+ const result = await this._pkc._pkcRpcClient.publishAnchorRecord({
129637
+ name: this.name,
129638
+ publicKey: this.publicKey,
129639
+ recordBase64: toString(recordBytes, "base64")
129640
+ });
129641
+ this.anchorRecordSequence = result.sequence;
129642
+ return result;
129643
+ }
129586
129644
  async stop() {
129587
129645
  this.posts._stop();
129588
129646
  if (this.state === "updating") return super.stop();
@@ -129728,4 +129786,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
129728
129786
  }
129729
129787
  };
129730
129788
  //#endregion
129731
- export { RepliesPages as $, t$8 as $n, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as $t, deriveDbPosts as A, RpcCidParamSchema as An, verifyCommunityEdit as At, setNativeFunctions as B, RpcFetchCidResultSchema as Bn, getCommunityPublicKeyFromWire as Bt, BackupAbortError as C, parseRpcCommentEventWithPKCErrorIfItFails as Cn, verifyChallengeVerification as Ct, createKuboRpcClient as D, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Dn, verifyCommentPubsubMessage as Dt, calculateInlineRepliesBudget as E, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as En, verifyCommentModeration as Et, importSignerIntoKuboNode as F, RpcExportCommunityModLogsParamSchema as Fn, getAuthorNameFromWire as Ft, REPLY_REPLIES_SORT_TYPES as G, RpcUnsubscribeParamSchema as Gn, getIpfsKeyFromPrivateKey as Gt, CommentClientsManager as H, RpcResolveAuthorNameResultSchema as Hn, decode as Ht, listCommunitiesSync as I, RpcExportCommunityModLogsResultSchema as In, normalizeCreatePublicationAuthor as It, buildPagesRuntimeFields as J, r as Jn, getPublicKeyFromPrivateKey as Jt, TIMEFRAMES_TO_SECONDS as K, t$2 as Kn, getPKCAddressFromPublicKey as Kt, monitorCommunitiesDirectory as L, RpcExportCommunityParamSchema as Ln, buildRuntimeCommunityFields as Lt, getDefaultCommunityDbConfig as M, RpcCommunityIdentifierParamSchema as Mn, buildRuntimeAuthor as Mt, getDefaultDataPath as N, RpcCommunityPageParamSchema as Nn, cleanWireAuthor as Nt, deleteOldCommunityInWindows as O, RpcAuthorNameParamSchema as On, verifyCommentUpdate as Ot, getThumbnailPropsOfLink as P, RpcEditCommunityParamSchema as Pn, getAuthorNameFromRuntime as Pt, parseRawPages as Q, t$7 as Qn, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Qt, moveCommunityDbToDeletedDirectory as R, RpcExportCommunityResultSchema as Rn, getCommunityAddressFromRecord as Rt, encryptEd25519AesGcmPublicKeyBuffer as S, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Sn, verifyChallengeRequest as St, calculateExpectedSignatureSize as T, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as Tn, verifyCommentIpfs as Tt, POSTS_SORT_TYPES as U, RpcSubscriptionIdResultSchema as Un, encode as Ut, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as V, RpcPublishChallengeAnswersParamSchema as Vn, normalizeCommunityInputFromCommunity as Vt, POST_REPLIES_SORT_TYPES as W, RpcSuccessResultSchema as Wn, getBufferedPKCAddressFromPublicKey as Wt, findCommentInPageInstanceRecursively as X, n$5 as Xn, parseCidStringSchemaWithPKCErrorIfItFails as Xt, extractCommunityRuntimeFieldsFromParsedPages as Y, t$5 as Yn, createSchemaRowParser as Yt, iterateOverPageCidsToFindAllCids as Z, n$6 as Zn, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Zt, SignerWithPublicKeyAddress as _, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as _n, signCommunity as _t, pkcJsChallenges as a, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as an, PKCTypedEmitter as at, decryptEd25519AesGcmPublicKeyBuffer as b, parseDecryptedChallengeWithPKCErrorIfItFails as bn, verifyChallengeAnswer as bt, AddressesRewriterProxyServer as c, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as cn, signChallengeAnswer as ct, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as d, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as dn, signChallengeVerification as dt, parseCommentIpfsSchemaWithPKCErrorIfItFails as en, stringify as er, PublicationClientsManager as et, KeyvBetterSqlite3 as f, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as fn, signComment as ft, decodeRpcChallengeVerificationPubsubMsg as g, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as gn, signCommentUpdateForChallengeVerification as gt, decodeRpcChallengeRequestPubsubMsg as h, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as hn, signCommentUpdate as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommunityAddressWithPKCErrorIfItFails as in, require_undici as ir, pLimit as it, deriveDbReplies as j, RpcCommentRepliesPageParamSchema as jn, verifyVote as jt, deriveCommentIpfsFromCommentTableRow as k, RpcCancelExportParamSchema as kn, verifyCommunity as kt, normalizeSelfAddrsForProvider as l, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as ln, signChallengeMessage as lt, decodeRpcChallengePubsubMsg as m, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as mn, signCommentModeration as mt, RpcRemoteCommunity as n, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as nn, require_lodash_merge as nr, InflightFetchManager as nt, TrackedInstanceRegistry as o, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as on, require_lib$1 as ot, decodeRpcChallengeAnswerPubsubMsg as p, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as pn, signCommentEdit as pt, buildPageRuntimeFields as q, t$4 as qn, getPKCAddressFromPublicKeySync as qt, getChallengeVerification as r, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as rn, nativeFunctions$1 as rr, pRetry as rt, LRUCache as s, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as sn, cleanUpBeforePublishing as st, RpcLocalCommunity as t, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as tn, STORAGE_KEYS as tr, PKCClientsManager as tt, RemoteCommunity as u, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as un, signChallengeRequest as ut, createSigner as v, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as vn, signCommunityEdit as vt, backupCommunityDb as w, parseRpcCommentUpdateEventWithPKCErrorIfItFails as wn, verifyCommentEdit as wt, encryptEd25519AesGcm as x, parseJsonWithPKCErrorIfFails as xn, verifyChallengeMessage as xt, decryptEd25519AesGcm as y, parseDecryptedChallengeVerification as yn, signVote as yt, resolveDbPostsCidRefs as z, RpcFetchCidParamSchema as zn, getCommunityNameFromWire$1 as zt };
129789
+ export { parseRawPages as $, t$5 as $n, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as $t, deriveCommentIpfsFromCommentTableRow as A, RpcAuthorNameParamSchema as An, verifyCommunity as At, resolveDbPostsCidRefs as B, RpcExportCommunityResultSchema as Bn, getCommunityNameFromWire$1 as Bt, encryptEd25519AesGcmPublicKeyBuffer as C, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as Cn, verifyChallengeRequest as Ct, calculateInlineRepliesBudget as D, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Dn, verifyCommentModeration as Dt, calculateExpectedSignatureSize as E, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as En, verifyCommentIpfs as Et, getThumbnailPropsOfLink as F, RpcCommunityPageParamSchema as Fn, getAuthorNameFromRuntime as Ft, POST_REPLIES_SORT_TYPES as G, RpcPublishedAnchorRecordResultSchema as Gn, getBufferedPKCAddressFromPublicKey as Gt, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as H, RpcFetchCidResultSchema as Hn, normalizeCommunityInputFromCommunity as Ht, importSignerIntoKuboNode as I, RpcEditCommunityParamSchema as In, getAuthorNameFromWire as It, buildPageRuntimeFields as J, RpcSuccessResultSchema as Jn, getPKCAddressFromPublicKeySync as Jt, REPLY_REPLIES_SORT_TYPES as K, RpcResolveAuthorNameResultSchema as Kn, getIpfsKeyFromPrivateKey as Kt, listCommunitiesSync as L, RpcExportCommunityModLogsParamSchema as Ln, normalizeCreatePublicationAuthor as Lt, deriveDbReplies as M, RpcCidParamSchema as Mn, verifyVote as Mt, getDefaultCommunityDbConfig as N, RpcCommentRepliesPageParamSchema as Nn, buildRuntimeAuthor as Nt, createKuboRpcClient as O, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as On, verifyCommentPubsubMessage as Ot, getDefaultDataPath as P, RpcCommunityIdentifierParamSchema as Pn, cleanWireAuthor as Pt, iterateOverPageCidsToFindAllCids as Q, r as Qn, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Qt, monitorCommunitiesDirectory as R, RpcExportCommunityModLogsResultSchema as Rn, buildRuntimeCommunityFields as Rt, encryptEd25519AesGcm as S, parseJsonWithPKCErrorIfFails as Sn, verifyChallengeMessage as St, backupCommunityDb as T, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Tn, verifyCommentEdit as Tt, CommentClientsManager as U, RpcPublishAnchorRecordParamSchema as Un, decode as Ut, setNativeFunctions as V, RpcFetchCidParamSchema as Vn, getCommunityPublicKeyFromWire as Vt, POSTS_SORT_TYPES as W, RpcPublishChallengeAnswersParamSchema as Wn, encode as Wt, extractCommunityRuntimeFieldsFromParsedPages as X, t$2 as Xn, createSchemaRowParser as Xt, buildPagesRuntimeFields as Y, RpcUnsubscribeParamSchema as Yn, getPublicKeyFromPrivateKey as Yt, findCommentInPageInstanceRecursively as Z, t$4 as Zn, parseCidStringSchemaWithPKCErrorIfItFails as Zt, SignerWithPublicKeyAddress as _, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as _n, signCommentUpdateForChallengeVerification as _t, pkcJsChallenges as a, parseCommunityAddressWithPKCErrorIfItFails as an, STORAGE_KEYS as ar, pLimit as at, decryptEd25519AesGcm as b, parseDecryptedChallengeVerification as bn, signVote as bt, AddressesRewriterProxyServer as c, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as cn, require_undici as cr, cleanUpBeforePublishing as ct, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as d, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as dn, signChallengeRequest as dt, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as en, n$5 as er, RepliesPages as et, KeyvBetterSqlite3 as f, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as fn, signChallengeVerification as ft, decodeRpcChallengeVerificationPubsubMsg as g, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as gn, signCommentUpdate as gt, decodeRpcChallengeRequestPubsubMsg as h, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as hn, signCommentModeration as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as in, stringify as ir, pRetry as it, deriveDbPosts as j, RpcCancelExportParamSchema as jn, verifyCommunityEdit as jt, deleteOldCommunityInWindows as k, RpcAnchorPublishPreparationResultSchema as kn, verifyCommentUpdate as kt, normalizeSelfAddrsForProvider as l, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as ln, signChallengeAnswer as lt, decodeRpcChallengePubsubMsg as m, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as mn, signCommentEdit as mt, RpcRemoteCommunity as n, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as nn, t$7 as nr, PKCClientsManager as nt, TrackedInstanceRegistry as o, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as on, require_lodash_merge as or, PKCTypedEmitter as ot, decodeRpcChallengeAnswerPubsubMsg as p, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as pn, signComment as pt, TIMEFRAMES_TO_SECONDS as q, RpcSubscriptionIdResultSchema as qn, getPKCAddressFromPublicKey as qt, getChallengeVerification as r, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as rn, t$8 as rr, InflightFetchManager as rt, LRUCache as s, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as sn, nativeFunctions$1 as sr, require_lib$1 as st, RpcLocalCommunity as t, parseCommentIpfsSchemaWithPKCErrorIfItFails as tn, n$6 as tr, PublicationClientsManager as tt, RemoteCommunity as u, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as un, signChallengeMessage as ut, createSigner as v, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as vn, signCommunity as vt, BackupAbortError as w, parseRpcCommentEventWithPKCErrorIfItFails as wn, verifyChallengeVerification as wt, decryptEd25519AesGcmPublicKeyBuffer as x, parseDecryptedChallengeWithPKCErrorIfItFails as xn, verifyChallengeAnswer as xt, createAnchorIpnsRecord as y, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as yn, signCommunityEdit as yt, moveCommunityDbToDeletedDirectory as z, RpcExportCommunityParamSchema as zn, getCommunityAddressFromRecord as zt };