Moderation tools

Recognize known nsite spam, review repeated bot-like templates, and hide blocked publishers or emoji-media hashes without erasing anything.

Try it in context: Read the guide.

import { Moderation } from '@chaoticka/nsite-loopy-sdk';

What you can call (19)

BUILT_IN_NSFW_BAN_PUBKEYS

The known blocked Nostr publishers from the curated Moji content list.

Call it as: Moderation.BUILT_IN_NSFW_BAN_PUBKEYS

For developers: TypeScript signature

const BUILT_IN_NSFW_BAN_PUBKEYS:readonly Hex[];

Code location: src/moderation/lists.js

BUILT_IN_NSFW_BLOB_HASHES

The known blocked emoji-media hashes used to hide matching content across packs.

Call it as: Moderation.BUILT_IN_NSFW_BLOB_HASHES

For developers: TypeScript signature

const BUILT_IN_NSFW_BLOB_HASHES:readonly Hex[];

Code location: src/moderation/lists.js

BUILT_IN_NSFW_MEDIA_URLS

The known media URLs used to seed Moji’s blocklist without loading the images.

Call it as: Moderation.BUILT_IN_NSFW_MEDIA_URLS

For developers: TypeScript signature

const BUILT_IN_NSFW_MEDIA_URLS:readonly string[];

Code location: src/moderation/lists.js

CAMPAIGN_ROLE_OPENERS

The opening phrases used by the recognized nsite spam campaign.

Call it as: Moderation.CAMPAIGN_ROLE_OPENERS

For developers: TypeScript signature

const CAMPAIGN_ROLE_OPENERS:readonly string[];

Code location: src/moderation/campaigns.js

MOJI_CURATOR_BLOCKLIST_VERSION

The format identifier for the built-in Moji blocklist.

Call it as: Moderation.MOJI_CURATOR_BLOCKLIST_VERSION

For developers: TypeScript signature

const MOJI_CURATOR_BLOCKLIST_VERSION:string;

Code location: src/moderation/lists.js

campaignMatch

Find the confirmed three-part spam description pattern in a site description.

Call it as: Moderation.campaignMatch

For developers: TypeScript signature

function campaignMatch(description:string):{prefix:string;reasons:string[]}|null;

Code location: src/moderation/campaigns.js

clusterNsiteSpam

Identify groups of suspiciously similar site descriptions posted by different accounts.

Call it as: Moderation.clusterNsiteSpam

For developers: TypeScript signature

function clusterNsiteSpam(sites:object[],options?:{minDistinctAuthors?:number}):object[];

Code location: src/moderation/campaigns.js

decodeNip19

Decode a Nostr identifier such as an npub into its underlying identifier data.

Call it as: Moderation.decodeNip19

For developers: TypeScript signature

function decodeNip19(value:string):{type:string;hex:Hex;relays?:string[];identifier?:string|null;kind?:number|null};

Code location: src/moderation/identity.js

filterNsites

Hide confirmed spam from a browsing view while retaining the complete original catalog.

Call it as: Moderation.filterNsites

For developers: TypeScript signature

function filterNsites(sites:object[],options?:{bannedPubkeys?:Hex[];hideConfirmed?:boolean;hideSuspected?:boolean;ownPubkey?:Hex}):{visible:object[];hidden:object[];decisions:object[];clusters:object[];rawCount:number};

Code location: src/moderation/campaigns.js

inspectNsiteSpam

Explain why a site looks like known spam, needs review or appears clear.

Call it as: Moderation.inspectNsiteSpam

For developers: TypeScript signature

function inspectNsiteSpam(site:object,options?:{knownCampaigns?:boolean}):{status:'confirmed'|'review'|'clear';reasons:string[];evidence:object};

Code location: src/moderation/campaigns.js

isEmojiAllowed

Decide whether a custom emoji is visible under the selected publisher and media rules.

Call it as: Moderation.isEmojiAllowed

For developers: TypeScript signature

function isEmojiAllowed(candidate:{source?:string;packAuthor?:string;hash?:string;emojiKey?:string},policy?:object):boolean;

Code location: src/moderation/lists.js

mergeBlocklists

Combine curated blocked-publisher and media-hash lists without duplicates.

Call it as: Moderation.mergeBlocklists

For developers: TypeScript signature

function mergeBlocklists(...lists:object[]):{pubkeys:Hex[];emojiHashes:Hex[];mediaUrls:string[]};

Code location: src/moderation/lists.js

muteListTemplate

Prepare a Nostr mute-list event that a signer can approve later.

Call it as: Moderation.muteListTemplate

For developers: TypeScript signature

function muteListTemplate(pubkeys:readonly string[],options?:{created_at?:number}):UnsignedEvent;

Code location: src/moderation/lists.js

normalizeEmojiHash

Convert a supported emoji hash or URL into a stable lookup value.

Call it as: Moderation.normalizeEmojiHash

For developers: TypeScript signature

function normalizeEmojiHash(value:string|null|undefined):Hex|null;

Code location: src/moderation/identity.js

normalizeHashList

Clean and deduplicate a list of emoji media hashes.

Call it as: Moderation.normalizeHashList

For developers: TypeScript signature

function normalizeHashList(values:readonly string[]):Hex[];

Code location: src/moderation/identity.js

normalizePubkey

Convert a valid npub or hex public key into a standard comparison form.

Call it as: Moderation.normalizePubkey

For developers: TypeScript signature

function normalizePubkey(value:string|null|undefined):Hex|null;

Code location: src/moderation/identity.js

normalizePubkeyList

Clean and deduplicate a list of publisher identities.

Call it as: Moderation.normalizePubkeyList

For developers: TypeScript signature

function normalizePubkeyList(values:readonly string[]):Hex[];

Code location: src/moderation/identity.js

parseCuratorBlocklist

Import the curated publisher/media blocklist from JSON.

Call it as: Moderation.parseCuratorBlocklist

For developers: TypeScript signature

function parseCuratorBlocklist(raw:string):{schema:string;pubkeys:Hex[];emojiHashes:Hex[];mediaUrls:string[]};

Code location: src/moderation/lists.js

parseNip51MuteList

Verify a signed account mute-list event and collect its blocked publishers.

Call it as: Moderation.parseNip51MuteList

For developers: TypeScript signature

function parseNip51MuteList(event:SignedEvent):{pubkey:Hex;pubkeys:Hex[];eventId:Hex;createdAt:number};

Code location: src/moderation/lists.js