Files
marco/scripts/publish-app-recommendation.sh
T
raucao 2fce1f532e Add NIP-89 app handler docs and Nostr publishing scripts
Document Marco's NIP-89 app handler (kind 31990) and recommendation
(kind 31989), and how the place NIPs are published on Nostr as kind 30817
custom NIPs.

Add shell scripts that build and publish these events via nak: the app
handler, a recommendation, and the NIP specs. The publishing relay list
lives in scripts/nostr-relays.txt for easy editing. Signing requires an
explicit NOSTR_SECRET_KEY (nsec or NIP-46 bunker URL), and the scripts
refuse to publish from the wrong identity.
2026-11-28 12:39:28 +04:00

51 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
#
# Publish (or re-publish) a NIP-89 recommendation (kind 31989) pointing at
# Marco's app handler. Signed by a *user* key (your own), not the app key.
#
# Kind 31989 is addressable per (author, "d" = supported kind), so re-running
# replaces your previous recommendation for that kind.
#
# Usage:
# NOSTR_SECRET_KEY='...' ./scripts/publish-app-recommendation.sh [kind] [--dry-run]
#
# kind defaults to 360 (place photos); pass 30360 once place reviews ship.
#
set -eu
. "$(dirname "$0")/nostr-common.sh"
DRY_RUN=0
RECOMMEND_KIND=360
for arg in "$@"; do
case "$arg" in
--dry-run) DRY_RUN=1 ;;
*[!0-9]*) die "unknown argument: $arg" ;;
*) RECOMMEND_KIND="$arg" ;;
esac
done
[ -n "$MARCO_APP_PUBKEY" ] || die "set MARCO_APP_PUBKEY in scripts/nostr-common.sh (run publish-app-handler.sh first)"
require_signer
# One "a" tag per relay hint, so clients can find the handler either way.
event=$(
nak event --sec "$NAK_SEC" -k 31989 \
-d "$RECOMMEND_KIND" \
-t "a=31990:$MARCO_APP_PUBKEY:$MARCO_APP_D;wss://nostr.kosmos.org;web" \
-t "a=31990:$MARCO_APP_PUBKEY:$MARCO_APP_D;wss://relay.primal.net;web"
)
pubkey=$(printf '%s\n' "$event" | event_pubkey)
[ -n "$pubkey" ] || die "could not read pubkey from the signed event"
if [ "$DRY_RUN" = 1 ]; then
printf '%s\n' "$event"
echo "dry run: signed by $pubkey, not published" >&2
exit 0
fi
printf '%s\n' "$event" | nak event $NOSTR_RELAYS
echo "published recommendation (kind 31989, kind $RECOMMEND_KIND) as $pubkey"