37 lines
1.1 KiB
Bash
37 lines
1.1 KiB
Bash
|
#!/bin/bash
|
||
|
################################################################################
|
||
|
# Author: Fred (support@qo-op.com)
|
||
|
# Version: 1.0
|
||
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||
|
###########################################################################################
|
||
|
# This script convert secret.dunikey into ~/.ssb/secret.ssb
|
||
|
DUNKEYFILE="$1"
|
||
|
[[ ! ${DUNIKEYFILE} ]] && DUNKEYFILE="./secret.dunikey"
|
||
|
[[ ! ${DUNIKEYFILE} ]] && DUNKEYFILE="~/.ssb/secret.dunikey"
|
||
|
[[ ! -f ${DUNIKEYFILE} ]] && exit
|
||
|
|
||
|
pub=$(cat ${DUNIKEYFILE} | grep "pub" | cut -d ' ' -f 2)
|
||
|
priv=$(cat ${DUNIKEYFILE} | grep "sec" | cut -d ' ' -f 2)
|
||
|
ssbpub=$(echo $pub | base58 -d | base64)
|
||
|
ssbpriv=$(echo $priv | base58 -d | base64)
|
||
|
|
||
|
cat > ~/.ssb/secret.ssb <<EOF
|
||
|
# This secret generated by duniter2secret.sh
|
||
|
# G1 Wallet ACCOUNT BALANCE:
|
||
|
# silkaj balance $pub
|
||
|
#
|
||
|
# THIS KEY IS YOURS!
|
||
|
# NEVER show this to anyone!!!
|
||
|
|
||
|
{
|
||
|
"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 public name: @$ssbpub.ed25519
|
||
|
EOF
|