Browse Source

📁 MV old-docs to prevent deploy. Fix symlinks. Static resources.

master
Puria Nafisi Azizi 1 year ago
parent
commit
0e2730f845
No known key found for this signature in database GPG Key ID: 57AA9EBCB1DA7141
100 changed files with 8205 additions and 1 deletions
  1. +0
    -0
      .docs.old/Coconut_credentials.dia
  2. +0
    -0
      .docs.old/DECODE_language_design_patterns.pdf
  3. +0
    -0
      .docs.old/Makefile
  4. +0
    -0
      .docs.old/README.txt
  5. +0
    -0
      .docs.old/Zencode_Whitepaper.odt
  6. +0
    -0
      .docs.old/Zencode_paper-Feb2020/Makefile
  7. +0
    -0
      .docs.old/Zencode_paper-Feb2020/Roio_Zencode.bib
  8. +0
    -0
      .docs.old/Zencode_paper-Feb2020/Roio_Zencode.pdf
  9. +0
    -0
      .docs.old/Zencode_paper-Feb2020/Roio_Zencode.tex
  10. +0
    -0
      .docs.old/Zencode_paper-Feb2020/aliascnt.sty
  11. +0
    -0
      .docs.old/Zencode_paper-Feb2020/remreset.sty
  12. +0
    -0
      .docs.old/Zencode_paper-Feb2020/svproc.cls
  13. +0
    -0
      .docs.old/article/config.zsh
  14. +0
    -0
      .docs.old/article/views/abstract.txt
  15. +0
    -0
      .docs.old/article/views/decode_language_patterns.md
  16. +0
    -0
      .docs.old/article/views/index.txt
  17. +0
    -0
      .docs.old/article/views/references.bib
  18. +0
    -0
      .docs.old/article/views/template.tex
  19. +0
    -0
      .docs.old/completions.lua
  20. +0
    -0
      .docs.old/config.zsh
  21. +0
    -0
      .docs.old/ec_logo.png
  22. +0
    -0
      .docs.old/ldoc/Makefile
  23. +0
    -0
      .docs.old/ldoc/config.ld
  24. +0
    -0
      .docs.old/ldoc/crypto.lua
  25. +0
    -0
      .docs.old/ldoc/css/ldoc.css
  26. +0
    -0
      .docs.old/ldoc/ldoc.ltp
  27. +0
    -0
      .docs.old/ldoc/math.lua
  28. +0
    -0
      .docs.old/ldoc/string.lua
  29. +0
    -0
      .docs.old/ldoc/table.lua
  30. +0
    -0
      .docs.old/logo/zenroom.sketch
  31. +0
    -0
      .docs.old/logo/zenroom.svg
  32. +0
    -0
      .docs.old/logo/zenroom_logotype.png
  33. +0
    -0
      .docs.old/logo/zenroom_white.svg
  34. +0
    -0
      .docs.old/parse_zencode.sh
  35. +0
    -0
      .docs.old/webnomad
  36. +0
    -0
      .docs.old/website/.gitignore
  37. +0
    -0
      .docs.old/website/docs/CNAME
  38. +0
    -0
      .docs.old/website/docs/README.md
  39. +0
    -0
      .docs.old/website/docs/crypto.md
  40. +0
    -0
      .docs.old/website/docs/css/custom.css
  41. +0
    -0
      .docs.old/website/docs/css/montserrat.css
  42. +0
    -0
      .docs.old/website/docs/demo/shell.js
  43. +0
    -0
      .docs.old/website/docs/demo/shell_minimal.html
  44. +0
    -0
      .docs.old/website/docs/encrypt.md
  45. +0
    -0
      .docs.old/website/docs/encrypt/code.md
  46. +0
    -0
      .docs.old/website/docs/js/cash.min.js
  47. +0
    -0
      .docs.old/website/docs/js/encrypt.js
  48. +0
    -0
      .docs.old/website/docs/random.md
  49. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/.deploy
  50. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/.github/README.md
  51. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/.init
  52. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/.preview
  53. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/.skel/docs/README.md
  54. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/.skel/docs/css/custom.css
  55. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/.skel/mkdocs.yml
  56. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/.update-theme
  57. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/assets/css/bulma-dyne.css
  58. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/assets/css/bulma.min.css
  59. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/assets/css/codehilite.css
  60. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/assets/css/materialdesignicons.min.css
  61. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/assets/fonts/materialdesignicons-webfont.woff
  62. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/assets/fonts/materialdesignicons-webfont.woff2
  63. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/assets/img/eu-flag.png
  64. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/assets/img/made_by_dyne.svg
  65. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/main.html
  66. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/mkdocs_theme.yml
  67. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/partials/drift.html
  68. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/partials/footer.html
  69. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/partials/ganalytics.html
  70. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/partials/navbar.html
  71. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/partials/sidebar-item.html
  72. +0
    -0
      .docs.old/website/mkdocs-dyne-theme/partials/sidebar.html
  73. +0
    -0
      .docs.old/website/mkdocs.yml
  74. +0
    -0
      .docs.old/website/petition.esh
  75. +0
    -0
      .docs.old/wiki
  76. +0
    -0
      .docs.old/zencode.yaml
  77. +0
    -0
      .docs.old/zencode_diagram.dia
  78. +0
    -0
      .docs.old/zencode_diagram.png
  79. +0
    -0
      .docs.old/zencode_utterances.yaml
  80. +1
    -1
      .gitmodules
  81. +8
    -0
      docs/Makefile
  82. +7890
    -0
      docs/_media/js/zenroom.data
  83. +1
    -0
      docs/_media/js/zenroom.js
  84. BIN
      docs/_media/js/zenroom.wasm
  85. +1
    -0
      docs/examples/crypt-to-multi.data
  86. +14
    -0
      docs/examples/crypt-to-multi.keys
  87. +36
    -0
      docs/examples/crypt-to-multi.lua
  88. +5
    -0
      docs/examples/dashboard-from-iotdev.data
  89. +3
    -0
      docs/examples/dashboard-from-iotdev.keys
  90. +17
    -0
      docs/examples/dashboard-from-iotdev.lua
  91. +15
    -0
      docs/examples/hello.lua
  92. +70
    -0
      docs/examples/implicit-certificate.lua
  93. +1
    -0
      docs/examples/iotdev-to-dashboard.data
  94. +6
    -0
      docs/examples/iotdev-to-dashboard.keys
  95. +41
    -0
      docs/examples/iotdev-to-dashboard.lua
  96. +36
    -0
      docs/examples/json-tables.data
  97. +19
    -0
      docs/examples/json-tables.lua
  98. +23
    -0
      docs/examples/keygen-multi.lua
  99. +12
    -0
      docs/examples/keygen.lua
  100. +6
    -0
      docs/examples/symmetric-crypto-pin.keys

docs.old/Coconut_credentials.dia → .docs.old/Coconut_credentials.dia View File


docs.old/DECODE_language_design_patterns.pdf → .docs.old/DECODE_language_design_patterns.pdf View File


docs.old/Makefile → .docs.old/Makefile View File


docs.old/README.txt → .docs.old/README.txt View File


docs.old/Zencode_Whitepaper.odt → .docs.old/Zencode_Whitepaper.odt View File


docs.old/Zencode_paper-Feb2020/Makefile → .docs.old/Zencode_paper-Feb2020/Makefile View File


docs.old/Zencode_paper-Feb2020/Roio_Zencode.bib → .docs.old/Zencode_paper-Feb2020/Roio_Zencode.bib View File


docs.old/Zencode_paper-Feb2020/Roio_Zencode.pdf → .docs.old/Zencode_paper-Feb2020/Roio_Zencode.pdf View File


docs.old/Zencode_paper-Feb2020/Roio_Zencode.tex → .docs.old/Zencode_paper-Feb2020/Roio_Zencode.tex View File


docs.old/Zencode_paper-Feb2020/aliascnt.sty → .docs.old/Zencode_paper-Feb2020/aliascnt.sty View File


docs.old/Zencode_paper-Feb2020/remreset.sty → .docs.old/Zencode_paper-Feb2020/remreset.sty View File


docs.old/Zencode_paper-Feb2020/svproc.cls → .docs.old/Zencode_paper-Feb2020/svproc.cls View File


docs.old/article/config.zsh → .docs.old/article/config.zsh View File


docs.old/article/views/abstract.txt → .docs.old/article/views/abstract.txt View File


docs.old/article/views/decode_language_patterns.md → .docs.old/article/views/decode_language_patterns.md View File


docs.old/article/views/index.txt → .docs.old/article/views/index.txt View File


docs.old/article/views/references.bib → .docs.old/article/views/references.bib View File


docs.old/article/views/template.tex → .docs.old/article/views/template.tex View File


docs.old/completions.lua → .docs.old/completions.lua View File


docs.old/config.zsh → .docs.old/config.zsh View File


docs.old/ec_logo.png → .docs.old/ec_logo.png View File


docs.old/ldoc/Makefile → .docs.old/ldoc/Makefile View File


docs.old/ldoc/config.ld → .docs.old/ldoc/config.ld View File


docs.old/ldoc/crypto.lua → .docs.old/ldoc/crypto.lua View File


docs.old/ldoc/css/ldoc.css → .docs.old/ldoc/css/ldoc.css View File


docs.old/ldoc/ldoc.ltp → .docs.old/ldoc/ldoc.ltp View File


docs.old/ldoc/math.lua → .docs.old/ldoc/math.lua View File


docs.old/ldoc/string.lua → .docs.old/ldoc/string.lua View File


docs.old/ldoc/table.lua → .docs.old/ldoc/table.lua View File


docs.old/logo/zenroom.sketch → .docs.old/logo/zenroom.sketch View File


docs.old/logo/zenroom.svg → .docs.old/logo/zenroom.svg View File


docs.old/logo/zenroom_logotype.png → .docs.old/logo/zenroom_logotype.png View File


docs.old/logo/zenroom_white.svg → .docs.old/logo/zenroom_white.svg View File


docs.old/parse_zencode.sh → .docs.old/parse_zencode.sh View File


docs.old/webnomad → .docs.old/webnomad View File


docs.old/website/.gitignore → .docs.old/website/.gitignore View File


docs.old/website/docs/CNAME → .docs.old/website/docs/CNAME View File


docs.old/website/docs/README.md → .docs.old/website/docs/README.md View File


docs.old/website/docs/crypto.md → .docs.old/website/docs/crypto.md View File


docs.old/website/docs/css/custom.css → .docs.old/website/docs/css/custom.css View File


docs.old/website/docs/css/montserrat.css → .docs.old/website/docs/css/montserrat.css View File


docs.old/website/docs/demo/shell.js → .docs.old/website/docs/demo/shell.js View File


docs.old/website/docs/demo/shell_minimal.html → .docs.old/website/docs/demo/shell_minimal.html View File


docs.old/website/docs/encrypt.md → .docs.old/website/docs/encrypt.md View File


docs.old/website/docs/encrypt/code.md → .docs.old/website/docs/encrypt/code.md View File


docs.old/website/docs/js/cash.min.js → .docs.old/website/docs/js/cash.min.js View File


docs.old/website/docs/js/encrypt.js → .docs.old/website/docs/js/encrypt.js View File


docs.old/website/docs/random.md → .docs.old/website/docs/random.md View File


docs.old/website/mkdocs-dyne-theme/.deploy → .docs.old/website/mkdocs-dyne-theme/.deploy View File


docs.old/website/mkdocs-dyne-theme/.github/README.md → .docs.old/website/mkdocs-dyne-theme/.github/README.md View File


docs.old/website/mkdocs-dyne-theme/.init → .docs.old/website/mkdocs-dyne-theme/.init View File


docs.old/website/mkdocs-dyne-theme/.preview → .docs.old/website/mkdocs-dyne-theme/.preview View File


docs.old/website/mkdocs-dyne-theme/.skel/docs/README.md → .docs.old/website/mkdocs-dyne-theme/.skel/docs/README.md View File


docs.old/website/mkdocs-dyne-theme/.skel/docs/css/custom.css → .docs.old/website/mkdocs-dyne-theme/.skel/docs/css/custom.css View File


docs.old/website/mkdocs-dyne-theme/.skel/mkdocs.yml → .docs.old/website/mkdocs-dyne-theme/.skel/mkdocs.yml View File


docs.old/website/mkdocs-dyne-theme/.update-theme → .docs.old/website/mkdocs-dyne-theme/.update-theme View File


docs.old/website/mkdocs-dyne-theme/assets/css/bulma-dyne.css → .docs.old/website/mkdocs-dyne-theme/assets/css/bulma-dyne.css View File


docs.old/website/mkdocs-dyne-theme/assets/css/bulma.min.css → .docs.old/website/mkdocs-dyne-theme/assets/css/bulma.min.css View File


docs.old/website/mkdocs-dyne-theme/assets/css/codehilite.css → .docs.old/website/mkdocs-dyne-theme/assets/css/codehilite.css View File


docs.old/website/mkdocs-dyne-theme/assets/css/materialdesignicons.min.css → .docs.old/website/mkdocs-dyne-theme/assets/css/materialdesignicons.min.css View File


docs.old/website/mkdocs-dyne-theme/assets/fonts/materialdesignicons-webfont.woff → .docs.old/website/mkdocs-dyne-theme/assets/fonts/materialdesignicons-webfont.woff View File


docs.old/website/mkdocs-dyne-theme/assets/fonts/materialdesignicons-webfont.woff2 → .docs.old/website/mkdocs-dyne-theme/assets/fonts/materialdesignicons-webfont.woff2 View File


docs.old/website/mkdocs-dyne-theme/assets/img/eu-flag.png → .docs.old/website/mkdocs-dyne-theme/assets/img/eu-flag.png View File


docs.old/website/mkdocs-dyne-theme/assets/img/made_by_dyne.svg → .docs.old/website/mkdocs-dyne-theme/assets/img/made_by_dyne.svg View File


docs.old/website/mkdocs-dyne-theme/main.html → .docs.old/website/mkdocs-dyne-theme/main.html View File


docs.old/website/mkdocs-dyne-theme/mkdocs_theme.yml → .docs.old/website/mkdocs-dyne-theme/mkdocs_theme.yml View File


docs.old/website/mkdocs-dyne-theme/partials/drift.html → .docs.old/website/mkdocs-dyne-theme/partials/drift.html View File


docs.old/website/mkdocs-dyne-theme/partials/footer.html → .docs.old/website/mkdocs-dyne-theme/partials/footer.html View File


docs.old/website/mkdocs-dyne-theme/partials/ganalytics.html → .docs.old/website/mkdocs-dyne-theme/partials/ganalytics.html View File


docs.old/website/mkdocs-dyne-theme/partials/navbar.html → .docs.old/website/mkdocs-dyne-theme/partials/navbar.html View File


docs.old/website/mkdocs-dyne-theme/partials/sidebar-item.html → .docs.old/website/mkdocs-dyne-theme/partials/sidebar-item.html View File


docs.old/website/mkdocs-dyne-theme/partials/sidebar.html → .docs.old/website/mkdocs-dyne-theme/partials/sidebar.html View File


docs.old/website/mkdocs.yml → .docs.old/website/mkdocs.yml View File


docs.old/website/petition.esh → .docs.old/website/petition.esh View File


docs.old/wiki → .docs.old/wiki View File


docs.old/zencode.yaml → .docs.old/zencode.yaml View File


docs.old/zencode_diagram.dia → .docs.old/zencode_diagram.dia View File


docs.old/zencode_diagram.png → .docs.old/zencode_diagram.png View File


docs.old/zencode_utterances.yaml → .docs.old/zencode_utterances.yaml View File


+ 1
- 1
.gitmodules View File

@@ -1,3 +1,3 @@
[submodule "docs/wiki"]
path = docs.old/wiki
path = .docs.old/wiki
url = https://github.com/DECODEproject/zenroom.wiki.git

+ 8
- 0
docs/Makefile View File

@@ -11,7 +11,11 @@ api:
website:
@if ! [ -r _media/js/zenroom.js -o -r _media/js/zenroom.wasm ]; then curl https://sdk.dyne.org:4443/view/zenroom/job/zenroom-web/lastSuccessfulBuild/artifact/build/web/zenroom.wasm https://sdk.dyne.org:4443/view/zenroom/job/zenroom-web/lastSuccessfulBuild/artifact/build/web/zenroom.js https://sdk.dyne.org:4443/view/zenroom/job/zenroom-web/lastSuccessfulBuild/artifact/build/web/zenroom.data -o _media/js/zenroom.wasm -o _media/js/zenroom.js -o _media/js/zenroom.data; fi
@ln -s _media/js/zenroom.data .
@mkdir -p _media/examples
@cp -v ../examples/*.keys ../examples/*.data ../examples/*.lua _media/examples/
@cp -av ../test/zencode_coconut ../test/zencode_simple _media/examples/
@cp -v ../bindings/javascript/README.md pages/javascript.md
@cp -v ../bindings/python3/README.md pages/python.md

map:
./_media/scripts/parse_zencode.sh _media/zencode_utterances.yaml
@@ -29,5 +33,9 @@ clean:
@rm -f _media/examples/*.lua
@rm -f _media/js/zenroom.*
@rm -f _media/zencode_utterances.yaml
@rm -f pages/javascript.md
@rm -f pages/python.md
@rm -rf _media/examples/zencode_simple
@rm -rf _media/examples/zencode_coconut
@rm -f zenroom.data
@echo "Zenroom docs cleaned up"

+ 7890
- 0
docs/_media/js/zenroom.data
File diff suppressed because it is too large
View File


+ 1
- 0
docs/_media/js/zenroom.js
File diff suppressed because it is too large
View File


BIN
docs/_media/js/zenroom.wasm View File


+ 1
- 0
docs/examples/crypt-to-multi.data View File

@@ -0,0 +1 @@
This is a secret message.

+ 14
- 0
docs/examples/crypt-to-multi.keys View File

@@ -0,0 +1,14 @@
{
"keyring" : {
"public" : "u64:BPx7noN1G4tbDBxE1CFxmOaFaIAY0tsh6nLjaKXo5XCm1cDmNyGk9uVav-ElwaqjlpGqjwXwaDnPELXm8PzD0UlXNFudDWc2Sz8xjJsdCQlvLfBc_p_WnvVO3NBNcA9Jr9bPK2_nFAtGs1GZ1Eig4TM",
"secret" : "u64:NQePSaOl3jd9YO4fCEAFm4mn_cn4Lnw4Qr4yZppNS-IVqSNp24hWEnyCyub4gldZ_Wt5AEmtRtU"
},
"recipients" : {
"mayo" : "u64:BGzS9Zk38I73Dzix-gNILRWn1HXJAs56Yw86P_jNjLu6ocUQp1aO_g5dUsRNuryK6Jx3SplBLHy1bmH3XVhcVn6X63_FBCaRsTRJlILCTk-0y0dq6y8AJB6MxVR77dzoGyLkZH5Q1MQilZM7w3ltc54",
"jim" : "u64:BKJy7FOdD9e1fcbhp-7-KmveqMQ0jKAjj4Uzt9vWXxeEsyK29s0j5W3rygazdaVx8XG3ly8oxhqhNLjCelYVKSZRlt7Yt-MO8dk82Gg0SkneBSseZsfg3kmPGwRgE2kT4vSVRTI5EhQQFowvTv4av6E",
"jaromil" : "u64:BNvABN9bln4VVi4Mk1n68m91pfMyTLK_CokhVVKM8jjLFeWHjt5lCjr16o5OHKFdLidf0c5QDS_xz30ZP54BiGSdCSv1Mg1KJ8jpv2PRnr0LGHqdEjxUo2S5Il6t49JRXdSdT_dT1G--ro8X9Yuha2Q",
"paulus" : "u64:BACm5xAfJzjwAYup3P4lcNLNAmsx8-hHUMPOqNJJUkE7mbmeCxP4TeScv047LlGKxKOwKBZUhSEOYpPxWWTqIRv9bHq-vlrEL-IG1mrJ33OneI9m4Gz84ie5QpHMh9RWQ5MCguo6J4SEUWY42UUOvEM",
"francesca" : "u64:BOxh59-_IuE2EJ0Ph4wSSUUCSQ84OzodsE2tOPgXSMS0uMu7KpKbFhoWvwl141Vrs0NslqqwBMmgcwaHS2IsMt96sOUr3MApn7bYNd4xUw7OzHOO9wrtY4-ws8rvpPzeQIxDAVnr7Z2eDhXQrUQXcbk",
"mark" : "u64:BKR0eWc0av_etfqgE1ZoYKTJQGHdI3Mvp_zInb7MSuJUSV4vEaKAMV4Uem21Azy7aaIO-lU5lbxcUqJfhzhKzKQDgRPwlNtqVRVzzl0EzXkt1xN1jjsicaVV1t8HWO3O_SKDGL-OEmf9QRQg78FBLbQ"
}
}

+ 36
- 0
docs/examples/crypt-to-multi.lua View File

@@ -0,0 +1,36 @@
-- encrypt a secret to multiple recipients

-- run with arguments:
-- -a crypto-to-multi.data -k crypt-to-multi.keys

-- inside KEYS is a list of names and public keys encoded with b58; it
-- returns a list of recipients and encrypted secrets for each and the
-- sender's public key

secret = str(DATA)

keys = JSON.decode(KEYS)

-- this is our own secret key, combined with the recipient's public
-- key to obtain a session key
local private = url64(keys.keyring.secret)
res = {}

-- loop through all recipients
for name,pubkey in pairs(keys.recipients) do
-- calculate the session key

session = ECDH.session(private, url64(pubkey))
iv = O.random(32)

out = { header = "encoded using zenroom " .. VERSION.original}
-- encrypt the message with the session key
out.text, out.checksum =
ECDH.aead_encrypt(KDF(session), secret, iv, out.header)

-- insert results in final json array
res[name] = url64( JSON.encode(out) )
end

-- return the json array
print(JSON.encode(res))

+ 5
- 0
docs/examples/dashboard-from-iotdev.data View File

@@ -0,0 +1,5 @@
{
"checksum" : "u64:3wPJiE4ZzZEHprA4Lsr-TQ",
"text" : "u64:7xKuOiQ5oZxz0KtS1Yku-XKdsAQc-YPq0EW1FJhjLCzyGruMwC4PUuenUpG1U4AxFTaB06UpoXIBwCMm80XXgu4",
"header" : "u64:eyJpdiI6InU2NDpPOFBMYzBfdTRsdmpFQkQwMlZsN2I0Mng1Y3FwUWlJdUcwQ1Nfd2lsQmFRIiwiZGV2aWNlX3B1YmtleSI6InU2NDpCTkRLRm5OVThzM05fWFoySmlVazlIOVg5VU1MRm5sMUp1TDl1SEs0SmdrVTFPQUFMMko4ZFZLR3RWaXFFY3Nfd0wwQ0JpdHhXVG80ZUIyMlJNWTAxN29udE9vVlF4TVNyZllhVmhZT2FJV0NaZTYwZXM4SjhSb1JJT285ZHFqTWY0d0F2VG9mMzRzbFZLek85VURLOEc4IiwiY29tbXVuaXR5X2lkIjoic21hcnRjaXRpemVucyJ9"
}

+ 3
- 0
docs/examples/dashboard-from-iotdev.keys View File

@@ -0,0 +1,3 @@
{
"community_seckey": "u64:Cf88o0bEY3igf3mbnKTT7s7_huXDPvlATz7J1T7atZo"
}

+ 17
- 0
docs/examples/dashboard-from-iotdev.lua View File

@@ -0,0 +1,17 @@
-- a dashboard receives an ID and payload packet from an IoT device

-- read and validate data
keys = I.spy( JSON.decode(KEYS) )
data = I.spy( JSON.decode(DATA) )

decode = { header = JSON.decode(url64(data.header)) }

commsec = url64(keys.community_seckey)
devpub = url64(decode.header.device_pubkey)
session = ECDH.session(commsec, devpub)
decode.text, decode.checksum =
ECDH.aead_decrypt(KDF(session), url64(data.text), url64(decode.header.iv), data.header)

assert(decode.checksum == url64(data.checksum))
print(JSON.encode(decode))


+ 15
- 0
docs/examples/hello.lua View File

@@ -0,0 +1,15 @@
hello = str("Hello World!")
print(hello:string())
print("in hex: " .. hello:hex())
print("in base64: " .. hello:base64())

hello = hex("48656c6c6f20576f726c6421")
print("re-assign from hex, length "..#hello)
print("as string: " .. hello:string())
print("in base64: " .. hello:base64())

hello = base64("b64:SGVsbG8gV29ybGQh")
print("re-assign from base64, length "..#hello)
print("as string: " .. hello:string())
print("in hex: " .. hello:hex())


+ 70
- 0
docs/examples/implicit-certificate.lua View File

@@ -0,0 +1,70 @@
-- ECQV (Qu-Vanstone Implicit Certificate Scheme)
-- Zenroom implementation by Jaromil
-- based on "Standards for Efficient Cryptogrpahy"
-- specification SEC 4 v1.0 retrieved from www.secg.org

-- setup
ECP = require_once'zenroom_ecp'
G = ECP.generator()

-- typical EC key generation on G1
-- take a random big integer modulo curve order
-- and multiply it by the curve generator

function keygen()
local key = INT.random()
return { private = key,
public = key * G }
end

-- generate the certification request
certreq = keygen()
-- certreq.private is preserved in a safe place
-- certreq.public is sent to the CA along with a declaration
declaration = { requester = "Alice",
statement = "I am stuck in Wonderland" }
print("Declaration:")
I.print(declaration)
-- Requester sends to CA -->

-- ... once upon a time ...

-- --> CA receives from Requester
-- keypair for CA (known to everyone as the Mad Hatter)
CA = keygen()

-- from here the CA has received the request
certkey = keygen()
-- certkey.private is sent to requester
-- certkey.public is broadcasted

-- public key reconstruction data
certpub = certreq.public + certkey.public
-- the certification is serialized (could use ASN-1 or X509)
certification = { public = certpub,
requester = declaration.requester,
statement = declaration.statement,
certifier = str("Mad Hatter") }
CERT = sha256(OCTET.serialize(certification))
CERThash = INT.new(CERT)
-- private key reconstruction data
certpriv = (CERThash * certkey.private + CA.private)
-- CA sends to Requester certpriv and CERThash
-- eventually CA broadcasts certpub and CERThash

-- ... on the other side of the mirror ...

-- Alice has received from the CA the certpriv and CERT
-- which can be used to create a new CERTprivate key
CERTprivate = (CERThash * certreq.private + certpriv) % ECP.order()

-- Anyone may receive the certpub and CERThash and, knowing the CA
-- public key, can recover the same CERTpublic key from them
CERTpublic = certpub * CERThash + CA.public

-- As a proof here we generate the public key in a standard way,
-- multiplying it by the curve generator point, then check equality
assert(CERTpublic == G * CERTprivate)
print "Certification by Mad Hatter:"
I.print({ private = CERTprivate:octet():hex(),
public = CERTpublic:octet():hex() })

+ 1
- 0
docs/examples/iotdev-to-dashboard.data View File

@@ -0,0 +1 @@
Some, sort, of, sensor, data

+ 6
- 0
docs/examples/iotdev-to-dashboard.keys View File

@@ -0,0 +1,6 @@
{
"device_id": "anonymous",
"community_id": "smartcitizens",
"community_pubkey": "u64:BCfdjzF7npsNdTNlvUA62TOlwdTHi8e_28gPGsUcVHYYaiRIaOcl8_51IAwB7xaSlPvNZBLK5THb9S6jkmt7z9oHcwUcrB7xvuwj7YKIWZDOB-1r8pzH7YCaTQmSWkxrr_FfboSq1rfHx_7ZeHgjS-I"
}


+ 41
- 0
docs/examples/iotdev-to-dashboard.lua View File

@@ -0,0 +1,41 @@
-- one iot device encrypts its data and ID to a community dashboard
-- defines data validation shcemas that can be used on both ends
-- complementary to other script for reception

-- import and validate keys
keys = JSON.decode(KEYS)

-- generate a new device keypair every time
-- this could be optimised by creating keys onetime at first run
-- or temporarily, i.e: every day or every hour
devkey = ECDH.keygen()

-- compute the session key using private/public keys
-- it may change to use random, but then we need a session channel

-- payload is a nested json structure to be encrypted
payload = {}
payload.device_id = keys.device_id
payload.data = DATA

-- The device's public key, the 'community_id' and the encryption
-- curve type are transmitted in clear inside the header, which is
-- authenticated (AEAD)
header = {}
header.device_pubkey = devkey.public:url64()
header.community_id = keys.community_id
header.iv = O.random(32):url64()

-- content( header ) -- uncomment for debug

-- The output is a table with crypto contents which is standard for
-- zenroom's functions encrypt/decrypt: .checksum .header .iv .text
local session = ECDH.session(devkey.private, url64(keys.community_pubkey))
local out = { header = url64(JSON.encode(header)) }
out.text, out.checksum =
ECDH.aead_encrypt(KDF(session), JSON.encode(payload), header.iv, out.header)

-- content(output) -- uncomment for debug
print( JSON.encode( out ) ) -- map(output, url64) ) )



+ 36
- 0
docs/examples/json-tables.data View File

@@ -0,0 +1,36 @@
{
"squadName": "Super hero squad",
"homeTown": "Metro City",
"formed": 2016,
"secretBase": "Super tower",
"active": true,
"Molecule Man": {
"age": 29,
"secretIdentity": "Dan Jukes",
"powers": [
"Radiation resistance",
"Turning tiny",
"Radiation blast"
]
},
"Madame Uppercut": {
"age": 39,
"secretIdentity": "Jane Wilson",
"powers": [
"Million tonne punch",
"Damage resistance",
"Superhuman reflexes"
]
},
"Eternal Flame": {
"age": 1000000,
"secretIdentity": "Unknown",
"powers": [
"Immortality",
"Heat Immunity",
"Inferno",
"Teleportation",
"Interdimensional travel"
]
}
}

+ 19
- 0
docs/examples/json-tables.lua View File

@@ -0,0 +1,19 @@
-- Example demonstrating how to manipulate complex data structures
-- (called tables) and convert them back and forth to JSON strings

-- using the "inspection module" to print contents of complex data
-- structures: inside.print() instead of print()

-- this converts the JSON string to a table on which various
-- operations can be done (see @tables and @functions modules)
superheroes = JSON.decode(DATA)

-- iterate through the members array and print
-- out only names. ipairs is very unelegand
print "import from JSON"
I.print(superheroes)

print "flatten tree"
superflat = flatten(superheroes)
I.print(superflat)


+ 23
- 0
docs/examples/keygen-multi.lua View File

@@ -0,0 +1,23 @@
-- generate a private keyring and other fictional public keys

-- run with: zenroom keygen.zen

-- any combination of public and private keys generated this way and
-- exchanged among different people will lead to the same secret which
-- is then usable for asymmetric encryption.

recipients={'jaromil','francesca','jim','mark','paulus','mayo'}
keys={}
for i,name in ipairs(recipients) do
kk = ECDH.keygen()
keys[name] = kk.public:url64()
end


keyring = ECDH.keygen()

keypairs = JSON.encode({
keyring={public=keyring.public:url64(),
secret=keyring.private:url64()},
recipients=keys})
print(keypairs)

+ 12
- 0
docs/examples/keygen.lua View File

@@ -0,0 +1,12 @@
-- generate a simple keyring
keyring = ECDH.new()
keyring:keygen()

-- export the keypair to json
export = JSON.encode(
{
public = keyring: public():url64(),
private = keyring:private():url64()
}
)
print(export)

+ 6
- 0
docs/examples/symmetric-crypto-pin.keys View File

@@ -0,0 +1,6 @@
{
"pin": "1234",
"text": "my private declaration or certificate of sorts",
"salt": "c6e49670a3c65d7f19ee7d39a25478900f8e98ec1e9a82131e23e7b07d17c0c9",
"iterations": 10000
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save