astroport/zen/secret2dunikey.sh

28 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
########################################################################
# Author: Fred (support@qo-op.com)
# Version: 1.0
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
########################################################################
# This script creates ~/.ssb/secret.dunikey from your scuttlebutt secret
# You can use it https://cesium.app / https://silkaj.duniter.org/
# Python API https://pypi.org/project/duniterpy/
########################################################################
[[ ! -f ~/.ssb/secret ]] && echo "Your SSB secret is missing... EXIT" && exit 1
rm -f ~/.ssb/secret.dunikey
ssbpub=$(cat ~/.ssb/secret | grep public\" | cut -d ' ' -f 4 | cut -d '.' -f 1 | sed s/\"//g)
ssbpriv=$(cat ~/.ssb/secret | grep private\" | cut -d ' ' -f 4 | cut -d '.' -f 1 | sed s/\"//g)
g1pub=$(echo $ssbpub | base64 -d | base58)
g1priv=$(echo $ssbpriv | base64 -d | base58)
cat > ~/.ssb/secret.dunikey <<EOF
Type: PubSec
Version: 1
pub: $g1pub
sec: $g1priv
EOF
echo "Your G1 Wallet PubKey is :
$g1pub
Your KEY is located in ~/.ssb/secret.dunikey
Use it with https://cesium.app "