This commit is contained in:
qo-op 2020-12-08 21:34:35 +01:00
commit 0cf78d0700
4 changed files with 19 additions and 8 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ www/LOVELand/jukebox/prefs
www/LOVELand/jukebox/albumart
www/LOVELand/g1barre/img/qrcodes
zen/tools/scraping/transiscope/transiscope.json
zen/tools/__pycache__

View File

@ -8,19 +8,19 @@
# protoc --python_out=. crypto.proto
#########################################################################
import os
import base58
import base64
import re, base58, base64, crypto_pb2
import cryptography.hazmat.primitives.asymmetric.ed25519 as ed25519
from cryptography.hazmat.primitives import serialization
import crypto_pb2
from sys import argv
# TODO controls
# Capturing keys (from /tmp/secret.dunikey)
shared_key = os.popen('cat /tmp/secret.dunikey | grep pub | cut -d " " -f 2').read()
secure_key = os.popen('cat /tmp/secret.dunikey | grep sec | cut -d " " -f 2').read()
dunikey = "/tmp/secret.dunikey"
for line in open(dunikey, "r"):
if re.search("pub", line):
shared_key = line.replace('\n','').split(': ')[1]
elif re.search("sec", line):
secure_key = line.replace('\n','').split(': ')[1]
# Decoding keys
decoded_shared = base58.b58decode(shared_key)
@ -46,7 +46,7 @@ pkey = crypto_pb2.PrivateKey()
pkey.Type = 1
pkey.Data = ipfs_secure_bytes + ipfs_shared_bytes
PrivKey = base64.b64encode(pkey.SerializeToString()).decode('ascii')
print('PrivKEY={}'.format(base64.b64encode(pkey.SerializeToString()).decode('ascii')))
print('PrivKEY=' + base64.b64encode(pkey.SerializeToString()).decode('ascii'))
# jq '.Identity.PeerID="$PeerID"' ~/.ipfs/config
# jq '.Identity.PrivKey="$PrivKey"' ~/.ipfs/config

10
zen/tools/ipfs_to_g1.py Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env python3
import sys, base58
ID = sys.argv[1]
hexFmt = base58.b58decode(ID)
noTag = hexFmt[6:]
b58Key = base58.b58encode(noTag).decode()
print(b58Key)