-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·55 lines (45 loc) · 1.69 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·55 lines (45 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
KEYS_DIR="$SCRIPT_DIR/keys"
echo "=== Marmot CLI Setup ==="
echo ""
# Create keys directory with restrictive permissions
mkdir -p "$KEYS_DIR"
chmod 700 "$KEYS_DIR"
# Prompt for nsec if credentials don't already exist
if [ ! -f "$KEYS_DIR/nostr.json" ]; then
echo "Enter your Nostr private key (nsec1...) — input will be hidden:"
read -r -s nsec
echo "" # newline after hidden input
if [[ ! "$nsec" =~ ^nsec1 ]]; then
echo "ERROR: Key must start with 'nsec1'"
exit 1
fi
printf '{"nsec": "%s"}\n' "$nsec" > "$KEYS_DIR/nostr.json"
chmod 600 "$KEYS_DIR/nostr.json"
echo "Credentials saved to $KEYS_DIR/nostr.json"
else
echo "Credentials already exist at $KEYS_DIR/nostr.json — skipping key prompt."
fi
echo ""
DEFAULT_RELAYS="wss://relay.damus.io,wss://relay.primal.net,wss://nos.lol"
echo "Relay URLs (comma-separated)."
echo "Press Enter to use defaults: $DEFAULT_RELAYS"
read -r -p "Relays: " relays
relays="${relays:-$DEFAULT_RELAYS}"
echo "MARMOT_RELAYS=$relays" > "$SCRIPT_DIR/.env"
echo "Relays saved to .env"
echo ""
echo "Building Docker image (Rust compile takes a few minutes on first run)..."
docker compose -f "$SCRIPT_DIR/docker-compose.yml" build
echo ""
echo "Publishing your MLS key package to Nostr relays..."
echo " Using: $relays"
# marmot wrapper loads credentials from /credentials/nostr.json and relay list from env
docker compose -f "$SCRIPT_DIR/docker-compose.yml" run --rm \
--entrypoint /usr/local/bin/marmot \
marmot publish-key-package
echo ""
echo "Setup complete!"
echo "Run ./dm.sh (or just: docker compose run --rm marmot) to open the DM menu."