Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/social/signin.sh # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / social / signin.sh` 43 lines ยท 2468 bytes Raw Blame History 1 #!/bin/sh 2 # Interplane sign-in. Run the one command the sign-in page shows you: 3 # curl -fsSL https://interplane.io/signin.sh | sh -s -- 4 # It makes your key the first time (kept on this computer in ~/.interplane/key, never sent anywhere), 5 # signs the page's one-time code, and gives you one block of text to paste into the box on the page. 6 set -eu 7 c=${1:-} 8 case $c in 9 interplane-forge-login:*) ;; 10 *) echo "Copy the whole command from the sign-in page (https://interplane.io/login) and run it again." >&2; exit 2 ;; 11 esac 12 case $c in *[!a-z0-9:-]*) echo "That code does not look right. Copy the command from the sign-in page again." >&2; exit 2 ;; esac 13 command -v ssh-keygen > /dev/null 2>&1 || { echo "This needs ssh-keygen (OpenSSH), which is missing on this computer." >&2; exit 2; } 14 k=${INTERPLANE_KEY:-$HOME/.interplane/key} 15 if [ ! -f "$k" ]; then 16 mkdir -p "$(dirname "$k")"; chmod 700 "$(dirname "$k")" 17 ssh-keygen -q -t `ed25519` -N '' -C interplane -f "$k" 18 echo "Made your Interplane key: $k (this file is your account; keep it)" >&2 19 fi 20 [ -f "$k.pub" ] || ssh-keygen -y -f "$k" > "$k.pub" 21 case $(cut -d' ' -f1 "$k.pub") in ssh-`ed25519`) ;; *) echo "The key $k is not an Ed25519 key." >&2; exit 2 ;; esac 22 sig=$(printf %s "$c" | ssh-keygen -Y sign -f "$k" -n interplane-forge 2> /dev/null) || { echo "Signing failed with the key $k." >&2; exit 2; } 23 b64d() { base64 -d 2> /dev/null || base64 -D; } 24 # the account id: did:key:z + base58(0xed 0x01 + the 32 bytes of the public key) 25 id=$(cut -d' ' -f2 "$k.pub" | b64d | od -An -v -tu1 | tr -s ' \n' ' ' | awk '{ 26 n = 0; b[n++] = 237; b[n++] = 1; for (i = NF - 31; i <= NF; i++) b[n++] = $i + 0 27 al = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; s = ""; st = 0 28 while (st < n) { r = 0; for (i = st; i < n; i++) { v = r * 256 + b[i]; b[i] = int(v / 58); r = v % 58 } 29 s = substr(al, r + 1, 1) s; while (st < n && b[st] == 0) st++ } 30 printf "did:key:z%s", s }') 31 out=$(printf '%s\n%s\n' "$id" "$sig") 32 copied= 33 for t in pbcopy wl-copy "xclip -selection clipboard" "xsel --clipboard --input" clip.exe; do 34 if command -v "${t%% *}" > /dev/null 2>&1 && printf '%s\n' "$out" | $t 2> /dev/null; then copied=1; break; fi 35 done 36 echo 37 printf '%s\n' "$out" 38 echo 39 if [ -n "$copied" ]; then 40 echo "Copied. Go back to the sign-in page, paste into the box, press Sign in." >&2 41 else 42 echo "Copy everything between the blank lines above, paste it into the box on the sign-in page, press Sign in." >&2 43 fi