Skip to content

Instantly share code, notes, and snippets.

@ohac
Created October 3, 2025 15:20
Show Gist options
  • Select an option

  • Save ohac/7c8f7e791d9b83826f7625f4ee03f102 to your computer and use it in GitHub Desktop.

Select an option

Save ohac/7c8f7e791d9b83826f7625f4ee03f102 to your computer and use it in GitHub Desktop.
upload to nostr.build using NIP-96
#!/usr/bin/env bash
FILE_PATH="$1"
NOSTR_AUTH="$2"
URL="$3"
if [ -z "$URL" ]; then
echo no URL
exit 1
fi
curl -sS \
-H "Authorization: Nostr ${NOSTR_AUTH}" \
-F "file=@${FILE_PATH}" \
$URL
#!/usr/bin/env bash
FILE_PATH="$1"
if [ -z "$FILE_PATH" ]; then
echo no file
exit 1
fi
URL="https://nostr.build/api/v2/nip96/upload"
NOSTR_SECRET_KEY=$(cat nsechex.txt)
export SIGNED_EVENT="$(
nak event \
-k 27235 \
--tag u=$URL \
--tag method=POST \
--sec $NOSTR_SECRET_KEY \
-c '' \
)"
NOSTR_AUTH=$(echo "$SIGNED_EVENT" \
| jq -c . \
| base64 -w0 | tr '+/' '-_' | tr -d '=')
./post.sh $FILE_PATH $NOSTR_AUTH $URL > result.json
jq < result.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment