Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

CIP-0020 | Update with new Implementors, Screenshots ... #394

Merged
merged 35 commits into from
Dec 8, 2022
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
942e121
Create cip0020-encryption-modes.json
gitmachtl Nov 29, 2022
61b0ac5
Update cip0020-encryption-modes.json
gitmachtl Nov 29, 2022
2afea02
Update README.md
gitmachtl Nov 29, 2022
8639330
Update README.md
gitmachtl Nov 29, 2022
aabfacd
Update README.md
gitmachtl Nov 29, 2022
f6db60a
Create demo_via_nodeJS.js
gitmachtl Nov 29, 2022
c7acbd3
Create demo_via_PHP.php
gitmachtl Nov 29, 2022
0050d55
Update demo_via_nodeJS.js
gitmachtl Nov 29, 2022
7b9290f
Update README.md
gitmachtl Nov 29, 2022
0553507
Update README.md
gitmachtl Nov 29, 2022
199a8f5
Update README.md
gitmachtl Nov 29, 2022
6f877ce
Create cip0020-democode-PHP.php
gitmachtl Nov 29, 2022
30f59f9
Delete demo_via_PHP.php
gitmachtl Nov 29, 2022
9e3b746
Create cip0020-democode-NODEJS.js
gitmachtl Nov 29, 2022
629e355
Delete demo_via_nodeJS.js
gitmachtl Nov 29, 2022
b6bf2b3
Create normal-message-metadata.json
gitmachtl Nov 29, 2022
02cbc5c
Create encrypted-message-metadata.json
gitmachtl Nov 29, 2022
400fdb5
Create cip0020-democode-BASH.sh
gitmachtl Nov 29, 2022
cb63808
Update cip0020-democode-BASH.sh
gitmachtl Nov 29, 2022
5c593ba
Update README.md
gitmachtl Nov 29, 2022
fe27b14
Update README.md
gitmachtl Nov 29, 2022
7dd544c
Update README.md
gitmachtl Nov 29, 2022
5e95677
Update README.md
gitmachtl Nov 29, 2022
b29186c
Update README.md
gitmachtl Nov 29, 2022
8ad5e42
Update README.md
gitmachtl Nov 29, 2022
24d892f
Update README.md
gitmachtl Nov 29, 2022
b9672fe
Added 'SPO Scripts' as an encrypted msg integration example
gitmachtl Dec 3, 2022
6441cd3
Delete cip0020-encryption-modes.json
gitmachtl Dec 8, 2022
85f8fa7
Delete cip0020-democode-BASH.sh
gitmachtl Dec 8, 2022
dd923ce
Delete cip0020-democode-NODEJS.js
gitmachtl Dec 8, 2022
ccfcb02
Delete cip0020-democode-PHP.php
gitmachtl Dec 8, 2022
cc10ca9
Delete encrypted-message-metadata.json
gitmachtl Dec 8, 2022
0a246ef
Delete normal-message-metadata.json
gitmachtl Dec 8, 2022
768080b
Updating README with updated Implementors
gitmachtl Dec 8, 2022
4e9a0cd
Adjust authors list (remove markdown) + adjust section titles levels.
KtorZ Dec 8, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Create cip0020-democode-BASH.sh
  • Loading branch information
gitmachtl authored Nov 29, 2022
commit 400fdb54e369e8574cf09ac966d37a4928d32ca8
47 changes: 47 additions & 0 deletions CIP-0020/codesamples/cip0020-democode-BASH.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# --------------------------------------------------------------------------------------------
# Demonstration implementation of CIP-0020 Transaction Messages Encryption/Decryption via BASH
# --------------------------------------------------------------------------------------------


#Unencrypted Metadata JSON
echo "Normal unencrpted messages metadata JSON:"
cat normal-message-metadata.json | jq
echo


#Encrypt the msg array from the JSON
encrText=$(jq -crM .\"674\".msg normal-message-metadata.json | openssl enc -e -aes-256-cbc -pbkdf2 -iter 10000 -a -k "cardano")
echo "Encrypted Strings (base64 format):"
echo "${encrText}"
echo


#Compose it into a new JSON and add the 'enc' entry
echo "New encrypted messages metadata JSON:"
jq ".\"674\".msg = [ $(awk {'print "\""$1"\","'} <<< ${encrText} | sed '$ s/.$//') ]" <<< '{"674":{"enc":"basic"}}' | jq


echo
echo "----------------------"
echo


#Encrypted Metadata JSON
echo "Encrypted messages metadata JSON:"
cat encrypted-message-metadata.json | jq
echo


#Decrypt the msg array from the JSON
decrText=$(jq -crM ".\"674\".msg[]" encrypted-message-metadata.json | openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -a -k "cardano")
echo "Decrypted Content:"
echo "${decrText}"
echo


#Compose it into a new JSON in the standard message format
echo "New messages metadata JSON:"
jq ".\"674\".msg = ${decrText}" <<< "{}"
echo