SURVEY_swarmkey

This commit is contained in:
qo-op 2020-03-27 04:15:32 +01:00
parent 8463f23d73
commit 1572d3a458
2 changed files with 13 additions and 14 deletions

@ -1 +1 @@
Subproject commit 9bb02920fda14aa064f49a243369cd7a4acb61f4 Subproject commit 24847070307a3342d5d3237aedfe118fc3bc2284

View File

@ -16,10 +16,11 @@ echo '
# ex: ./'$ME' # ex: ./'$ME'
# SURVEY received #astroport-swarmkey ipfs_swarm.key.crypt for IPFS # SURVEY received #astroport-swarmkey ipfs_swarm.key.crypt for IPFS
######################################################################## _ _ _ _ _ ######################################################################## _ _ _ _ _
___ _ _ __ __ __ _ _
| |_)|_(_ _ _.._._ _ | _ (_ (_ |_) _ ._ _ _|_o| _ _
_|_| | __) _>\/\/(_|| | | ||<(/_\/ __)__)|_) _>|_||\/(/_\/ | ||(/__>
/ /
USED ONLY ONCE... Next swarm.key change will accurs in ~/.zen/ipfs-swarm USED ONLY ONCE... Next swarm.key change will accurs in ~/.zen/ipfs-swarm
{ {
@ -46,16 +47,14 @@ USED ONLY ONCE... Next swarm.key change will accurs in ~/.zen/ipfs-swarm
}, },
"timestamp": 1585194822367 "timestamp": 1585194822367
} }
' '
[[ -f ~/.ipfs/ipfs_swarm.key ]] && echo "SWARM KEY ~/.ipfs/ipfs_swarm.key OK !!!" && exit 0
self=$(sbotc whoami | jq -r .id) || exit 1 self=$(sbotc whoami | jq -r .id) || exit 1
g1self=$(echo $self | cut -d '@' -f 2 | cut -d '.' -f 1 | base64 -d | base58) g1self=$(echo $self | cut -d '@' -f 2 | cut -d '.' -f 1 | base64 -d | base58)
self_name=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$self"'", "content":{"type":"about", "about": "'"$self"'"}}}}]}' | jq -r .value?.content?.name | grep -v null | tail -n 1) self_name=$(sbotc query.read '{"query":[{"$filter":{"value":{"author": "'"$self"'", "content":{"type":"about", "about": "'"$self"'"}}}}]}' | jq -r .value?.content?.name | grep -v null | tail -n 1)
ipfsnodeid=$(ipfs id -f='<id>\n') ipfsnodeid=$(ipfs id -f='<id>\n')
[[ -f ~/.ipfs/ipfs_swarm.key ]] && echo "SWARM KEY OK" && exit 1
# SEARCH "#astroport-swarmkey" CMD in message text # SEARCH "#astroport-swarmkey" CMD in message text
# Not working without patchwork (TODO: find bug. installation ok!? activate? ssb-server ssb-backlinks node_modules. HELP !! ) # Not working without patchwork (TODO: find bug. installation ok!? activate? ssb-server ssb-backlinks node_modules. HELP !! )
@ -78,8 +77,8 @@ sbotc messagesByType "post"
messages=$(sbotc messagesByType '{"type":"post"}') messages=$(sbotc messagesByType '{"type":"post"}')
while read -r msg while read -r msg
do do
author=$(printf %s "$msg" | jq -r .value.author)
attached_file=$(printf %s "$msg" | jq -r .value.content.mentions.link 2>/dev/null) attached_file=$(printf %s "$msg" | jq -r .value.content.mentions[].name 2>/dev/null)
if [[ $attached_file == "ipfs_swarm.key.crypt" ]]; then if [[ $attached_file == "ipfs_swarm.key.crypt" ]]; then
@ -92,9 +91,9 @@ to ~/.ipfs/ipfs_swarm.key
' '
mytmp=$(mktemp -d "${TMPDIR:-/tmp}/ssb-npm.XXXXXXXXX") mytmp=$(mktemp -d "${TMPDIR:-/tmp}/ssb-npm.XXXXXXXXX")
curl -s "http://localhost:8989/blobs/get/$attached_file" > $mytmp/ipfs_swarm.key.crypt curl -s "http://localhost:8989/blobs/get/$attached_file" > $mytmp/ipfs_swarm.key.crypt
$MY_PATH/tools/natools.py decrypt -k ~/.ssb/secret.dunikey -i $mytmp/ipfs_swarm.key.crypt -o ~/.ipfs/ipfs_swarm.key $MY_PATH/tools/natools.py decrypt -k ~/.ssb/secret.dunikey -i $mytmp/ipfs_swarm.key.crypt -o ~/.ipfs/ipfs_swarm.key && \
echo "IPFS SWARM KEY ~/.ipfs/ipfs_swarm.key received from SSB $author ... OK !"
echo ' echo '
___ _ _ __ ___ _ _ __
| |_)|_(_ _| _. _ ._ _ _ ._ | |_)|_(_ _| _. _ ._ _ _ ._