Shell script examples

This page lists various examples ready to cut and paste into a terminal where Zenroom is installed, to test running it and examine the files created.

To run them make sure the "zenroom" executable is in your $PATH or insert an alias at the beginning of each script like:

alias zenroom="./src/zenroom"

Credential flow

This script demonstrates the flow of Attribute Based Credentials

Setup

Cut, paste and run in a terminal the script below:

#!/bin/sh
set -e
#
cat << EOF | zenroom -z                                                  >  credential_keypair.json
Scenario coconut: credential keygen
Given that I am known as 'Alice'
When I create the credential keypair
Then print my 'credential keypair'
EOF
cat << EOF | zenroom -z                                                  >  issuer_keypair.json
Scenario coconut: issuer keygen
Given that I am known as 'MadHatter'
When I create the issuer keypair
Then print my 'issuer keypair'
EOF
cat << EOF | zenroom -z   -k issuer_keypair.json                         >  verifier.json
Scenario coconut: publish verifier
Given that I am known as 'MadHatter'
and I have my valid 'verifier'
Then print my 'verifier'
EOF
cat << EOF | zenroom -z   -k credential_keypair.json                     >  request.json
Scenario coconut: create request
Given that I am known as 'Alice'
and I have my valid 'credential keypair'
When I create the credential request
Then print my 'credential request'
EOF
cat << EOF | zenroom -z   -k issuer_keypair.json      -a request.json    >  signature.json
Scenario coconut: issuer sign
Given that I am known as 'MadHatter'
and I have my valid 'issuer keypair'
and I have a valid 'credential request'
When I create the credential signature
Then print the 'credential signature'
and print the 'verifier'
EOF
cat << EOF | zenroom -z   -k credential_keypair.json  -a signature.json  >  credential.json
Scenario coconut: aggregate signature
Given that I am known as 'Alice'
and I have my valid 'credential keypair'
and I have a valid 'credential signature'
When I create the credentials
Then print my 'credentials'
and print my 'credential keypair'
EOF

Now examine the .json files created at your fingertips.