forked from axiom-team/astroport
203 lines
5.6 KiB
Bash
Executable File
203 lines
5.6 KiB
Bash
Executable File
#!/bin/bash
|
|
########################################################################
|
|
MY_PATH="`dirname \"$0\"`" # relative
|
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
|
ME="${0##*/}"
|
|
echo '
|
|
########################################################################
|
|
# \\///
|
|
# qo-op
|
|
############# '$MY_PATH/$ME'
|
|
########################################################################
|
|
# Make a G1SSB Account
|
|
# Verify silkaj & sbotc install
|
|
# Backup any ~/.ssb to ~/.ssb_$USER
|
|
# Creates ~/.ssb_astroport and link it to ~/.ssb
|
|
# Ask for credentials (or auto)
|
|
# CREATE "~/.ssb/secret" & "~/.ssb/secret.dunikey" of you
|
|
# !!! KEEP CREDENTIALS IN ~/.zen/secret.astroport.key
|
|
########################################################################
|
|
'
|
|
# git & astroport code in ~/.zen
|
|
[[ ! -d ~/.zen ]] && mkdir -p ~/.zen
|
|
[[ !$(which git) ]] && sudo apt install git -y
|
|
[[ ! -d ~/.zen/astroport ]] && cd ~/.zen && git clone https://git.p2p.legal/axiom-team/astroport.git && cd astroport
|
|
|
|
# INSTALL Silkaj, CLI for Duniter
|
|
if [[ ! $(which silkaj) ]]; then
|
|
echo '**************************************************************
|
|
__ ___
|
|
(_ | | |/ /\ |
|
|
__) _|_ |_ |\ /--\ \_|
|
|
|
|
#Duniter communication client...
|
|
'
|
|
sudo apt update || true
|
|
libzzz=$(sudo apt-cache search libsodium | awk '{print $1}' | grep libsodium2)
|
|
sudo apt install build-essential jq $libzzz -y
|
|
sudo pip3 install base58
|
|
sudo apt install python3-pip python3-setuptools python3-wheel -y
|
|
pip3 install silkaj --user
|
|
echo 'PATH=$PATH:~/.local/bin' >> ~/.bashrc && source ~/.bashrc
|
|
fi
|
|
|
|
# INSTALL sbotc
|
|
if [[ ! $(which sbotc) ]]; then
|
|
|
|
echo '
|
|
__ __
|
|
_____/ /_ ____ / /______
|
|
/ ___/ __ \/ __ \/ __/ ___/
|
|
(__ ) /_/ / /_/ / /_/ /__
|
|
/____/_.___/\____/\__/\___/
|
|
|
|
ScuttleButt communication client...
|
|
'
|
|
sudo apt install libsodium-dev jq -y
|
|
cd ~/.zen/astroport/.install/sbotc
|
|
make
|
|
sudo make install
|
|
cd ~/.zen/astroport
|
|
fi
|
|
|
|
|
|
echo '
|
|
__ __
|
|
____ ______/ /__________ ____ ____ _____/ /_
|
|
/ __ `/ ___/ __/ ___/ __ \/ __ \/ __ \/ ___/ __/
|
|
/ /_/ (__ ) /_/ / / /_/ / /_/ / /_/ / / / /_
|
|
\__,_/____/\__/_/ \____/ .___/\____/_/ \__/
|
|
/_/
|
|
|
|
ONBOARDING activation... linking ~/.ssb to ~/.ssb_astroport
|
|
|
|
'
|
|
# CREATE ~/.ssb_astroport
|
|
[[ ! -d ~/.ssb_astroport ]] && mkdir -p ~/.ssb_astroport
|
|
|
|
# If exists backup ~/.ssb to ~/.ssb_$USER SSB (one time only !)
|
|
[[ -d ~/.ssb_$USER ]] && echo "BACKUP already existing... Restore it : rm -Rf ~/.ssb && mv ~/.ssb_$USER ~/.ssb and Try again..." && exit 1
|
|
|
|
if [[ -d ~/.ssb ]]; then
|
|
cp -f ~/.ssb/manifest.json ~/.ssb_astroport/
|
|
cp -f ~/.ssb/conn.json ~/.ssb_astroport/
|
|
cp -f ~/.ssb/gossip.json ~/.ssb_astroport/
|
|
fi
|
|
|
|
# BACKUP ACTUAL SSB ACCOUNT
|
|
[[ ! -d ~/.ssb_$USER ]] && mv ~/.ssb ~/.ssb_$USER
|
|
|
|
# Symlink ~/.ssb -> ~/.ssb_astroport
|
|
[[ -L ~/.ssb ]] && rm ~/.ssb
|
|
[[ -d ~/.ssb_astroport ]] && ln -s ~/.ssb_astroport ~/.ssb
|
|
|
|
cd ~/.ssb/
|
|
|
|
echo '>>>>>>> METAVERSE KEY CREATION <<<<<<<<
|
|
|
|
__ __ __ _
|
|
/__ /| (_ (_ |_)
|
|
\_| | __) __) |_)
|
|
|
|
CHOOSE YOU LOGIN (best more than 6 words)...
|
|
or LEAVE BLANK and HIT ENTER FOR diceware AUTO GENERATION
|
|
'
|
|
read salt
|
|
[[ $salt != "" ]] && echo "CHOOSE PASSWORD?" && read pepper && [[ $pepper == "" ]] && exit 1
|
|
|
|
if [[ "$salt" == "" && "$pepper" == "" ]]; then
|
|
|
|
echo '
|
|
._ _ ._ _ ._ _ _ ._ o _
|
|
| | | | | (/_ | | | (_) | | | (_
|
|
|
|
diceware passphrase generator...'
|
|
|
|
# LOGIN (=SALT)
|
|
salt="$($MY_PATH/diceware.sh 6)"
|
|
# PASS (=PEPPER)
|
|
pepper="$($MY_PATH/diceware.sh 4)"
|
|
|
|
echo "........."
|
|
|
|
[[ -f ~/.zen/secret.astroport.key ]] && echo "Your identity is already existing..." && cat ~/.zen/secret.astroport.key && exit 1
|
|
rm -f ~/.zen/secret.astroport.key
|
|
echo "# ASTROPORT SECRET CREDENTIALS !!!
|
|
ZENID=\"$salt\"
|
|
ZENPWD=\"$pepper\"" > ~/.zen/secret.astroport.key
|
|
|
|
fi
|
|
|
|
# CREATE ~/.ssb/secret.dunikey
|
|
python3 $MY_PATH/key_create_dunikey.py "$salt" "$pepper"
|
|
sleep 1
|
|
[[ -f /tmp/secret.dunikey ]] && mv /tmp/secret.dunikey ~/.ssb/secret.dunikey || exit 1
|
|
|
|
# CREATE SSB secret
|
|
g1pub=$(cat ~/.ssb/secret.dunikey | grep "pub" | cut -d ' ' -f 2)
|
|
echo "ZENG1=\"$g1pub\"" >> ~/.zen/secret.astroport.key
|
|
|
|
g1priv=$(cat ~/.ssb/secret.dunikey | grep "sec" | cut -d ' ' -f 2)
|
|
ssbpub=$(echo $g1pub | base58 -d | base64)
|
|
ssbpriv=$(echo $g1priv | base58 -d | base64 | tr -d "\n" )
|
|
|
|
cat > ~/.ssb/secret <<EOF
|
|
# THIS KEY IS YOURS! REMIND IT AND KEEP IT SAFE AS A REAL WALLET
|
|
{
|
|
"curve": "ed25519",
|
|
"public": "${ssbpub}.ed25519",
|
|
"private": "${ssbpriv}.ed25519",
|
|
"id": "@${ssbpub}.ed25519"
|
|
}
|
|
|
|
# WARNING! It's vital that you DO NOT edit OR share your secret name
|
|
# ONLY Share your public name : @${ssbpub}.ed25519
|
|
# AND Public G1 WALLET : $g1pub
|
|
|
|
EOF
|
|
|
|
echo "ZENSSB=\"@$ssbpub.ed25519\"" >> ~/.zen/secret.astroport.key
|
|
|
|
echo "
|
|
_
|
|
|__|_ \ / _ o | _.
|
|
|_ |_ \/ (_) | | (_|
|
|
|
|
Your Identity is created !!
|
|
REMEMBER TO KEEP your secret files SECRET !!!
|
|
|
|
Your public name : @${ssbpub}.ed25519
|
|
Your G1 WALLET : $g1pub
|
|
|
|
Install https://cesium.app
|
|
"
|
|
|
|
cat ~/.zen/secret.astroport.key
|
|
chmod 400 ~/.zen/secret.astroport.key
|
|
chmod 400 ~/.ssb/secret
|
|
chmod 400 ~/.ssb/secret.dunikey
|
|
|
|
echo '
|
|
__
|
|
__________/ /_
|
|
/ ___/ ___/ __ \
|
|
(__ |__ ) /_/ /
|
|
/____/____/_.___/
|
|
|
|
Open Patchwork ScuttleButt Client.
|
|
|
|
https://ahdinosaur.github.io/patchwork-downloader/
|
|
|
|
Enter "yes" for your Station initializing connections...
|
|
'
|
|
read yesno
|
|
|
|
if [[ $yesno == "yes" ]]; then
|
|
|
|
~/.zen/astroport/zen/ssb_INIT.sh
|
|
~/.zen/astroport/zen/cron_VRFY.sh
|
|
fi
|
|
|
|
|
|
exit 0
|