astroport/zen/tools/make_G1SSB_secret.sh

335 lines
9.7 KiB
Bash
Raw Normal View History

#!/bin/bash
2020-05-04 18:54:12 +02:00
{
########################################################################
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
echo '
########################################################################
# \\///
# qo-op
############# '$MY_PATH/$ME'
########################################################################
2020-05-03 01:06:49 +02:00
# Make Astroport Station Account
2020-05-03 01:09:32 +02:00
#
# You should already be runing ipfs daemon
2020-05-03 01:06:49 +02:00
########################################################################
# - Install silkaj youtube-dl & sbotc
# - 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
2020-05-02 00:24:39 +02:00
# !!! KEEP CREDENTIALS IN ~/.zen/secret.astroport.key
2020-05-03 01:06:49 +02:00
########################################################################
# UnInstall and Recover your ~/.ssb_$USER
2020-05-02 03:57:49 +02:00
# cd && rm -Rf ~/.zen && rm ~/.ssb && mv ~/.ssb_$USER ~/.ssb
########################################################################
2020-05-03 00:33:07 +02:00
I encourage you to read any code you download.
This one is not perfect, but will not harm your system...
2020-05-03 18:03:39 +02:00
Install IPFS (compatible with ARM and X64)
2020-05-04 19:30:17 +02:00
curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/.install/ipfs_alone.sh | bash
2020-05-03 18:03:39 +02:00
2020-05-03 00:33:07 +02:00
HIT ENTER TO CONTINUE
'
2020-05-03 00:33:07 +02:00
read letsgo
2020-05-02 03:33:11 +02:00
2020-05-04 19:30:17 +02:00
# "ipfs daemon" MUST be RUNNING
[[ ! $(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) ]] \
&& echo "EXIT! PLEASE INSTALL & RUN ipfs daemon WITH curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/.install/ipfs_alone.sh | bash " \
&& exit 1
2020-05-04 19:30:17 +02:00
# ~/.zen is ASTROPORT living place.
2020-05-02 03:33:11 +02:00
[[ ! -d ~/.zen/astroport ]] && mkdir -p ~/.zen/astroport
2020-05-04 19:30:17 +02:00
# IS git THERE ?
2020-05-02 03:33:11 +02:00
[[ ! $(which git) ]] && sudo apt install git -y
2020-05-04 19:30:17 +02:00
# USE git pull OR git clone
2020-05-02 03:33:11 +02:00
if [[ -f ~/.zen/astroport/install.sh ]]; then
cd ~/.zen/astroport && git pull
else
cd ~/.zen
git clone https://git.p2p.legal/axiom-team/astroport.git
fi
2020-05-02 03:27:00 +02:00
cd ~/.zen/astroport
2020-05-04 19:30:17 +02:00
# LETS GO
2020-05-03 22:51:50 +02:00
# Install nvm
echo '
__ _
____ ____ ____/ /__ (_)____
/ __ \/ __ \/ __ / _ \ / / ___/
/ / / / /_/ / /_/ / __/ / (__ )
/_/ /_/\____/\__,_/\___/ __/ /____/
/___/
'
2020-05-04 03:11:17 +02:00
if [[ ! $(which node) ]]; then
2020-05-03 22:51:50 +02:00
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
source ~/.bashrc
export NVM_DIR="$HOME/.nvm"
nvm install --lts
fi
2020-04-04 17:07:38 +02:00
# INSTALL Silkaj, CLI for Duniter
2020-05-02 03:36:12 +02:00
echo '**************************************************************
2020-04-04 17:07:38 +02:00
__ ___
(_ | | |/ /\ |
__) _|_ |_ |\ /--\ \_|
2020-05-02 00:24:39 +02:00
#Duniter communication client...
2020-04-04 17:07:38 +02:00
'
2020-05-02 03:36:12 +02:00
export PATH=$PATH:~/.local/bin
if [[ ! $(which silkaj) ]]; then
2020-04-04 17:07:38 +02:00
sudo apt update || true
2020-04-30 02:40:26 +02:00
libzzz=$(sudo apt-cache search libsodium | awk '{print $1}' | grep libsodium2)
2020-05-04 16:30:43 +02:00
sudo apt install build-essential qrencode jq $libzzz -y
2020-04-04 17:07:38 +02:00
sudo apt install python3-pip python3-setuptools python3-wheel -y
2020-05-03 00:00:16 +02:00
sudo pip3 install base58
2020-04-04 17:07:38 +02:00
pip3 install silkaj --user
2020-04-30 02:36:45 +02:00
echo 'PATH=$PATH:~/.local/bin' >> ~/.bashrc && source ~/.bashrc
2020-04-04 17:07:38 +02:00
fi
2020-04-30 02:51:50 +02:00
# INSTALL sbotc
2020-05-01 21:53:40 +02:00
echo '
__ __
_____/ /_ ____ / /______
/ ___/ __ \/ __ \/ __/ ___/
(__ ) /_/ / /_/ / /_/ /__
/____/_.___/\____/\__/\___/
2020-05-02 00:24:39 +02:00
ScuttleButt communication client...
2020-05-01 21:53:40 +02:00
'
2020-05-02 03:36:12 +02:00
if [[ ! $(which sbotc) ]]; then
2020-05-03 01:09:32 +02:00
sudo apt install libsodium-dev build-essential imagemagick -y
2020-05-02 01:13:00 +02:00
cd /tmp/
git clone https://git.scuttlebot.io/%25133ulDgs%2FoC1DXjoK04vDFy6DgVBB%2FZok15YJmuhD5Q%3D.sha256 sbotc
cd sbotc
2020-04-30 02:51:50 +02:00
make
sudo make install
2020-05-02 00:24:39 +02:00
cd ~/.zen/astroport
2020-04-30 02:51:50 +02:00
fi
2020-04-04 17:07:38 +02:00
2020-05-03 01:00:38 +02:00
# INSTALL youtube-dl
echo '
__ __ ____
__ ______ __ __/ /___ __/ /_ ___ ____/ / /
/ / / / __ \/ / / / __/ / / / __ \/ _ \______/ __ / /
/ /_/ / /_/ / /_/ / /_/ /_/ / /_/ / __/_____/ /_/ / /
\__, /\____/\__,_/\__/\__,_/_.___/\___/ \__,_/_/
/____/
youtube-dl Swarm audio and video source...
'
if [[ ! $(which youtube-dl) ]]; then
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl || exit 1
sudo chmod a+rx /usr/local/bin/youtube-dl
sudo chown $USER /usr/local/bin/youtube-dl
fi
2020-05-02 00:24:39 +02:00
echo '
__ __
____ ______/ /__________ ____ ____ _____/ /_
/ __ `/ ___/ __/ ___/ __ \/ __ \/ __ \/ ___/ __/
/ /_/ (__ ) /_/ / / /_/ / /_/ / /_/ / / / /_
\__,_/____/\__/_/ \____/ .___/\____/_/ \__/
/_/
ONBOARDING activation... linking ~/.ssb to ~/.ssb_astroport
'
2020-04-30 04:54:29 +02:00
# CREATE ~/.ssb_astroport
[[ ! -d ~/.ssb_astroport ]] && mkdir -p ~/.ssb_astroport
2020-05-01 21:53:40 +02:00
# If exists backup ~/.ssb to ~/.ssb_$USER SSB (one time only !)
2020-05-02 04:08:22 +02:00
[[ -d ~/.ssb_$USER ]] && echo "BACKUP already existing... Restore it : rm -Rf ~/.ssb && mv ~/.ssb_$USER ~/.ssb # and Try again..." && exit 1
2020-05-01 21:53:40 +02:00
if [[ -d ~/.ssb ]]; then
2020-05-02 03:38:13 +02:00
[[ -f ~/.ssb/manifest.json ]] && cp -f ~/.ssb/manifest.json ~/.ssb_astroport/
[[ -f ~/.ssb/conn.json ]] && cp -f ~/.ssb/conn.json ~/.ssb_astroport/
[[ -f ~/.ssb/gossip.json ]] && cp -f ~/.ssb/gossip.json ~/.ssb_astroport/
2020-05-01 21:53:40 +02:00
fi
# BACKUP ACTUAL SSB ACCOUNT
2020-05-02 01:13:00 +02:00
[[ -d ~/.ssb ]] && mv ~/.ssb ~/.ssb_$USER
2020-05-01 21:53:40 +02:00
2020-04-30 04:54:29 +02:00
# Symlink ~/.ssb -> ~/.ssb_astroport
[[ -L ~/.ssb ]] && rm ~/.ssb
[[ -d ~/.ssb_astroport ]] && ln -s ~/.ssb_astroport ~/.ssb
2020-04-30 04:09:58 +02:00
cd ~/.ssb/
2020-05-02 00:24:39 +02:00
echo '>>>>>>> METAVERSE KEY CREATION <<<<<<<<
2020-05-04 19:30:17 +02:00
__ __ ____
__/ // /_______ ______ __________ ___ / __ \
/_ _ __/ ___/ | /| / / __ `/ ___/ __ `__ \/ / / /
/_ _ __(__ )| |/ |/ / /_/ / / / / / / / / /_/ /
/_//_/ /____/ |__/|__/\__,_/_/ /_/ /_/ /_/\____/
KEY
2020-05-09 02:09:19 +02:00
CHOOSE YOU LOGIN (min 8 car. best is more than 6 words!!)...
2020-05-02 00:24:39 +02:00
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
2020-05-02 00:24:39 +02:00
echo '
._ _ ._ _ ._ _ _ ._ o _
| | | | | (/_ | | | (_) | | | (_
2020-05-02 00:24:39 +02:00
diceware passphrase generator...'
2020-05-05 18:32:19 +02:00
# INSTALL diceware files ## TODO REPLACE WITH ipfs links
[[ ! -f ~/.ssb_astroport/diceware.sh ]] \
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/diceware.sh -o ~/.ssb_astroport/diceware.sh \
&& chmod +x ~/.ssb_astroport/diceware.sh
[[ ! -f ~/.ssb_astroport/diceware-wordlist.txt ]] \
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/diceware-wordlist.txt
2020-05-02 00:24:39 +02:00
# LOGIN (=SALT)
2020-05-05 18:32:19 +02:00
salt="$(~/.ssb_astroport/diceware.sh 6)"
2020-05-02 00:24:39 +02:00
# PASS (=PEPPER)
2020-05-05 18:32:19 +02:00
pepper="$(~/.ssb_astroport/diceware.sh 4)"
2020-05-02 03:46:32 +02:00
fi
2020-04-30 04:54:29 +02:00
echo "........."
2020-04-30 04:09:58 +02:00
2020-05-02 03:46:32 +02:00
# [[ -f ~/.zen/secret.astroport.key ]] && echo "Your identity is already existing..." && cat ~/.zen/secret.astroport.key && exit 1
2020-05-02 00:24:39 +02:00
rm -f ~/.zen/secret.astroport.key
2020-05-04 19:30:17 +02:00
echo "# ASTROPORT #SWARM0 KEY SECRET CREDENTIALS !!!
2020-05-02 00:24:39 +02:00
ZENID=\"$salt\"
ZENPWD=\"$pepper\"" > ~/.zen/secret.astroport.key
# CREATE ~/.ssb/secret.dunikey
python3 ~/.zen/astroport/zen/tools/key_create_dunikey.py "$salt" "$pepper"
2020-04-30 04:54:29 +02:00
sleep 1
2020-04-30 04:50:03 +02:00
[[ -f /tmp/secret.dunikey ]] && mv /tmp/secret.dunikey ~/.ssb/secret.dunikey || exit 1
# CREATE SSB secret
2020-04-21 00:38:03 +02:00
g1pub=$(cat ~/.ssb/secret.dunikey | grep "pub" | cut -d ' ' -f 2)
2020-05-02 00:24:39 +02:00
echo "ZENG1=\"$g1pub\"" >> ~/.zen/secret.astroport.key
2020-04-30 04:09:58 +02:00
2020-04-21 00:38:03 +02:00
g1priv=$(cat ~/.ssb/secret.dunikey | grep "sec" | cut -d ' ' -f 2)
ssbpub=$(echo $g1pub | base58 -d | base64)
2020-04-30 05:18:43 +02:00
ssbpriv=$(echo $g1priv | base58 -d | base64 | tr -d "\n" )
2020-05-02 04:09:35 +02:00
rm -f ~/.ssb/secret
cat > ~/.ssb/secret <<EOF
# THIS KEY IS YOURS! REMIND IT AND KEEP IT SAFE AS A REAL WALLET
{
"curve": "ed25519",
2020-04-30 05:10:51 +02:00
"public": "${ssbpub}.ed25519",
"private": "${ssbpriv}.ed25519",
"id": "@${ssbpub}.ed25519"
}
# WARNING! It's vital that you DO NOT edit OR share your secret name
2020-05-02 00:24:39 +02:00
# ONLY Share your public name : @${ssbpub}.ed25519
# AND Public G1 WALLET : $g1pub
2020-04-30 05:10:51 +02:00
EOF
2020-05-02 00:24:39 +02:00
echo "ZENSSB=\"@$ssbpub.ed25519\"" >> ~/.zen/secret.astroport.key
2020-04-30 04:09:58 +02:00
echo "
_
|__|_ \ / _ o | _.
|_ |_ \/ (_) | | (_|
2020-05-02 00:24:39 +02:00
Your Identity is created !!
REMEMBER TO KEEP your secret files SECRET !!!
2020-05-02 00:24:39 +02:00
Your public name : @${ssbpub}.ed25519
Your G1 WALLET : $g1pub
2020-05-02 04:07:28 +02:00
"
2020-04-30 04:59:08 +02:00
2020-05-02 00:24:39 +02:00
chmod 400 ~/.zen/secret.astroport.key
chmod 400 ~/.ssb/secret
chmod 400 ~/.ssb/secret.dunikey
echo '
__
__________/ /_
/ ___/ ___/ __ \
(__ |__ ) /_/ /
/____/____/_.___/
2020-05-04 19:30:17 +02:00
NEW IDENTITY ACTIVATED in ~/.ssb/secret
You can use Patchwork ScuttleButt Client.
2020-05-02 00:24:39 +02:00
https://ahdinosaur.github.io/patchwork-downloader/
2020-05-03 00:39:33 +02:00
2020-05-04 19:30:17 +02:00
You can try others and report them to us ;P
Maybe help making install script for them ;)
2020-05-03 00:39:33 +02:00
2020-05-02 00:54:40 +02:00
'
2020-05-03 01:02:05 +02:00
sleep 5
2020-05-02 00:54:40 +02:00
echo '
_________
/ ____< /
/ / __ / /
/ /_/ // /
\____//_/
2020-05-04 19:30:17 +02:00
IDENTITY CREATED in ~/.ssb/secret.dunikey
Install https://cesium.app and use it
2020-05-02 00:54:40 +02:00
2020-05-02 04:07:28 +02:00
'
2020-05-02 03:57:49 +02:00
2020-05-02 04:07:28 +02:00
cat ~/.zen/secret.astroport.key
echo '
2020-05-03 00:39:33 +02:00
2020-05-04 19:30:17 +02:00
Enter "yes" to init Astroport Station...
and join your #Swarm0 ScuttleButt IPFS Metaverse
2020-05-03 00:39:33 +02:00
2020-05-04 19:31:41 +02:00
ACTIVATE METAVERSE #SWARM0 INIT SEQUENCE ?
2020-05-04 19:30:17 +02:00
ALPHA - ALPHA - ALPHA - ALPHA
2020-05-04 19:31:41 +02:00
Enter "yes" then hit ENTER
2020-05-04 19:30:17 +02:00
Do you want to continue?
2020-05-02 00:24:39 +02:00
'
read yesno
if [[ $yesno == "yes" ]]; then
~/.zen/astroport/zen/ssb_INIT.sh
~/.zen/astroport/zen/cron_VRFY.sh
fi
2020-04-30 04:59:08 +02:00
2020-05-03 00:39:33 +02:00
echo "Finished...
2020-05-02 03:57:49 +02:00
########################################################################
2020-05-04 19:30:17 +02:00
!!!! PLEASE TEST THAT EVERYTHING IS ALRIGHT !!!!
Please try ASTROPORT basic commands:
1. Test IPFS : ipfs id
2. Test SSB : sbotc whoami
3. Test G1 : silkaj balance $g1pub
4. Test #Swarm0 : crontab -l
2020-05-02 03:57:49 +02:00
2020-05-03 00:00:16 +02:00
You should see 'astroport/zen/cron_MINUTE.sh' in last one.
2020-05-02 03:57:49 +02:00
2020-05-04 19:30:17 +02:00
Manual activation #Swarm0 Astroport Station:
2020-05-02 04:04:49 +02:00
~/.zen/astroport/zen/cron_VRFY.sh
2020-05-03 00:39:33 +02:00
~/.zen/astroport/zen/ssb_INIT.sh
2020-05-02 04:04:49 +02:00
Submit issues: https://git.p2p.legal/axiom-team/astroport/issues
Send ideas to support@qo-op.com
2020-05-03 00:00:16 +02:00
"
2020-04-30 00:34:57 +02:00
exit 0
2020-05-04 18:54:12 +02:00
}