Skip to content

Commit

Permalink
fix: bbs bats test for docs
Browse files Browse the repository at this point in the history
  • Loading branch information
FilippoTrotter authored and jaromil committed Aug 19, 2024
1 parent f9f7324 commit bb13f7f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
30 changes: 17 additions & 13 deletions test/zencode/bbs_sha.bats
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ Scenario bbs
Given I am known as 'Alice'
When I create the keyring
and I create the bbs key
and I create the bbs shake key
Then print my 'keyring'
EOF
save_output alice_keys_docs.json
Expand All @@ -229,7 +230,9 @@ Scenario bbs
Given I am known as 'Alice'
Given I have my 'keyring'
When I create the bbs public key
When I create the bbs shake public key
Then print my 'bbs public key'
Then print my 'bbs shake public key'
EOF
save_output alice_pubkey_docs.json
}
Expand Down Expand Up @@ -260,29 +263,30 @@ When I rename the 'bbs signature' to 'myMessage.signature'
#If we want we can specify the hash function used by the algorithm
When I create the bbs signature of 'myStringArray'
When I rename the 'bbs signature' to 'myStringArray.signature.sha'
When I create the bbs shake signature of 'myStringArray'
When I rename the 'bbs shake signature' to 'myStringArray.signature.shake'
When I create the bbs signature of 'myMessage'
When I rename the 'bbs signature' to 'myMessage.signature.sha'
When I create the bbs shake signature of 'myMessage'
When I rename the 'bbs shake signature' to 'myMessage.signature.shake'
# Here we are printing out the signatures
Then print the 'myStringArray'
Then print the 'myStringArray.signature'
Then print the 'myStringArray.signature.sha'
Then print the 'myStringArray.signature.shake'
Then print the 'myMessage'
Then print the 'myMessage.signature'
Then print the 'myMessage.signature.sha'
Then print the 'myMessage.signature.shake'
EOF
save_output signed_bbs_docs.json
}

@test "DOCS: verify signature example" {
cat <<EOF | zexe verify_bbs_docs.zen alice_pubkey_docs.json signed_bbs_docs.json
cat <<EOF | zexe verify_bbs_docs.zen alice_pubkey_docs.json signed_bbs_docs.json
Scenario 'bbs': Bob verifies the signature from Alice
# Here we load the pubkey we'll verify the signature against
Given I have a 'bbs public key' from 'Alice'
Given I have a 'bbs shake public key' from 'Alice'
# Here we load the objects to be verified
Given I have a 'string' named 'myMessage'
Expand All @@ -291,17 +295,17 @@ Given I have a 'string array' named 'myStringArray'
# Here we load the objects' signatures
Given I have a 'bbs signature' named 'myStringArray.signature'
Given I have a 'bbs signature' named 'myMessage.signature'
Given I have a 'bbs signature' named 'myStringArray.signature.sha'
Given I have a 'bbs signature' named 'myMessage.signature.sha'
Given I have a 'bbs signature' named 'myStringArray.signature.shake'
Given I have a 'bbs signature' named 'myMessage.signature.shake'
# Here we perform the verifications.
# When not specified, the bbs verification algorithm uses SHAKE-256.
# When not specified, the bbs verification algorithm uses SHA-256.
When I verify the 'myMessage' has a bbs signature in 'myMessage.signature' by 'Alice'
When I verify the 'myStringArray' has a bbs signature in 'myStringArray.signature' by 'Alice'
# You can specify either 'SHA256' or 'SHAKE256' as input like this:
When I verify the 'myMessage' has a bbs signature in 'myMessage.signature.sha' by 'Alice'
When I verify the 'myStringArray' has a bbs signature in 'myStringArray.signature.sha' by 'Alice'
# You can specify 'SHAKE256' as input like this:
When I verify the 'myMessage' has a bbs shake signature in 'myMessage.signature.shake' by 'Alice'
When I verify the 'myStringArray' has a bbs shake signature in 'myStringArray.signature.shake' by 'Alice'
# Here we print out the result: if the verifications succeeded, a string will be printed out
# If the verifications failed, Zenroom will throw an error.
Expand Down
6 changes: 3 additions & 3 deletions test/zencode/bbs_zkp.bats
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Scenario 'bbs': participant generates the bbs proof
Given I have a 'bbs public key' inside 'The Authority'
Given I have a 'bbs credential'
Given I have a 'string array' named 'bbs messages'
# This is the same hash function used by the Authority to sign the messages.
Given I have a 'number array' named 'bbs disclosed indexes'
Expand All @@ -192,7 +192,7 @@ When I rename the 'random_object' to 'bbs presentation header'
When I create the bbs disclosed messages
# The SAME hash function must be used in BOTH the creation and the verification.
When I create the bbs proof of the signature 'bbs credential' of the messages 'bbs messages' with public key 'bbs public key' presentation header 'bbs presentation header' and disclosed indexes 'bbs disclosed indexes'
When I rename the 'bbs proof' to 'bbs proof verbose'
When I create the bbs proof
Expand Down Expand Up @@ -220,7 +220,7 @@ and I have a 'base64' named 'bbs presentation header'
Given I have a 'number array' named 'bbs disclosed indexes'
and I have a 'string array' named 'bbs disclosed messages'
# The SAME hash function must be used in BOTH the creation and the verification.
When I verify the bbs proof with public key 'bbs public key' presentation header 'bbs presentation header' disclosed messages 'bbs disclosed messages' and disclosed indexes 'bbs disclosed indexes'
When I verify the bbs proof
Expand Down

0 comments on commit bb13f7f

Please sign in to comment.