Anchor tools

Keep Nostr account settings portable, look up event kinds, evaluate relay suitability and understand what a publication receipt actually proves.

Try it in context: Read the guide.

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

What you can call (9)

assessRelayOutbox

Evaluate whether a relay is suitable for posting based on observed health and policy.

Call it as: Anchor.assessRelayOutbox

For developers: TypeScript signature

function assessRelayOutbox(relay?:object):{status:string;role:string;reasons:string[];verified:boolean};

Code location: src/anchor/relays.js

buildPublicAccountBackup

Save portable public account settings without exporting private keys or signer secrets.

Call it as: Anchor.buildPublicAccountBackup

For developers: TypeScript signature

function buildPublicAccountBackup(state:object,options?:{now?:number}):object;

Code location: src/anchor/index.js

classifyEventStorage

Identify how a Nostr event kind is normally stored and replaced.

Call it as: Anchor.classifyEventStorage

For developers: TypeScript signature

function classifyEventStorage(kind:number):'regular'|'replaceable'|'ephemeral'|'addressable';

Code location: src/anchor/kinds.js

extractEventAssets

List media attachments mentioned in a verified event without downloading them.

Call it as: Anchor.extractEventAssets

For developers: TypeScript signature

function extractEventAssets(event:SignedEvent):string[];

Code location: src/anchor/index.js

kindSpec

Look up the purpose and storage behavior of a Nostr event kind.

Call it as: Anchor.kindSpec

For developers: TypeScript signature

function kindSpec(kind:number):{kind:number;label:string;nip:string;storageClass:string;requiresDTag:boolean};

Code location: src/anchor/kinds.js

planVerifiedOutbox

Choose publishing relays from an account’s current options using actual probe evidence.

Call it as: Anchor.planVerifiedOutbox

For developers: TypeScript signature

function planVerifiedOutbox(relays:object[],options?:{max?:number}):{write:string[];reviewed:object[];insufficientEvidence:boolean};

Code location: src/anchor/relays.js

restorePublicAccountBackup

Restore public account settings in read-only mode until a signer is reapproved.

Call it as: Anchor.restorePublicAccountBackup

For developers: TypeScript signature

function restorePublicAccountBackup(input:object|string):{session:object;profile:object;relays:object[];blossomServers:object[];follows:object[];publications:object[];rejectedPublications:object[];signerConnected:false};

Code location: src/anchor/index.js

sanitizePublicSession

Remove private connection details before storing or exporting account information.

Call it as: Anchor.sanitizePublicSession

For developers: TypeScript signature

function sanitizePublicSession(session:object):object|null;

Code location: src/anchor/index.js

summarizePublicationReceipts

Summarize which relays accepted a publication and which actually returned the event.

Call it as: Anchor.summarizePublicationReceipts

For developers: TypeScript signature

function summarizePublicationReceipts(receipts?:object[]|object):{total:number;accepted:number;retrieved:number;verified:boolean;receipts:object[]};

Code location: src/anchor/index.js