Fun fact, Kind 0 (User Profile Metadata) is such an old, scappy pre-nips nostr relic that there isn't even a NIP describing how to put your lightning address in your profile data. Everything was made up. It's time to fix this shit, @npub180cv...h6w6

Replies (12)

To illustrate how bad kind0 is sometimes below is a real function I wrote (unfortunately) like 2 years ago to get users fields from their profile: export const findKind0Fields = async kind0 => { let fields = {}; const usernameProperties = ['name', 'displayName', 'display_name', 'username', 'handle', 'alias']; const pubkeyProperties = ['pubkey', 'npub', '_pubkey']; const findTruthyPropertyValue = (object, properties) => { for (const property of properties) { if (object?.[property]) { return object[property]; } } return null; }; const username = findTruthyPropertyValue(kind0, usernameProperties); if (username) { fields.username = username; } const avatar = findTruthyPropertyValue(kind0, [ 'picture', 'avatar', 'profilePicture', 'profile_picture', 'image', ]); if (avatar) { fields.avatar = avatar; } const pubkey = findTruthyPropertyValue(kind0, pubkeyProperties); if (pubkey) { fields.pubkey = pubkey; } const lud16 = findTruthyPropertyValue(kind0, ['lud16', 'lightning', 'lnurl', 'lnurlp', 'lnurlw']); if (lud16) { fields.lud16 = lud16; } const nip05 = findTruthyPropertyValue(kind0, ['nip05']); if (nip05) { fields.nip05 = nip05; } return fields; }; View quoted note →
You can use #Shakespeare to let it write a proper NIP for that, then post that to nostrhub.io - I did this with my NIP-54 successor. Or you write the NIP fully yourself as you have done multiple times.
SatsAndSports's avatar
SatsAndSports 1 month ago
Slightly unrelated: Where can I rebroadcast the Kind0 event of another user? I sometimes can see the profile page in Amethyst, but it's missing from other clients, and I guess it's a relay issue