Stringify JSON and not hash ...
This commit is contained in:
parent
2d904e2f08
commit
071c945f1c
|
@ -21,8 +21,9 @@ times=$(date -u +'%s')
|
||||||
nonce=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
|
nonce=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
|
||||||
|
|
||||||
# Fabrication du hash
|
# Fabrication du hash
|
||||||
hash=$(echo "{"issuer" : "$issuer","recipient" : "$recipient","title" : "$title","content" : "$content","time" : "$times","nonce" : "$nonce"}" | sha256sum | awk '{ print $1 }')
|
hash="{"issuer" : "$issuer","recipient" : "$recipient","title" : "$title","content" : "$content","time" : "$times","nonce" : "$nonce"}"
|
||||||
hash=$(node -p "JSON.stringify(\"$hash\")")
|
hash="$(printf "%q" "$hash")"
|
||||||
|
hash=$(node -p "JSON.stringify(\"$hash\")" | sha256sum | awk '{ print $1 }')
|
||||||
|
|
||||||
# Fabrication de la signature
|
# Fabrication de la signature
|
||||||
signature=$(echo "$hash" | ./natools.py sign --pubsec -k ~/dev/trousseau-Do99s6wQ-g1-PubSec.dunikey --noinc -O 64)
|
signature=$(echo "$hash" | ./natools.py sign --pubsec -k ~/dev/trousseau-Do99s6wQ-g1-PubSec.dunikey --noinc -O 64)
|
||||||
|
@ -35,7 +36,7 @@ echo "{
|
||||||
"content" : \"$content\",
|
"content" : \"$content\",
|
||||||
"time" : "$times",
|
"time" : "$times",
|
||||||
"nonce" : \"$nonce\",
|
"nonce" : \"$nonce\",
|
||||||
"hash" : "$hash",
|
"hash" : \"$hash\",
|
||||||
"signature" : \"$signature\"
|
"signature" : \"$signature\"
|
||||||
}"
|
}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue