Skip to content

Commit

Permalink
chore(merge dev) - merge dev into staging (#146)
Browse files Browse the repository at this point in the history
* fix: set cli as a es module

* fix: bump 0.3.0; minor missing imports for enums

* feat (EC2-demo) testing VMs

* feat(ec2) - continuing with poc

* fix(sybil) - add tests

* fix(sybil) - added prod test switch

* build: update external packages dependencies

* feat(public ceremonies) - allow to download ceremony data to everyone

* refactor: move auto-generated types to root

* refactor: improve package configuration; remove unused files

* refactor: complete configuration; lint and small fix

* fix: wrong prod Firebase project for CI

* refactor: update phase2cli package config; fixed bin overwrite when installing

* refactor: use meta import to optimize repository file read

* refactor: use ts-node instead of dist to execute phase2cli

* refactor: update .env and package.json imports

* fix: wrong path for environment config file

* fix(public-data) remove cloud function

* fix(public-data) remove function from index.ts

* fix(public data)  yarn.locl

* fix: missing skipLibCheck option was causing docs script to exit

* fix: add missing options to ts config

* chore(release): publish 0.3.0

* build: update yarn version

* fix: spinner does not stop correctly after contribution verification

* chore(release): publish 0.3.1

* fix: missing updates for current contributor fields when coordinating

* fix: duplicate messages when waiting for contribution; remove wrong listener

* chore(release): publish 0.3.5

* fix(sybil checks): amended env var name and added to the backend

* fix(s3): creating public bucket with object ACL enabled

configuring S3 to allow download of verification transcript

* fix(tests): fixed tests

* fix: unconsistency when resuming a contribution

* fix: add missing alternative case; fix wrong tests

* chore(release): publish 0.4.0

* fix: wrong ci env project

* fix: missing sort for ceremony circuits

* fix: wrong document property lead to error when checking github antisybil

* build: missing dependencies on actions package

* chore(release): publish 0.4.1

* chore(release): publish 0.4.2

* test: update github anti-sybil tests

* fix(ux): added more verbose messages to inform the user of waiting times and errors

* feat(ec2): added tests and ip function

* feat(ec2): merge udpates and add tests

* feat(vms): added ssm code and more tests + changes on backend

* feat(vms): refactoring

* fix: imports and package version

* feat(vms): added tests

* fix(vms): tests

* feat(ec2): fixed bug in running commands at deployment and refactored setup

* test(ec2): added setup e2e test

* fix(vms): refactoring and code fixes

* fix(vm): bug fix

* fix(vm): missing files

* feat(vms): implemented e2e test for contribution verification

* feat(vms): tests and refactoring

* fix(vms): remove redundant code

* test(vms): completed e2e tests with VMs

* fix(vms): cleanup test

* fix(vms): remove redundant parameter on VM startup - ssh keypair

* fix(vms): add tags on EC2 creation

* refactor: add missing hash computation; minor conflicts and changes

* fix(vms): fix VM commands

* test(vms): fix test to also delete the verification transcript

* chore: publish 0.4.7

* test(vms): refactoring of VM tests with extra debug options

* test(vms): fixed finalize test and cloud function. Adding extra debugging for verification

* fix(vms): fixed wrong path in blake3 bin command and various fixes on the verification CF

* chore: publish 0.4.8

* fix(vms): removed stdin/stdout redirection in VM command and added regex match for blake3 hash

* fix(vms): fixed cloud function for VM verification

* chore: publish 0.4.9

* fix(vms): fix cloud function bug related to the wrong verification transcript path

* test(vms): fix broken tests due to VM upgrade

* fix(vms): disable eslint rule for regex

* feat(vms): implement SNS topic command to trigger Lambda that stops the VM after initialization

* feat(vms): add marker file in userData to avoid running initialization code more than once

* fix(vms): fix userData commands

* refactor: add VM prices

* refactor: add selector for VM disk type

* test: update tests

* refactor: complete and remove old todos

* refactor: add retry mechanism for VM

* fix: wrong path to Verifier smart contract template

* feat(vms): implement terraform script to deploy AWS inf

* fix(vms): fix import error

* fix: correct failing tests

* fix(vms): fix cloud function multipartupload wrong parameter name

* chore: publish 0.4.10

* fix(vms): fix terraform and lambda config

* fix(vms): temp revert of retry feature in verifyContribution

* fix(vms): fix emulator tests

* fix(vms): fix prod tests

* refactor: improve verifycontribution function code; minor changes to code readability

* fix(vms): fix prod test - wrong parameter order in ec2 tests

* chore: publish 0.5.0

* fix: missing else statement for verifycontribution function; wrong return on custom promise

* fix(vms): revert part of the verifyContribution refactoring and update terraform

* fix(vms): retry mechanism for VM startup

* refactor: add options for contribute command

* refactor: make coordinator artifacts publicly downloadable by default

* chore: update backend firebase default prod project

* fix(tests): add extra sleep when setting custom claims to allow propagation

* fix(tests): skip a test that would fail due to environment not clean

* fix(tests): fix issues with user not being recognized as coordinator

* fix(tests): add extra sleep and coordinator checks within tests

* refactor: avoid mandatory memory check; add missing loader and messages to improve ux

* feat(setup): start to implement non interactive setup

* feat(setup): implement non interactive setup

* fix(setup): change test file

* fix(setup): remove non working test

* fix(setup): change setup test file

* fix(setup): amend after PR review

* feat(setup): add option to pass the authentication token as cli param

passing the cli token as param one could easily use p0tion non interactive setup in a CI/CD env like
GitHub actions.

* fix(tests): add extra coordinator user to resolve random test failure

* fix(tests): add extra sleep after user creation

* fix(auth): fix non interactive auth and force token refresh for coordinator

* fix(setup): fix local path to circuit artifacts + change error in security tests

* fix(setup): add missing circuit artifacts local path

allow circuit artifacts to be in a separate folder for setup so that it can be used with
definitelySetup

* fix(tests): fix tests

* refactor: improve ux ui of auth and logout commands

* feat(setup): add a cli command to validate the ceremony setup file and the constraints

* refactor: add spinners to avoid delays; add custom feedback messages for contributor

* chore: correct text

* feat(list ceremonies): add a command to list all ceremonies

* feat(list): exit with code 1 when calling showError with exit=true

* fix(tests and setup): fix tests and cleanup config file

* chore: publish 1.0.0

* fix(verifycontribution): fix issue with failing to deconstruct undefined object (vm)

* Revise workflow

* Fix a typo

* V1.1.1

* V1.1

* fix: set cli as a es module

* fix: bump 0.3.0; minor missing imports for enums

* feat (EC2-demo) testing VMs

* feat(ec2) - continuing with poc

* fix(sybil) - add tests

* fix(sybil) - added prod test switch

* build: update external packages dependencies

* feat(public ceremonies) - allow to download ceremony data to everyone

* refactor: move auto-generated types to root

* refactor: improve package configuration; remove unused files

* refactor: complete configuration; lint and small fix

* fix: wrong prod Firebase project for CI

* refactor: update phase2cli package config; fixed bin overwrite when installing

* refactor: use meta import to optimize repository file read

* refactor: use ts-node instead of dist to execute phase2cli

* refactor: update .env and package.json imports

* fix: wrong path for environment config file

* fix(public-data) remove cloud function

* fix(public-data) remove function from index.ts

* fix(public data)  yarn.locl

* fix: missing skipLibCheck option was causing docs script to exit

* fix: add missing options to ts config

* chore(release): publish 0.3.0

* build: update yarn version

* fix: spinner does not stop correctly after contribution verification

* chore(release): publish 0.3.1

* fix: missing updates for current contributor fields when coordinating

* fix: duplicate messages when waiting for contribution; remove wrong listener

* chore(release): publish 0.3.5

* fix(sybil checks): amended env var name and added to the backend

* fix(s3): creating public bucket with object ACL enabled

configuring S3 to allow download of verification transcript

* fix(tests): fixed tests

* fix: unconsistency when resuming a contribution

* fix: add missing alternative case; fix wrong tests

* chore(release): publish 0.4.0

* fix: wrong ci env project

* fix: missing sort for ceremony circuits

* fix: wrong document property lead to error when checking github antisybil

* build: missing dependencies on actions package

* chore(release): publish 0.4.1

* chore(release): publish 0.4.2

* test: update github anti-sybil tests

* fix(ux): added more verbose messages to inform the user of waiting times and errors

* feat(ec2): added tests and ip function

* feat(ec2): merge udpates and add tests

* feat(vms): added ssm code and more tests + changes on backend

* feat(vms): refactoring

* fix: imports and package version

* feat(vms): added tests

* fix(vms): tests

* feat(ec2): fixed bug in running commands at deployment and refactored setup

* test(ec2): added setup e2e test

* fix(vms): refactoring and code fixes

* fix(vm): bug fix

* fix(vm): missing files

* feat(vms): implemented e2e test for contribution verification

* feat(vms): tests and refactoring

* fix(vms): remove redundant code

* test(vms): completed e2e tests with VMs

* fix(vms): cleanup test

* fix(vms): remove redundant parameter on VM startup - ssh keypair

* fix(vms): add tags on EC2 creation

* refactor: add missing hash computation; minor conflicts and changes

* fix(vms): fix VM commands

* test(vms): fix test to also delete the verification transcript

* chore: publish 0.4.7

* test(vms): refactoring of VM tests with extra debug options

* test(vms): fixed finalize test and cloud function. Adding extra debugging for verification

* fix(vms): fixed wrong path in blake3 bin command and various fixes on the verification CF

* chore: publish 0.4.8

* fix(vms): removed stdin/stdout redirection in VM command and added regex match for blake3 hash

* fix(vms): fixed cloud function for VM verification

* chore: publish 0.4.9

* fix(vms): fix cloud function bug related to the wrong verification transcript path

* test(vms): fix broken tests due to VM upgrade

* fix(vms): disable eslint rule for regex

* feat(vms): implement SNS topic command to trigger Lambda that stops the VM after initialization

* feat(vms): add marker file in userData to avoid running initialization code more than once

* fix(vms): fix userData commands

* refactor: add VM prices

* refactor: add selector for VM disk type

* test: update tests

* refactor: complete and remove old todos

* refactor: add retry mechanism for VM

* fix: wrong path to Verifier smart contract template

* feat(vms): implement terraform script to deploy AWS inf

* fix(vms): fix import error

* fix: correct failing tests

* fix(vms): fix cloud function multipartupload wrong parameter name

* chore: publish 0.4.10

* fix(vms): fix terraform and lambda config

* fix(vms): temp revert of retry feature in verifyContribution

* fix(vms): fix emulator tests

* fix(vms): fix prod tests

* refactor: improve verifycontribution function code; minor changes to code readability

* fix(vms): fix prod test - wrong parameter order in ec2 tests

* chore: publish 0.5.0

* fix: missing else statement for verifycontribution function; wrong return on custom promise

* fix(vms): revert part of the verifyContribution refactoring and update terraform

* fix(vms): retry mechanism for VM startup

* refactor: add options for contribute command

* refactor: make coordinator artifacts publicly downloadable by default

* chore: update backend firebase default prod project

* fix(tests): add extra sleep when setting custom claims to allow propagation

* fix(tests): skip a test that would fail due to environment not clean

* fix(tests): fix issues with user not being recognized as coordinator

* fix(tests): add extra sleep and coordinator checks within tests

* refactor: avoid mandatory memory check; add missing loader and messages to improve ux

* feat(setup): start to implement non interactive setup

* feat(setup): implement non interactive setup

* fix(setup): change test file

* fix(setup): remove non working test

* fix(setup): change setup test file

* fix(setup): amend after PR review

* feat(setup): add option to pass the authentication token as cli param

passing the cli token as param one could easily use p0tion non interactive setup in a CI/CD env like
GitHub actions.

* fix(tests): add extra coordinator user to resolve random test failure

* fix(tests): add extra sleep after user creation

* fix(auth): fix non interactive auth and force token refresh for coordinator

* fix(setup): fix local path to circuit artifacts + change error in security tests

* fix(setup): add missing circuit artifacts local path

allow circuit artifacts to be in a separate folder for setup so that it can be used with
definitelySetup

* fix(tests): fix tests

* refactor: improve ux ui of auth and logout commands

* feat(setup): add a cli command to validate the ceremony setup file and the constraints

* refactor: add spinners to avoid delays; add custom feedback messages for contributor

* chore: correct text

* feat(list ceremonies): add a command to list all ceremonies

* feat(list): exit with code 1 when calling showError with exit=true

* fix(tests and setup): fix tests and cleanup config file

* chore: publish 1.0.0

* fix(verifycontribution): fix issue with failing to deconstruct undefined object (vm)

* Revise workflow

* Fix a typo

---------

Co-authored-by: ctrlc03 <[email protected]>
Co-authored-by: cedoor <[email protected]>
Co-authored-by: Jeeiii <[email protected]>
Co-authored-by: Daehyun Paik <[email protected]>

* Separate deployment and testing

---------

Co-authored-by: daodesigner <[email protected]>
Co-authored-by: ctrlc03 <[email protected]>
Co-authored-by: cedoor <[email protected]>
Co-authored-by: Jeeiii <[email protected]>

* Separate deploy and test (#99)

* feat(setup): non interactive setup with artifacts download

* feat(setup): add cloud function for file transfer and unit tests

* feat(setup): add transfer of object inside phase2cli

* feat(setup): remove return value and amend tests

* fix(setup): revert transfer of object and add region to config

* feat(setup) fix test template

* fix(setup): fix not waiting for file download

* fix(setup): remove redundant function

* chore(release): publish 1.0.1

* fix(vms): specify region in sns command

* fix(vms) - missing param

* fix(vms): missing doc

* fix(vms): fix default region

* chore(release): publish 1.0.2

* fix(setup): fix vm command due to differences in AMI config between regions

* chore(release): publish 1.0.4

* fix (ceremony) - fix various bugs (#116)

* fix(setup): add spinners

* fix(bugs): fix backend and cli bugs

* fix(regions): move cloud functions to same region as firestore and s3

* fix(tests): add new region on test utils

* Ensure all CFs are deployed into `europe-west1` region

* fix(verification): set concurrency to 1 and ensure that files are downloaded

* chore(release): publish 1.0.5 (#120)

* fix(verify): revert removing concurrency and add unique filenames (#122)

* ci: add npm publish pipeline

* fix(ceremony): fix various bugs

* fix(verification): revert download check

* chore: add missing dependency declaration

* fix(publish): fix npm publish error

* docs(docs): add AWS instructions on backend README

* docs(readme): add system requirements on phase2cli

* fix(ui): change bold text

* fix: fix log level to INFO when user failed to pass GitHub reputation check

* fix(auth): fix issue with GitHub name being null

* feat(auth): optimize gihub queries and save avatar

* fix(auth): fix docs and format

* chore(publish): publish 1.0.6

---------

Co-authored-by: cedoor <[email protected]>
Co-authored-by: Jeeiii <[email protected]>
Co-authored-by: Daehyun Paik <[email protected]>
Co-authored-by: daodesigner <[email protected]>
Co-authored-by: daodesigner <[email protected]>
  • Loading branch information
6 people authored Aug 14, 2023
1 parent 60fd2e3 commit c67a673
Show file tree
Hide file tree
Showing 13 changed files with 349 additions and 65 deletions.
106 changes: 106 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages/*"
],
"npmClient": "yarn",
"version": "1.0.5",
"version": "1.0.6",
"changelogPreset": {
"name": "conventionalcommits",
"issuePrefixes": [
Expand Down
77 changes: 77 additions & 0 deletions packages/actions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,83 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [1.0.6](https://github.com/privacy-scaling-explorations/p0tion/compare/v0.3.0...v1.0.6) (2023-08-14)


### Features

* **auth:** optimize gihub queries and save avatar ([09c5982](https://github.com/privacy-scaling-explorations/p0tion/commit/09c59828fb7ed2f926b98a87442307e95bd2fe81))
* **ec2:** added tests and ip function ([2658c1a](https://github.com/privacy-scaling-explorations/p0tion/commit/2658c1a049c8fa79dde93617d6a7190c53e6ad9f))
* **ec2:** fixed bug in running commands at deployment and refactored setup ([f7e8de7](https://github.com/privacy-scaling-explorations/p0tion/commit/f7e8de702faa62565e197073db6096cf6734955a))
* **ec2:** merge udpates and add tests ([5e8a76f](https://github.com/privacy-scaling-explorations/p0tion/commit/5e8a76fe68154998b72ab12b478a057c91da8bf4))
* **setup:** add a cli command to validate the ceremony setup file and the constraints ([66f8837](https://github.com/privacy-scaling-explorations/p0tion/commit/66f88378d79ec789a025f296e5abd565f5d1e8db))
* **setup:** add cloud function for file transfer and unit tests ([f7b059d](https://github.com/privacy-scaling-explorations/p0tion/commit/f7b059db9bca336c981980a93a2d422d643d183f))
* **setup:** implement non interactive setup ([c3638d4](https://github.com/privacy-scaling-explorations/p0tion/commit/c3638d4ab963d03038e76178af48f32148034b4d))
* **setup:** non interactive setup with artifacts download ([d032f37](https://github.com/privacy-scaling-explorations/p0tion/commit/d032f37a609448ec1741cd822967737c4d37515b))
* **setup:** remove return value and amend tests ([c407bee](https://github.com/privacy-scaling-explorations/p0tion/commit/c407bee2225758ce10f99842a1f63f41d28f62db))
* **setup:** start to implement non interactive setup ([e72c2f8](https://github.com/privacy-scaling-explorations/p0tion/commit/e72c2f87e09c73eb002f060a688a741af0833b20))
* **vms:** add marker file in userData to avoid running initialization code more than once ([dfda857](https://github.com/privacy-scaling-explorations/p0tion/commit/dfda857093133de8113d8aeb3963555b59e90cc8))
* **vms:** added ssm code and more tests + changes on backend ([f9a251a](https://github.com/privacy-scaling-explorations/p0tion/commit/f9a251a9cc9812e28956a003a17ea2046fcdf10b))
* **vms:** added tests ([89b621b](https://github.com/privacy-scaling-explorations/p0tion/commit/89b621ba08ffe09cde3afa98b444fddf7a065f7a))
* **vms:** implement SNS topic command to trigger Lambda that stops the VM after initialization ([f5f73bb](https://github.com/privacy-scaling-explorations/p0tion/commit/f5f73bb546aeefa8da263dacbef7e84eb2bb97e6))
* **vms:** implemented e2e test for contribution verification ([684123a](https://github.com/privacy-scaling-explorations/p0tion/commit/684123af219d7ad4b38d8f1378952f657982e845))
* **vms:** refactoring ([08486b2](https://github.com/privacy-scaling-explorations/p0tion/commit/08486b2fc1e3b871f1bf2a341a1bc394063ddf06))
* **vms:** tests and refactoring ([3a19f95](https://github.com/privacy-scaling-explorations/p0tion/commit/3a19f952f2206de7d5a04f511dc7a947e47e50ad))


### Bug Fixes

* add missing alternative case; fix wrong tests ([5044da6](https://github.com/privacy-scaling-explorations/p0tion/commit/5044da612bb576837077c65bc3ee579dff1c492e))
* **auth:** fix docs and format ([ab01a39](https://github.com/privacy-scaling-explorations/p0tion/commit/ab01a39e9544c4464af4f938f761dd5484d5e756))
* **auth:** fix non interactive auth and force token refresh for coordinator ([0f4dfea](https://github.com/privacy-scaling-explorations/p0tion/commit/0f4dfea3b3961aa5b8024400431ede78d9f3a0b1))
* correct failing tests ([f55e832](https://github.com/privacy-scaling-explorations/p0tion/commit/f55e832391ebf0d42340dfb8ce3727977016ecc2))
* imports and package version ([8b8b84f](https://github.com/privacy-scaling-explorations/p0tion/commit/8b8b84fa836a2a33f549c3a4dfd26adc4a3c79c5))
* **setup:** add missing circuit artifacts local path ([15b8743](https://github.com/privacy-scaling-explorations/p0tion/commit/15b87439e147d7210cd54d72ea8bcc3bd496010c))
* **setup:** amend after PR review ([8c104ef](https://github.com/privacy-scaling-explorations/p0tion/commit/8c104ef7e8a9bfeca4d18e3ce8ff22ab9be6a4f4))
* **setup:** change setup test file ([cf8e698](https://github.com/privacy-scaling-explorations/p0tion/commit/cf8e6982bc584533d1e5042aa8a78d9df433469e))
* **setup:** change test file ([46260eb](https://github.com/privacy-scaling-explorations/p0tion/commit/46260eb1b0af45d99b5946a7232423552c50be7f))
* **setup:** fix local path to circuit artifacts + change error in security tests ([865a06f](https://github.com/privacy-scaling-explorations/p0tion/commit/865a06f8f369f941282be26183079932b3bdfb1b))
* **setup:** fix not waiting for file download ([a233767](https://github.com/privacy-scaling-explorations/p0tion/commit/a2337675d12bd4c154def8716451fe50ee320e47))
* **setup:** fix vm command due to differences in AMI config between regions ([1d6a748](https://github.com/privacy-scaling-explorations/p0tion/commit/1d6a748a9acdd67632e2637a3f1fcd9a61e95303))
* **setup:** remove non working test ([2e21885](https://github.com/privacy-scaling-explorations/p0tion/commit/2e218854c6989b9a2642f184a43e3d40c2978a59))
* **setup:** remove redundant function ([8467f62](https://github.com/privacy-scaling-explorations/p0tion/commit/8467f62ec3d08e86d074919379ef6130f82e69f9))
* **setup:** revert transfer of object and add region to config ([690da25](https://github.com/privacy-scaling-explorations/p0tion/commit/690da25addc9005ec3a5ce21a22fb7044293f772))
* spinner does not stop correctly after contribution verification ([345bdcb](https://github.com/privacy-scaling-explorations/p0tion/commit/345bdcb8a09915aba29b37ac988b7109a67490e0))
* **sybil checks:** amended env var name and added to the backend ([c28e2f0](https://github.com/privacy-scaling-explorations/p0tion/commit/c28e2f0579cc86f716731d793fccfb31e14d11c7))
* **tests and setup:** fix tests and cleanup config file ([152b4da](https://github.com/privacy-scaling-explorations/p0tion/commit/152b4da3c85266faa55b5a409f33b6a06f2d5624))
* **tests:** add extra coordinator user to resolve random test failure ([6745c45](https://github.com/privacy-scaling-explorations/p0tion/commit/6745c45158ae13c6f4e0c8e7d1b397f1eb3f7061))
* **tests:** add extra sleep after user creation ([b637b9e](https://github.com/privacy-scaling-explorations/p0tion/commit/b637b9e96c569af191cd15802df7d3ebbaeda07f))
* **tests:** add extra sleep and coordinator checks within tests ([3e31cd2](https://github.com/privacy-scaling-explorations/p0tion/commit/3e31cd25c956aeb4de60708ec4b1d03baa6de225))
* **tests:** add extra sleep when setting custom claims to allow propagation ([19ba15d](https://github.com/privacy-scaling-explorations/p0tion/commit/19ba15dc9f2db1ab72a61864852062c0d532eb16))
* **tests:** fix issues with user not being recognized as coordinator ([14a6ecd](https://github.com/privacy-scaling-explorations/p0tion/commit/14a6ecd2ec9e065071c58a84548b243fff808ace))
* **tests:** fix tests ([905b6c0](https://github.com/privacy-scaling-explorations/p0tion/commit/905b6c0fb660fb457456c7d1376557fcbd277508))
* **tests:** fixed tests ([d4a6dc8](https://github.com/privacy-scaling-explorations/p0tion/commit/d4a6dc838771b2f0f76d7eca1698bf84918d9053))
* **tests:** skip a test that would fail due to environment not clean ([9346a6f](https://github.com/privacy-scaling-explorations/p0tion/commit/9346a6f1bd95181bfc95cb842c9f951af1f9ca17))
* **verification:** set concurrency to 1 and ensure that files are downloaded ([45b8fc5](https://github.com/privacy-scaling-explorations/p0tion/commit/45b8fc50f82784f2c5ba877c57d1bc064d449113))
* **vm:** bug fix ([f4ae99d](https://github.com/privacy-scaling-explorations/p0tion/commit/f4ae99d586f625ac073ce079f100a25e21b77d25))
* **vms:** add tags on EC2 creation ([0347289](https://github.com/privacy-scaling-explorations/p0tion/commit/0347289f414800d2c7ce45ba1bafe4e36e32788b))
* **vms:** cleanup test ([c0a2922](https://github.com/privacy-scaling-explorations/p0tion/commit/c0a29220cce5a75b2e8ee1f6a7d3f713d5fbe2ec))
* **vms:** fix cloud function bug related to the wrong verification transcript path ([db35a5f](https://github.com/privacy-scaling-explorations/p0tion/commit/db35a5f0010be7b84217ba5fd146a7adf245e5dc))
* **vms:** fix cloud function multipartupload wrong parameter name ([b98e088](https://github.com/privacy-scaling-explorations/p0tion/commit/b98e08864736f22cf8199a953dec46912b8f55f0))
* **vms:** fix emulator tests ([98af9d0](https://github.com/privacy-scaling-explorations/p0tion/commit/98af9d021ca72c173e1da491da1bfd859862c8e6))
* **vms:** fix import error ([7e7f9f6](https://github.com/privacy-scaling-explorations/p0tion/commit/7e7f9f697f004ee2506601ce350293cd9b3eec77))
* **vms:** fix prod test - wrong parameter order in ec2 tests ([86beca7](https://github.com/privacy-scaling-explorations/p0tion/commit/86beca72c6b7b77bea90214a42442918b8a3e10b))
* **vms:** fix prod tests ([f8b4397](https://github.com/privacy-scaling-explorations/p0tion/commit/f8b439755c1665539ded525890d8e5972b2c8d84))
* **vms:** fix userData commands ([cd65566](https://github.com/privacy-scaling-explorations/p0tion/commit/cd65566d4298d64f7bebff4ec0579df9bfa174fa))
* **vms:** fix VM commands ([a39fd5f](https://github.com/privacy-scaling-explorations/p0tion/commit/a39fd5fa9543af412eae7f7e505660547c29b4b3))
* **vms:** fixed cloud function for VM verification ([3ca22a5](https://github.com/privacy-scaling-explorations/p0tion/commit/3ca22a53253f500caa0227b529aed0d145433295))
* **vms:** fixed wrong path in blake3 bin command and various fixes on the verification CF ([9aec4e7](https://github.com/privacy-scaling-explorations/p0tion/commit/9aec4e7188653acb4bdce5f17f5a161918ee768d))
* **vms:** missing doc ([8c6d7e0](https://github.com/privacy-scaling-explorations/p0tion/commit/8c6d7e0e33f3d6f347e10cd717aeeca2ee75213b))
* **vms:** refactoring and code fixes ([0ebe401](https://github.com/privacy-scaling-explorations/p0tion/commit/0ebe401894befb4dddab414392bcb29e656ba456))
* **vms:** remove redundant code ([80ce491](https://github.com/privacy-scaling-explorations/p0tion/commit/80ce491cf77d49c2f5899c05f8720634743aa437))
* **vms:** remove redundant parameter on VM startup - ssh keypair ([8f3dc42](https://github.com/privacy-scaling-explorations/p0tion/commit/8f3dc42f6ddad9c755ae6e2370b6a783f6aae306))
* **vms:** removed stdin/stdout redirection in VM command and added regex match for blake3 hash ([0bf3034](https://github.com/privacy-scaling-explorations/p0tion/commit/0bf30346fe60850df76e3125866bdaeda86cc502))
* **vms:** specify region in sns command ([1cc1485](https://github.com/privacy-scaling-explorations/p0tion/commit/1cc148533d1fedabaec0220c4dd55f16f9131ff4))
* **vms:** tests ([dfbf3a7](https://github.com/privacy-scaling-explorations/p0tion/commit/dfbf3a7422e773d87d5d1e94ddc1a85aa99c6220))
* wrong document property lead to error when checking github antisybil ([fbe22ea](https://github.com/privacy-scaling-explorations/p0tion/commit/fbe22ea6d84becee1dcb8b1beb594de5c11a25ae))




## [1.0.5](https://github.com/privacy-scaling-explorations/p0tion/compare/v1.0.4...v1.0.5) (2023-07-24)

Expand Down
2 changes: 1 addition & 1 deletion packages/actions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@p0tion/actions",
"version": "1.0.5",
"version": "1.0.6",
"description": "A set of actions and helpers for CLI commands",
"repository": "[email protected]:privacy-scaling-explorations/p0tion.git",
"homepage": "https://github.com/privacy-scaling-explorations/p0tion",
Expand Down
6 changes: 6 additions & 0 deletions packages/actions/src/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,12 @@ export const commonTerms = {
verificationStartedAt: "verificationStartedAt"
}
},
avatars: {
name: "avatars",
fields: {
avatarUrl: "avatarUrl"
}
},
ceremonies: {
name: "ceremonies",
fields: {
Expand Down
78 changes: 29 additions & 49 deletions packages/actions/src/helpers/security.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,31 @@
import fetch from "@adobe/node-fetch-retry"

/**
* This function will return the number of public repos of a user
* @param user <string> The username of the user
* @returns <number> The number of public repos
*/
const getNumberOfPublicReposGitHub = async (user: string): Promise<number> => {
const response = await fetch(`https://api.github.com/user/${user}/repos`, {
method: "GET",
headers: {
Authorization: `token ${process.env.GITHUB_ACCESS_TOKEN!}`
}
})
if (response.status !== 200)
throw new Error("It was not possible to retrieve the number of public repositories. Please try again.")
const jsonData: any = await response.json()
return jsonData.length
}
/**
* This function will return the number of followers of a user
* @param user <string> The username of the user
* @returns <number> The number of followers
*/
const getNumberOfFollowersGitHub = async (user: string): Promise<number> => {
const response = await fetch(`https://api.github.com/user/${user}/followers`, {
method: "GET",
headers: {
Authorization: `token ${process.env.GITHUB_ACCESS_TOKEN!}`
}
})
if (response.status !== 200)
throw new Error("It was not possible to retrieve the number of followers. Please try again.")
const jsonData: any = await response.json()
return jsonData.length
}
/**
* This function will return the number of following of a user
* @param user <string> The username of the user
* @returns <number> The number of following users
* This function queries the GitHub API to fetch users statistics
* @param user {string} the user uid
* @returns {any} the stats from the GitHub API
*/
const getNumberOfFollowingGitHub = async (user: string): Promise<number> => {
const response = await fetch(`https://api.github.com/user/${user}/following`, {
const getGitHubStats = async (user: string): Promise<any> => {
const response = await fetch(`https://api.github.com/user/${user}`, {
method: "GET",
headers: {
Authorization: `token ${process.env.GITHUB_ACCESS_TOKEN!}`
}
})

if (response.status !== 200)
throw new Error("It was not possible to retrieve the number of following. Please try again.")
throw new Error("It was not possible to retrieve the user's statistic. Please try again.")

const jsonData: any = await response.json()

return jsonData.length
const data = {
following: jsonData.following,
followers: jsonData.followers,
publicRepos: jsonData.public_repos,
avatarUrl: jsonData.avatar_url
}

return data
}

/**
Expand All @@ -60,27 +34,33 @@ const getNumberOfFollowingGitHub = async (user: string): Promise<number> => {
* @param minimumAmountOfFollowing <number> The minimum amount of following the user should have
* @param minimumAmountOfFollowers <number> The minimum amount of followers the user should have
* @param minimumAmountOfPublicRepos <number> The minimum amount of public repos the user should have
* @returns <boolean> True if the user is reputable enough, false otherwise
* @returns <any> Return the avatar URL of the user if the user is reputable, false otherwise
*/
export const githubReputation = async (
userLogin: string,
minimumAmountOfFollowing: number,
minimumAmountOfFollowers: number,
minimumAmountOfPublicRepos: number
): Promise<boolean> => {
): Promise<any> => {
if (!process.env.GITHUB_ACCESS_TOKEN)
throw new Error(
"The GitHub access token is missing. Please insert a valid token to be used for anti-sybil checks on user registation, and then try again."
)
const following = await getNumberOfFollowingGitHub(userLogin)
const repos = await getNumberOfPublicReposGitHub(userLogin)
const followers = await getNumberOfFollowersGitHub(userLogin)

const { following, followers, publicRepos, avatarUrl } = await getGitHubStats(userLogin)

if (
following < minimumAmountOfFollowing ||
repos < minimumAmountOfPublicRepos ||
publicRepos < minimumAmountOfPublicRepos ||
followers < minimumAmountOfFollowers
)
return false
return true
return {
reputable: false,
avatarUrl: ""
}

return {
reputable: true,
avatarUrl: avatarUrl
}
}
Loading

0 comments on commit c67a673

Please sign in to comment.