Cesium key can become IPFSNODEID
This commit is contained in:
parent
f6f4ea2bbf
commit
2ea0185d6b
|
@ -37,7 +37,7 @@ ipfs_secure_bytes = ipfs_secure.private_bytes(encoding=serialization.Encoding.Ra
|
|||
# Formulating PeerID
|
||||
ipfs_pid = base58.b58encode(b'\x00$\x08\x01\x12 ' + ipfs_shared_bytes)
|
||||
PeerID = ipfs_pid.decode('ascii')
|
||||
print('Peer ID: {}'.format(ipfs_pid.decode('ascii')))
|
||||
print('PeerID={}'.format(ipfs_pid.decode('ascii')))
|
||||
|
||||
|
||||
# Serializing private key in IPFS-native mode, the private key contains public one
|
||||
|
@ -45,7 +45,7 @@ pkey = crypto_pb2.PrivateKey()
|
|||
pkey.Type = crypto_pb2.KeyType.Ed25519
|
||||
pkey.Data = ipfs_secure_bytes + ipfs_shared_bytes
|
||||
PrivKey = base64.b64encode(pkey.SerializeToString()).decode('ascii')
|
||||
print('Private key: {}'.format(base64.b64encode(pkey.SerializeToString()).decode('ascii')))
|
||||
print('PrivKEY={}'.format(base64.b64encode(pkey.SerializeToString()).decode('ascii')))
|
||||
|
||||
# jq '.Identity.PeerID="$PeerID"' ~/.ipfs/config
|
||||
# jq '.Identity.PrivKey="$PrivKey"' ~/.ipfs/config
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
#!/bin/bash
|
||||
{
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
|
||||
echo '>>>>>>> METAVERSE KEY CREATION <<<<<<<<
|
||||
|
||||
__ __ ____
|
||||
__/ // /_______ ______ __________ ___ / __ \
|
||||
/_ _ __/ ___/ | /| / / __ `/ ___/ __ `__ \/ / / /
|
||||
/_ _ __(__ )| |/ |/ / /_/ / / / / / / / / /_/ /
|
||||
/_//_/ /____/ |__/|__/\__,_/_/ /_/ /_/ /_/\____/
|
||||
|
||||
KEY
|
||||
|
||||
CHOOSE YOU LOGIN (min 8 car. best is more than 6 words!!)...
|
||||
or LEAVE BLANK and HIT ENTER FOR diceware AUTO GENERATION
|
||||
'
|
||||
read salt
|
||||
[[ $salt != "" ]] && echo "CHOOSE PASSWORD?" && read pepper && [[ $pepper == "" ]] && echo "AARRRRGGG why no pepper? exiting" && exit 1
|
||||
|
||||
if [[ "$salt" == "" && "$pepper" == "" ]]; then
|
||||
echo '
|
||||
._ _ ._ _ ._ _ _ ._ o _
|
||||
| | | | | (/_ | | | (_) | | | (_
|
||||
|
||||
diceware passphrase generator...'
|
||||
# INSTALL diceware files ## TODO REPLACE WITH ipfs links
|
||||
|
||||
[[ ! -f ~/.zen/astroport/zen/tools/diceware.sh ]] \
|
||||
&& mkdir -p ~/.zen/astroport/zen/tools/ \
|
||||
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/diceware.sh -o ~/.zen/astroport/zen/tools/diceware.sh \
|
||||
&& chmod +x ~/.zen/astroport/zen/tools/diceware.sh
|
||||
|
||||
[[ ! -f ~/.zen/astroport/zen/tools/diceware-wordlist.txt ]] \
|
||||
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/diceware-wordlist.txt -o ~/.zen/astroport/zen/tools/diceware-wordlist.txt
|
||||
|
||||
# LOGIN (=SALT)
|
||||
salt="$(~/.zen/astroport/zen/tools/diceware.sh 6 | xargs)"
|
||||
# PASS (=PEPPER)
|
||||
pepper="$(~/.zen/astroport/zen/tools/diceware.sh 4 | xargs)"
|
||||
fi
|
||||
echo "........."
|
||||
|
||||
# CREATE /tmp/secret.dunikey
|
||||
[[ ! -f ~/.zen/astroport/zen/tools/key_create_dunikey.py ]] \
|
||||
&& mkdir -p ~/.zen/astroport/zen/tools/ \
|
||||
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/key_create_dunikey.py -o ~/.zen/astroport/zen/tools/key_create_dunikey.py \
|
||||
&& chmod +x ~/.zen/astroport/zen/tools/key_create_dunikey.py
|
||||
|
||||
python3 ~/.zen/astroport/zen/tools/key_create_dunikey.py "$salt" "$pepper"
|
||||
sleep 1
|
||||
[[ ! -f /tmp/secret.dunikey ]] && echo "AARRRRGGG problem happens making your secret.dunikey exiting" && exit 1
|
||||
[[ -f /tmp/secret.dunikey ]] && cp -f /tmp/secret.dunikey ~/.zen/
|
||||
|
||||
echo "#YOUR CESIUM SWARM0 IDENTITY
|
||||
ZENID=\"$salt\"
|
||||
ZENPWD=\"$pepper\" IS :
|
||||
"
|
||||
g1pub=$(cat ~/.zen/secret.dunikey | grep "pub" | cut -d ' ' -f 2)
|
||||
echo "G1PUB=\"$g1pub\"" >> ~/.zen/secret.astroport.key
|
||||
|
||||
g1priv=$(cat ~/.zen/secret.dunikey | grep "sec" | cut -d ' ' -f 2)
|
||||
|
||||
ssbpub=$(echo $g1pub | base58 -d | base64)
|
||||
ssbpriv=$(echo $g1priv | base58 -d | base64 | tr -d "\n" )
|
||||
|
||||
# MODIFY ~/.ipfs/config
|
||||
[[ ! -f ~/.zen/astroport/zen/tools/crypto_pb2.py ]] \
|
||||
&& mkdir -p ~/.zen/astroport/zen/tools/ \
|
||||
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/crypto_pb2.py -o ~/.zen/astroport/zen/tools/crypto_pb2.py \
|
||||
|
||||
[[ ! -f ~/.zen/astroport/zen/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py ]] \
|
||||
&& mkdir -p ~/.zen/astroport/zen/tools/ \
|
||||
&& curl -s https://git.p2p.legal/axiom-team/astroport/raw/master/zen/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py -o ~/.zen/astroport/zen/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py \
|
||||
&& chmod +x ~/.zen/astroport/zen/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py
|
||||
|
||||
echo "execute python3 ~/.zen/astroport/zen/tools/create_ipfsnodeid_from_tmp_secret.dunikey.py"
|
||||
# jq '.Identity.PeerID="$PeerID"' ~/.ipfs/config
|
||||
# jq '.Identity.PrivKey="$PrivKey"' ~/.ipfs/config
|
||||
# rm -f /tmp/secret.dunikey
|
||||
}
|
Loading…
Reference in New Issue