From c47d7a1ebf5619b18b089b1908072f1cd8c19ada Mon Sep 17 00:00:00 2001 From: qo-op Date: Sun, 22 Mar 2020 02:42:32 +0100 Subject: [PATCH] INIT G1SSB + Zen MAKE decoration --- zen/functions.sh | 2 +- zen/ssb_INIT.sh | 2 +- zen/zen_MAKE.sh | 113 +++++++++++++++++++++++++++++++++-------------- 3 files changed, 81 insertions(+), 36 deletions(-) diff --git a/zen/functions.sh b/zen/functions.sh index 9f4974a..da6144b 100755 --- a/zen/functions.sh +++ b/zen/functions.sh @@ -45,7 +45,7 @@ return 0 ######################################################################## # PUBLISH ~/.zen/ipfs ON /ipns/$NODEIPNS -function ipfs_ipfs_publish (){ +function ipfs_node_publish (){ IWALLETS=$(ipfs add -rHq '~/.zen/ipfs' | tail -n 1) NODEIPNS=$(ipfs name publish --quieter /ipfs/$IWALLETS) echo $IWALLETS diff --git a/zen/ssb_INIT.sh b/zen/ssb_INIT.sh index c358e9e..9cfe021 100755 --- a/zen/ssb_INIT.sh +++ b/zen/ssb_INIT.sh @@ -55,7 +55,7 @@ id="$(sbotc blobs.add < $qrcodefile)" type="$(file -b --mime-type $qrcodefile)" size="$(wc -c < $qrcodefile)" # Publish About message -sbot publish --type about --about $ssbpub --description "Welcome to [Astroport](https://astroport.com) G1SSB/IPFS Station [$IPFSNODEID](http://$(cat /etc/hostname).local/ipns/$IPFSNODEID)" --name "$USER@$(cat /etc/hostname)" --image "$id" +sbot publish --type about --about $ssbpub --description "Welcome to [Astroport](https://astroport.com) G1SSB/IPFS Station [$IPFSNODEID](http://localhost/ipns/$IPFSNODEID)" --name "$USER@$(cat /etc/hostname)" --image "$id" #sbotc publish '{"type":"about","about":"'"$ssbpub"'","description":"Welcome to [Astroport](https://astroport.com) G1SSB/IPFS Station\nhttp://'$(cat /etc/hostname)'.local/ipns/$IPFSNODEID","name":'"'$USER'@'$(cat /etc/hostname)'"',"image":'"'$id'"'}' sbotc publish '{"type":"post","text":"[G1SSB_Wallet.png]('"$id"')\nUse https://cesium.app to send payment.\nComment your transaction with '"'Zen'"' to order ZenTag...","mentions":[{"link":"'"$id"'","name":"'"$name"'","size":'"$size"',"type":"'"$type"'"}]}' diff --git a/zen/zen_MAKE.sh b/zen/zen_MAKE.sh index 173085c..bc20f2f 100755 --- a/zen/zen_MAKE.sh +++ b/zen/zen_MAKE.sh @@ -87,11 +87,13 @@ IPFS: $IPFSNODEID # Produce unique 6 words diceware to give a name _tag.uid AA=$(echo $($MY_PATH/tools/diceware.sh 6 | xargs) | sed s/\ /_/g ) # ZenTag Name = Diceware_6_words AAH=$(echo -n ${AA} | sha256sum | cut -d ' ' -f 1) # ZenTag Name SHA256 + +# TODO ACTIVATE SWARM UNICITY CHECK # Create Unique Zentag for all IPFS SWARM! -while [[ $(grep -Rwl "$AA" ~/.zen/ipfs_swarm/.Qm*/TAG/) ]]; do - AA=$(echo $($MY_PATH/tools/diceware.sh 6 | xargs) | sed s/\ /_/g ) - AAH=$(echo -n ${AA} | sha256sum | cut -d ' ' -f 1) -done +#while [[ $(grep -Rwl "$AA" ~/.zen/ipfs_swarm/.Qm*/TAG/) ]]; do +# AA=$(echo $($MY_PATH/tools/diceware.sh 6 | xargs) | sed s/\ /_/g ) +# AAH=$(echo -n ${AA} | sha256sum | cut -d ' ' -f 1) +#done # BB key is a 4 word diceware printed on QRCode for Human use. # SHA512 PASSWORD CHECK FOR ALLOWING WRITE ACTION @@ -103,9 +105,20 @@ BBH=$(echo -n "$BB" | sha512sum | cut -d ' ' -f 1) ######################################################################## mkdir -p ~/.zen/tag/${AAH} # LOG -echo "CREATING ZenTag, Value = $ZEN Zen" -echo "$AA :|: $BB" -echo "DATASTRUCTURE: ls -al ~/.zen/tag/${AAH}" +echo " + _____ _____ _ ____ +|__ /___ _ _|_ _|/ \ / ___| __/\__ + / // _ \ °_ \| | / _ \| | _ \ / + / /| __/ | | | |/ ___ \ |_| | /_ _\ +/____\___|_| |_|_/_/ \_\____| \/ + +${AAH} + +$AA $ZEN Zen + +******************************************************* +" + # COPY ZENTAG TO LOCAL ~/.zen/tag echo "$AA" > ~/.zen/tag/${AAH}/_tag.uid # Nom du ZenTAG echo "$ZEN" > ~/.zen/tag/${AAH}/_tag.zen # Tag ZEN amount @@ -128,7 +141,20 @@ echo "$BBH" > ~/.zen/tag/${AAH}/_tag.BB.sha openssl aes-256-cbc -pbkdf2 -k "$BB" -salt -in ~/.ipfs/keystore/${AA}.key -out ~/.zen/tag/${AAH}/_ipfs.publishkey.BB.aes # GIVE IPFS CREATOR NODE ACCESS TO ZEN TAG $MY_PATH/tools/natools.py encrypt -p $NODE_G1PUBKEY -i ~/.ipfs/keystore/${AA}.key -o ~/.zen/tag/${AAH}/_ipfs.publishkey.crypt +# LOG +echo " +CYPHERING PUBLISH KEY + + _/_/ __/|_ __/|_ | | + / / | / | / / / + / / /_ __| /_ __| / / +/ / |/ |/ _/_/ +|_| /_/ + +KEY : $BB +BBH : $BBH +" ####################################################################### # PASSENGER FILE is added to IPFS then link is cyphered # @@ -138,6 +164,7 @@ echo " / \ / \ / \ / \ / \ / \ / \ / \ / \ ( p | a | s | s | e | n | g | e | r ) \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ + " # ADD PASSENGER TO IPFS IPASSENGER=$(ipfs add -q $PASSENGER -w | tail -n 1) @@ -158,14 +185,26 @@ echo " echo "$PARK" > ~/.zen/tag/${AAH}/_passenger.park echo " +_passenger.filename : $PASSENGERNAME +_passenger.ipfs : $IPASSENGER + # #### ## ##### ###### ##### # # # # # # # # # # # # # # # # # ##### # # # # # ###### # # # # # # # # # # # # # # # ###### #### # # ##### ###### ##### +################################################################## +# Decode _passenger.ipfs with BB Passphrase +################################################################## +openssl aes-256-cbc -pbkdf2 -k \"$BB\" -d -salt -in ~/.zen/tag/${AAH}/_passenger.ipfs.BB.aes -out /tmp/_passenger.ipfs +ipfs get -o /tmp /ipfs/$IPASSENGER/$PASSENGERNAME && vlc /tmp/$PASSENGERNAME 2>/dev/null + +READ : $READ Zen +PARK : $PARK Zen + " -fi + ######################################################################## # PASSENGER DIRECTORY ######################################################################## @@ -173,28 +212,7 @@ fi # tar -zcf - directory | openssl aes-128-cbc -pbkdf2 -k "$BB" -salt -out directory.tar.gz.aes # Encrypt # openssl aes-128-cbc -pbkdf2 -k "$BB" -d -salt -in directory.tar.gz.aes | tar -xz -f - # Decrypt ######################################################################## - -# TRY ACCESS TO PASSENGER FILE ##################### -echo " -################################################################## -# READ PASSENGER $PASSENGERNAME :: READ=$READ, PARK=$PARK Zen -################################################################## -# Decode _passenger.ipfs with G1SSB Node secret.dunikey -################################################################## -$MY_PATH/tools/natools.py decrypt --pubsec -k ~/.ssb/secret.dunikey -i ~/.zen/tag/${AAH}/_passenger.ipfs.crypt -o /tmp/_passenger.ipfs - -################################################################## -# Decode _passenger.ipfs with BB Passphrase -################################################################## -openssl aes-256-cbc -pbkdf2 -k \"$BB\" -d -salt -in ~/.zen/tag/${AAH}/_passenger.ipfs.BB.aes -out /tmp/_passenger.ipfs - -################################################################## -# Now 'ipfs get' IT and open with VLC (TODO: apt install vlc) -################################################################## -ipfs get -o /tmp /ipfs/$IPASSENGER/$PASSENGERNAME && vlc /tmp/$PASSENGERNAME 2>/dev/null -# ipfs get -o /tmp /ipfs/$(cat /tmp/_passenger.ipfs)/$(cat ~/.zen/tag/${AAH}/_passenger.filename) && vlc /tmp/$(cat ~/.zen/tag/${AAH}/_passenger.filename) 2>/dev/null -##################################################################" -# /DEBUG ##################### +fi ########################################################### # Copy TAG into IPFS + ipfs name publish -k ${AA}.key @@ -205,6 +223,10 @@ echo "0" > ~/.zen/tag/${AAH}/_chain.n # Tag modification number (0 first) NANODATE=$(date -u +%s%N) echo "$NANODATE" > ~/.zen/tag/${AAH}/_chain.nanodate # Nanodate notification +echo " + _|_ _.o._ +(_| |(_||| | : $NANODATE : 0 +" I=$(ipfs add -qr ~/.zen/tag/${AAH} | tail -n 1) echo "${I}" > ~/.zen/tag/${AAH}/_chain @@ -217,26 +239,49 @@ echo "${I}" > ~/.zen/tag/${AAH}/_chain J=$(ipfs name publish -k ${AA}.key --quieter /ipfs/${I}) echo "${J}" > ~/.zen/tag/${AAH}/_ipns -# REPORT ZenTag to SWARM +# INDEXING ZenTag to SWARM mkdir -p ~/.zen/ipfs/.$IPFSNODEID/TAG/${J} echo "${AA}" > ~/.zen/ipfs/.$IPFSNODEID/TAG/${J}/_tag.uid +IWALLETS=$(ipfs add -rHq ~/.zen/ipfs | tail -n 1) +NODEIPNS=$(ipfs name publish --quieter /ipfs/$IWALLETS) + +echo " + _ ____ + (_)___ / __/____ + / / __ \/ /_/ ___/ + / / /_/ / __(__ ) +/_/ .___/_/ /____/ + /_/ +$I + +ZenTAG : ipfs ls /ipns/$J +NODE index : ipfs ls /ipns/$NODEIPNS/.$IPFSNODEID +" ######################################################################## # CREATE ZenTAG READ/WRITE QRCODES ### PRINTER IS HOOKED TO G1SSB NODE = G1DAB ######################################################################## +echo " + _ _ _ _ _ _ +/ \|_) / / \| \|_ +\_X| \ \_\_/|_/|_ ................................. +" # READ QRCODE qrencode -s 5 -o ~/.zen/tag/${AAH}/_QRCODE.read.png "RJ:${AA}#${J}" # WRITE QRCODE qrencode -s 5 -o ~/.zen/tag/${AAH}/_QRCODE.write.png "BJ:${BB}#${J}" -echo "ZenTag ${AA}.key made CHECK IT :: ipfs ls /ipns/${J}" +echo "DONE !! +${AA}" ######################################################################## # IPFS CLEANING (MANUAL OPERATION) ######################################################################## -echo "################################################################## ----> Whishing to clean IPFS repo ? RUN +echo " + +>>> CLEAN IPFS REPO +################################################################## ipfs pin ls -q --type recursive | xargs ipfs pin rm && ipfs repo gc rm -f ~/.ipfs/keystore/*.key rm -Rf ~/.zen/tag/*