Use the same about text as the app's kind-0 profile: "Unhosted maps app, enhancing OpenStreetMap with decentralized user data and content".
8.6 KiB
Marco as a NIP-89 App Handler
NIP-89 lets clients discover applications that can handle an otherwise unknown event kind. Marco declares itself as the handler for the place media kinds it defines:
kind 360— Place Photos and Videos (seenip-place-photos.md)kind 30360— Place Reviews (to be added whennip-place-reviews.mdships)
Two events are involved:
| Event | Kind | Published by | Purpose |
|---|---|---|---|
| App handler | 31990 |
the author's npub | Describes Marco and where to open each handled kind |
| Recommendation | 31989 |
a user key | Recommends Marco's handler to that user's followers |
Both are addressable: re-publishing with the same author and d tag replaces
the previous event.
Identity
Marco's app handler is signed by the author's own npub — the same identity that authors the NIP specs — so it appears on NostrHub under a real Nostr account rather than a separate app key:
pubkey: 1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb
npub: npub1raustrrh5gjwt03zdj8syn9vmt2dwsv9t467m8c3gua636uxu89svgdees
naddr: naddr1qq9k6ctjvdhjuetpwf6xsq3qraustrrh5gjwt03zdj8syn9vmt2dwsv9t467m8c3gua636uxu89sxpqqqp70va9myaa
The key itself is never stored in this repository. The publishing scripts sign
through nak with an explicit signer from NOSTR_SECRET_KEY (an nsec/hex
key, or a NIP-46 bunker:// URL for a desktop signer), and MARCO_APP_PUBKEY
in scripts/nostr-common.sh guards against signing from any other key. See
publishing.md for the shared setup.
App handler event (kind 31990)
{
"kind": 31990,
"pubkey": "1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb",
"content": "{\"name\":\"Marco\",\"about\":\"Unhosted maps app, enhancing OpenStreetMap with decentralized user data and content\",\"picture\":\"https://marco.earth/icons/icon-192.png\",\"website\":\"https://marco.earth\",\"nip05\":\"marco@kosmos.org\"}",
"tags": [
["d", "marco.earth"],
["k", "360"],
["web", "https://marco.earth/e/<bech32>", "nevent"],
["i", "https://github.com/nostr-protocol/nips/blob/master/01.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/07.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/09.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/19.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/21.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/46.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/57.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/65.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/73.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/89.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/92.md"],
["i", "https://github.com/nostr-protocol/nips/blob/master/B7.md"],
[
"a",
"30817:1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb:place-photos-and-videos",
"wss://nostr.kosmos.org",
"nip"
],
["t", "maps"],
[
"a",
"30617:1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb:marco",
"wss://relay.ngit.dev"
]
]
}
contentis optional kind-0-style metadata. Because the app key is not an account users follow, Marco carries its name/description/icon/website here instead of (or in addition to) akind 0.dismarco.earth, so the addressable coordinate is31990:1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb:marco.earth.klists every event kind Marco handles. Add["k", "30360"]when place reviews ship.webis a URL template. Clients replace<bech32>with the NIP-19 encoding of the entity to open, then load the URL. Marco resolves this at/e/:event_id, reads the event'sitag and opens its place. When the event is a place photo, it focuses that photo in the place's carousel (the place URL gains a?photo=<event-id>query param). It accepts a raw 64-hex event id,note1/nevent1/naddr1codes (relay hints included), an optionalnostr:prefix, and full permalinks (resolved via the last path segment).- The second
webvalue (nevent) makes the tag kind-specific. When reviews ship, add annaddrtemplate (reviews are addressable) pointing at the same route, since annaddrresolves to the reviewed place too. itags advertise the official NIPs Marco implements, and oneatag references Marco's own kind-30817 NIP (Place Photos and Videos). See Implemented NIPs.content.nip05is the app's NIP-05 identifier.ttags are categories; NostrHub renders them as hashtags.- The kind-30617
atag links Marco's ngit repository (with a relay hint), which NostrHub shows as the app's source.
Implemented NIPs
The handler lists what Marco implements so directories such as NostrHub's app list can show it. NostrHub reads two shapes:
- official NIPs as
itags whose value is the NIP's file URL in nostr-protocol/nips, e.g.["i", "https://github.com/nostr-protocol/nips/blob/master/89.md"]; - custom NIPs (kind 30817) as an
atag markednip, e.g.["a", "30817:<pubkey>:place-photos-and-videos", "wss://nostr.kosmos.org", "nip"].
The set (edit MARCO_NIPS and MARCO_NIP_PHOTOS_D in
scripts/nostr-common.sh):
| NIP | What Marco uses it for |
|---|---|
| 01 | Base protocol |
| 07 | window.nostr extension signer |
| 09 | Photo deletion (kind 5) |
| 19 | bech32 entities (npub/nevent/naddr) |
| 21 | nostr: URIs |
| 46 | Nostr Connect remote signer |
| 57 | Zaps (kinds 9734/9735) |
| 65 | Reading relay lists (kind 10002) |
| 73 | External content IDs (osm:) |
| 89 | App handlers (this NIP) |
| 92 | imeta media metadata |
| B7 | Blossom blob upload/delete (kind 24242) |
The NipId & NIP References
extension of NIP-73 defines a more general ["i", "<nipid>", …] + ["k", "nip"]
form (github.com:nostr-protocol/nips:89, or 30817:<pubkey>:<d>), but
NostrHub's app directory does not parse it, so the shapes above are used
instead.
Recommendation event (kind 31989)
Published from a user's account (scripts/publish-app-recommendation.sh):
{
"kind": 31989,
"pubkey": "<user-pubkey>",
"content": "",
"tags": [
["d", "360"],
[
"a",
"31990:1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb:marco.earth",
"wss://nostr.kosmos.org",
"web"
],
[
"a",
"31990:1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb:marco.earth",
"wss://relay.primal.net",
"web"
]
]
}
dis the supported event kind this recommendation applies to (360now; publish another withd = 30360later).- Each
atag is the app-handler coordinate plus a relay hint and the platform (web). Two tags give clients two places to find the handler.
Relays
Publishing targets live in scripts/nostr-relays.txt (one URL per line; #
comments allowed). scripts/nostr-common.sh loads them into NOSTR_RELAYS;
edit that file to change where events are sent. An explicitly set
NOSTR_RELAYS environment variable overrides it.
Publishing
# app handler, signed by the author's own npub
NOSTR_SECRET_KEY='bunker://...' ./scripts/publish-app-handler.sh
# recommendation, signed by your own key
NOSTR_SECRET_KEY='<your key or bunker>' ./scripts/publish-app-recommendation.sh
# retire an old handler (only its author key can delete it)
NOSTR_SECRET_KEY='<old app key>' ./scripts/unpublish-app-handler.sh --dry-run
NOSTR_SECRET_KEY='<old app key>' ./scripts/unpublish-app-handler.sh
# add --dry-run to any script to sign and print without publishing
MARCO_APP_PUBKEY in scripts/nostr-common.sh holds the handler's author npub;
the scripts refuse to sign from any other key. unpublish-app-handler.sh
targets MARCO_OLD_APP_PUBKEY by default (pass a pubkey to override).