clone

tiny dependency-free nostr libraries for plain html, each under 5kb and named for an element. public domain

main
nobel / radon / README.md
README.md 1.4K source

🪪 radon.js - names & faces

radon.js is a miniature profile loader. Any element with nrn-profile gets its author's name, picture or other kind 0 fields filled in, with requests batched across the page and results cached. NIP-05 identifiers are checked, and newly seen or published profiles update every element at once.

<span nrn-profile="npub1..." nrn-field="name">npub1...</span>
<img nrn-profile="{pubkey}" nrn-field="picture">

The span's text becomes the author's name, and the image's src their picture.

Attributes

attribute description
nrn-profile Hex pubkey, or npub/nprofile when neon.js is loaded
nrn-field Kind 0 field to fill (on the element itself or descendants): name, picture, about, nip05, ... img gets src, others textContent
nrn-verified Set by radon when the profile's nip05 checks out
nrn-ignore radon skips this element and its descendants

name falls back to display_name. Requests go to the element's relays from hydrogen (the closest nhy-relay, else nhyCfg.relays) plus window.nrnCfg.relays (default wss://purplepag.es).

Events

event cancel to detail
nrn:profile skip filling this element pubkey, profile

API

function returns
radon.get(pubkey) promise of the profile (or undefined)
radon.cache profiles by hex pubkey

Requires xenon.js.