Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/nostr_deno_client/lib/nostr.ts>Nostr

Nostr protocol client library for deno runtime.
Latest
class Nostr
extends EventEmitter
import { Nostr } from "https://deno.land/x/nostr_deno_client@v0.2.7/lib/nostr.ts";

Constructors

new
Nostr()

Properties

private
_privateKey: any
private
_publicKey: any
private
relayInstances: Array<Relay>
debugMode: boolean
writeonly
privateKey: string
writeonly
publicKey: string
relayList: Array<RelayList>

Methods

private
calculateId(event: NostrEvent)
private
eventCommitment(event: NostrEvent): string
private
getFollowerInfo(publicKey: string)
private
getFollowingInfo(publicKey: string)
private
getKeyFromNip19(key: string)
private
getProfile(publicKey: string): Promise<ProfileInfo>
private
hexChar(val: number)
private
hexEncode(buf: any)
private
sendPost(
content: string,
rootReference?: string,
reference?: string,
mention?: string,
)
private
signId(id: string)
private
utf8Encode(txt: string)
filter(filters: NostrFilters, unique?)

Usage example: for await (const event of nostr.filter({ kinds: [NostrKind.META_DATA], authors: [publicKey], limit: 1 })) { console.log(event) }

getNip19FromKey(key: string)
getOtherProfile(publicKey: string): Promise<ProfileInfo>
globalFeed(unnamed 0: { limit?: number; since?: number; authors?: Array<string>; }): Promise<Array<NostrPost>>
isValidEvent(event: NostrEvent): Promise<boolean>
log(...args: any)
sendMessage(to: string, message: any)
sendReplyPost(content: string, post: NostrPost)
sendTextPost(content: string)