Remove useless issuer pubkey in .env and anywhere

This commit is contained in:
poka 2020-11-17 01:11:30 +01:00
parent 1ed3fbbcee
commit a4497faf8e
4 changed files with 20 additions and 27 deletions

View File

@ -1,3 +1,3 @@
issuer="" # Clé publique Ḡ1 de l'émetteur du message
dunikey="" # La clé privé Ḡ1 de l'émetteur, générable par Cesium au format PubSec
pod="https://g1.data.duniter.fr" # Noeud Cecium+ utilisé pour l'envoi du message
#pod="https://data.gchange.fr"

View File

@ -18,7 +18,6 @@ helpOpt() {
\rOptions:
-id,--id <ID du message>\tDelete the message with ID <id>.
-i,--issuer <pubkey>\tUses <pubkey> as issuer of the message.
-k,--key <key>\t\tPath <key> to the pubsec keychain file of the issuer.
-o,--outbox\t\t\tDelete outbox messages instead of inbox
-h,--help\t\t\tDisplay this help"
@ -32,8 +31,6 @@ do
-o|--outbox) type=outbox;;
-id|--id) id="${args[$i+1]}"
[[ -z $id ]] && echo "Veuillez préciser un ID de message." && exit 1;;
-i|--issuer) issuer="${args[$i+1]}"
[[ -z $issuer ]] && echo "Veuillez préciser un émetteur." && exit 1;;
-k|--key) dunikey="${args[$i+1]}"
[[ -z $dunikey ]] && echo "Veuillez préciser un fichier de trousseau." && exit 1;;
-h|--help) helpOpt && exit 0;;
@ -41,6 +38,11 @@ do
esac
done
if [[ -z $dunikey ]]; then
read -p "Fichier de trousseau: " dunikey
fi
issuer=$(./natools.py pk -f pubsec -k $dunikey)
if [[ -z $type ]]; then
type="inbox"
fi
@ -48,12 +50,6 @@ fi
if [[ -z $id ]]; then
read -p "ID de message: " ID
fi
if [[ -z $issuer ]]; then
read -p "Émetteur: " issuer
fi
if [[ -z $dunikey ]]; then
read -p "Fichier de trousseau: " dunikey
fi
[[ -z $(grep -Eo $REGEX_PUBKEYS <<<$issuer) ]] && echo "Le format de la clé publique de l'émetteur est invalide." && exit 1

View File

@ -17,7 +17,6 @@ helpOpt() {
Advice: Fill your .env file for more fun.
\rOptions:
-r,--recipient <pubkey>\tUses <pubkey> as recipient of the messages.
-k,--key <key>\t\tPath <key> to the pubsec keychain file of the issuer.
-n,--number <number>\tDisplay the <number> lasts messages from Cesium (tail-like format)
-o,--outbox\t\t\tRead outbox messages instead of inbox
@ -33,8 +32,6 @@ declare -a args=($@)
for ((i=0; i<${#args[*]}; ++i))
do
case ${args[$i]} in
-r|--recipient) recipient="${args[$i+1]}"
[[ -z $recipient ]] && echo "Veuillez préciser un destinataire." && exit 1;;
-k|--key) dunikey="${args[$i+1]}"
[[ -z $dunikey ]] && echo "Veuillez préciser un fichier de trousseau." && exit 1;;
-o|--outbox) type=outbox;;
@ -45,9 +42,8 @@ do
esac
done
if [[ -z $recipient ]]; then
read -p "Clé publique de l'utilisateur: " recipient
fi
recipient=$(./natools.py pk -f pubsec -k $dunikey)
if [[ -z $dunikey ]]; then
read -p "Fichier de trousseau: " dunikey
fi
@ -79,4 +75,8 @@ for i in $msgContent; do
echo "$contentClear"
echo "========="
((n++))
# echo "./natools.py box-decrypt -p $issuer -f pubsec -k $dunikey -n $nonce -I 64 <<< \"${title}\""
done
#echo "$msgContent" | jq

View File

@ -14,13 +14,12 @@ helpOpt() {
echo -e "Cesium+ messages sender
Default: ask title, content and recipient in interactive mode.
Advice: Fill your .env file for more fun.
Example: $0 -f <Path of file content message> -r <recipient pubkey> -i <issuer pubkey> -k <path of pubsec keychain of issuer>
Example: $0 -f <Path of file content message> -r <recipient pubkey> -k <path of pubsec keychain of issuer>
\rOptions:
-t\t\t\t\tTest mode: Uses the \"test.txt\" file as well as the same recipient as the sender.
-f,--file <file>\t\tRead the file <file> with title in first line and content in rest of the file for the message.
-r,--recipient <pubkey>\tUses <pubkey> as recipient of the message.
-i,--issuer <pubkey>\tUses <pubkey> as issuer of the message (Could be remove in future version by calculating pubkey from privatekey).
-k,--key <key>\t\tPath <key> to the pubsec keychain file of the issuer.
-h,--help\t\t\tDisplay this help"
}
@ -35,11 +34,10 @@ do
-f|--file) file="${args[$i+1]}"
[[ ! -f $file ]] && echo "Le fichier $file n'existe pas." && exit 1;;
-t|--test) file="test.txt"
issuer=$(./natools.py pk -f pubsec -k $dunikey)
recipient=$issuer;;
-r|--recipient) recipient="${args[$i+1]}"
[[ -z $recipient ]] && echo "Veuillez préciser un destinataire." && exit 1;;
-i|--issuer) issuer="${args[$i+1]}"
[[ -z $issuer ]] && echo "Veuillez préciser un émetteur." && exit 1;;
-k|--key) dunikey="${args[$i+1]}"
[[ -z $dunikey ]] && echo "Veuillez préciser un fichier de trousseau." && exit 1;;
-h|--help) helpOpt && exit 0;;
@ -47,6 +45,11 @@ do
esac
done
if [[ -z $dunikey ]]; then
read -p "Fichier de trousseau: " dunikey
fi
issuer=$(./natools.py pk -f pubsec -k $dunikey)
if [[ -z $file ]]; then
read -p "Objet du message: " title
read -p "Corps du message: " content
@ -54,15 +57,9 @@ if [[ -z $file ]]; then
else
message=$(cat $file)
fi
if [[ -z $issuer ]]; then
read -p "Émetteur: " issuer
fi
if [[ -z $recipient ]]; then
read -p "Destinataire: " recipient
fi
if [[ -z $dunikey ]]; then
read -p "Fichier de trousseau: " dunikey
fi
[[ -z $(grep -Eo $REGEX_PUBKEYS <<<$recipient) ]] && echo "Le format de la clé publique du destinataire est invalide." && exit 1
[[ -z $(grep -Eo $REGEX_PUBKEYS <<<$issuer) ]] && echo "Le format de la clé publique de l'émetteur est invalide." && exit 1
@ -100,5 +97,5 @@ echo -e "\nMessage ID: $msgID"
# To put the message in outbox too
#curl -s -X POST "$pod/message/outbox?pubkey=$issuer" -d "$document"
# To put the message as read, ad this at the end of document
# To put the message as read, add this at the end of document
#,\"read_signature\":\"$signature\"