Skip to content

Commit

Permalink
docs: update BBS documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
FilippoTrotter authored and jaromil committed Aug 19, 2024
1 parent bb13f7f commit 3b20fa3
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 67 deletions.
2 changes: 1 addition & 1 deletion docs/examples/zencode_cookbook/bbs/alice_keys_docs.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Alice":{"keyring":{"bbs":"EIRxtRfx2zDcSEogGyVJ29yj4wHwncuNQMrCpLnfknA="}}}
{"Alice":{"keyring":{"bbs":"EIRxtRfx2zDcSEogGyVJ29yj4wHwncuNQMrCpLnfknA=","bbs_shake":"ZER4PU8gSQvJxrjoJGC+dKm+CMunGFYojP12F0EXoJU="}}}
2 changes: 1 addition & 1 deletion docs/examples/zencode_cookbook/bbs/alice_pubkey_docs.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Alice":{"bbs_public_key":"i33+cqmLXaneXsvmCv9EE+4GU1+cxO8uZYV+wTLjU0UL7uXbsBW2D0Pd34j5I2E6BFxcFdaVfACQutLX3kQ1TaO0V9Iz1KTn03/OHzyNKhWBkXEYolZ6mdc75DZQDy1k"}}
{"Alice":{"bbs_public_key":"i33+cqmLXaneXsvmCv9EE+4GU1+cxO8uZYV+wTLjU0UL7uXbsBW2D0Pd34j5I2E6BFxcFdaVfACQutLX3kQ1TaO0V9Iz1KTn03/OHzyNKhWBkXEYolZ6mdc75DZQDy1k","bbs_shake_public_key":"tFWMqWLpE1Hq/vJ6mpBzDhjY6yYaj9xvXlZLMe1MX0AmyKHCRIl76lWjTffpbPzqA99k5ASIwRqdzLrgCASvNpVO9FToL86QxL0WJtVbHrDLiFmNH+QrF+n6xSVPUejA"}}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ Given I have a 'string array' named 'bbs messages'

# The hash function used to generate the signature, to create the proof and to verify it
# must be the same in all the three cases.
Given I have a 'string' named 'hash name'

# The private credential is generated by signing the messages.
When I create the bbs signature of 'bbs messages' using 'hash name'
When I create the bbs signature of 'bbs messages'
When I rename the 'bbs signature' to 'bbs credential'

Then print the 'bbs messages'
Then print the 'bbs credential'
Then print the 'hash name'
10 changes: 4 additions & 6 deletions docs/examples/zencode_cookbook/bbs/create_proof_docs.zen
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,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 'string' named 'hash name'


Given I have a 'number array' named 'bbs disclosed indexes'

Expand All @@ -13,10 +12,10 @@ 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' using 'hash name' with public key 'bbs public key' presentation header 'bbs presentation header' and disclosed indexes 'bbs disclosed indexes'

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 using 'hash name'
When I create the bbs proof

Then print the 'bbs proof verbose'
Then print the 'bbs proof'
Expand All @@ -25,4 +24,3 @@ Then print the 'bbs disclosed messages'
Then print the 'bbs disclosed indexes'
Then print the 'bbs presentation header'
Then print the 'bbs credential'
Then print the 'hash name'
19 changes: 19 additions & 0 deletions docs/examples/zencode_cookbook/bbs/create_shake_proof.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Scenario bbs
# 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'
Given I have a 'number array' named 'bbs disclosed indexes'
When I create the bbs shake key
and I create the bbs shake public key
When I create the random object of '256' bits
When I rename the 'random_object' to 'bbs presentation header'
When I create the bbs shake signature of 'bbs messages'
and I rename 'bbs shake signature' to 'bbs shake credential'
When I create the bbs disclosed messages
When I create the bbs shake proof
Then print the 'bbs shake proof'
Then print the 'bbs shake public key'
Then print the 'bbs disclosed messages'
Then print the 'bbs disclosed indexes'
Then print the 'bbs presentation header'
Then print the 'bbs shake credential'
2 changes: 1 addition & 1 deletion docs/examples/zencode_cookbook/bbs/created_proof_docs.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"bbs_credential":"mM+sPY0BNTri66IFR/G9HgSvJuzhf1fz36twKO4RnQXQyKYv2afPYa0J7fKpGC2KSdUb4M9lC59iLXS5n6Cutgc8pE21NRyvaV/Pp3mOnOxSw8ScbPbpuQuPVqUkPK16V+hlWMKRVc7+njxQZUt1oA==","bbs_disclosed_indexes":[1,3],"bbs_disclosed_messages":["above 18","professor"],"bbs_presentation_header":"XdjAYj+RY95+uyYMI8fR3+fmP5LyQaN54vyTTVKxZyA=","bbs_proof":"txtzTP3STsaGXlm/VtIChwy8EsnAGvpgV2sNVHm0Muiml0aUOZU6Exh1wCFo2tn7rhWn1AKQdiX6ZUzdz/X3FRbSYbg6J1zDK1989WFmsb2h174KiGUpTWcX6hnurJW1qpfT+GZjLZDc7LoAQlVjZ4SShg26A7AmckR21ZAZ8qKPE6eBEuAhA/bxfWBsJaCxHYFi7T6PQn3HU2g9ZafMUdWhnzszbkNu32uGlnSKPR5rR6GNnCUwiVlBZoDCHZpB0nGPXFTQB+FVKiEQuae9niMJuSKEbFGpT7fWFs6MLeXJbnbfCw5OJ/Rk3EZzGti3UUGXW5Xmke/WXqOD0pwYB7FeraPlM4f2LRxSTXgL/9Vd9QB3OK8gcvX+8xZyji4lRmEbLXeuk79H4bqs8j5jgkjJqQJYqZnqZ8FIdW6SsUJtFZ0gVCTWrXfssw9rBVkl","bbs_proof_verbose":"tcIqOLqAfzb20nvreTgXFCVon32VG8alqu+f3GBeq7787ibrpOh4RrUF13bcpam5g0QwTsqI14t7eIEkLMZJwbZb/KJz2XdVnu1A3dlJ0urNoTKo/O3XSgTl+0PiJqS3tsNzQi0mhA2rHnc7iJNc7g/rx4HoRc8LvZfb6TuusFxt51+SvN8ywREpyBIYMf57Jgs9m1uy8RMfaZ8GG8zPhK3A2yjCofp69t20pvBezRIMyGBZ7qlMZsWiMaKYG+83CwOiDHNupPe3EhEgiqaTZBVJqMcV0K912aWZ55kRDOW2/47cuTwE2QrPNbGrL3/eG78U8vIeepjUvLl6IKHlTw4Hk+dMa+XGrVyZFEUwcvNsA28ocVKI7wW6NJuxfQpXl3ViGIIS3IYOYdU+y/PrmEa7hXoQKE1pTWzPz9/uIXEm1l3ij+jTRlWi7/VgV/35","bbs_public_key":"o+JuJ0zDfbRzXkXsgBZ9t2YvM+OGOFWqByaQeYxplqUU/2SNEYTcP5QQh1mSN9xxDyNW/s6Lm/fR8D6c7kfbdRwSPcx+xb0iemsNxhwFtVqo/KrAtpsOaBugtUh8P0xY","hash_name":"sha256"}
{"bbs_credential":"oamUr6F4m2WuHNhn2zah0TCy/oBb2r09ozWn/bmzvv/KMaBcN0tTySjJCESBUXi8M050WIdBiYg6pxd87UQeBVgfNKK39OGNlnZM2GNZFfE=","bbs_disclosed_indexes":[1,3],"bbs_disclosed_messages":["above 18","professor"],"bbs_presentation_header":"XdjAYj+RY95+uyYMI8fR3+fmP5LyQaN54vyTTVKxZyA=","bbs_proof":"saqQpmcF/SGQNoRVW3PkgqOl7R2Mqm+w0hQ1OAOi+Xss8IKM+QxINTzATD3ZG03eoMd3zJtRq4fOWD96p0GAH4oPn/iUuciLNrEkHuQqNEyo+IxQLDribteE9ojfehH0izxn7h/TaWqECtYpgGBApvQtWRCYJNBhxuzo6cH3IAzmlHgyU6NOOiY05TvL0hgKAvbuBPCOYLtKadve9OvVcwdhAMPbPu8fSeeJP8CU4VYoTcwgv2pUVg1gT21MxxhvDXDOO+bSF/kecImTCz0Nih9fshjUIu/0tdMDTkprqfMvw9fafUfxpHYdTa9LGk+zGswzrM2HH/RcYhUxp6ots+zysukuwEXRLfurJKSKjrZig3SOg2pJ1gkpr/Nh5Rc5juc04BkX2/9HIP3Ukl6Qtg==","bbs_proof_verbose":"jeg56H2xpF77nV4+hCAsKQ/lfQg/G2yfkktrNtgSRWfh/UsJy32NDIb9cPBUZnaHjxCeAiWUaUcjXWcTsJIl553qZY5XP2FIfVKENcAUK9Uk+ONYSn+WJn53hcJ+H46NmBKvOrskrN3dXMmRl/JnTTDKnJJGF2DMtS4MgO5LmrLVGd8UXkcgYHYxMmYhnKtkVd8aWqSSpbwop03W6X86Y0+rXB6NUA1EcuLyOQ/CLy9Y7WjBI8Ik7xCQO9eN1cxUcVi6bewNsDTM8YnGHWJzF0X1VRgKOQ90a+MIdYzivzRLeNDDHJa3awDrbd3dT4WiS1mUFh7BCT3oaIsk0Am7ViJpmgu+fxIfDy3ZjwudC4tZOVqpwYmwtO9ukaVyPuC1lgehOAqVV1y50mVTnMN+Og==","bbs_public_key":"i33+cqmLXaneXsvmCv9EE+4GU1+cxO8uZYV+wTLjU0UL7uXbsBW2D0Pd34j5I2E6BFxcFdaVfACQutLX3kQ1TaO0V9Iz1KTn03/OHzyNKhWBkXEYolZ6mdc75DZQDy1k"}
7 changes: 3 additions & 4 deletions docs/examples/zencode_cookbook/bbs/data_credential_docs.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"The_Authority": {
"bbs_public_key": "o+JuJ0zDfbRzXkXsgBZ9t2YvM+OGOFWqByaQeYxplqUU/2SNEYTcP5QQh1mSN9xxDyNW/s6Lm/fR8D6c7kfbdRwSPcx+xb0iemsNxhwFtVqo/KrAtpsOaBugtUh8P0xY",
"bbs_public_key": "i33+cqmLXaneXsvmCv9EE+4GU1+cxO8uZYV+wTLjU0UL7uXbsBW2D0Pd34j5I2E6BFxcFdaVfACQutLX3kQ1TaO0V9Iz1KTn03/OHzyNKhWBkXEYolZ6mdc75DZQDy1k",
"keyring": {
"bbs": "MXuDMAavZ9URy0VSwIxQwl9gCTXL1ePQfyWpHQCL9Wk="
"bbs": "EIRxtRfx2zDcSEogGyVJ29yj4wHwncuNQMrCpLnfknA="
}
},
"bbs_messages": [
"above 18",
"italian",
"professor"
],
"hash_name": "sha256"
]
}
4 changes: 0 additions & 4 deletions docs/examples/zencode_cookbook/bbs/issuer_keys_docs.zen
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
Scenario 'bbs': authority generates its keys

Given I am 'The Authority'

When I create the bbs key
When I create the bbs public key

Then print my 'bbs public key'
Then print my 'keyring'

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"The_Authority":{"bbs_public_key":"qZAXFyd/GWAv9WQllN9t+w+6AlMAfjrb4RXhmYP0wGRzUpR1VBQwTzwdr2UvdxTvFBjxVb6TF7ZPK1B6qji08gLlioiMLO/0cBBRZrnsTRhynsDXlB6Yp6brQ758zqFj","keyring":{"bbs":"U+KhGohqd4/Cs1dA/6HBj3wOM8vSgEQ++1wVcTaKFZ0="}}}
{"The_Authority":{"bbs_public_key":"i33+cqmLXaneXsvmCv9EE+4GU1+cxO8uZYV+wTLjU0UL7uXbsBW2D0Pd34j5I2E6BFxcFdaVfACQutLX3kQ1TaO0V9Iz1KTn03/OHzyNKhWBkXEYolZ6mdc75DZQDy1k","keyring":{"bbs":"EIRxtRfx2zDcSEogGyVJ29yj4wHwncuNQMrCpLnfknA="}}}
1 change: 1 addition & 0 deletions docs/examples/zencode_cookbook/bbs/keygen_docs.zen
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ 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'
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"bbs_credential":"mM+sPY0BNTri66IFR/G9HgSvJuzhf1fz36twKO4RnQXQyKYv2afPYa0J7fKpGC2KSdUb4M9lC59iLXS5n6Cutgc8pE21NRyvaV/Pp3mOnOxSw8ScbPbpuQuPVqUkPK16V+hlWMKRVc7+njxQZUt1oA==","bbs_messages":["above 18","italian","professor"],"hash_name":"sha256"}
{"bbs_credential":"hQjtvfh/fYpygqCd89OJSckcMDjHoy+8kAMaTzHqfZ4djSE557kk9jW3ERriL+DyCJvMenJqEQIvrEy1kC9mqjx75Xkg+NdWni7WpvEH+l4=","bbs_messages":["above 18","italian","professor"]}
5 changes: 2 additions & 3 deletions docs/examples/zencode_cookbook/bbs/proof_data_docs.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"The_Authority": {
"bbs_public_key": "o+JuJ0zDfbRzXkXsgBZ9t2YvM+OGOFWqByaQeYxplqUU/2SNEYTcP5QQh1mSN9xxDyNW/s6Lm/fR8D6c7kfbdRwSPcx+xb0iemsNxhwFtVqo/KrAtpsOaBugtUh8P0xY"
"bbs_public_key": "i33+cqmLXaneXsvmCv9EE+4GU1+cxO8uZYV+wTLjU0UL7uXbsBW2D0Pd34j5I2E6BFxcFdaVfACQutLX3kQ1TaO0V9Iz1KTn03/OHzyNKhWBkXEYolZ6mdc75DZQDy1k"
},
"bbs_credential": "mM+sPY0BNTri66IFR/G9HgSvJuzhf1fz36twKO4RnQXQyKYv2afPYa0J7fKpGC2KSdUb4M9lC59iLXS5n6Cutgc8pE21NRyvaV/Pp3mOnOxSw8ScbPbpuQuPVqUkPK16V+hlWMKRVc7+njxQZUt1oA==",
"bbs_credential": "oamUr6F4m2WuHNhn2zah0TCy/oBb2r09ozWn/bmzvv/KMaBcN0tTySjJCESBUXi8M050WIdBiYg6pxd87UQeBVgfNKK39OGNlnZM2GNZFfE=",
"bbs_messages": [
"above 18",
"italian",
"professor"
],
"hash_name": "sha256",
"bbs_disclosed_indexes": [
1,
3
Expand Down
17 changes: 0 additions & 17 deletions docs/examples/zencode_cookbook/bbs/proved_signature_docs.json

This file was deleted.

2 changes: 2 additions & 0 deletions docs/examples/zencode_cookbook/bbs/pubkey_docs.zen
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ 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'
12 changes: 6 additions & 6 deletions docs/examples/zencode_cookbook/bbs/sign_bbs_docs.zen
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ 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'
2 changes: 1 addition & 1 deletion docs/examples/zencode_cookbook/bbs/signed_bbs_docs.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"myMessage":"Dear Bob, your name is too short, goodbye - Alice.","myMessage.signature":"ra8Lk5YxznEuw1YLjzR/jZyeYudnDgzDQSwXfW12RcjJ5uKzv0iGOtjsQGDuAlRMHWN/rRyylugoMx4kcJXFxF061Gsc+IyXFl12TLNM068=","myMessage.signature.sha":"ra8Lk5YxznEuw1YLjzR/jZyeYudnDgzDQSwXfW12RcjJ5uKzv0iGOtjsQGDuAlRMHWN/rRyylugoMx4kcJXFxF061Gsc+IyXFl12TLNM068=","myStringArray":["Hello World! This is my string array, element [0]","Hello World! This is my string array, element [1]","Hello World! This is my string array, element [2]"],"myStringArray.signature":"t+Ewwf9T5uWcijQC6ji9GLdNyQUsznOcSsJy2V2iHJGVlV3aRK/853F6KA9yLvMBLExj15X09eL6v82L81Qwb7guE4XAcH1UTyvRzYgT+h4=","myStringArray.signature.sha":"t+Ewwf9T5uWcijQC6ji9GLdNyQUsznOcSsJy2V2iHJGVlV3aRK/853F6KA9yLvMBLExj15X09eL6v82L81Qwb7guE4XAcH1UTyvRzYgT+h4="}
{"myMessage":"Dear Bob, your name is too short, goodbye - Alice.","myMessage.signature":"ra8Lk5YxznEuw1YLjzR/jZyeYudnDgzDQSwXfW12RcjJ5uKzv0iGOtjsQGDuAlRMHWN/rRyylugoMx4kcJXFxF061Gsc+IyXFl12TLNM068=","myMessage.signature.shake":"sw/lIzhk9+JfCNKcJQBeuKbbYE7GNsd4PlL44umCK6jj2YgdWcsB+mtcw/h8uMvAStVyA6MtNc/o4098eHPQzHndLpc1CUzbZ5IhRstnhvo=","myStringArray":["Hello World! This is my string array, element [0]","Hello World! This is my string array, element [1]","Hello World! This is my string array, element [2]"],"myStringArray.signature":"t+Ewwf9T5uWcijQC6ji9GLdNyQUsznOcSsJy2V2iHJGVlV3aRK/853F6KA9yLvMBLExj15X09eL6v82L81Qwb7guE4XAcH1UTyvRzYgT+h4=","myStringArray.signature.shake":"ge+/5zGSrYUeZjU1qIAqshDfKIUgV2pTYXGvRDOr2XFpw1HxpE8Eo/NPnatoeOFyHUsoiP5wQJHZT/UScg4TDsLV53bXU3EFppbSCvuxKAw="}
13 changes: 7 additions & 6 deletions docs/examples/zencode_cookbook/bbs/verify_bbs_docs.zen
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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 @@ -10,17 +11,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
8 changes: 4 additions & 4 deletions docs/examples/zencode_cookbook/bbs/verify_proof_docs.zen
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Scenario bbs: verify a bbs proof

# We load al the necessary objects one at a time
Given I have a 'bbs public key' in 'The Authority'
Given I have a 'bbs public key'
and I have a 'bbs proof'
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 using 'sha256' 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 using 'sha256'

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

# The print is executed only if the verification was successful
Then print the string 'bbs zkp verification successful'
Loading

0 comments on commit 3b20fa3

Please sign in to comment.