@pkcprotocol/pkc-js 0.0.102 → 0.0.104
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.
- package/README.md +35 -8
- package/dist/browser/clients/base-client-manager.d.ts +1 -0
- package/dist/browser/clients/base-client-manager.js +72 -11
- package/dist/browser/clients/base-client-manager.js.map +1 -1
- package/dist/browser/community/community-client-manager.d.ts +3 -0
- package/dist/browser/community/community-client-manager.js +87 -14
- package/dist/browser/community/community-client-manager.js.map +1 -1
- package/dist/browser/community/remote-community.js +3 -0
- package/dist/browser/community/remote-community.js.map +1 -1
- package/dist/browser/community/schema.d.ts +4 -0
- package/dist/browser/community/schema.js +7 -1
- package/dist/browser/community/schema.js.map +1 -1
- package/dist/browser/constants.d.ts +3 -0
- package/dist/browser/constants.js +35 -0
- package/dist/browser/constants.js.map +1 -1
- package/dist/browser/errors.d.ts +5 -1
- package/dist/browser/errors.js +7 -1
- package/dist/browser/errors.js.map +1 -1
- package/dist/browser/generated-version.d.ts +1 -1
- package/dist/browser/generated-version.js +1 -1
- package/dist/browser/index-with-compile-cache.d.ts +2 -0
- package/dist/browser/index.d.ts +2 -0
- package/dist/browser/pkc/pkc.d.ts +4 -0
- package/dist/browser/pkc/pkc.js +30 -1
- package/dist/browser/pkc/pkc.js.map +1 -1
- package/dist/browser/pkc-error.d.ts +1 -1
- package/dist/browser/publications/comment/comment-client-manager.js +11 -0
- package/dist/browser/publications/comment/comment-client-manager.js.map +1 -1
- package/dist/browser/publications/comment/comment.js +8 -6
- package/dist/browser/publications/comment/comment.js.map +1 -1
- package/dist/browser/publications/comment/crosspost-runtime.js +3 -2
- package/dist/browser/publications/comment/crosspost-runtime.js.map +1 -1
- package/dist/browser/rpc/src/index.js +6 -0
- package/dist/browser/rpc/src/index.js.map +1 -1
- package/dist/browser/rpc/src/lib/pkc-js/index.d.ts +1 -0
- package/dist/browser/rpc/src/schema.d.ts +6 -0
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.d.ts +11 -1
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.js +32 -21
- package/dist/browser/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/index.d.ts +10 -3
- package/dist/browser/runtime/node/community/challenges/index.js +82 -16
- package/dist/browser/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +7 -4
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +13 -5
- package/dist/browser/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/author-identity.d.ts +37 -2
- package/dist/browser/runtime/node/community/local-community/author-identity.js +73 -13
- package/dist/browser/runtime/node/community/local-community/author-identity.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/challenges.d.ts +16 -2
- package/dist/browser/runtime/node/community/local-community/challenges.js +40 -9
- package/dist/browser/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/editing.js +7 -2
- package/dist/browser/runtime/node/community/local-community/editing.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-store.d.ts +13 -2
- package/dist/browser/runtime/node/community/local-community/publication-store.js +29 -7
- package/dist/browser/runtime/node/community/local-community/publication-store.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community/publication-validation.d.ts +13 -3
- package/dist/browser/runtime/node/community/local-community/publication-validation.js +63 -28
- package/dist/browser/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/browser/runtime/node/community/local-community.d.ts +2 -2
- package/dist/browser/runtime/node/community/local-community.js +6 -4
- package/dist/browser/runtime/node/community/local-community.js.map +1 -1
- package/dist/browser/schema.d.ts +8 -0
- package/dist/browser/types.d.ts +1 -0
- package/dist/bundled/bundle-manifest.json +26 -26
- package/dist/bundled/chunks/{helia-for-pkc-ZbhRl9a-.js → helia-for-pkc-CQM2gwO-.js} +2 -2
- package/dist/bundled/chunks/{local-community-Cu95rtju.js → local-community-CaK2PibY.js} +1 -1
- package/dist/bundled/chunks/{local-community-L-1IkV1x.js → local-community-Cad8EnIh.js} +160 -61
- package/dist/bundled/chunks/{node-DaN6R9HB.js → node-C6LbmJAq.js} +19 -8
- package/dist/bundled/chunks/{rpc-local-community-aV790d8_.js → rpc-local-community-Dciiw7xH.js} +275 -103
- package/dist/bundled/chunks/{schema-gif6qroG.js → schema-CRAfzWYa.js} +8 -3
- package/dist/bundled/chunks/{util-BsJoElMm.js → util-BWhDfSw9.js} +1 -1
- package/dist/bundled/index.js +1 -1
- package/dist/bundled/rpc/src/index.js +9 -4
- package/dist/node/clients/base-client-manager.d.ts +1 -0
- package/dist/node/clients/base-client-manager.js +72 -11
- package/dist/node/clients/base-client-manager.js.map +1 -1
- package/dist/node/community/community-client-manager.d.ts +3 -0
- package/dist/node/community/community-client-manager.js +87 -14
- package/dist/node/community/community-client-manager.js.map +1 -1
- package/dist/node/community/remote-community.js +3 -0
- package/dist/node/community/remote-community.js.map +1 -1
- package/dist/node/community/schema.d.ts +4 -0
- package/dist/node/community/schema.js +7 -1
- package/dist/node/community/schema.js.map +1 -1
- package/dist/node/constants.d.ts +3 -0
- package/dist/node/constants.js +35 -0
- package/dist/node/constants.js.map +1 -1
- package/dist/node/errors.d.ts +5 -1
- package/dist/node/errors.js +7 -1
- package/dist/node/errors.js.map +1 -1
- package/dist/node/generated-version.d.ts +1 -1
- package/dist/node/generated-version.js +1 -1
- package/dist/node/index-with-compile-cache.d.ts +2 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/pkc/pkc.d.ts +4 -0
- package/dist/node/pkc/pkc.js +30 -1
- package/dist/node/pkc/pkc.js.map +1 -1
- package/dist/node/pkc-error.d.ts +1 -1
- package/dist/node/publications/comment/comment-client-manager.js +11 -0
- package/dist/node/publications/comment/comment-client-manager.js.map +1 -1
- package/dist/node/publications/comment/comment.js +8 -6
- package/dist/node/publications/comment/comment.js.map +1 -1
- package/dist/node/publications/comment/crosspost-runtime.js +3 -2
- package/dist/node/publications/comment/crosspost-runtime.js.map +1 -1
- package/dist/node/rpc/src/index.js +6 -0
- package/dist/node/rpc/src/index.js.map +1 -1
- package/dist/node/rpc/src/lib/pkc-js/index.d.ts +1 -0
- package/dist/node/rpc/src/schema.d.ts +6 -0
- package/dist/node/runtime/node/community/challenges/exclude/exclude.d.ts +11 -1
- package/dist/node/runtime/node/community/challenges/exclude/exclude.js +32 -21
- package/dist/node/runtime/node/community/challenges/exclude/exclude.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/index.d.ts +10 -3
- package/dist/node/runtime/node/community/challenges/index.js +82 -16
- package/dist/node/runtime/node/community/challenges/index.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js +7 -4
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/blacklist.js.map +1 -1
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js +13 -5
- package/dist/node/runtime/node/community/challenges/pkc-js-challenges/whitelist.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/author-identity.d.ts +37 -2
- package/dist/node/runtime/node/community/local-community/author-identity.js +73 -13
- package/dist/node/runtime/node/community/local-community/author-identity.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/challenges.d.ts +16 -2
- package/dist/node/runtime/node/community/local-community/challenges.js +40 -9
- package/dist/node/runtime/node/community/local-community/challenges.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/editing.js +7 -2
- package/dist/node/runtime/node/community/local-community/editing.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-store.d.ts +13 -2
- package/dist/node/runtime/node/community/local-community/publication-store.js +29 -7
- package/dist/node/runtime/node/community/local-community/publication-store.js.map +1 -1
- package/dist/node/runtime/node/community/local-community/publication-validation.d.ts +13 -3
- package/dist/node/runtime/node/community/local-community/publication-validation.js +63 -28
- package/dist/node/runtime/node/community/local-community/publication-validation.js.map +1 -1
- package/dist/node/runtime/node/community/local-community.d.ts +2 -2
- package/dist/node/runtime/node/community/local-community.js +6 -4
- package/dist/node/runtime/node/community/local-community.js.map +1 -1
- package/dist/node/schema.d.ts +8 -0
- package/dist/node/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/bundled/chunks/{rpc-local-community-aV790d8_.js → rpc-local-community-Dciiw7xH.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-2rV9d50f.js";
|
|
2
|
-
import { $ as isRequestPubsubPublicationOfReply, $n as CommunityAuthorChallengeReservedFieldNames, $t as ChallengeFileFactorySchema, A as doesDomainAddressHaveCapitalLetter, An as CommentUpdateReservedFields, Ar as boolean, B as ipnsNameToIpnsOverPubsubTopic, Cn as CommentIpfsSchema, Cr as messages, D as createAbortError, Dn as CommentUpdateChallengeReservedFieldNames, Dt as listStartedCommunities, En as CommentSignedPropertyNames, Er as require_ms$1, Et as findUpdatingCommunity, Fn as CreateCommentOptionsWithRefinementSchema, Fr as record, Ft as trackUpdatingCommunity, G as isIpnsPath, Gn as CreateCommentEditOptionsWithRefinementSchema, Gt as CommunityEditPubsubMessagePublicationSchema, H as isIpfsCid, Ht as CommunityEditPublicationChallengeRequestToEncryptSchema, In as GetPageParamSchema, Ir as string, It as untrackStartedCommunity, Jt as CommentModerationPubsubMessagePublicationSchema, Kn as AuthorAddressSchema, Kt as CreateCommunityEditPublicationOptionsWithRefinementSchema, L as getPostUpdateTimestampRange, Ln as ModQueuePageIpfsSchema, Lt as untrackUpdatingComment, M as fetchAndValidateIpnsRecordFromGateway, Mn as CommentUpdateSignedPropertyNames, Mr as literal, Nr as number, Nt as trackStartedCommunity, O as deepMergeRuntimeFields, Or as _enum, Pr as object, Q as isRequestPubsubPublicationOfPost, Qn as CommunityAddressSchema, Qt as CreateCommentModerationOptionsWithRefinementSchema, R as hideClassPrivateProps, Rn as PageIpfsSchema, Rt as untrackUpdatingCommunity, S as calculateIpfsCidV0, Sn as CommentIpfsReservedFields, Sr as PKCError, Tn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Tr as require_supports_color, Tt as findUpdatingComment, U as isIpfsPath, Un as CommentEditSignedPropertyNames, V as isAbortError, Vn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Vt as pTimeout, W as isIpns, Wt as CommunityEditPublicationSignedPropertyNames, Xn as CidPathSchema, Xt as CommentModerationSignedPropertyNames, Yn as ChallengeAnswersSchema, Zn as CidStringSchema, Zt as CommentModerationsTableRowSchema, _ as PKCUserOptionBaseSchema, _n as VotePubsubMessagePublicationSchema, _r as FailedToFetchCommentIpfsFromGatewaysError, _t as sleepUntilTimeoutOrAbort, an as CommunityIpfsReservedFields, ar as t$13, b as areEquivalentCommunityAddresses, br as FailedToFetchGenericIpfsFromGatewaysError, bt as timestamp, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateNewLocalCommunityUserOptionsSchema, cr as t$11, dn as ExportCommunityModLogsOptionsSchema, dr as n$8, dt as resolveWhenPredicateIsTrue, en as ChallengeFileSchema, er as CreateSignerSchema, et as pubsubTopicToDhtKey, f as DecryptedChallengeSchema, fr as r$7, g as PKCParsedOptionsSchema, gn as VoteChallengeRequestToEncryptSchema, gr as require_retry$1, gt as shortifyCid, h as NameResolverSerializedSchema, hn as CreateVoteUserOptionsWithRefinementSchema, hr as e$4, ht as shortifyAddress, i as ChallengeMessageSignedPropertyNames, in as CommunityExportRecordsSchema, j as extractNetworkErrorDetails, jn as CommentUpdateSchema, jr as custom, jt as refreshTrackedCommunityAliases, k as derivePublicationFromChallengeRequest, kn as CommentUpdateForChallengeVerificationSignedPropertyNames, kr as array, kt as listUpdatingCommunities, l as DecryptedChallengeAnswerSchema, ln as CreateRemoteCommunityFunctionArgumentSchema, lr as r$8, m as NameResolveCacheOptionsSchema, mn as isStringDomain, mr as t$9, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityChallengeSettingSchema, nt as raceAgainstAbort, o as ChallengeRequestMessageSignedPropertyNames, on as CommunityIpfsSchema, or as e$6, p as DecryptedChallengeVerificationSchema, pn as RpcRemoteCommunityUpdateEventResultSchema, pr as t$10, qn as AuthorCommentIpfsReservedFields, qt as CommentModerationChallengeRequestToEncryptSchema, rn as CommunityEditOptionsSchema, rr as n$9, sn as CommunitySignedPropertyNames, sr as e$5, st as removeNullUndefinedEmptyObjectsValuesRecursively, tr as n$10, un as CreateRpcCommunityFunctionArgumentSchema, ur as t$12, v as PKCUserOptionsSchema, vr as FailedToFetchCommentUpdateFromGatewaysError, wr as logger_default, wt as findStartedCommunity, xn as CommentChallengeRequestToEncryptSchema, xr as FailedToFetchPageIpfsFromGatewaysError, xt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, yn as VoteSignedPropertyNames, yr as FailedToFetchCommunityFromGatewaysError, yt as throwIfAbortSignalAborted, z as interruptibleSleep, zn as CommentEditChallengeRequestToEncryptSchema, zt as require_sha256$1 } from "./schema-
|
|
2
|
+
import { $ as isRequestPubsubPublicationOfReply, $n as CommunityAuthorChallengeReservedFieldNames, $t as ChallengeFileFactorySchema, A as doesDomainAddressHaveCapitalLetter, An as CommentUpdateReservedFields, Ar as boolean, B as ipnsNameToIpnsOverPubsubTopic, Cn as CommentIpfsSchema, Cr as messages, D as createAbortError, Dn as CommentUpdateChallengeReservedFieldNames, Dt as listStartedCommunities, En as CommentSignedPropertyNames, Er as require_ms$1, Et as findUpdatingCommunity, Fn as CreateCommentOptionsWithRefinementSchema, Fr as record, Ft as trackUpdatingCommunity, G as isIpnsPath, Gn as CreateCommentEditOptionsWithRefinementSchema, Gt as CommunityEditPubsubMessagePublicationSchema, H as isIpfsCid, Ht as CommunityEditPublicationChallengeRequestToEncryptSchema, In as GetPageParamSchema, Ir as string, It as untrackStartedCommunity, Jt as CommentModerationPubsubMessagePublicationSchema, Kn as AuthorAddressSchema, Kt as CreateCommunityEditPublicationOptionsWithRefinementSchema, L as getPostUpdateTimestampRange, Ln as ModQueuePageIpfsSchema, Lt as untrackUpdatingComment, M as fetchAndValidateIpnsRecordFromGateway, Mn as CommentUpdateSignedPropertyNames, Mr as literal, Nr as number, Nt as trackStartedCommunity, O as deepMergeRuntimeFields, Or as _enum, Pr as object, Q as isRequestPubsubPublicationOfPost, Qn as CommunityAddressSchema, Qt as CreateCommentModerationOptionsWithRefinementSchema, R as hideClassPrivateProps, Rn as PageIpfsSchema, Rt as untrackUpdatingCommunity, S as calculateIpfsCidV0, Sn as CommentIpfsReservedFields, Sr as PKCError, Tn as CommentPubsubMessageWithFlexibleAuthorRefinementSchema, Tr as require_supports_color, Tt as findUpdatingComment, U as isIpfsPath, Un as CommentEditSignedPropertyNames, V as isAbortError, Vn as CommentEditPubsubMessagePublicationWithFlexibleAuthorSchema, Vt as pTimeout, W as isIpns, Wt as CommunityEditPublicationSignedPropertyNames, Xn as CidPathSchema, Xt as CommentModerationSignedPropertyNames, Yn as ChallengeAnswersSchema, Zn as CidStringSchema, Zt as CommentModerationsTableRowSchema, _ as PKCUserOptionBaseSchema, _n as VotePubsubMessagePublicationSchema, _r as FailedToFetchCommentIpfsFromGatewaysError, _t as sleepUntilTimeoutOrAbort, an as CommunityIpfsReservedFields, ar as t$13, b as areEquivalentCommunityAddresses, br as FailedToFetchGenericIpfsFromGatewaysError, bt as timestamp, c as ChallengeVerificationMessageSignedPropertyNames, cn as CreateNewLocalCommunityUserOptionsSchema, cr as t$11, dn as ExportCommunityModLogsOptionsSchema, dr as n$8, dt as resolveWhenPredicateIsTrue, en as ChallengeFileSchema, er as CreateSignerSchema, et as pubsubTopicToDhtKey, f as DecryptedChallengeSchema, fr as r$7, g as PKCParsedOptionsSchema, gn as VoteChallengeRequestToEncryptSchema, gr as require_retry$1, gt as shortifyCid, h as NameResolverSerializedSchema, hn as CreateVoteUserOptionsWithRefinementSchema, hr as e$4, ht as shortifyAddress, i as ChallengeMessageSignedPropertyNames, in as CommunityExportRecordsSchema, j as extractNetworkErrorDetails, jn as CommentUpdateSchema, jr as custom, jt as refreshTrackedCommunityAliases, k as derivePublicationFromChallengeRequest, kn as CommentUpdateForChallengeVerificationSignedPropertyNames, kr as array, kt as listUpdatingCommunities, l as DecryptedChallengeAnswerSchema, ln as CreateRemoteCommunityFunctionArgumentSchema, lr as r$8, m as NameResolveCacheOptionsSchema, mn as isStringDomain, mr as t$9, n as ChallengeAnswerMessageSignedPropertyNames, nn as CommunityChallengeSettingSchema, nt as raceAgainstAbort, o as ChallengeRequestMessageSignedPropertyNames, on as CommunityIpfsSchema, or as e$6, p as DecryptedChallengeVerificationSchema, pn as RpcRemoteCommunityUpdateEventResultSchema, pr as t$10, qn as AuthorCommentIpfsReservedFields, qt as CommentModerationChallengeRequestToEncryptSchema, rn as CommunityEditOptionsSchema, rr as n$9, sn as CommunitySignedPropertyNames, sr as e$5, st as removeNullUndefinedEmptyObjectsValuesRecursively, tr as n$10, un as CreateRpcCommunityFunctionArgumentSchema, ur as t$12, v as PKCUserOptionsSchema, vr as FailedToFetchCommentUpdateFromGatewaysError, wr as logger_default, wt as findStartedCommunity, xn as CommentChallengeRequestToEncryptSchema, xr as FailedToFetchPageIpfsFromGatewaysError, xt as waitForUpdateInCommunityInstanceWithErrorAndTimeout, yn as VoteSignedPropertyNames, yr as FailedToFetchCommunityFromGatewaysError, yt as throwIfAbortSignalAborted, z as interruptibleSleep, zn as CommentEditChallengeRequestToEncryptSchema, zt as require_sha256$1 } from "./schema-CRAfzWYa.js";
|
|
3
3
|
import { t as all } from "./src-CYIMjhjK.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { pathToFileURL } from "node:url";
|
|
@@ -91428,6 +91428,9 @@ var STORAGE_KEYS;
|
|
|
91428
91428
|
STORAGE_KEYS[STORAGE_KEYS["ANCHOR_IPNS_RECORD"] = 5] = "ANCHOR_IPNS_RECORD";
|
|
91429
91429
|
STORAGE_KEYS[STORAGE_KEYS["HIGHEST_ACCEPTED_ANCHOR_SEQUENCE"] = 6] = "HIGHEST_ACCEPTED_ANCHOR_SEQUENCE";
|
|
91430
91430
|
})(STORAGE_KEYS || (STORAGE_KEYS = {}));
|
|
91431
|
+
const NAME_RESOLVED_FALSE_TTL_MS = 6e4;
|
|
91432
|
+
const NAME_RESOLVED_TRUE_TTL_MS = 36e5;
|
|
91433
|
+
const NAME_RESOLVE_FAILED_RETRY_FLOOR_MS = 1e4;
|
|
91431
91434
|
//#endregion
|
|
91432
91435
|
//#region node_modules/safe-stable-stringify/index.js
|
|
91433
91436
|
var require_safe_stable_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -99753,6 +99756,8 @@ var BaseClientsManager = class BaseClientsManager {
|
|
|
99753
99756
|
const persistentCache = this._getNameResolutionCache();
|
|
99754
99757
|
let value;
|
|
99755
99758
|
let anyResolverCanHandle = false;
|
|
99759
|
+
let anyResolverAnswered = false;
|
|
99760
|
+
const resolverErrors = {};
|
|
99756
99761
|
for (const nameResolver of nameResolvers) {
|
|
99757
99762
|
if (!nameResolver.canResolve({ name })) continue;
|
|
99758
99763
|
anyResolverCanHandle = true;
|
|
@@ -99764,6 +99769,7 @@ var BaseClientsManager = class BaseClientsManager {
|
|
|
99764
99769
|
});
|
|
99765
99770
|
if (cached) {
|
|
99766
99771
|
value = cached.publicKey;
|
|
99772
|
+
anyResolverAnswered = true;
|
|
99767
99773
|
break;
|
|
99768
99774
|
}
|
|
99769
99775
|
this.preResolveNameResolver({
|
|
@@ -99790,8 +99796,13 @@ var BaseClientsManager = class BaseClientsManager {
|
|
|
99790
99796
|
if (abortSignal?.aborted) throwIfAbortSignalAborted(abortSignal);
|
|
99791
99797
|
if (isAbortError(error)) throw error;
|
|
99792
99798
|
log.trace(`Resolver ${nameResolver.key} failed for ${name}`, error);
|
|
99799
|
+
resolverErrors[nameResolver.key] = {
|
|
99800
|
+
provider: nameResolver.provider,
|
|
99801
|
+
error
|
|
99802
|
+
};
|
|
99793
99803
|
continue;
|
|
99794
99804
|
}
|
|
99805
|
+
anyResolverAnswered = true;
|
|
99795
99806
|
this.postResolveNameResolverSuccess({
|
|
99796
99807
|
address: name,
|
|
99797
99808
|
resolveType,
|
|
@@ -99816,8 +99827,17 @@ var BaseClientsManager = class BaseClientsManager {
|
|
|
99816
99827
|
}
|
|
99817
99828
|
}
|
|
99818
99829
|
if (!anyResolverCanHandle) throw new PKCError("ERR_NO_RESOLVER_FOR_NAME", { address: name });
|
|
99830
|
+
if (!value && !anyResolverAnswered) throw new PKCError("ERR_ALL_NAME_RESOLVERS_FAILED", {
|
|
99831
|
+
address: name,
|
|
99832
|
+
resolverErrors
|
|
99833
|
+
});
|
|
99819
99834
|
return value || null;
|
|
99820
99835
|
}
|
|
99836
|
+
canResolveName(name) {
|
|
99837
|
+
const nameResolvers = this._pkc.nameResolvers;
|
|
99838
|
+
if (!nameResolvers || nameResolvers.length === 0) return false;
|
|
99839
|
+
return nameResolvers.some((nameResolver) => nameResolver.canResolve({ name }));
|
|
99840
|
+
}
|
|
99821
99841
|
async resolveCommunityNameIfNeeded({ communityName, abortSignal, cache }) {
|
|
99822
99842
|
assert(typeof communityName === "string", "communityName needs to be a string to be resolved");
|
|
99823
99843
|
if (!isStringDomain(communityName)) return communityName;
|
|
@@ -99850,14 +99870,20 @@ var BaseClientsManager = class BaseClientsManager {
|
|
|
99850
99870
|
resolveAuthorNamesInBackground({ authors, onResolved, abortSignal }) {
|
|
99851
99871
|
const log = logger_default("pkc-js:base-client-manager:resolveAuthorNamesInBackground");
|
|
99852
99872
|
const verificationCache = this._pkc._memCaches.nameResolvedCache;
|
|
99873
|
+
const inFlight = this._pkc._authorNameResolvesInFlight;
|
|
99874
|
+
const failedRecently = this._pkc._memCaches.nameResolveFailedCache;
|
|
99853
99875
|
const seen = /* @__PURE__ */ new Set();
|
|
99854
99876
|
const toResolve = [];
|
|
99855
99877
|
for (const { authorName, signaturePublicKey } of authors) {
|
|
99856
99878
|
if (!isStringDomain(authorName)) continue;
|
|
99879
|
+
if (!this.canResolveName(authorName)) continue;
|
|
99857
99880
|
const cacheKey = (0, import_sha256.sha256)(authorName + signaturePublicKey);
|
|
99858
99881
|
if (seen.has(cacheKey)) continue;
|
|
99859
99882
|
seen.add(cacheKey);
|
|
99860
99883
|
if (typeof verificationCache.get(cacheKey) === "boolean") continue;
|
|
99884
|
+
if (inFlight.has(cacheKey)) continue;
|
|
99885
|
+
if (failedRecently.get(cacheKey)) continue;
|
|
99886
|
+
inFlight.add(cacheKey);
|
|
99861
99887
|
toResolve.push({
|
|
99862
99888
|
authorName,
|
|
99863
99889
|
signaturePublicKey,
|
|
@@ -99865,27 +99891,34 @@ var BaseClientsManager = class BaseClientsManager {
|
|
|
99865
99891
|
});
|
|
99866
99892
|
}
|
|
99867
99893
|
if (toResolve.length === 0) return;
|
|
99894
|
+
const setVerdict = (cacheKey, verdict) => verdict ? verificationCache.set(cacheKey, true, { ttl: this._pkc._nameResolvedTrueTtlMs }) : verificationCache.set(cacheKey, false, { ttl: this._pkc._nameResolvedFalseTtlMs });
|
|
99868
99895
|
const limit = pLimit(MAX_CONCURRENT_AUTHOR_NAME_RESOLUTIONS);
|
|
99869
99896
|
const resolveOne = async (entry) => {
|
|
99870
|
-
if (abortSignal?.aborted) return false;
|
|
99871
99897
|
try {
|
|
99898
|
+
if (abortSignal?.aborted) return false;
|
|
99872
99899
|
const { resolvedAuthorName: resolved } = await this.resolveAuthorNameIfNeeded({
|
|
99873
99900
|
authorName: entry.authorName,
|
|
99874
99901
|
abortSignal,
|
|
99875
99902
|
cache: { maxAge: 3600 }
|
|
99876
99903
|
});
|
|
99877
|
-
if (typeof resolved !== "string")
|
|
99904
|
+
if (typeof resolved !== "string") {
|
|
99905
|
+
setVerdict(entry.cacheKey, false);
|
|
99906
|
+
return true;
|
|
99907
|
+
}
|
|
99878
99908
|
const signerAddress = await getPKCAddressFromPublicKey(entry.signaturePublicKey);
|
|
99879
|
-
|
|
99909
|
+
setVerdict(entry.cacheKey, resolved === signerAddress);
|
|
99880
99910
|
return true;
|
|
99881
99911
|
} catch (e) {
|
|
99882
99912
|
if (isAbortError(e)) return false;
|
|
99883
|
-
if (e instanceof PKCError && e.code === "
|
|
99884
|
-
|
|
99913
|
+
if (e instanceof PKCError && e.code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS") {
|
|
99914
|
+
setVerdict(entry.cacheKey, false);
|
|
99885
99915
|
return true;
|
|
99886
99916
|
}
|
|
99887
99917
|
log.error("Failed to resolve author name in background", entry.authorName, e);
|
|
99918
|
+
failedRecently.set(entry.cacheKey, true, { ttl: this._pkc._nameResolveFailedRetryFloorMs });
|
|
99888
99919
|
return false;
|
|
99920
|
+
} finally {
|
|
99921
|
+
inFlight.delete(entry.cacheKey);
|
|
99889
99922
|
}
|
|
99890
99923
|
};
|
|
99891
99924
|
Promise.allSettled(toResolve.map((entry) => limit(() => resolveOne(entry)))).then((results) => {
|
|
@@ -100619,7 +100652,6 @@ function collectCrosspostAuthorsToResolve({ crosspost, maxLevels = CROSSPOST_LEV
|
|
|
100619
100652
|
const authors = [];
|
|
100620
100653
|
const chain = _chainOf(crosspost).slice(0, maxLevels);
|
|
100621
100654
|
for (const level of chain) {
|
|
100622
|
-
if (typeof level.comment.author?.nameResolved === "boolean") continue;
|
|
100623
100655
|
const authorName = getAuthorNameFromWire(level.comment.author);
|
|
100624
100656
|
if (!authorName) continue;
|
|
100625
100657
|
authors.push({
|
|
@@ -101998,6 +102030,7 @@ var CommentClientsManager = class extends PublicationClientsManager {
|
|
|
101998
102030
|
return;
|
|
101999
102031
|
}
|
|
102000
102032
|
this._resetFreshHandlerAbortController();
|
|
102033
|
+
if (!this._pkc._pkcRpcClient) this._comment._resolveAuthorNamesInBackground();
|
|
102001
102034
|
const postInUpdatingCommunity = this._findCommentInPagesOfUpdatingCommentsOrCommunity({ community });
|
|
102002
102035
|
if (postInUpdatingCommunity && postInUpdatingCommunity.commentUpdate.updatedAt > (this._comment.raw?.commentUpdate?.updatedAt || 0)) {
|
|
102003
102036
|
const log = logger_default("pkc-js:comment:update:handleUpdateEventFromCommunity:find-comment-update-in-updating-community-or-comments-pages");
|
|
@@ -102181,6 +102214,7 @@ var CommentClientsManager = class extends PublicationClientsManager {
|
|
|
102181
102214
|
const log = logger_default("pkc-js:comment:update:handleUpdateEventFromPost");
|
|
102182
102215
|
log("Received update event from post", postInstance.cid, "for reply", this._comment.cid, "with depth", this._comment.depth);
|
|
102183
102216
|
this._resetFreshHandlerAbortController();
|
|
102217
|
+
if (!this._pkc._pkcRpcClient) this._comment._resolveAuthorNamesInBackground();
|
|
102184
102218
|
if (Object.keys(postInstance.replies.pageCids).length === 0 && Object.keys(postInstance.replies.pages).length === 0) {
|
|
102185
102219
|
log("Post", postInstance.cid, "has no replies, therefore reply", this._comment.cid, "will wait until another update event by post");
|
|
102186
102220
|
this._comment._setUpdatingStateWithEmissionIfNewState("waiting-retry");
|
|
@@ -125434,6 +125468,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125434
125468
|
this._pendingIpnsArrivalHopTargets = /* @__PURE__ */ new Set();
|
|
125435
125469
|
this._nextResolveRevalidatesNetwork = false;
|
|
125436
125470
|
this._lastForcedIpnsNetworkRevalidationAtMs = 0;
|
|
125471
|
+
this._nameResolveInFlight = false;
|
|
125437
125472
|
this._community = community;
|
|
125438
125473
|
this._initPKCRpcClients();
|
|
125439
125474
|
hideClassPrivateProps(this);
|
|
@@ -125492,6 +125527,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125492
125527
|
}
|
|
125493
125528
|
postResolveNameResolverSuccess(opts) {
|
|
125494
125529
|
super.postResolveNameResolverSuccess(opts);
|
|
125530
|
+
if (opts.resolveType !== "community") return;
|
|
125495
125531
|
if (!opts.resolvedValue && this._community.state === "updating") throw new PKCError("ERR_DOMAIN_TXT_RECORD_NOT_FOUND", { name: opts.address });
|
|
125496
125532
|
}
|
|
125497
125533
|
_getCommunityAddressFromInstance() {
|
|
@@ -125578,9 +125614,13 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125578
125614
|
const publicKeyBeforeApply = this._community.publicKey;
|
|
125579
125615
|
this._community.initCommunityIpfsPropsNoMerge(communityLoadingRes.community);
|
|
125580
125616
|
this._community.updateCid = communityLoadingRes.cid;
|
|
125581
|
-
if (publicKeyBeforeApply && this._community.publicKey !== publicKeyBeforeApply)
|
|
125582
|
-
|
|
125583
|
-
|
|
125617
|
+
if (publicKeyBeforeApply && this._community.publicKey !== publicKeyBeforeApply) {
|
|
125618
|
+
this._community.nameResolved = void 0;
|
|
125619
|
+
this._nameResolvedFalseAtMs = void 0;
|
|
125620
|
+
this._nameResolveFailedAtMs = void 0;
|
|
125621
|
+
}
|
|
125622
|
+
if (!isStringDomain(this._community.address) && this._community.name && this._community.publicKey && this._community.nameResolved !== true) this._resolveNameInBackground(this._community.name);
|
|
125623
|
+
else if (isStringDomain(this._community.address) && this._community.publicKey && this._community.nameResolved !== true) this._resolveNameInBackground(this._community.address);
|
|
125584
125624
|
log(`Remote Community`, this._community.address, `received a new update. Will emit an update event with updatedAt`, this._community.updatedAt, "that's", timestamp() - this._community.updatedAt, "seconds old");
|
|
125585
125625
|
this._community._changeStateEmitEventEmitStateChangeEvent({
|
|
125586
125626
|
event: {
|
|
@@ -125778,11 +125818,18 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125778
125818
|
}
|
|
125779
125819
|
_resolveNameInBackground(name) {
|
|
125780
125820
|
const log = logger_default("pkc-js:community-client-manager:_resolveNameInBackground");
|
|
125821
|
+
if (this._nameResolveInFlight) return;
|
|
125822
|
+
if (!this.canResolveName(name)) return;
|
|
125823
|
+
if (typeof this._nameResolveFailedAtMs === "number" && Date.now() - this._nameResolveFailedAtMs < this._pkc._nameResolveFailedRetryFloorMs) return;
|
|
125824
|
+
if (this._community.nameResolved === false && typeof this._nameResolvedFalseAtMs === "number" && Date.now() - this._nameResolvedFalseAtMs < this._pkc._nameResolvedFalseTtlMs) return;
|
|
125781
125825
|
const setNameResolvedAndEmitUpdate = (newNameResolved) => {
|
|
125826
|
+
this._nameResolvedFalseAtMs = newNameResolved === false ? Date.now() : void 0;
|
|
125827
|
+
this._nameResolveFailedAtMs = void 0;
|
|
125782
125828
|
if (this._community.nameResolved === newNameResolved) return;
|
|
125783
125829
|
this._community.nameResolved = newNameResolved;
|
|
125784
125830
|
if (typeof this._community.updatedAt === "number") this._community.emit("update", this._community);
|
|
125785
125831
|
};
|
|
125832
|
+
this._nameResolveInFlight = true;
|
|
125786
125833
|
this._resolveCommunityNameWithoutUpdatingState({
|
|
125787
125834
|
communityName: name,
|
|
125788
125835
|
abortSignal: this._community._getStopAbortSignal(),
|
|
@@ -125801,8 +125848,14 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125801
125848
|
} else if (resolved) setNameResolvedAndEmitUpdate(true);
|
|
125802
125849
|
if (!resolved && this._community.name) setNameResolvedAndEmitUpdate(false);
|
|
125803
125850
|
}).catch((e) => {
|
|
125804
|
-
if (e instanceof PKCError && (e.code === "
|
|
125805
|
-
else
|
|
125851
|
+
if (e instanceof PKCError && (e.code === "ERR_DOMAIN_TXT_RECORD_NOT_FOUND" || e.code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS")) setNameResolvedAndEmitUpdate(false);
|
|
125852
|
+
else if (isAbortError(e)) return;
|
|
125853
|
+
else {
|
|
125854
|
+
log.trace("Background name resolution failed for", name, e);
|
|
125855
|
+
this._nameResolveFailedAtMs = Date.now();
|
|
125856
|
+
}
|
|
125857
|
+
}).finally(() => {
|
|
125858
|
+
this._nameResolveInFlight = false;
|
|
125806
125859
|
});
|
|
125807
125860
|
}
|
|
125808
125861
|
_resolvePageAuthorNamesInBackground() {
|
|
@@ -125814,7 +125867,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125814
125867
|
if (!page) continue;
|
|
125815
125868
|
for (const comment of page.comments) {
|
|
125816
125869
|
const domain = getAuthorNameFromRuntime(comment.author);
|
|
125817
|
-
if (domain
|
|
125870
|
+
if (domain) authors.push({
|
|
125818
125871
|
authorName: domain,
|
|
125819
125872
|
signaturePublicKey: comment.signature.publicKey
|
|
125820
125873
|
});
|
|
@@ -125847,7 +125900,7 @@ var CommunityClientsManager = class extends PKCClientsManager {
|
|
|
125847
125900
|
abortSignal: this._community._getStopAbortSignal(),
|
|
125848
125901
|
cache: { maxAge: 3600 }
|
|
125849
125902
|
});
|
|
125850
|
-
if (!isDomain && this._community.name && this._community.publicKey &&
|
|
125903
|
+
if (!isDomain && this._community.name && this._community.publicKey && this._community.nameResolved !== true) this._resolveNameInBackground(this._community.name);
|
|
125851
125904
|
if (!ipnsName) throw Error("Failed to resolve community address to an IPNS name");
|
|
125852
125905
|
if (this._community.ipnsName !== ipnsName) {
|
|
125853
125906
|
this._community.ipnsName = ipnsName;
|
|
@@ -128508,70 +128561,22 @@ const addToRateLimiter = (communityChallenges, request, challengeSuccess) => {
|
|
|
128508
128561
|
for (const rateLimiter of Object.values(rateLimiters)) rateLimiter.tryRemoveTokens(1);
|
|
128509
128562
|
};
|
|
128510
128563
|
//#endregion
|
|
128511
|
-
//#region dist/node/runtime/node/community/local-community/author-identity.js
|
|
128512
|
-
function createAuthorIdentityMatcher({ community, publication }) {
|
|
128513
|
-
const log = logger_default("pkc-js:local-community:author-identity");
|
|
128514
|
-
const signerAddress = getPKCAddressFromPublicKeySync(publication.signature.publicKey);
|
|
128515
|
-
const wireName = getAuthorNameFromWire(publication.author);
|
|
128516
|
-
let nameResolvesToSignerPromise;
|
|
128517
|
-
const nameResolvesToSigner = () => {
|
|
128518
|
-
if (!wireName || !isStringDomain(wireName)) return Promise.resolve(false);
|
|
128519
|
-
if (!nameResolvesToSignerPromise) nameResolvesToSignerPromise = (async () => {
|
|
128520
|
-
try {
|
|
128521
|
-
const { resolvedAuthorName } = await community._clientsManager.resolveAuthorNameIfNeeded({
|
|
128522
|
-
authorName: wireName,
|
|
128523
|
-
abortSignal: AbortSignal.timeout(community._pkc._timeouts["resolve-author-name"]),
|
|
128524
|
-
cache: { maxAge: 0 }
|
|
128525
|
-
});
|
|
128526
|
-
return resolvedAuthorName === signerAddress;
|
|
128527
|
-
} catch (e) {
|
|
128528
|
-
log("Failed to resolve author name while matching identity, treating as no match", wireName, e);
|
|
128529
|
-
return false;
|
|
128530
|
-
}
|
|
128531
|
-
})();
|
|
128532
|
-
return nameResolvesToSignerPromise;
|
|
128533
|
-
};
|
|
128534
|
-
const matchesIdentity = async (identity) => {
|
|
128535
|
-
if (!isStringDomain(identity)) return identity === signerAddress;
|
|
128536
|
-
if (identity !== wireName) return false;
|
|
128537
|
-
return nameResolvesToSigner();
|
|
128538
|
-
};
|
|
128539
|
-
const matchesAnyIdentity = async (identities) => {
|
|
128540
|
-
let nameListed = false;
|
|
128541
|
-
for (const identity of identities) {
|
|
128542
|
-
if (identity === signerAddress) return true;
|
|
128543
|
-
if (wireName && identity === wireName) nameListed = true;
|
|
128544
|
-
}
|
|
128545
|
-
return nameListed ? nameResolvesToSigner() : false;
|
|
128546
|
-
};
|
|
128547
|
-
return {
|
|
128548
|
-
signerAddress,
|
|
128549
|
-
wireName,
|
|
128550
|
-
matchesIdentity,
|
|
128551
|
-
matchesAnyIdentity
|
|
128552
|
-
};
|
|
128553
|
-
}
|
|
128554
|
-
//#endregion
|
|
128555
128564
|
//#region dist/node/runtime/node/community/challenges/exclude/exclude.js
|
|
128556
|
-
const testRole = async (excludeRole,
|
|
128557
|
-
if (!communityRoles) return false;
|
|
128565
|
+
const testRole = async ({ excludeRole, identityMatcher, communityRoles }) => {
|
|
128566
|
+
if (!communityRoles) return { matched: false };
|
|
128558
128567
|
const roleKeys = Object.keys(communityRoles).filter((roleKey) => excludeRole.includes(communityRoles[roleKey].role));
|
|
128559
|
-
if (roleKeys.length === 0) return false;
|
|
128560
|
-
return
|
|
128568
|
+
if (roleKeys.length === 0) return { matched: false };
|
|
128569
|
+
return identityMatcher.matchesAnyIdentity(roleKeys);
|
|
128561
128570
|
};
|
|
128562
|
-
const shouldExcludePublication = async (communityChallenge, request, community) => {
|
|
128571
|
+
const shouldExcludePublication = async ({ communityChallenge, request, community, identityMatcher }) => {
|
|
128563
128572
|
if (!communityChallenge) throw Error(`shouldExcludePublication invalid communityChallenge argument '${communityChallenge}'`);
|
|
128564
128573
|
const publication = derivePublicationFromChallengeRequest(request);
|
|
128565
128574
|
if (!publication?.author) throw Error(`shouldExcludePublication invalid publication argument '${publication}'`);
|
|
128566
128575
|
const author = publication.author;
|
|
128567
|
-
if (!communityChallenge.exclude) return false;
|
|
128576
|
+
if (!communityChallenge.exclude) return { shouldExclude: false };
|
|
128568
128577
|
if (!Array.isArray(communityChallenge.exclude)) throw Error(`shouldExcludePublication invalid communityChallenge argument '${communityChallenge}' communityChallenge.exclude not an array`);
|
|
128569
128578
|
let authorPublicationCounts;
|
|
128570
|
-
let
|
|
128571
|
-
const getIdentityMatcher = () => identityMatcher ??= createAuthorIdentityMatcher({
|
|
128572
|
-
community,
|
|
128573
|
-
publication
|
|
128574
|
-
});
|
|
128579
|
+
let nameFailure;
|
|
128575
128580
|
for (const exclude of communityChallenge.exclude) {
|
|
128576
128581
|
if (typeof exclude.postScore !== "number" && typeof exclude.replyScore !== "number" && typeof exclude.postCount !== "number" && typeof exclude.replyCount !== "number" && typeof exclude.firstCommentTimestamp !== "number" && !exclude.publicKeys?.length && !exclude.names?.length && exclude.publicationType === void 0 && exclude.rateLimit === void 0 && !exclude.roles?.length) continue;
|
|
128577
128582
|
let shouldExclude = true;
|
|
@@ -128580,17 +128585,36 @@ const shouldExcludePublication = async (communityChallenge, request, community)
|
|
|
128580
128585
|
if (!testFirstCommentTimestamp(exclude.firstCommentTimestamp, author.community?.firstCommentTimestamp)) shouldExclude = false;
|
|
128581
128586
|
if (!testPublicationType(exclude.publicationType, request)) shouldExclude = false;
|
|
128582
128587
|
if (!testRateLimit(exclude, request)) shouldExclude = false;
|
|
128583
|
-
if (exclude.publicKeys && !exclude.publicKeys.includes(
|
|
128584
|
-
if (exclude.names && !await getIdentityMatcher().matchesAnyIdentity(exclude.names)) shouldExclude = false;
|
|
128585
|
-
if (Array.isArray(exclude.roles) && !await testRole(exclude.roles, getIdentityMatcher, community?.roles)) shouldExclude = false;
|
|
128588
|
+
if (exclude.publicKeys && !exclude.publicKeys.includes(identityMatcher.signerAddress)) shouldExclude = false;
|
|
128586
128589
|
if (typeof exclude.postCount === "number" || typeof exclude.replyCount === "number") {
|
|
128587
|
-
if (!authorPublicationCounts && community?._dbHandler) authorPublicationCounts = community._dbHandler.queryAuthorPublicationCounts(
|
|
128590
|
+
if (!authorPublicationCounts && community?._dbHandler) authorPublicationCounts = community._dbHandler.queryAuthorPublicationCounts(identityMatcher.signerAddress);
|
|
128588
128591
|
if (!testScore(exclude.postCount, authorPublicationCounts?.postCount)) shouldExclude = false;
|
|
128589
128592
|
if (!testScore(exclude.replyCount, authorPublicationCounts?.replyCount)) shouldExclude = false;
|
|
128590
128593
|
}
|
|
128591
|
-
if (shouldExclude)
|
|
128594
|
+
if (shouldExclude && exclude.names) {
|
|
128595
|
+
const namesMatch = await identityMatcher.matchesAnyIdentity(exclude.names);
|
|
128596
|
+
if (!namesMatch.matched) {
|
|
128597
|
+
shouldExclude = false;
|
|
128598
|
+
nameFailure ??= namesMatch.nameFailure;
|
|
128599
|
+
}
|
|
128600
|
+
}
|
|
128601
|
+
if (shouldExclude && Array.isArray(exclude.roles)) {
|
|
128602
|
+
const roleMatch = await testRole({
|
|
128603
|
+
excludeRole: exclude.roles,
|
|
128604
|
+
identityMatcher,
|
|
128605
|
+
communityRoles: community?.roles
|
|
128606
|
+
});
|
|
128607
|
+
if (!roleMatch.matched) {
|
|
128608
|
+
shouldExclude = false;
|
|
128609
|
+
nameFailure ??= roleMatch.nameFailure;
|
|
128610
|
+
}
|
|
128611
|
+
}
|
|
128612
|
+
if (shouldExclude) return { shouldExclude: true };
|
|
128592
128613
|
}
|
|
128593
|
-
return
|
|
128614
|
+
return {
|
|
128615
|
+
shouldExclude: false,
|
|
128616
|
+
nameFailure
|
|
128617
|
+
};
|
|
128594
128618
|
};
|
|
128595
128619
|
const shouldExcludeChallengeSuccess = (communityChallenge, communityChallengeIndex, challengeResults) => {
|
|
128596
128620
|
if (!communityChallenge) throw Error(`shouldExcludeChallengeSuccess invalid communityChallenge argument '${communityChallenge}'`);
|
|
@@ -128723,6 +128747,98 @@ const shouldExcludeChallengeCommentCids = async (communityChallenge, challengeRe
|
|
|
128723
128747
|
return false;
|
|
128724
128748
|
};
|
|
128725
128749
|
//#endregion
|
|
128750
|
+
//#region dist/node/runtime/node/community/local-community/author-identity.js
|
|
128751
|
+
const NO_MATCH = { matched: false };
|
|
128752
|
+
const MATCH = { matched: true };
|
|
128753
|
+
/**
|
|
128754
|
+
* The message a publisher is owed when their author name could not be verified: one remedy per outcome, and
|
|
128755
|
+
* one table for both places that classify a resolve, the identity matcher here and `checkAuthorIdentity`, so
|
|
128756
|
+
* the two can never disagree about the same failure. `error: null` is the resolvers answering "no record";
|
|
128757
|
+
* anything else is whatever the resolve threw. Issue #353.
|
|
128758
|
+
*/
|
|
128759
|
+
function authorNameResolveFailureReason({ error }) {
|
|
128760
|
+
if (error === null) return messages.ERR_AUTHOR_NAME_HAS_NO_RECORD;
|
|
128761
|
+
const code = error instanceof PKCError ? error.code : void 0;
|
|
128762
|
+
if (code === "ERR_NO_RESOLVER_FOR_NAME") return messages.ERR_COMMUNITY_HAS_NO_RESOLVER_FOR_AUTHOR_NAME_TLD;
|
|
128763
|
+
if (code === "ERR_RESOLVED_TEXT_RECORD_TO_NON_IPNS") return messages.ERR_AUTHOR_NAME_RECORD_IS_NOT_A_VALID_KEY;
|
|
128764
|
+
return messages.ERR_COMMUNITY_FAILED_TO_RESOLVE_AUTHOR_NAME;
|
|
128765
|
+
}
|
|
128766
|
+
/**
|
|
128767
|
+
* The matcher for an author nothing can refer to: no signature to derive an identity from, so every configured
|
|
128768
|
+
* identity string is a non-match, and a non-match with no `nameFailure` because no name was ever consulted.
|
|
128769
|
+
* Answering "no match" beats throwing from deep inside validation or the challenge runner.
|
|
128770
|
+
*/
|
|
128771
|
+
const NO_OP_AUTHOR_IDENTITY_MATCHER = {
|
|
128772
|
+
signerAddress: "",
|
|
128773
|
+
wireName: void 0,
|
|
128774
|
+
matchesIdentity: async () => NO_MATCH,
|
|
128775
|
+
matchesAnyIdentity: async () => NO_MATCH
|
|
128776
|
+
};
|
|
128777
|
+
function authorIdentityMatcherForRequest({ community, request }) {
|
|
128778
|
+
const publication = derivePublicationFromChallengeRequest(request);
|
|
128779
|
+
if (typeof publication?.signature?.publicKey !== "string") return NO_OP_AUTHOR_IDENTITY_MATCHER;
|
|
128780
|
+
return createAuthorIdentityMatcher({
|
|
128781
|
+
community,
|
|
128782
|
+
publication
|
|
128783
|
+
});
|
|
128784
|
+
}
|
|
128785
|
+
function createAuthorIdentityMatcher({ community, publication }) {
|
|
128786
|
+
const log = logger_default("pkc-js:local-community:author-identity");
|
|
128787
|
+
const signerAddress = getPKCAddressFromPublicKeySync(publication.signature.publicKey);
|
|
128788
|
+
const wireName = getAuthorNameFromWire(publication.author);
|
|
128789
|
+
let nameOutcomePromise;
|
|
128790
|
+
const nameResolvesToSigner = () => {
|
|
128791
|
+
if (!wireName || !isStringDomain(wireName)) return Promise.resolve(NO_MATCH);
|
|
128792
|
+
if (!nameOutcomePromise) nameOutcomePromise = (async () => {
|
|
128793
|
+
try {
|
|
128794
|
+
const { resolvedAuthorName } = await community._clientsManager.resolveAuthorNameIfNeeded({
|
|
128795
|
+
authorName: wireName,
|
|
128796
|
+
abortSignal: AbortSignal.timeout(community._pkc._timeouts["resolve-author-name"]),
|
|
128797
|
+
cache: { maxAge: 0 }
|
|
128798
|
+
});
|
|
128799
|
+
if (resolvedAuthorName === signerAddress) return MATCH;
|
|
128800
|
+
if (resolvedAuthorName === null) {
|
|
128801
|
+
log("Author name has no record while matching identity", wireName);
|
|
128802
|
+
return {
|
|
128803
|
+
matched: false,
|
|
128804
|
+
nameFailure: { reason: authorNameResolveFailureReason({ error: null }) }
|
|
128805
|
+
};
|
|
128806
|
+
}
|
|
128807
|
+
return NO_MATCH;
|
|
128808
|
+
} catch (e) {
|
|
128809
|
+
log("Failed to resolve author name while matching identity", wireName, e instanceof PKCError ? e.code : void 0, e);
|
|
128810
|
+
return {
|
|
128811
|
+
matched: false,
|
|
128812
|
+
nameFailure: {
|
|
128813
|
+
reason: authorNameResolveFailureReason({ error: e }),
|
|
128814
|
+
error: e
|
|
128815
|
+
}
|
|
128816
|
+
};
|
|
128817
|
+
}
|
|
128818
|
+
})();
|
|
128819
|
+
return nameOutcomePromise;
|
|
128820
|
+
};
|
|
128821
|
+
const matchesIdentity = async (identity) => {
|
|
128822
|
+
if (!isStringDomain(identity)) return identity === signerAddress ? MATCH : NO_MATCH;
|
|
128823
|
+
if (identity !== wireName) return NO_MATCH;
|
|
128824
|
+
return nameResolvesToSigner();
|
|
128825
|
+
};
|
|
128826
|
+
const matchesAnyIdentity = async (identities) => {
|
|
128827
|
+
let nameListed = false;
|
|
128828
|
+
for (const identity of identities) {
|
|
128829
|
+
if (identity === signerAddress) return MATCH;
|
|
128830
|
+
if (wireName && identity === wireName) nameListed = true;
|
|
128831
|
+
}
|
|
128832
|
+
return nameListed ? nameResolvesToSigner() : NO_MATCH;
|
|
128833
|
+
};
|
|
128834
|
+
return {
|
|
128835
|
+
signerAddress,
|
|
128836
|
+
wireName,
|
|
128837
|
+
matchesIdentity,
|
|
128838
|
+
matchesAnyIdentity
|
|
128839
|
+
};
|
|
128840
|
+
}
|
|
128841
|
+
//#endregion
|
|
128726
128842
|
//#region dist/node/runtime/node/community/challenges/pkc-js-challenges/text-math.js
|
|
128727
128843
|
const optionInputs$5 = [{
|
|
128728
128844
|
option: "difficulty",
|
|
@@ -128897,16 +129013,16 @@ var UrlsAddressesSet$1 = class {
|
|
|
128897
129013
|
}
|
|
128898
129014
|
};
|
|
128899
129015
|
const urlsAddressesSet$1 = new UrlsAddressesSet$1();
|
|
128900
|
-
const getChallenge$3 = async ({ challengeSettings, challengeRequestMessage, community }) => {
|
|
129016
|
+
const getChallenge$3 = async ({ challengeSettings, challengeRequestMessage, community, authorIdentityMatcher }) => {
|
|
128901
129017
|
const error = challengeSettings?.options?.error;
|
|
128902
129018
|
const addresses = challengeSettings?.options?.addresses?.split(",").map((u) => u.trim()).filter(Boolean);
|
|
128903
129019
|
const addressesSet = new Set(addresses);
|
|
128904
129020
|
const publication = derivePublicationFromChallengeRequest(challengeRequestMessage);
|
|
128905
|
-
const identityMatcher = createAuthorIdentityMatcher({
|
|
129021
|
+
const identityMatcher = authorIdentityMatcher ?? createAuthorIdentityMatcher({
|
|
128906
129022
|
community,
|
|
128907
129023
|
publication
|
|
128908
129024
|
});
|
|
128909
|
-
if (await identityMatcher.matchesAnyIdentity(addressesSet) || await identityMatcher.matchesAnyIdentity(await urlsAddressesSet$1.getAddresses(getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls))) return {
|
|
129025
|
+
if ((await identityMatcher.matchesAnyIdentity(addressesSet)).matched || (await identityMatcher.matchesAnyIdentity(await urlsAddressesSet$1.getAddresses(getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls))).matched) return {
|
|
128910
129026
|
success: false,
|
|
128911
129027
|
error: error || `You're blacklisted.`
|
|
128912
129028
|
};
|
|
@@ -128988,19 +129104,29 @@ var UrlsAddressesSet = class {
|
|
|
128988
129104
|
}
|
|
128989
129105
|
};
|
|
128990
129106
|
const urlsAddressesSet = new UrlsAddressesSet();
|
|
128991
|
-
const getChallenge$2 = async ({ challengeSettings, challengeRequestMessage, community }) => {
|
|
129107
|
+
const getChallenge$2 = async ({ challengeSettings, challengeRequestMessage, community, authorIdentityMatcher }) => {
|
|
128992
129108
|
const error = challengeSettings?.options?.error;
|
|
128993
129109
|
const addresses = challengeSettings?.options?.addresses?.split(",").map((u) => u.trim()).filter(Boolean);
|
|
128994
129110
|
const addressesSet = new Set(addresses);
|
|
128995
129111
|
const publication = derivePublicationFromChallengeRequest(challengeRequestMessage);
|
|
128996
|
-
const identityMatcher = createAuthorIdentityMatcher({
|
|
129112
|
+
const identityMatcher = authorIdentityMatcher ?? createAuthorIdentityMatcher({
|
|
128997
129113
|
community,
|
|
128998
129114
|
publication
|
|
128999
129115
|
});
|
|
129000
|
-
|
|
129001
|
-
|
|
129002
|
-
|
|
129003
|
-
|
|
129116
|
+
const directMatch = await identityMatcher.matchesAnyIdentity(addressesSet);
|
|
129117
|
+
const urlMatch = directMatch.matched ? directMatch : await identityMatcher.matchesAnyIdentity(await urlsAddressesSet.getAddresses(getCommunityAddressFromRecord(publication), challengeSettings?.options?.urls));
|
|
129118
|
+
if (!urlMatch.matched) {
|
|
129119
|
+
const nameFailure = directMatch.nameFailure ?? urlMatch.nameFailure;
|
|
129120
|
+
if (nameFailure) return {
|
|
129121
|
+
success: false,
|
|
129122
|
+
error: nameFailure.reason,
|
|
129123
|
+
reason: nameFailure.reason
|
|
129124
|
+
};
|
|
129125
|
+
return {
|
|
129126
|
+
success: false,
|
|
129127
|
+
error: error || `You're not whitelisted.`
|
|
129128
|
+
};
|
|
129129
|
+
}
|
|
129004
129130
|
return { success: true };
|
|
129005
129131
|
};
|
|
129006
129132
|
function ChallengeFileFactory$2({ challengeSettings }) {
|
|
@@ -129321,14 +129447,15 @@ const loadChallengeFile = async ({ communityChallengeSettings, challengeIndex, c
|
|
|
129321
129447
|
});
|
|
129322
129448
|
return { challengeFile };
|
|
129323
129449
|
};
|
|
129324
|
-
const callGetChallenge = async ({ challengeFile, communityChallengeSettings, challengeRequestMessage, challengeIndex, community }) => {
|
|
129450
|
+
const callGetChallenge = async ({ challengeFile, communityChallengeSettings, challengeRequestMessage, challengeIndex, community, authorIdentityMatcher }) => {
|
|
129325
129451
|
let challengeOrChallengeResult;
|
|
129326
129452
|
try {
|
|
129327
129453
|
challengeOrChallengeResult = await challengeFile.getChallenge({
|
|
129328
129454
|
challengeSettings: communityChallengeSettings,
|
|
129329
129455
|
challengeRequestMessage,
|
|
129330
129456
|
challengeIndex,
|
|
129331
|
-
community
|
|
129457
|
+
community,
|
|
129458
|
+
authorIdentityMatcher
|
|
129332
129459
|
});
|
|
129333
129460
|
validateChallengeOrChallengeResult({
|
|
129334
129461
|
challengeOrChallengeResult,
|
|
@@ -129411,7 +129538,11 @@ const canFailedChallengeStillBeExcluded = (i, communityChallenges, decided, resu
|
|
|
129411
129538
|
}
|
|
129412
129539
|
return false;
|
|
129413
129540
|
};
|
|
129414
|
-
const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMessage, community }) => {
|
|
129541
|
+
const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMessage, community, authorIdentityMatcher }) => {
|
|
129542
|
+
const identityMatcher = authorIdentityMatcher ?? authorIdentityMatcherForRequest({
|
|
129543
|
+
community,
|
|
129544
|
+
request: challengeRequestMessage
|
|
129545
|
+
});
|
|
129415
129546
|
if (!Array.isArray(community.settings?.challenges)) return {
|
|
129416
129547
|
challengeSuccess: true,
|
|
129417
129548
|
pendingApprovalSuccess: false
|
|
@@ -129428,12 +129559,23 @@ const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMes
|
|
|
129428
129559
|
challengeIndex: i,
|
|
129429
129560
|
community
|
|
129430
129561
|
})).challengeFile));
|
|
129562
|
+
const identityNameFailureByIndex = new Array(challengeCount);
|
|
129431
129563
|
await Promise.all(communityChallenges.map(async (communityChallenge, i) => {
|
|
129432
|
-
|
|
129564
|
+
const excludeResult = await shouldExcludePublication({
|
|
129565
|
+
communityChallenge,
|
|
129566
|
+
request: challengeRequestMessage,
|
|
129567
|
+
community,
|
|
129568
|
+
identityMatcher
|
|
129569
|
+
});
|
|
129570
|
+
if (excludeResult.shouldExclude) {
|
|
129433
129571
|
decided[i] = true;
|
|
129434
129572
|
return;
|
|
129435
129573
|
}
|
|
129436
|
-
if (await shouldExcludeChallengeCommentCids(communityChallenge, challengeRequestMessage, community._pkc))
|
|
129574
|
+
if (await shouldExcludeChallengeCommentCids(communityChallenge, challengeRequestMessage, community._pkc)) {
|
|
129575
|
+
decided[i] = true;
|
|
129576
|
+
return;
|
|
129577
|
+
}
|
|
129578
|
+
identityNameFailureByIndex[i] = excludeResult.nameFailure;
|
|
129437
129579
|
}));
|
|
129438
129580
|
const deferred = new Array(challengeCount).fill(false);
|
|
129439
129581
|
let shortCircuitToFailure = false;
|
|
@@ -129466,7 +129608,8 @@ const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMes
|
|
|
129466
129608
|
communityChallengeSettings: community.settings.challenges[i],
|
|
129467
129609
|
challengeRequestMessage,
|
|
129468
129610
|
challengeIndex: i,
|
|
129469
|
-
community
|
|
129611
|
+
community,
|
|
129612
|
+
authorIdentityMatcher: identityMatcher
|
|
129470
129613
|
})).challengeOrChallengeResult;
|
|
129471
129614
|
decided[i] = true;
|
|
129472
129615
|
}
|
|
@@ -129492,7 +129635,8 @@ const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMes
|
|
|
129492
129635
|
communityChallengeSettings: community.settings.challenges[firstUndecided],
|
|
129493
129636
|
challengeRequestMessage,
|
|
129494
129637
|
challengeIndex: firstUndecided,
|
|
129495
|
-
community
|
|
129638
|
+
community,
|
|
129639
|
+
authorIdentityMatcher: identityMatcher
|
|
129496
129640
|
})).challengeOrChallengeResult;
|
|
129497
129641
|
decided[firstUndecided] = true;
|
|
129498
129642
|
}
|
|
@@ -129553,18 +129697,24 @@ const getPendingChallengesOrChallengeVerification = async ({ challengeRequestMes
|
|
|
129553
129697
|
if (challengeSuccess === false) return {
|
|
129554
129698
|
challengeSuccess,
|
|
129555
129699
|
challengeErrors,
|
|
129556
|
-
aggregatedReason: agg.aggregatedReason
|
|
129700
|
+
aggregatedReason: agg.aggregatedReason,
|
|
129701
|
+
identityNameFailureByIndex
|
|
129557
129702
|
};
|
|
129558
129703
|
return {
|
|
129559
129704
|
pendingChallenges,
|
|
129560
129705
|
pendingApprovalSuccess,
|
|
129561
129706
|
deferredChallenges: deferredChallenges.length > 0 ? deferredChallenges : void 0,
|
|
129562
129707
|
partialResults: results,
|
|
129563
|
-
communityChallenges
|
|
129708
|
+
communityChallenges,
|
|
129709
|
+
identityNameFailureByIndex
|
|
129564
129710
|
};
|
|
129565
129711
|
};
|
|
129566
|
-
const getChallengeVerificationFromChallengeAnswers = async ({ pendingChallenges, challengeAnswers, community, challengeRequestMessage, deferredChallenges, partialResults, communityChallenges }) => {
|
|
129712
|
+
const getChallengeVerificationFromChallengeAnswers = async ({ pendingChallenges, challengeAnswers, community, challengeRequestMessage, deferredChallenges, partialResults, communityChallenges, authorIdentityMatcher }) => {
|
|
129567
129713
|
if (!Array.isArray(community.settings?.challenges)) throw Error("community.settings?.challenges is not defined");
|
|
129714
|
+
const identityMatcher = authorIdentityMatcher ?? (challengeRequestMessage ? authorIdentityMatcherForRequest({
|
|
129715
|
+
community,
|
|
129716
|
+
request: challengeRequestMessage
|
|
129717
|
+
}) : NO_OP_AUTHOR_IDENTITY_MATCHER);
|
|
129568
129718
|
const challengeCount = community.settings.challenges.length;
|
|
129569
129719
|
const verifyChallengePromises = [];
|
|
129570
129720
|
for (const i in pendingChallenges) verifyChallengePromises.push(Promise.resolve(pendingChallenges[i].verify(challengeAnswers[i])));
|
|
@@ -129613,7 +129763,8 @@ const getChallengeVerificationFromChallengeAnswers = async ({ pendingChallenges,
|
|
|
129613
129763
|
communityChallengeSettings: community.settings.challenges[i],
|
|
129614
129764
|
challengeRequestMessage,
|
|
129615
129765
|
challengeIndex: i,
|
|
129616
|
-
community
|
|
129766
|
+
community,
|
|
129767
|
+
authorIdentityMatcher: identityMatcher
|
|
129617
129768
|
})).challengeOrChallengeResult;
|
|
129618
129769
|
decided[i] = true;
|
|
129619
129770
|
}
|
|
@@ -129640,7 +129791,8 @@ const getChallengeVerificationFromChallengeAnswers = async ({ pendingChallenges,
|
|
|
129640
129791
|
communityChallengeSettings: community.settings.challenges[firstUndecided],
|
|
129641
129792
|
challengeRequestMessage,
|
|
129642
129793
|
challengeIndex: firstUndecided,
|
|
129643
|
-
community
|
|
129794
|
+
community,
|
|
129795
|
+
authorIdentityMatcher: identityMatcher
|
|
129644
129796
|
})).challengeOrChallengeResult;
|
|
129645
129797
|
decided[firstUndecided] = true;
|
|
129646
129798
|
}
|
|
@@ -129683,19 +129835,29 @@ const getChallengeVerificationFromChallengeAnswers = async ({ pendingChallenges,
|
|
|
129683
129835
|
...successAgg
|
|
129684
129836
|
};
|
|
129685
129837
|
};
|
|
129686
|
-
const getChallengeVerification = async ({ challengeRequestMessage, community, getChallengeAnswers }) => {
|
|
129838
|
+
const getChallengeVerification = async ({ challengeRequestMessage, community, getChallengeAnswers, authorIdentityMatcher }) => {
|
|
129687
129839
|
if (!challengeRequestMessage) throw Error(`getChallengeVerification invalid challengeRequestMessage argument '${challengeRequestMessage}'`);
|
|
129688
129840
|
if (typeof community?._pkc?.getComment !== "function") throw Error(`getChallengeVerification invalid community argument '${community}' invalid community.pkc instance`);
|
|
129689
129841
|
if (typeof getChallengeAnswers !== "function") throw Error(`getChallengeVerification invalid getChallengeAnswers argument '${getChallengeAnswers}' not a function`);
|
|
129690
129842
|
if (!Array.isArray(community.settings?.challenges)) throw Error("community.settings?.challenges is not defined");
|
|
129691
129843
|
const res = await getPendingChallengesOrChallengeVerification({
|
|
129692
129844
|
challengeRequestMessage,
|
|
129693
|
-
community
|
|
129845
|
+
community,
|
|
129846
|
+
authorIdentityMatcher: authorIdentityMatcher ?? authorIdentityMatcherForRequest({
|
|
129847
|
+
community,
|
|
129848
|
+
request: challengeRequestMessage
|
|
129849
|
+
})
|
|
129694
129850
|
});
|
|
129695
129851
|
let pendingApprovalSuccess = "pendingApprovalSuccess" in res ? res.pendingApprovalSuccess : false;
|
|
129852
|
+
const identityNameFailureByIndex = "identityNameFailureByIndex" in res ? res.identityNameFailureByIndex : void 0;
|
|
129696
129853
|
let challengeVerification;
|
|
129854
|
+
let postAnswerAuthorIdentityMatcher;
|
|
129697
129855
|
if ("pendingChallenges" in res) {
|
|
129698
129856
|
const challengeAnswers = await getChallengeAnswers(res.pendingChallenges.map((challenge) => n$9(challenge, ["index", "verify"])));
|
|
129857
|
+
postAnswerAuthorIdentityMatcher = authorIdentityMatcherForRequest({
|
|
129858
|
+
community,
|
|
129859
|
+
request: challengeRequestMessage
|
|
129860
|
+
});
|
|
129699
129861
|
const verificationFromPending = await getChallengeVerificationFromChallengeAnswers({
|
|
129700
129862
|
pendingChallenges: res.pendingChallenges,
|
|
129701
129863
|
challengeAnswers,
|
|
@@ -129703,7 +129865,8 @@ const getChallengeVerification = async ({ challengeRequestMessage, community, ge
|
|
|
129703
129865
|
challengeRequestMessage,
|
|
129704
129866
|
deferredChallenges: res.deferredChallenges,
|
|
129705
129867
|
partialResults: res.partialResults,
|
|
129706
|
-
communityChallenges: res.communityChallenges
|
|
129868
|
+
communityChallenges: res.communityChallenges,
|
|
129869
|
+
authorIdentityMatcher: postAnswerAuthorIdentityMatcher
|
|
129707
129870
|
});
|
|
129708
129871
|
if ("pendingApprovalSuccess" in verificationFromPending) {
|
|
129709
129872
|
pendingApprovalSuccess = pendingApprovalSuccess || verificationFromPending.pendingApprovalSuccess;
|
|
@@ -129719,12 +129882,21 @@ const getChallengeVerification = async ({ challengeRequestMessage, community, ge
|
|
|
129719
129882
|
if ("aggregatedCommentUpdate" in res && res.aggregatedCommentUpdate) challengeVerification.aggregatedCommentUpdate = res.aggregatedCommentUpdate;
|
|
129720
129883
|
if ("aggregatedReason" in res && res.aggregatedReason) challengeVerification.aggregatedReason = res.aggregatedReason;
|
|
129721
129884
|
}
|
|
129885
|
+
const failedChallengeIndexes = Object.keys(challengeVerification.challengeErrors ?? {});
|
|
129886
|
+
const decisiveNameFailure = failedChallengeIndexes.length > 0 && identityNameFailureByIndex ? failedChallengeIndexes.every((index) => identityNameFailureByIndex[Number(index)]) ? identityNameFailureByIndex[Number(failedChallengeIndexes[0])] : void 0 : void 0;
|
|
129887
|
+
if (challengeVerification.challengeSuccess === false && decisiveNameFailure) challengeVerification.aggregatedReason = decisiveNameFailure.reason;
|
|
129722
129888
|
addToRateLimiter(community.settings?.challenges, challengeRequestMessage, challengeVerification.challengeSuccess);
|
|
129723
|
-
|
|
129889
|
+
const shouldSendToPendingApproval = Boolean(challengeRequestMessage.comment) && challengeVerification.challengeSuccess === true && pendingApprovalSuccess;
|
|
129890
|
+
const postAnswerMatcherField = postAnswerAuthorIdentityMatcher ? { postAnswerAuthorIdentityMatcher } : {};
|
|
129891
|
+
if (shouldSendToPendingApproval) return {
|
|
129892
|
+
...challengeVerification,
|
|
129893
|
+
pendingApproval: true,
|
|
129894
|
+
...postAnswerMatcherField
|
|
129895
|
+
};
|
|
129896
|
+
return {
|
|
129724
129897
|
...challengeVerification,
|
|
129725
|
-
|
|
129898
|
+
...postAnswerMatcherField
|
|
129726
129899
|
};
|
|
129727
|
-
return challengeVerification;
|
|
129728
129900
|
};
|
|
129729
129901
|
const derivePublicOptions = (communityChallengeSettings) => {
|
|
129730
129902
|
const { publicOptions, options } = communityChallengeSettings;
|
|
@@ -130389,4 +130561,4 @@ var RpcLocalCommunity = class extends RpcRemoteCommunity {
|
|
|
130389
130561
|
}
|
|
130390
130562
|
};
|
|
130391
130563
|
//#endregion
|
|
130392
|
-
export {
|
|
130564
|
+
export { findCommentInPageInstanceRecursively as $, RpcResolveAuthorNameResultSchema as $n, getIpfsKeyFromPrivateKey as $t, createKuboRpcClient as A, parsePKCUserOptionsSchemaWithPKCErrorIfItFails as An, verifyChallengeRequest as At, monitorCommunitiesDirectory as B, RpcCommentRepliesPageParamSchema as Bn, buildRuntimeAuthor as Bt, decryptEd25519AesGcmPublicKeyBuffer as C, parseCreateRemoteCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as Cn, signCommentUpdate as Ct, backupCommunityDb as D, parseDecryptedChallengeVerification as Dn, signVote as Dt, BackupAbortError as E, parseDecryptedChallengeAnswerWithPKCErrorIfItFails as En, signCommunityEdit as Et, getDefaultCommunityDbConfig as F, parseVotePubsubMessagePublicationSchemaWithPKCErrorIfItFails as Fn, verifyCommentPubsubMessage as Ft, CommentClientsManager as G, RpcExportCommunityModLogsResultSchema as Gn, buildRuntimeCommunityFields as Gt, resolveDbPostsCidRefs as H, RpcCommunityPageParamSchema as Hn, getAuthorNameFromRuntime as Ht, getDefaultDataPath as I, RpcAnchorPublishPreparationResultSchema as In, verifyCommentUpdate as It, REPLY_REPLIES_SORT_TYPES as J, RpcFetchCidParamSchema as Jn, getCommunityPublicKeyFromWire as Jt, POSTS_SORT_TYPES as K, RpcExportCommunityParamSchema as Kn, getCommunityAddressFromRecord as Kt, getThumbnailPropsOfLink as L, RpcAuthorNameParamSchema as Ln, verifyCommunity as Lt, deriveCommentIpfsFromCommentTableRow as M, parseRpcCommentUpdateEventWithPKCErrorIfItFails as Mn, verifyCommentEdit as Mt, deriveDbPosts as N, parseSetNewSettingsPKCWsServerSchemaWithPKCErrorIfItFails as Nn, verifyCommentIpfs as Nt, calculateExpectedSignatureSize as O, parseDecryptedChallengeWithPKCErrorIfItFails as On, verifyChallengeAnswer as Ot, deriveDbReplies as P, parseVoteChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as Pn, verifyCommentModeration as Pt, extractCommunityRuntimeFieldsFromParsedPages as Q, RpcPublishedAnchorRecordResultSchema as Qn, getBufferedPKCAddressFromPublicKey as Qt, importSignerIntoKuboNode as R, RpcCancelExportParamSchema as Rn, verifyCommunityEdit as Rt, decryptEd25519AesGcm as S, parseCreatePKCWsServerOptionsSchemaWithPKCErrorIfItFails as Sn, signCommentModeration as St, encryptEd25519AesGcmPublicKeyBuffer as T, parseCreateVoteOptionsSchemaWithPKCErrorIfItFails as Tn, signCommunity as Tt, setNativeFunctions as U, RpcEditCommunityParamSchema as Un, getAuthorNameFromWire as Ut, moveCommunityDbToDeletedDirectory as V, RpcCommunityIdentifierParamSchema as Vn, cleanWireAuthor as Vt, tryToDeleteCommunitiesThatFailedToBeDeletedBefore as W, RpcExportCommunityModLogsParamSchema as Wn, normalizeCreatePublicationAuthor as Wt, buildPageRuntimeFields as X, RpcPublishAnchorRecordParamSchema as Xn, decode as Xt, TIMEFRAMES_TO_SECONDS as Y, RpcFetchCidResultSchema as Yn, normalizeCommunityInputFromCommunity as Yt, buildPagesRuntimeFields as Z, RpcPublishChallengeAnswersParamSchema as Zn, encode as Zt, decodeRpcChallengeRequestPubsubMsg as _, parseCreateCommentEditOptionsSchemaWithPKCErrorIfItFails as _n, STORAGE_KEYS as _r, signChallengeMessage as _t, loadChallengeFileFromCommunityChallengeSettings as a, parseCommentChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as an, t$2 as ar, collectCrosspostAuthorsToResolve as at, createSigner as b, parseCreateCommunityEditPublicationOptionsSchemaWithPKCErrorIfItFails as bn, require_undici as br, signComment as bt, authorNameResolveFailureReason as c, parseCommentIpfsSchemaWithPKCErrorIfItFails as cn, t$5 as cr, PublicationClientsManager as ct, LRUCache as d, parseCommentPubsubMessagePublicationWithPKCErrorIfItFails as dn, t$7 as dr, pRetry as dt, getPKCAddressFromPublicKey as en, RpcSubscriptionIdResultSchema as er, iterateOverPageCidsToFindAllCids as et, RemoteCommunity as f, parseCommunityAddressWithPKCErrorIfItFails as fn, t$8 as fr, pLimit as ft, decodeRpcChallengePubsubMsg as g, parseCommunityIpfsSchemaPassthroughWithPKCErrorIfItFails as gn, NAME_RESOLVE_FAILED_RETRY_FLOOR_MS as gr, signChallengeAnswer as gt, decodeRpcChallengeAnswerPubsubMsg as h, parseCommunityEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as hn, NAME_RESOLVED_TRUE_TTL_MS as hr, cleanUpBeforePublishing as ht, getCommunityChallengeFromCommunityChallengeSettings as i, parseCidStringSchemaWithPKCErrorIfItFails as in, effectiveMaxCrosspostDepth as ir, cloneCrosspostForRuntime as it, deleteOldCommunityInWindows as j, parseRpcCommentEventWithPKCErrorIfItFails as jn, verifyChallengeVerification as jt, calculateInlineRepliesBudget as k, parseJsonWithPKCErrorIfFails as kn, verifyChallengeMessage as kt, createAuthorIdentityMatcher as l, parseCommentModerationChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as ln, n$5 as lr, PKCClientsManager as lt, KeyvBetterSqlite3 as m, parseCommunityEditOptionsSchemaWithPKCErrorIfItFails as mn, NAME_RESOLVED_FALSE_TTL_MS as mr, require_lib$1 as mt, RpcRemoteCommunity as n, getPublicKeyFromPrivateKey as nn, RpcUnsubscribeParamSchema as nr, RepliesPages as nt, pkcJsChallenges as o, parseCommentEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as on, t$4 as or, extractCrosspostRuntimeFields as ot, MAX_FILE_SIZE_BYTES_FOR_COMMUNITY_IPFS as p, parseCommunityEditChallengeRequestToEncryptSchemaWithPKCErrorIfItFails as pn, stringify as pr, PKCTypedEmitter as pt, POST_REPLIES_SORT_TYPES as q, RpcExportCommunityResultSchema as qn, getCommunityNameFromWire$1 as qt, getChallengeVerification as r, createSchemaRowParser as rn, crosspostChainDepthUpTo as rr, applyNameResolvedCacheToCrosspost as rt, authorIdentityMatcherForRequest as s, parseCommentEditPubsubMessagePublicationSchemaWithPKCErrorIfItFails as sn, r as sr, stripNameResolvedFromCrosspost as st, RpcLocalCommunity as t, getPKCAddressFromPublicKeySync as tn, RpcSuccessResultSchema as tr, parseRawPages as tt, TrackedInstanceRegistry as u, parseCommentModerationPubsubMessagePublicationSchemaWithPKCErrorIfItFails as un, n$6 as ur, InflightFetchManager as ut, decodeRpcChallengeVerificationPubsubMsg as v, parseCreateCommentModerationOptionsSchemaWithPKCErrorIfItFails as vn, require_lodash_merge as vr, signChallengeRequest as vt, encryptEd25519AesGcm as w, parseCreateRpcCommunityFunctionArgumentSchemaWithPKCErrorIfItFails as wn, signCommentUpdateForChallengeVerification as wt, createAnchorIpnsRecord as x, parseCreateNewLocalCommunityUserOptionsSchemaWithPKCErrorIfItFails as xn, signCommentEdit as xt, SignerWithPublicKeyAddress as y, parseCreateCommentOptionsSchemaWithPKCErrorIfItFails as yn, nativeFunctions$1 as yr, signChallengeVerification as yt, listCommunitiesSync as z, RpcCidParamSchema as zn, verifyVote as zt };
|