diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1738f1377..444f7446c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: fsfe/reuse-action@v3 + - uses: fsfe/reuse-action@v4 c-lint: diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 000000000..3f5d298ee --- /dev/null +++ b/.mise.toml @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: 2024 Dyne.org foundation +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +[tools] +emsdk = "3" +meson = "1" +rust = "stable" diff --git a/.reuse/dep5 b/.reuse/dep5 deleted file mode 100644 index be5082656..000000000 --- a/.reuse/dep5 +++ /dev/null @@ -1,24 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: Zenroom -Upstream-Contact: Denis Roio -Source: https://github.com/dyne/Zenroom - -Files: src/* bindings/* test/* docs/* examples/* .github/* build/* VERSION pet/petitionCount.zen .gitattributes -Copyright: 2017-2023 Dyne.org foundation -License: AGPL-3.0-or-later - -Files: lib/lua54/* -Copyright: 1994-2023 Lua.org, PUC-Rio -License: MIT - -Files: lib/milagro-crypto-c/* -Copyright: 2019 The Apache Software Foundation -License: Apache-2.0 - -Files: lib/pqclean/* -Copyright: Léo Ducas, Eike Kiltz, Tancrède Lepoint, Vadim Lyubashevsky, Gregor Seiler, Peter Schwabe, Damien Stehlé -License: CC0-1.0 - -Files: lib/ed25519-donna/* -Copyright: Andrew M. -License: CC0-1.0 diff --git a/README.md b/README.md index bfded1dc9..c8276d78a 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,11 @@ Zencode has a **no-code** approach. It is a domain-specific language (DSL) **sim Zencode helps developers to **empower people** who know what to do with data: one can write and review business logic and data-sensitive operations **without learning to code**. - -[![software by Dyne.org](https://files.dyne.org/software_by_dyne.png)](http://www.dyne.org) +

+ + + +

## Timeline @@ -98,38 +101,24 @@ Dependencies: makefile, cmake, gcc, libreadline-dev, xxd Optional: musl-libc, emscripten for wasm builds -Use this command sequence: - -``` -git clone https://github.com/dyne/zenroom -cd zenroom -make linux -``` - -to create the CLI executable in `src/zenroom` - -``` -make linux-lib -``` - -to create the shared library in `src/libzenroom-x86_64.so` +There are various build targets, just type make to have a list: ``` -make +✨ Welcome to the Zenroom build system +🛟 Usage: make +👇🏽 List of targets: + posix-exe Dynamic executable for generic POSIX + posix-lib Dynamic library for generic POSIX + linux-exe Dynamic executable for GNU/Linux + linux-lib Dynamic library for GNU/Linux + musl Static executable for Musl + win-exe Executable for Windows x86 64bit + win-dll Dynamic lib (DLL) for Windows x86 64bit + osx-exe Executable for Apple MacOS + osx-lib Library for Apple MacOS native + node-wasm WebAssembly (WASM) for Javascript in-browser (Emscripten) ``` -to list more available targets - -### Meson + Ninja - -Practical build scripts for GNU/Linux are provided using Meson + Ninja - -``` -make meson -``` - -Will produce a `zenroom` executable and a `libzenroom` shared lib in `zenroom/build`. - ## License Copyright (C) 2017-2023 Dyne.org foundation @@ -160,7 +149,7 @@ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU diff --git a/REUSE.toml b/REUSE.toml new file mode 100644 index 000000000..9d6d7092e --- /dev/null +++ b/REUSE.toml @@ -0,0 +1,47 @@ +# SPDX-FileCopyrightText: 2024 Dyne.org foundation +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +version = 1 +SPDX-PackageName = "Zenroom" +SPDX-PackageSupplier = "Denis Roio " +SPDX-PackageDownloadLocation = "https://github.com/dyne/Zenroom" + +[[annotations]] +path = [ + "src/**", + "bindings/**", + "test/**", + "docs/**", + ".github/**", + "build/*", + ".gitattributes", + "compile_flags.txt" +] +precedence = "aggregate" +SPDX-FileCopyrightText = "2017-2024 Dyne.org foundation" +SPDX-License-Identifier = "AGPL-3.0-or-later" + +[[annotations]] +path = ["lib/lua54/**"] +precedence = "aggregate" +SPDX-FileCopyrightText = "1994-2024 Lua.org, PUC-Rio" +SPDX-License-Identifier = "MIT" + +[[annotations]] +path = ["lib/milagro-crypto-c/**"] +precedence = "aggregate" +SPDX-FileCopyrightText = "2019 The Apache Software Foundation" +SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = ["lib/pqclean/**"] +precedence = "aggregate" +SPDX-FileCopyrightText = "Léo Ducas, Eike Kiltz, Tancrède Lepoint, Vadim Lyubashevsky, Gregor Seiler, Peter Schwabe, Damien Stehlé" +SPDX-License-Identifier = "CC0-1.0" + +[[annotations]] +path = ["lib/ed25519-donna/**"] +precedence = "aggregate" +SPDX-FileCopyrightText = "Andrew M. " +SPDX-License-Identifier = "CC0-1.0" diff --git a/compile_flags.txt b/compile_flags.txt new file mode 100644 index 000000000..90258102e --- /dev/null +++ b/compile_flags.txt @@ -0,0 +1,5 @@ +-Ilib/lua54/src +-Ilib/milagro-crypto-c/build/include +-Ilib/milagro-crypto-c/include +-Ilib/ed25519-donna +-Isrc diff --git a/docs/_media/run_utterances.sh b/docs/_media/run_utterances.sh index 73cc5079c..95d068340 100755 --- a/docs/_media/run_utterances.sh +++ b/docs/_media/run_utterances.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash # this file create the zencode_utterances_reworked.yaml file # that in turn is used by zencode-list.md to document all the # zenroom statements @@ -5,23 +6,32 @@ rm -f zencode_utterances_reworked.yaml for i in `ls ../../src/lua/zencode_*`; do - SCENARIO=`echo $i | cut -d _ -f 2 | cut -d . -f 1` - ../../src/zenroom -D $SCENARIO 2>/dev/null | jq . > temp.json; + SCENARIO=`echo $i | cut -d _ -f2- | cut -d . -f1` + ../../zenroom -D $SCENARIO 2>/dev/null | jq . > temp.json; echo "### [${SCENARIO}]" >> zencode_utterances_reworked.yaml - if [ $SCENARIO == "debug" ]; then - cat temp.json \ - | jq '."Given" | keys[] ' \ - | sed -e 's/\\\"/\"/g' -e 's/^.//g' -e 's/.$//g' \ - | sort \ - >> zencode_utterances_reworked.yaml + if [ "$SCENARIO" == "debug" ]; then + cat temp.json \ + | jq '."Given" | keys[] ' \ + | sed -e 's/\\\"/\"/g' -e 's/^.//g' -e 's/.$//g' \ + | sort \ + >> zencode_utterances_reworked.yaml else - cat temp.json \ - | jq '.["Given", "If", "When", "Then"] | keys[] ' \ - | sed -e 's/\\\"/\"/g' -e 's/^.//g' -e 's/.$//g' \ - | sort \ - >> zencode_utterances_reworked.yaml + cat temp.json \ + | jq '.If | keys[] ' \ + | sed -e 's/\\\"/\"/g' -e 's/^.//g' -e 's/.$//g' \ + >> temp_if.txt + cat temp.json \ + | jq '.["Given", "If", "Foreach", "When", "Then"] | keys[] ' \ + | sed -e 's/\\\"/\"/g' -e 's/^.//g' -e 's/.$//g' \ + | sort \ + >> zencode_utterances_reworked.yaml fi echo "### [${SCENARIO}]" >> zencode_utterances_reworked.yaml done +echo "### [if_subset]" >> zencode_utterances_reworked.yaml +cat temp_if.txt | sort >> zencode_utterances_reworked.yaml +echo "### [if_subset]" >> zencode_utterances_reworked.yaml + rm temp.json +rm temp_if.txt diff --git a/docs/_media/zencode_utterances_reworked.yaml b/docs/_media/zencode_utterances_reworked.yaml index 45537fcdf..5f7f64a34 100644 --- a/docs/_media/zencode_utterances_reworked.yaml +++ b/docs/_media/zencode_utterances_reworked.yaml @@ -1,60 +1,85 @@ ### [array] -create the aggregation of array '' -create the array of objects named by '' found in '' -create the average of elements in array '' -create the copy of element '' in array '' -create the flat array of contents in '' -create the flat array of keys in '' -create the length of '' -create the new array -create the size of '' -create the standard deviation of elements in array '' -create the sum value of elements in array '' -create the variance of elements in array '' -insert '' in '' +create aggregation of array '' +create array by splitting '' at '' +create array of objects named by '' found in '' +create average of elements in array '' +create copy of element '' from array '' +create flat array of contents in '' +create flat array of keys in '' +create '' from '' in '' +create new array +create standard deviation of elements in array '' +create sum value of elements in array '' +create variance of elements in array '' +insert false in '' insert string '' in '' -remove the '' from '' -the '' is found in '' -the '' is found in '' at least '' times -the '' is not found in '' +insert true in '' ### [array] +### [bbs] +create bbs disclosed messages +create bbs key +create bbs key with secret '' +create bbs key with secret key '' +create bbs proof +create bbs proof of signature '' of messages '' with public key '' presentation header '' and disclosed indexes '' +create bbs public key +create bbs public key with secret key '' +create bbs shake key +create bbs shake key with secret '' +create bbs shake key with secret key '' +create bbs shake proof +create bbs shake proof of signature '' of messages '' with public key '' presentation header '' and disclosed indexes '' +create bbs shake public key +create bbs shake public key with secret key '' +create bbs shake signature of '' +create bbs signature of '' +verify bbs proof +verify bbs proof with public key '' presentation header '' disclosed messages '' and disclosed indexes '' +verify bbs shake proof +verify bbs shake proof with public key '' presentation header '' disclosed messages '' and disclosed indexes '' +verify '' has a bbs shake signature in '' by '' +verify '' has a bbs signature in '' by '' +### [bbs] ### [bitcoin] -create the bitcoin address -create the bitcoin key -create the bitcoin key with secret '' -create the bitcoin key with secret key '' -create the bitcoin public key -create the bitcoin raw transaction -create the bitcoin transaction -create the bitcoin transaction to '' -create the testnet address -create the testnet key -create the testnet key with secret '' -create the testnet key with secret key '' -create the testnet public key -create the testnet raw transaction -create the testnet transaction -create the testnet transaction to '' -sign the bitcoin transaction -sign the testnet transaction +create bitcoin address +create bitcoin key +create bitcoin key with secret '' +create bitcoin key with secret key '' +create bitcoin public key +create bitcoin raw transaction +create bitcoin transaction +create bitcoin transaction to '' +create testnet address +create testnet key +create testnet key with secret '' +create testnet key with secret key '' +create testnet public key +create testnet raw transaction +create testnet transaction +create testnet transaction to '' +sign bitcoin transaction +sign testnet transaction ### [bitcoin] ### [credential] -aggregate the issuer public keys -create the credential key -create the credential key with secret '' -create the credential key with secret key '' -create the credential proof -create the credential request -create the credentials -create the credential signature -create the issuer key -create the issuer public key -verify the credential proof +aggregate credentials in '' +aggregate issuer public keys +aggregate verifiers in '' +create credential key +create credential key with secret '' +create credential key with secret key '' +create credential proof +create credential request +create credentials +create credential signature +create issuer key +create issuer public key +verify credential proof ### [credential] ### [data] ### [data] ### [debug] backtrace +break codec config debug @@ -62,178 +87,360 @@ schema trace ### [debug] ### [dictionary] -create the array of elements named '' for dictionaries in '' -create the copy of '' from '' -create the copy of '' from dictionary '' -create the copy of '' in '' -create the copy of '' in '' in '' -create the copy of object named by '' from dictionary '' -create the new dictionary -create the new dictionary named '' -create the pruned dictionary of '' -create the sum value '' for dictionaries in '' -create the sum value '' for dictionaries in '' where '' > '' +create array of elements named '' for dictionaries in '' +create copy of '' from '' +create copy of '' from dictionary '' +create copy of object named by '' from dictionary '' +create new dictionary +create new dictionary named '' +create pruned dictionary of '' +create sum value '' for dictionaries in '' +create sum value '' for dictionaries in '' where '' > '' filter '' fields from '' -find the '' for dictionaries in '' where '' = '' -find the max value '' for dictionaries in '' -find the min value '' for dictionaries in '' +find '' for dictionaries in '' where '' = '' +find max value '' for dictionaries in '' +find min value '' for dictionaries in '' for each dictionary in '' append '' to '' -move '' in '' ### [dictionary] +### [did] +create '' public key from did document '' +create serviceEndpoint of '' +create verificationMethod of '' +verify did document named '' +verify did document named '' is signed by '' +### [did] ### [dp3t] -create the ephemeral ids for today -create the proximity tracing of infected ids -renew the secret day key to a new day +create ephemeral ids for today +create proximity tracing of infected ids +renew secret day key to a new day ### [dp3t] ### [ecdh] -create the ecdh key -create the ecdh key with secret '' -create the ecdh key with secret key '' -create the ecdh public key -create the ecdh signature of '' -create the signature of '' -decrypt the text of '' from '' -decrypt the text of '' with '' -encrypt the secret message of '' for '' -encrypt the secret message '' with '' -verify the '' has a ecdh signature in '' by '' -verify the '' has a signature in '' by '' +create ecdh deterministic signature of '' +create ecdh key +create ecdh key with secret '' +create ecdh key with secret key '' +create ecdh public key +create ecdh signature of '' +create ecdsa deterministic signature of '' +create signature of '' +decrypt text of '' from '' +decrypt text of '' with '' +encrypt secret message of '' for '' +encrypt secret message '' with '' +verify '' has a ecdh deterministic signature in '' by '' +verify '' has a ecdh signature in '' by '' +verify '' has a ecdsa deterministic signature in '' by '' +verify '' has a signature in '' by '' ### [ecdh] +### [eddsa] +create eddsa key +create eddsa key with secret '' +create eddsa key with secret key '' +create eddsa public key +create eddsa public key with secret key '' +create eddsa signature of '' +verify '' has a eddsa signature in '' by '' +### [eddsa] +### [es256] +create es256 key +create es256 key with secret '' +create es256 key with secret key '' +create es256 public key +create es256 public key with secret key '' +create es256 signature of '' +verify '' has a es256 signature in '' by '' +### [es256] ### [ethereum] -create the ethereum address -create the ethereum key -create the ethereum key with secret '' -create the ethereum key with secret key '' -create the ethereum transaction of '' to '' -create the ethereum transaction to '' -create the signed ethereum transaction -create the signed ethereum transaction for chain '' -create the string from the ethereum bytes named '' -use the ethereum transaction to store '' -verify the signed ethereum transaction from '' +create '' decoded from ethereum bytes '' +create ethereum abi decoding of '' using '' +create ethereum abi encoding of '' using '' +create ethereum address +create ethereum address from ethereum signature '' of '' +create ethereum key +create ethereum key with secret '' +create ethereum key with secret key '' +create ethereum signature of '' +create ethereum transaction of '' to '' +create ethereum transaction to '' +create signed ethereum transaction +create signed ethereum transaction for chain '' +create string from ethereum bytes named '' +use ethereum address signature pair array '' to create result array of '' +use ethereum transaction to approve erc721 '' transfer from '' +use ethereum transaction to create erc721 of object '' +use ethereum transaction to create erc721 of uri '' +use ethereum transaction to run '' using '' +use ethereum transaction to store '' +use ethereum transaction to transfer '' erc20 tokens to '' +use ethereum transaction to transfer '' erc20 tokens to '' with details '' +use ethereum transaction to transfer erc721 '' from '' to '' +use ethereum transaction to transfer erc721 '' in contract '' to '' in planetmint +verify ethereum address signature pair array '' of '' +verify ethereum address string '' is valid +verify '' has a ethereum signature in '' by '' +verify signed ethereum transaction from '' ### [ethereum] +### [foreach] +break foreach +exit foreach +'' in '' +'' in sequence from '' to '' with step '' +### [foreach] +### [fsp] +create fsp ciphertext of '' +create fsp cleartext of '' +create fsp cleartext of response '' +create fsp cleartext of response '' to '' +create fsp key +create fsp key with secret '' +create fsp key with secret key '' +create fsp response of '' with '' +create fsp response with '' +### [fsp] ### [given] -a '' -a '' from '' -a '' in '' -a '' is valid +'' am '' -a '' named '' -a '' named by '' -a '' named by '' in '' -a '' named '' in '' -a '' public key from '' +'' from '' +'' in '' +'' in path '' +'' is valid my '' my '' is valid my '' named '' my '' named by '' -my name is in a '' named '' -my name is in a '' named '' in '' +my name is in '' named '' +my name is in '' named '' in '' +'' named '' +'' named by '' +'' named by '' in '' +'' named '' in '' nothing +'' part of '' after string prefix '' +'' part of '' before string suffix '' +'' public key from '' +rename '' to '' ### [given] ### [hash] -create the hashes of each object in '' -create the hash of '' -create the hash of '' using '' -create the hash to point '' of each object in '' -create the HMAC of '' with key '' -create the key derivation of '' -create the key derivation of '' with password '' +create hashes of each object in '' +create hash of '' +create hash of '' using '' +create hash to point '' of '' +create HMAC of '' with key '' +create key derivation of '' +create key derivation of '' with password '' +create key derivation of '' with '' rounds +create key derivation of '' with '' rounds with password '' +create key derivations of each object in '' ### [hash] ### [http] append '' as http request to '' -create the url from '' +append percent encoding of '' as http request to '' +create http get parameters from '' +create http get parameters from '' using percent encoding +create url from '' ### [http] +### [jwk] +create jwk of ecdh public key +create jwk of ecdh public key '' +create jwk of ecdh public key with private key +create jwk of es256k public key +create jwk of es256k public key '' +create jwk of es256k public key with private key +create jwk of es256 public key +create jwk of es256 public key '' +create jwk of es256 public key with private key +create jwk of p256 public key +create jwk of p256 public key '' +create jwk of p256 public key with private key +create jwk of secp256k1 public key +create jwk of secp256k1 public key '' +create jwk of secp256k1 public key with private key +create jwk of secp256r1 public key +create jwk of secp256r1 public key '' +create jwk of secp256r1 public key with private key +### [jwk] +### [jws] +create jws detached signature of header '' and payload '' +create jws header for ecdh signature +create jws header for ecdh signature with public key +create jws header for es256k signature +create jws header for es256k signature with public key +create jws header for es256 signature +create jws header for es256 signature with public key +create jws header for p256 signature +create jws header for p256 signature with public key +create jws header for secp256k1 signature +create jws header for secp256k1 signature with public key +create jws header for secp256r1 signature +create jws header for secp256r1 signature with public key +create jws signature of '' +create jws signature of header '' and payload '' +create jws signature using ecdh signature in '' +verify '' has a jws signature in '' +verify jws signature in '' +verify jws signature of '' +### [jws] +### [jwt] +create json web token of '' using '' +verify json web token in '' using '' +### [jwt] ### [keyring] -create the keyring +create keyring ### [keyring] +### [pack] +create '' decoded from mpack '' +create mpack of '' +### [pack] ### [petition] -add the signature to the petition -count the petition results +add signature to petition +count petition results create a petition tally -create the petition '' -create the petition signature '' -the petition signature is just one more -the petition signature is not a duplicate -verify the new petition to be empty -verify the signature proof is correct +create petition '' +create petition signature '' +verify new petition to be empty +verify petition signature is just one more +verify petition signature is not a duplicate +verify signature proof is correct ### [petition] +### [planetmint] +create planetmint signatures of '' +### [planetmint] +### [pvss] +compose pvss secret using '' with quorum '' +create pvss key +create pvss public key +create pvss public shares of '' with '' quorum '' using public keys '' +create pvss verified shares from '' +create secret share with public key '' +verify pvss public shares with '' quorum '' +### [pvss] ### [qp] -create the dilithium key -create the dilithium public key -create the dilithium public key with secret key '' -create the dilithium signature of '' -create the kyber kem for '' -create the kyber key -create the kyber public key -create the kyber public key with secret key '' -create the kyber secret from '' -create the ntrup kem for '' -create the ntrup key -create the ntrup public key -create the ntrup public key with secret key '' -create the ntrup secret from '' -verify the '' has a dilithium signature in '' by '' +create dilithium key +create dilithium public key +create dilithium public key with secret key '' +create dilithium signature of '' +create kyber kem for '' +create kyber key +create kyber public key +create kyber public key with secret key '' +create kyber secret from '' +create mldsa44 key +create mldsa44 public key +create mldsa44 public key with secret key '' +create mldsa44 signature of '' +create mlkem512 kem for '' +create mlkem512 key +create mlkem512 public key +create mlkem512 public key with secret key '' +create mlkem512 secret from '' +create ntrup kem for '' +create ntrup key +create ntrup public key +create ntrup public key with secret key '' +create ntrup secret from '' +verify '' has a dilithium signature in '' by '' +verify '' has a mldsa44 signature in '' by '' ### [qp] ### [random] -create the array of '' random numbers -create the array of '' random numbers modulo '' -create the array of '' random objects -create the array of '' random objects of '' bits -create the array of '' random objects of '' bytes -create the random '' -create the random dictionary with '' random objects from '' -create the random object of '' bits -create the random object of '' bytes -pick the random object in '' -randomize the '' array +create array of '' random numbers +create array of '' random numbers modulo '' +create array of '' random objects +create array of '' random objects of '' bits +create array of '' random objects of '' bytes +create random '' +create random dictionary with '' random objects from '' +create random object of '' bits +create random object of '' bytes +pick random object in '' +randomize '' array +seed random with '' ### [random] ### [reflow] -add the reflow fingerprint to the reflow seal -add the reflow signature to the reflow seal -aggregate the issuer public keys -aggregate the reflow public key from array '' -aggregate the reflow seal array in '' -check the reflow signature fingerprint is new -create the credential key -create the credential key with secret '' -create the credential key with secret key '' -create the credential proof -create the credential request -create the credentials -create the credential signature -create the issuer key -create the issuer public key -create the material passport of '' -create the reflow identity of '' -create the reflow identity of objects in '' -create the reflow key -create the reflow key with secret '' -create the reflow key with secret key '' -create the reflow public key -create the reflow seal -create the reflow seal with identity '' -create the reflow signature +add reflow fingerprint to reflow seal +add reflow signature to reflow seal +aggregate credentials in '' +aggregate issuer public keys +aggregate reflow public key from array '' +aggregate reflow seal array in '' +aggregate verifiers in '' +create credential key +create credential key with secret '' +create credential key with secret key '' +create credential proof +create credential request +create credentials +create credential signature +create issuer key +create issuer public key +create material passport of '' +create reflow identity of '' +create reflow identity of objects in '' +create reflow key +create reflow key with secret '' +create reflow key with secret key '' +create reflow public key +create reflow seal +create reflow seal with identity '' +create reflow signature prepare credentials for verification -verify the credential proof -verify the material passport of '' -verify the material passport of '' is valid -verify the reflow seal is valid -verify the reflow signature credential +verify credential proof +verify material passport of '' +verify material passport of '' is valid +verify reflow seal is valid +verify reflow signature credential +verify reflow signature fingerprint is new ### [reflow] +### [rsa] +create rsa key +create rsa public key +create rsa public key with secret key '' +create rsa signature of '' +verify '' has a rsa signature in '' by '' +### [rsa] ### [schnorr] -create the schnorr key -create the schnorr key with secret '' -create the schnorr key with secret key '' -create the schnorr public key -create the schnorr public key with secret key '' -create the schnorr signature of '' -verify the '' has a schnorr signature in '' by '' +create schnorr key +create schnorr key with secret '' +create schnorr key with secret key '' +create schnorr public key +create schnorr public key with secret key '' +create schnorr signature of '' +verify '' has a schnorr signature in '' by '' ### [schnorr] +### [sd_jwt] +create disclosed kv from signed selective disclosure '' +create jwt key binding with jwk '' +create selective disclosure of '' +create selective disclosure request from '' with id '' for '' +create signed selective disclosure of '' +use signed selective disclosure '' only with disclosures '' +verify disclosures '' are found in signed selective disclosure '' +verify signed selective disclosure '' issued by '' is valid +### [sd_jwt] ### [secshare] -compose the secret using '' -create the secret shares of '' with '' quorum '' +compose secret using '' +create secret shares of '' with '' quorum '' ### [secshare] +### [table] +copy '' as '' in '' +copy '' from '' in '' +copy '' in '' +copy named by '' in '' +copy '' to '' in '' +create copy of last element from '' +create size of '' +move '' as '' in '' +move '' from '' in '' +move '' in '' +move named by '' in '' +move '' to '' in '' +pickup a '' from path '' +pickup from path '' +remove '' from '' +take '' from path '' +verify '' is found in '' +verify '' is found in '' at least '' times +verify '' is not found in '' +### [table] ### [then] nothing print '' @@ -256,74 +463,226 @@ print my data from '' as '' print my '' from '' print my '' from '' as '' print my keyring +print my name in '' print object named by '' print string '' ### [then] +### [time] +create date table of timestamp '' +create integer '' cast of timestamp '' +create timestamp +create timestamp of date table '' +### [time] +### [vc] +get verification method in '' +set verification method in '' to '' +sign verifiable credential named '' +verify verifiable credential named '' +### [vc] ### [verify] -number '' is less or equal than '' -number '' is less than '' -number '' is more or equal than '' -number '' is more than '' -the elements in '' are equal -the elements in '' are not equal verify '' contains a list of emails +verify elements in '' are equal +verify elements in '' are not equal +verify '' ends with '' +verify '' has prefix '' +verify '' has suffix '' verify '' is a email verify '' is equal to '' verify '' is equal to '' in '' verify '' is not equal to '' verify '' is not equal to '' in '' +verify number '' is less or equal than '' +verify number '' is less than '' +verify number '' is more or equal than '' +verify number '' is more than '' +verify size of '' is less or equal than '' +verify size of '' is less than '' +verify size of '' is more or equal than '' +verify size of '' is more than '' +verify '' starts with '' ### [verify] ### [w3c] -get the verification method in '' -set the verification method in '' to '' -sign the verifiable credential named '' -verify the verifiable credential named '' +create json web token of '' using '' +create jwk of ecdh public key +create jwk of ecdh public key '' +create jwk of ecdh public key with private key +create jwk of es256k public key +create jwk of es256k public key '' +create jwk of es256k public key with private key +create jwk of es256 public key +create jwk of es256 public key '' +create jwk of es256 public key with private key +create jwk of p256 public key +create jwk of p256 public key '' +create jwk of p256 public key with private key +create jwk of secp256k1 public key +create jwk of secp256k1 public key '' +create jwk of secp256k1 public key with private key +create jwk of secp256r1 public key +create jwk of secp256r1 public key '' +create jwk of secp256r1 public key with private key +create jws detached signature of header '' and payload '' +create jws header for ecdh signature +create jws header for ecdh signature with public key +create jws header for es256k signature +create jws header for es256k signature with public key +create jws header for es256 signature +create jws header for es256 signature with public key +create jws header for p256 signature +create jws header for p256 signature with public key +create jws header for secp256k1 signature +create jws header for secp256k1 signature with public key +create jws header for secp256r1 signature +create jws header for secp256r1 signature with public key +create jws signature of '' +create jws signature of header '' and payload '' +create jws signature using ecdh signature in '' +create '' public key from did document '' +create serviceEndpoint of '' +create verificationMethod of '' +get verification method in '' +set verification method in '' to '' +sign verifiable credential named '' +verify did document named '' +verify did document named '' is signed by '' +verify '' has a jws signature in '' +verify json web token in '' using '' +verify jws signature in '' +verify jws signature of '' +verify verifiable credential named '' ### [w3c] ### [when] +append '' of '' to '' +append string '' to '' append '' to '' +compact ascii strings in '' +copy '' as '' to '' copy contents of '' in '' copy contents of '' named '' in '' -copy the '' in '' to '' -copy the '' to '' +copy '' from '' to '' copy '' to '' -create the '' -create the cbor of '' -create the json of '' -create the '' named '' -create the number from '' -create the result of '' % '' -create the result of '' * '' -create the result of '' + '' -create the result of '' - '' -create the result of '' / '' -create the result of '' * '' in '' -create the result of '' / '' in '' -create the result of '' in '' % '' -create the result of '' in '' * '' -create the result of '' in '' + '' -create the result of '' in '' - '' -create the result of '' in '' / '' -create the result of '' in '' % '' in '' -create the result of '' in '' * '' in '' -create the result of '' in '' + '' in '' -create the result of '' in '' - '' in '' -create the result of '' in '' / '' in '' -create the result of '' inverted sign +create '' +create '' cast of strings in '' +create count of char '' found in '' +create float '' cast of integer in '' +create json escaped string of '' +create json unescaped object of '' +create '' named '' +create number from '' +create result of '' +create result of '' % '' +create result of '' * '' +create result of '' + '' +create result of '' - '' +create result of '' / '' +create result of '' * '' in '' +create result of '' / '' in '' +create result of '' in '' % '' +create result of '' in '' * '' +create result of '' in '' + '' +create result of '' in '' - '' +create result of '' in '' / '' +create result of '' in '' % '' in '' +create result of '' in '' * '' in '' +create result of '' in '' + '' in '' +create result of '' in '' - '' in '' +create result of '' in '' / '' in '' +create result of '' inverted sign +create '' string of '' delete '' done -'' is found -'' is not found +exit with error message '' +move '' as '' to '' +move '' from '' to '' +move '' to '' remove '' +remove all occurrences of character '' in '' +remove newlines in '' +remove spaces in '' remove zero values in '' -rename the object named by '' to '' -rename the object named by '' to named by '' -rename the '' to '' +rename object named by '' to '' +rename object named by '' to named by '' rename '' to '' rename '' to named by '' set '' to '' as '' set '' to '' base '' -split the leftmost '' bytes of '' -split the rightmost '' bytes of '' +split leftmost '' bytes of '' +split rightmost '' bytes of '' +verify '' is a json +verify '' is found +verify '' is not found write number '' in '' write string '' in '' ### [when] +### [if_subset] +verify bbs proof +verify bbs proof with public key '' presentation header '' disclosed messages '' and disclosed indexes '' +verify bbs shake proof +verify bbs shake proof with public key '' presentation header '' disclosed messages '' and disclosed indexes '' +verify '' contains a list of emails +verify credential proof +verify credential proof +verify did document named '' +verify did document named '' +verify did document named '' is signed by '' +verify did document named '' is signed by '' +verify disclosures '' are found in signed selective disclosure '' +verify elements in '' are equal +verify elements in '' are not equal +verify '' ends with '' +verify ethereum address signature pair array '' of '' +verify '' has a bbs shake signature in '' by '' +verify '' has a bbs signature in '' by '' +verify '' has a dilithium signature in '' by '' +verify '' has a ecdh deterministic signature in '' by '' +verify '' has a ecdh signature in '' by '' +verify '' has a ecdsa deterministic signature in '' by '' +verify '' has a eddsa signature in '' by '' +verify '' has a es256 signature in '' by '' +verify '' has a ethereum signature in '' by '' +verify '' has a jws signature in '' +verify '' has a jws signature in '' +verify '' has a mldsa44 signature in '' by '' +verify '' has a rsa signature in '' by '' +verify '' has a schnorr signature in '' by '' +verify '' has a signature in '' by '' +verify '' has prefix '' +verify '' has suffix '' +verify '' is a email +verify '' is a json +verify '' is equal to '' +verify '' is equal to '' in '' +verify '' is found +verify '' is found in '' +verify '' is found in '' at least '' times +verify '' is not equal to '' +verify '' is not equal to '' in '' +verify '' is not found +verify '' is not found in '' +verify json web token in '' using '' +verify json web token in '' using '' +verify jws signature in '' +verify jws signature in '' +verify jws signature of '' +verify jws signature of '' +verify material passport of '' +verify material passport of '' is valid +verify number '' is less or equal than '' +verify number '' is less than '' +verify number '' is more or equal than '' +verify number '' is more than '' +verify petition signature is just one more +verify petition signature is not a duplicate +verify reflow seal is valid +verify reflow signature credential +verify reflow signature fingerprint is new +verify signature proof is correct +verify signed selective disclosure '' issued by '' is valid +verify size of '' is less or equal than '' +verify size of '' is less than '' +verify size of '' is more or equal than '' +verify size of '' is more than '' +verify '' starts with '' +verify verifiable credential named '' +verify verifiable credential named '' +### [if_subset] diff --git a/docs/_sidebar.md b/docs/_sidebar.md index f110e3fa2..56d30a4e7 100755 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -4,7 +4,6 @@ - [Zenroom's VM and Zencode](/pages/zencode-intro.md "Zencode cookbook intro") - [Zenroom's Command Line Interface](/pages/how-to-exec.md "Execute") - - Zencode Basics - [Quickstart](/pages/zencode-cookbook-intro.md "Zencode Quickstart") - [Given phase](/pages/zencode-cookbook-given.md "Zencode cookbook Given") @@ -39,44 +38,40 @@ - [Zencode command list](/pages/zencode-list.md "Zencode command list") - Bindings - - [ Use Zenroom as a library](/pages/how-to-embed.md "Embed") + - [Use Zenroom as a library](/pages/how-to-embed.md "Embed") - [JavaScript ](/pages/javascript.md "Use Zenroom in JavaScript") - [Python](/pages/python.md "Use Zenroom in JavaScript") - [Java](/pages/java.md "Use Zenroom in Java") - [iOS](/pages/ios.md "Use Zenroom in iOS") - Integration - - [Zenroom in node.js](/pages/zenroom-javascript1b.md "Use Zenroom in node.js") - - [Zenroom in the browser](/pages/zenroom-javascript2b.md "Use Zenroom in the browser") - - [Zenroom in React](/pages/zenroom-javascript3.md "Use Zenroom in React") - - [Zenroom in React Native](/pages/zenroom-react-native.md "Use Zenroom in React Native") - - [Zenroom ClojureScript](/pages/zenroom-clojurescript.md "Zenroom ClojureScript]") + - [Zenroom in node.js](/pages/zenroom-javascript1b.md "Use Zenroom in node.js") + - [Zenroom in the browser](/pages/zenroom-javascript2b.md "Use Zenroom in the browser") + - [Zenroom in React](/pages/zenroom-javascript3.md "Use Zenroom in React") + - [Zenroom in React Native](/pages/zenroom-react-native.md "Use Zenroom in React Native") + - [Zenroom ClojureScript](/pages/zenroom-clojurescript.md "Zenroom ClojureScript]") - Extensions - - [RESTroom-mw](/pages/restroom-mw) - - [Redroom](/ext/redroom) - - [Lotionroom](/ext/lotionroom) - - [Sawroom](/ext/sawroom) - - [Apiroom](/pages/apiroom) - + - [RESTroom-mw](/pages/restroom-mw) + - [Redroom](/ext/redroom) + - [Lotionroom](/ext/lotionroom) + - [Sawroom](/ext/sawroom) + - [Apiroom](/pages/apiroom) - Build & Test - - [Build instructions](/pages/how-to-build.md "Build Zenroom") - - [Zenroom on Cortex M](/pages/cortex.md "Zenroom on Cortex M") - - [Random quality](/pages/random.md "Random quality measurement") - - [Browser-encryption demo](/pages/encrypt.md "Browser-encryption demo") - - [Telegram bot](/pages/zenroomTelegramBotPython.md "Zenroom Telegram bot") - - + - [Build instructions](/pages/how-to-build.md "Build Zenroom") + - [Zenroom on Cortex M](/pages/cortex.md "Zenroom on Cortex M") + - [Random quality](/pages/random.md "Random quality measurement") + - [Browser-encryption demo](/pages/encrypt.md "Browser-encryption demo") + - [Telegram bot](/pages/zenroomTelegramBotPython.md "Zenroom Telegram bot") - Programming Lua - [Lua](/pages/lua.md "in Lua") - [Lua full reference](/pages/ldoc/o/README.md "in Lua") - Misc - - [Changelog](CHANGELOG) - - [Contributing](CONTRIBUTING) - - [To-do](TODO) - - [📄 Zenroom whitepaper](/pages/zenroom_whitepaper.pdf ':ignore') + - [Changelog](CHANGELOG) + - [Contributing](CONTRIBUTING) + - [📄 Zenroom whitepaper](/pages/zenroom_whitepaper.pdf ':ignore') diff --git a/docs/index.html b/docs/index.html index 813e84f24..d1ad6ea4d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -28,10 +28,10 @@ - @@ -75,12 +75,11 @@ // routerMode: 'history', ga: 'UA-1857256-5', alias: { - '.*?/CHANGELOG': 'https://raw.githubusercontent.com/DECODEproject/Zenroom/master/ChangeLog.md', - '.*?/CONTRIBUTING': 'https://raw.githubusercontent.com/DECODEproject/Zenroom/master/Agreement.md', - '.*?/TODO': 'https://raw.githubusercontent.com/dyne/restroom-mw/master/README.md', + '.*?/CHANGELOG': 'https://raw.githubusercontent.com/dyne/Zenroom/master/ChangeLog.md', + '.*?/CONTRIBUTING': 'https://raw.githubusercontent.com/dyne/Zenroom/master/Agreement.md', '.*?/lotionroom': 'https://raw.githubusercontent.com/dyne/lotionroom/master/README.md', - '.*?/redroom': 'https://raw.githubusercontent.com/DECODEproject/RedRoom/master/docs/website/docs/README.md', - '.*?/sawroom': 'https://raw.githubusercontent.com/DECODEproject/Sawroom/master/website/docs/README.md', + '.*?/redroom': 'https://raw.githubusercontent.com/dyne/RedRoom/master/docs/website/docs/README.md', + '.*?/sawroom': 'https://raw.githubusercontent.com/dyne/Sawroom/master/website/docs/README.md', '/modules/(.*)': '/_media/ldoc/o/modules/$1', "/.*/_sidebar.md": "/_sidebar.md", "/.*/_navbar.md": "/_navbar.md", diff --git a/docs/pages/how-to-build.md b/docs/pages/how-to-build.md index c2eebec6f..03a7f3fe4 100644 --- a/docs/pages/how-to-build.md +++ b/docs/pages/how-to-build.md @@ -28,13 +28,13 @@ Then first build the shared executable for your platform: #### ** Linux ** ```bash -make linux +make linux-exe ``` #### ** macOS ** ```bash -make osx +make osx-exe ``` #### ** Windows ** @@ -44,12 +44,7 @@ the LUA interpreter and all crypto functions, for client side operations on windows desktops. ```bash -make win -``` - -#### ** BSD ** -```bash -make bsd +make win-exe ``` @@ -62,21 +57,15 @@ To run tests: #### ** Functional ** ```bash +make check make check-osx -make check-linux ``` #### ** Integration ** ```bash make check-js -make check-py -``` - -#### **Crypto** -```bash -make check-crypto -make check-crypto-lw +make check-rp ``` @@ -94,9 +83,10 @@ As a prerequisite you need the `musl-gcc` binary installed on your machine. To build the static environment with musl installed system wide run: ```bash -make musl-system +make musl ``` + ## Javascript builds @@ -118,10 +109,9 @@ For the Javascript and WebAssembly modules the Zenroom provides various targets 1. Download the latest EMSDK from https://github.com/emscripten-core/emsdk/tags inside the root of Zenroom source folder, extract it, rename the resulting subfolder to `emsdk` 2. enter the folder and run `./emsdk install latest`, wait until the installation is complete, then run `./emsdk activate latest` 3. go back in the zenroom root and activate emsdk with `. emsdk/emsdk_env.sh` (please note the dot followed by space at beginning) -4. Launch `yarn --cwd bindings/javascript` to install nodejs dependencies 5. Make sure the Zenroom source is clean with `make clean` -5. Launch `yarn --cwd bindings/javascript build` to build Zenroom WASM -6. Launch `yarn --cwd bindings/javascript test` to run all javascript tests +5. Launch `make node-wasm` to install nodejs dependencies and build Zenroom WASM +6. Launch `make check-js` to run all javascript tests The resulting `zenroom.js` module will be found in `bindings/javascript/dist/` and should have zero dependencies from other NodeJS packages. @@ -135,7 +125,7 @@ You need to have install `Xcode` with the `commandline-tools` There are 3 different targets `ios-sim` `ios-armv7` `ios-arm64` these targets creates an static library with the correct architecture (x86_64, ARMV7, ARM64). -Finally once done all the libraries there is a final target `ios-fat` that put them together creating a fat-binary that you can include into your app. +Finally once done all the libraries there is a final target `ios-fat` that put them together creating a fat-binary that you can include into your app. Or you can just use the `build-ios.sh` that does all the steps for you! @@ -172,5 +162,3 @@ src/main/jniLibs/ └── x86 └── libzenroom.so ``` - - diff --git a/docs/pages/how-to-exec.md b/docs/pages/how-to-exec.md index b377fddac..6488adade 100644 --- a/docs/pages/how-to-exec.md +++ b/docs/pages/how-to-exec.md @@ -8,24 +8,29 @@ This section explains how to invoke the Zenroom to execute scripts from commandl From **command-line** the Zenroom is operated passing files as arguments: ```text -Usage: zenroom [-h] [ -d lvl ] [ -i ] [ -c config ] [ -k keys ] [ -a data ] [ -S seed ] [ -p ] [ -z ] [ script.zen | script.lua ] - +Usage: zenroom [-h] [-s] [ -D scenario ] [ -i ] [ -c config ] [ -k keys ] [ -a data ] [ -z | -v ] [ -l lib ] [ script.lua ] ``` -The **`-d`** flag activates more verbose output for debugging. - -The **`-z`** flag activates the **zenCode** interpreter (rather than Lua) - -The `script.zen` can be the path to a script or a single dash (`-`) to instruct zenroom to process the script piped from `stdin`. +where: +* **`-h`** show the help meessage +* **`-s`** activate seccomp execution +* **`-D`** followed by a scenario return all the statements under that scenario divided by the phase they are into +* **`-i`** activate the interactive mode +* **`-c`** followed by a string indicates the [configuration](zenroom-config.md) to use +* **`-k`** indicates the path to contract keys file +* **`-a`** indicates the path to contract data file +* **`-z`** activates the **zenCode** interpreter (rather than Lua) +* **`-v`** run only the given phase and reutrn if the input is valid for the given smart contract +* **`-l`** allows to load an external lua library before executing zencode. ## Interactive console Just executing `zenroom` will open an interactive console with limited functionalities, which is capable to parse finite instruction blocks on each line. To facilitate editing of lines is possible to prefix it with readline using the `rlwrap zenroom` command instead. -The content of the KEYS, DATA and SCRIPT files cannot exceed 500KB. +The content of the KEYS, DATA and SCRIPT files cannot exceed 2MiB. Try: ```sh -./zenroom-static [enter] +./zenroom [enter] print("Hello World!") [enter] [Ctrl-D] to quit ``` @@ -35,8 +40,10 @@ Will print Zenroom's execution details on `stderr` and the "Hello World!" string Zenroom also supports being used as an "hashbang" interpreter at the beginning of executable scripts. Just use: ```sh -#!/usr/bin/env zenroom-static - +#!/usr/bin/env zenroom ``` -in the header, please note the final dash which is pretty important to tell zenroom to process the script from `stdin`. - - +in the header to run lua commands with zenroom, or +```sh +#!/usr/bin/env -S zenroom -z +``` +to run zencode contracts (the `-S` lets you pass multiple arguments in the shebang line). diff --git a/docs/pages/zencode-cookbook-intro.md b/docs/pages/zencode-cookbook-intro.md index bebf33adc..7ad15cf48 100755 --- a/docs/pages/zencode-cookbook-intro.md +++ b/docs/pages/zencode-cookbook-intro.md @@ -1,9 +1,10 @@ # Quickstart: My first random array :id=quickstart -One of Zenroom's strong points is the quality of the random generation (see [random test 1](https://github.com/dyne/Zenroom/blob/master/test/random_hamming_gnuplot.sh) and [random test 2](https://github.com/dyne/Zenroom/blob/master/test/random_rngtest_fips140-2.sh)), which happens to pass NIST's [tests](https://github.com/dyne/Zenroom/blob/master/test/nist/run.sh), so let's start with generate an array of random numbers and get it printed out. +One of Zenroom's strong points is the quality of the random generation (see [random test 1](https://github.com/dyne/Zenroom/blob/master/test/random_hamming_gnuplot.sh) +and [random test 2](https://github.com/dyne/Zenroom/blob/master/test/random_rngtest_fips140-2.sh)). -Let's first go the super fast way to test code, entering the [Zenroom web playground](https://apiroom.net). Copy this code into the *Zencode* tab on the top left of the page: +Let's first go the super fast way to test code, entering the [Zenroom web playground](https://apiroom.net). Copy this code into the *Zencode* tab on the top left of the page: [](../_media/examples/zencode_cookbook/cookbook_intro/randomArrayGeneration.zen ':include :type=code gherkin') @@ -14,29 +15,29 @@ Then press the *PLAY▶️* button to execute the script, the result should look ![CreateArrayWebDemo](../_media/images/ApiroomQuickIntro.png) -We got a nice array here. You can play with the values *'16'* and *'32'*, to see both the array and the random numbers change their length. +We got a nice array here. You can play with the values *'16'* and *'32'*, to see both the array and the random numbers change their length. -# Use Zenroom by command line (CLI) +# Use Zenroom by command line (CLI) -Once you're done with your array, it's time to go pro, meaning that we're leaving the web demo and moving to using Zenroom as *command line application* (CLI). +Once you're done with your array, it's time to go pro, meaning that we're leaving the web demo and moving to using Zenroom as *command line application* (CLI). - - The first step is to download a version of Zenroom that works on your system from the [Zenroom downloads](https://zenroom.org/#downloads). + - The first step is to download a version of Zenroom that works on your system from the [Zenroom downloads](https://zenroom.org/#downloads). - If you're using Linux, you'll want to place Zenroom in `/bin` or `/usr/sbin` (or just create a symlink or an alias). - Third, fire up your favourite text editor, paste the smart contract in it and save it *arrayGenerator.zen* Now you can let zenroom execute the script by launching the command: ``` -zenroom -z arrayGenerator.zen +zenroom -z arrayGenerator.zen ``` -The result will look like this: +The result will look like this: ![CreateArrayRaspi](../_media/images/cookbookCreateArrayRaspi.png) -In the example Zenroom did graciously output first the licensing, then some information about the file and the execution setting, a warning, our array and finally a message stating the it correctly shutdown after using a certain amount of RAM...a lot of information: how do I get my array saved into a file that I can later use? +In the example Zenroom did graciously output first the licensing, then some information about the file and the execution setting, a warning, our array and finally a message stating the it correctly shutdown after using a certain amount of RAM...a lot of information: how do I get my array saved into a file that I can later use? -On Linux, you can use: +On Linux, you can use: ```bash zenroom -z arrayGenerator.zen | tee myFirstRandomArray.json @@ -46,9 +47,9 @@ After running this command, a file named *myFirstRandomArray.json* should have m # Renaming the array: the *And* keyword -Open *myArray.json* with your text editor, and notice that the array produced with our first script is named "array": that is Zenroom's behaviour when creating objects. But what if that array should be called something else? First you will need to learn two concepts: +Open *myArray.json* with your text editor, and notice that the array produced with our first script is named "array": that is Zenroom's behaviour when creating objects. But what if that array should be called something else? First you will need to learn two concepts: - All data manipulation has to occur in the *When* phase. - - Each phase can have as many commands as you like, provided that they're on a different line and they begin with the keyword *And* + - Each phase can have as many commands as you like, provided that they're on a different line and they begin with the keyword *And* For example, you can rename your array to *'myArray'* by running this script: [](../_media/examples/zencode_cookbook/cookbook_intro/randomArrayRename.zen ':include :type=code gherkin') @@ -58,13 +59,15 @@ Note that you need to use the **' '** in the line that renames the array, cause [](../_media/examples/zencode_cookbook/cookbook_intro/randomArrayMultiple.zen ':include :type=code gherkin') -The script above will produce an output like this: +The script above will produce an output like this: [](../_media/examples/zencode_cookbook/cookbook_intro/myArrays.json ':include :type=code json') -Certainly, at this point, your keen eye has noted something odd in the output...If in the Zencode I generated the arrays sorted by size, why is output sorted differently? Because in Zenroom, my friend, [Determinism](https://github.com/dyne/Zenroom/blob/master/test/deterministic_random_test.sh) is king, so Zenroom will by default sort the output alphabetically. +Certainly, at this point, your keen eye has noted something odd in the output...If in the Zencode I generated the arrays sorted by size, +why is output sorted differently? Because in Zenroom, my friend, [Determinism](https://github.com/dyne/Zenroom/blob/master/test/determinism/run.bats) +is king, so Zenroom will by default sort the output alphabetically. If you enjoyed the trip so far, go on and learn how to program Zencode starting by the [Given](/pages/zencode-cookbook-given) phase. diff --git a/docs/pages/zencode-list.md b/docs/pages/zencode-list.md index a0f0e9882..03e7c1abc 100755 --- a/docs/pages/zencode-list.md +++ b/docs/pages/zencode-list.md @@ -1,6 +1,6 @@ # Zencode command list -Start reading here to understand how Zencode smart contracts are written and the philosophy behind the technology. +Start reading here to understand how Zencode smart contracts are written and the philosophy behind the technology. # Smart contract setup @@ -16,37 +16,37 @@ So each Zencode smart contract will contain at least three lines, each begining ## Scenarios -Scenarios are set in the beginning of a script and they make Zenroom use a certain set of rules to interpretate the Zencode contained in the smart contract. Different scenarios will typically contain different keywords. The syntax to set a scenario is: +Scenarios are set in the beginning of a script and they make Zenroom use a certain set of rules to interpretate the Zencode contained in the smart contract. Different scenarios will typically contain different keywords. The syntax to set a scenario is: ```gherkin Scenario 'simple': Create the keypair ``` -The scenario setting happens before the ```:```, everything right of that isn't processed by Zenroom and can be used as a title to the smart contract. +The scenario setting happens before the ```:```, everything right of that isn't processed by Zenroom and can be used as a title to the smart contract. ## Rules -Rules are *optional*, they are used to define input and output formats of the smart contract, they have to be set after the scenario and before the rest of the smart contracts. Current rules: +Rules are *optional*, they are used to define input and output formats of the smart contract, they have to be set after the scenario and before the rest of the smart contracts. Current rules: ```txt rule input encoding [ url64 | base64 | hex | bin ] rule input format [ json ] ``` -For example, a valid config is: +For example, a valid config is: ```gherkin rule input encoding hex rule output encoding hex ``` -A rule can be set also check that Zenroom is at a certain version: if the rule is not satisfied, Zenroom will stop. +A rule can be set also check that Zenroom is at a certain version: if the rule is not satisfied, Zenroom will stop. ```gherkin rule check version 2.0.0 ``` -## Configurations +## Configurations You can pass to Zenroom a configuration file, using the parameter ```-c```, description will follow soon. @@ -113,6 +113,12 @@ Without extensions, all the following statementes are valid: - random functions [](../_media/zencode_utterances_reworked.yaml ':include :fragment=random :type=code gherkin') +- table functions + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=table :type=code gherkin') +- time functions + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=time :type=code gherkin') - verify functions [](../_media/zencode_utterances_reworked.yaml ':include :fragment=verify :type=code gherkin') @@ -120,6 +126,9 @@ Without extensions, all the following statementes are valid: ## Extensions Each of the following scenario enable a set of sentences: +- `bbs functions` + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=bbs :type=code gherkin') - `credential` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=credential :type=code gherkin') @@ -129,24 +138,45 @@ Each of the following scenario enable a set of sentences: - `ecdh` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=ecdh :type=code gherkin') +- `eddsa` + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=eddsa :type=code gherkin') +- `es256` + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=es256 :type=code gherkin') - `ethereum` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=ethereum :type=code gherkin') +- `fsp` + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=fsp :type=code gherkin') - `http` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=http :type=code gherkin') - `petition` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=petition :type=code gherkin') +- `planetmint` + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=planetmint :type=code gherkin') +- `pvss` + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=pvss :type=code gherkin') - `qp` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=qp :type=code gherkin') - `reflow` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=reflow :type=code gherkin') +- `rsa` + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=rsa :type=code gherkin') - `schnorr` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=schnorr :type=code gherkin') +- `sd_jwt` + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=sd_jwt :type=code gherkin') - `secshare` [](../_media/zencode_utterances_reworked.yaml ':include :fragment=secshare :type=code gherkin') @@ -154,7 +184,17 @@ Each of the following scenario enable a set of sentences: [](../_media/zencode_utterances_reworked.yaml ':include :fragment=w3c :type=code gherkin') +# *Foreach* + +The foreach statements can be used directly without adding any scenario. + +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=foreach :type=code gherkin') + +# *If* + +The subset of the *When* statements that can be used with the *If* to create a conditional branch are: +[](../_media/zencode_utterances_reworked.yaml ':include :fragment=if_subset :type=code gherkin') # *Then* diff --git a/src/cli-zenroom.c b/src/cli-zenroom.c index 00569307b..690d3dff3 100644 --- a/src/cli-zenroom.c +++ b/src/cli-zenroom.c @@ -1,21 +1,21 @@ /* * This file is part of zenroom - * + * * Copyright (C) 2017-2021 Dyne.org foundation * designed, written and maintained by Denis Roio - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License v3.0 - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * Along with this program you should have received a copy of the * GNU Affero General Public License v3.0 * If not, see http://www.gnu.org/licenses/agpl.txt - * + * * Last modified by Denis Roio * on Thursday, 2nd September 2021 */ @@ -341,7 +341,6 @@ int main(int argc, char **argv) { // time from here clock_gettime(CLOCK_MONOTONIC, &before); - // set_debug(verbosity); Z = zen_init( (conffile[0])?conffile:NULL, (keys[0])?keys:NULL, diff --git a/src/cortex_m.c b/src/cortex_m.c index ba4f7b076..e091ba734 100644 --- a/src/cortex_m.c +++ b/src/cortex_m.c @@ -239,7 +239,6 @@ int main(void) load_file(data, datafile); } - // set_debug(verbosity); Z = zen_init( (conffile[0]) ? conffile : NULL, (keys[0]) ? keys : NULL, diff --git a/src/lua/zencode_ethereum.lua b/src/lua/zencode_ethereum.lua index edf7ae7a7..bbe881333 100644 --- a/src/lua/zencode_ethereum.lua +++ b/src/lua/zencode_ethereum.lua @@ -481,7 +481,7 @@ IfWhen("verify ethereum address signature pair array '' of ''", function(add_sig ) end) -IfWhen("use ethereum address signature pair array '' to create result array of ''", function(add_sig, doc) +When("use ethereum address signature pair array '' to create result array of ''", function(add_sig, doc) empty 'result array' ACK.result_array = _verify_address_signature_array(add_sig, doc, function(address_signature_pair, hmsg) diff --git a/src/zen_config.c b/src/zen_config.c index 44181d0ec..20b42dbe4 100644 --- a/src/zen_config.c +++ b/src/zen_config.c @@ -67,8 +67,6 @@ #define STB_C_LEXER_DEFINITIONS #define STB_C_LEXER_IMPLEMENTATION -extern void set_debug(int lev); - #include #include diff --git a/src/zen_error.h b/src/zen_error.h index 00334cf65..eabdd6a63 100644 --- a/src/zen_error.h +++ b/src/zen_error.h @@ -1,21 +1,21 @@ /* * This file is part of zenroom - * + * * Copyright (C) 2017-2021 Dyne.org foundation * designed, written and maintained by Denis Roio - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License v3.0 - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * Along with this program you should have received a copy of the * GNU Affero General Public License v3.0 * If not, see http://www.gnu.org/licenses/agpl.txt - * + * * Last modified by Denis Roio * on Tuesday, 27th July 2021 */ @@ -76,10 +76,6 @@ void json_end(void *L); #define SAFE(x) if(!x) lerror(L, "NULL variable in %s",__func__) -void set_debug(int lev); -int get_debug(); -void set_color(int on); - // useful for debugging #if DEBUG == 1 #define HERE() _err( "-> %s()\n",__func__) diff --git a/test/random_rngtest_fips140-2.sh b/test/random_rngtest_fips140-2.sh index d1370bfbf..9541238e4 100755 --- a/test/random_rngtest_fips140-2.sh +++ b/test/random_rngtest_fips140-2.sh @@ -10,6 +10,6 @@ if ! [ $? = 0 ]; then fi # 1000 blocks of 20000 bits (2500 bytes) # 32 bits / 4 bytes rngtest header -cat <