Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Create the user certs as part of the demo #34

Merged
merged 2 commits into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion banking-app/certs_for_demo/readme.txt

This file was deleted.

10 changes: 0 additions & 10 deletions banking-app/certs_for_demo/set_user0.json

This file was deleted.

10 changes: 0 additions & 10 deletions banking-app/certs_for_demo/set_user1.json

This file was deleted.

12 changes: 0 additions & 12 deletions banking-app/certs_for_demo/user0_cert.pem

This file was deleted.

9 changes: 0 additions & 9 deletions banking-app/certs_for_demo/user0_privk.pem

This file was deleted.

12 changes: 0 additions & 12 deletions banking-app/certs_for_demo/user1_cert.pem

This file was deleted.

9 changes: 0 additions & 9 deletions banking-app/certs_for_demo/user1_privk.pem

This file was deleted.

28 changes: 27 additions & 1 deletion banking-app/demo.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
#!/bin/bash
set -euo pipefail

# Run prepare_demo.sh in another terminal before running this script


cd workspace/sandbox_common
cp ../../certs_for_demo/* ./

create_certificate(){
local certName="$1"
local certFile="${1}_cert.pem"
local setUserFile="set_${1}.json"
/opt/ccf/bin/keygenerator.sh --name $certName

cert=$(< $certFile sed '$!G' | paste -sd '\\n' -)

cat <<JSON > $setUserFile
{
"actions": [
{
"name": "set_user",
"args": {
"cert": "${cert}"
}
}
]
}
JSON
}

create_certificate user0
create_certificate user1

cp ../../vote/* ./

user0_id=$(openssl x509 -in "user0_cert.pem" -noout -fingerprint -sha256 | cut -d "=" -f 2 | sed 's/://g' | awk '{print tolower($0)}')
Expand Down