143 lines
3.9 KiB
Bash
Executable File
143 lines
3.9 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
|
|
########################################################################
|
|
'
|
|
mkdir -p ~/.zen
|
|
|
|
# INSTALL Silkaj, CLI for Duniter
|
|
if [[ ! $(which silkaj) ]]; then
|
|
echo '**************************************************************
|
|
__ ___
|
|
(_ | | |/ /\ |
|
|
__) _|_ |_ |\ /--\ \_|
|
|
|
|
#Libre Money Layer
|
|
'
|
|
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
|
|
cd /tmp
|
|
sudo apt install libsodium-dev jq -y
|
|
git clone https://git.scuttlebot.io/%25133ulDgs%2FoC1DXjoK04vDFy6DgVBB%2FZok15YJmuhD5Q%3D.sha256 sbotc
|
|
cd sbotc
|
|
make
|
|
sudo make install
|
|
cd $MY_PATH
|
|
fi
|
|
|
|
# If exists backup ~/.ssb to ~/.ssb_$USER SSB (one time only !)
|
|
[[ -d ~/.ssb_$USER ]] && echo "BACKUP already existing... ~/.ssb_$USER !!! Manual check please..." && exit 1
|
|
[[ -d ~/.ssb ]] && [[ ! -d ~/.ssb_$USER ]] && mv ~/.ssb ~/.ssb_$USER
|
|
|
|
# CREATE ~/.ssb_astroport
|
|
[[ ! -d ~/.ssb_astroport ]] && mkdir -p ~/.ssb_astroport
|
|
|
|
# Symlink ~/.ssb -> ~/.ssb_astroport
|
|
[[ -L ~/.ssb ]] && rm ~/.ssb
|
|
[[ -d ~/.ssb_astroport ]] && ln -s ~/.ssb_astroport ~/.ssb
|
|
|
|
cd ~/.ssb/
|
|
|
|
echo "WELCOME CREATING YOUR G1 SSB ACCOUNT !!!"
|
|
echo '
|
|
__ __ __ _
|
|
/__ /| (_ (_ |_)
|
|
\_| | __) __) |_)
|
|
|
|
CHOOSE YOU LOGIN or LEAVE BLANK & HIT ENTER FOR AUTO GENERATION
|
|
'
|
|
read salt
|
|
[[ $salt != "" ]] && echo "CHOOSE PASSWORD?" && read pepper && [[ $pepper == "" ]] && exit 1
|
|
|
|
if [[ "$salt" == "" && "$pepper" == "" ]]; then
|
|
echo '
|
|
._ _ ._ _ ._ _ _ ._ o _
|
|
| | | | | (/_ | | | (_) | | | (_
|
|
|
|
passphrase generator...'
|
|
|
|
# GENERATE MNEMONIC KEY: 9 MOTS
|
|
# LOGIN (=SALT) 6 WORDS
|
|
salt="$($MY_PATH/diceware.sh 6)"
|
|
# PASS (=PEPPER) 4 WORDS
|
|
pepper="$($MY_PATH/diceware.sh 4)"
|
|
|
|
echo "........."
|
|
rm -f ~/.zen/secret.ZEN.txt
|
|
echo "SECRET CREDENTIALS !!! https://cesium.app & https://gchange.fr
|
|
ID:$salt
|
|
PWD:$pepper" > ~/.zen/secret.ZEN.txt
|
|
|
|
|
|
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 "G1:$g1pub" >> ~/.zen/secret.ZEN.txt
|
|
|
|
g1priv=$(cat ~/.ssb/secret.dunikey | grep "sec" | cut -d ' ' -f 2)
|
|
ssbpub=$(echo $g1pub | base58 -d | base64)
|
|
ssbpriv=$(echo $g1priv | base58 -d | base64)
|
|
|
|
cat > ~/.ssb/secret <<EOF
|
|
# This secret is related to your G1Wallet - https://cesium.app
|
|
# silkaj balance $g1pub
|
|
# ID (salt): $salt / Pass: $pepper
|
|
# THIS KEY IS YOURS! REMIND IT AND KEEP IT SAFE AS A REAL WALLET
|
|
# chmod 400 ~/.zen/secret
|
|
|
|
{
|
|
"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
|
|
# instead, share your public name
|
|
# your SSB public name: @${ssbpub}.ed25519
|
|
|
|
EOF
|
|
|
|
echo "SSB:@$ssbpub.ed25519" >> ~/.zen/secret.ZEN.txt
|
|
|
|
echo "
|
|
_
|
|
|__|_ \ / _ o | _.
|
|
|_ |_ \/ (_) | | (_|
|
|
|
|
Your G1SSB KEY is made !!
|
|
Install Patchwork : https://github.com/ssbc/patchwork/releases/
|
|
|
|
"
|
|
|
|
cat ~/.zen/secret.ZEN.txt
|
|
chmod 400 ~/.zen/secret.ZEN.txt
|
|
|
|
|
|
|
|
exit 0
|