Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilise Eddsa & Public Keys - Part 4 #794

Merged
merged 60 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
9354954
Update public key param in bpiSubject model
biscuitdey Apr 1, 2024
9273b60
Handle Eddsa public keys in BpiSubject
biscuitdey Apr 1, 2024
35a2aa8
Update authAgent to handle publicKeys
biscuitdey Apr 1, 2024
e9c459e
Update message tests to handle public keys
biscuitdey Apr 1, 2024
d26e7e5
Use publicKeys in messaging
biscuitdey Apr 1, 2024
18ec1c2
Use publicKeys in subjectAccounts test
biscuitdey Apr 1, 2024
0e3c61b
Use publicKeys in bpiAccounts tests
biscuitdey Apr 1, 2024
2f203d9
Use publicKeys in transaction tests
biscuitdey Apr 1, 2024
54c29ba
Use publicKeys in workgroup test
biscuitdey Apr 1, 2024
3668f47
Use publicKeys in shared test builder data
biscuitdey Apr 1, 2024
d096689
Bug fix
biscuitdey Apr 1, 2024
a1569ba
Handle Eddsa signature in circuit
biscuitdey Apr 1, 2024
a770b95
Add comments on Ecdsa and Eddsa
biscuitdey Apr 12, 2024
9d781f9
Add publicKeyDto to BpiSubject
biscuitdey Apr 12, 2024
b3edae7
Add publicKeyDto to response bpiSubjectDto
biscuitdey Apr 12, 2024
b2080cc
Add publicKeyDto to commandHandler
biscuitdey Apr 12, 2024
9f3a896
Build fix
biscuitdey Apr 12, 2024
3d42679
Add valid Eddsa public key to seed.ts
biscuitdey Apr 15, 2024
47c2c14
Revert mapper changes
biscuitdey Apr 15, 2024
9897c83
Remove unnecessary code from updateBpiSubject
biscuitdey Apr 15, 2024
5965541
Revert unnecessary changes to updateBpiSubject
biscuitdey Apr 15, 2024
89eb98d
Change let to const in circuitInputParser
biscuitdey Apr 15, 2024
e964f80
Update publicKeys in bpiSubjectStorageAgent
biscuitdey Apr 15, 2024
7e1623d
Add MerkleTree agent, storageAgent, service as provider
biscuitdey Apr 15, 2024
3a52e5c
Bug fix updateBpiSubject test
biscuitdey Apr 15, 2024
7b845c4
Update transaction.spec.ts tests to accept publicKeys
biscuitdey Apr 15, 2024
e7b9532
Change updateMany to upsert in BpiSubjectStorage agent
biscuitdey Apr 15, 2024
ed13e53
Bug fix in updateBpiSubject
biscuitdey Apr 15, 2024
1bffe23
Update bpiSubject publicKeys
biscuitdey Apr 15, 2024
aac947f
Merge branch 'feature/759-public-key-test-pass-1' into feature/759-pu…
biscuitdey Apr 17, 2024
e5d1c86
Merge branch 'feature/759-public-key-test-pass-2' into feature/759-pu…
biscuitdey Apr 17, 2024
c28e179
Remove unnecessary imports
biscuitdey Apr 17, 2024
d6a786c
Change create to createMany
biscuitdey Apr 17, 2024
ae2a8ee
Merge branch 'feature/759-public-key-test-pass-3' into feature/759-pu…
biscuitdey Apr 17, 2024
9b31966
Include roles when returning BpiSubject
biscuitdey Apr 17, 2024
21c09ae
Add did service
biscuitdey Apr 25, 2024
a0b91c2
Update did public and private keys
biscuitdey Apr 25, 2024
7b3cbc3
Change publicKey to publicKeys in e2e test
biscuitdey Apr 26, 2024
967ddb7
Update messageController to mock resolve createBpiMessage
biscuitdey Apr 30, 2024
572421e
Bug fix
biscuitdey Apr 30, 2024
4907714
Remove unnecessary publicKey param
biscuitdey Apr 30, 2024
4b6d49f
Return publicKeys when returning bpiSubject
biscuitdey Apr 30, 2024
2c8560f
Correct signature format
biscuitdey May 2, 2024
6b0de54
Correct circuit file paths
biscuitdey May 2, 2024
0066bd7
Workstep1 circuit files
biscuitdey May 2, 2024
5764abd
Throw error for invalid circuit inputs
biscuitdey May 3, 2024
a6b157c
Update error message
biscuitdey May 3, 2024
4605b9c
Fix assert in messaging agent unit test
ognjenkurtic Jun 13, 2024
3980f01
Computed witness for example workstep 1
ognjenkurtic Jun 13, 2024
8a245e1
Update github workflow with new env values for e2e tests
ognjenkurtic Jun 13, 2024
e469b88
Skip snarkjs service spec file as it tries to compute a witness whic…
ognjenkurtic Jun 13, 2024
7fefeec
Revert "Fix assert in messaging agent unit test"
ognjenkurtic Jun 13, 2024
79ac21f
Fix witness calculator path in transaction agent
ognjenkurtic Jun 13, 2024
5f4adaf
Fix path to witness calc in transactions agent; Update README
ognjenkurtic Jun 13, 2024
1a5e748
Increase e2e test timeout because of GH actions execution
ognjenkurtic Jun 13, 2024
81d7df6
Refactor env variables for dids to avoid duplication
ognjenkurtic Jun 19, 2024
e99ab31
Update env sample, readme and did-auth.md
ognjenkurtic Jun 19, 2024
e88cd03
Update github workflow with new env setup for did resolution
ognjenkurtic Jun 19, 2024
3c5ef4e
Fix formatting
ognjenkurtic Jun 19, 2024
6b8e047
Increase timeout in the end to end test to support slower exection in…
ognjenkurtic Jun 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .github/workflows/bri-3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ jobs:
- 4222:4222
env:
DATABASE_URL: "postgresql://postgres:example@localhost:5432/postgres"
GOERLI_RPC_URL: "https://rpc.goerli.eth.gateway.fm"
GOERLI_SERVICE_DID: "did:ethr:0x5:0xB73A16e32FE027838f9aDEf72A192AFFf45a0A9D"
GOERLI_SERVICE_SIGNER_PRIVATE_KEY: "0x0fbdb56ab0fecb2f406fa807d9e6558baedacc1c15c0e2703b77d4c08441e4fe"
DID_REGISTRY: "0x03d5003bf0e79c5f5223588f347eba39afbc3818"
DID_BPI_OPERATOR_PUBLIC_KEY: "0x08872e27BC5d78F1FC4590803369492868A1FCCb"
DID_BPI_OPERATOR_PRIVATE_KEY: "2c95d82bcd8851bd3a813c50afafb025228bf8d237e8fd37ba4adba3a7596d58"
DID_NETWORK: "sepolia"
INFURA_PROVIDER_API_KEY: "c5f37cd25eca4007a9768f18f492bc6f"
SERVICE_URL: "bri-3"
BPI_NATS_SERVER_URL: "localhost:4222"
BPI_NATS_SERVER_USER: "bpi_operator"
BPI_NATS_SERVER_PASS: "liftboiliftboiliftboiliftboi1"
BPI_ENCRYPTION_KEY_K_PARAM: "yzkXp3vY_AZQ3YfLv9GMRTYkjUOpn9x18gPkoFvoUxQ"
BPI_ENCRYPTION_KEY_KTY_PARAM: "oct"
SNARKJS_CIRCUITS_PATH: "zeroKnowledgeArtifacts/circuits/"
VSM_CYCLE_PERIOD_IN_SECS: 15
VSM_CYCLE_TX_BATCH_SIZE: 5
SNARKJS_CIRCUITS_PATH: "zeroKnowledgeArtifacts/circuits/"
CCSM_NETWORK: "goerli"
MERKLE_TREE_HASH_ALGH: "sha256"

steps:
Expand Down
37 changes: 19 additions & 18 deletions examples/bri-3/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,25 @@
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings

# Explanation of the params can be found in the Readme file.

DATABASE_URL="postgresql://postgres:example@localhost:5432/postgres"
GOERLI_RPC_URL=""
GOERLI_SERVICE_DID="did:ethr:0x5:<bpi_operator_public_key>"
GOERLI_SERVICE_SIGNER_PRIVATE_KEY="<bpi_operator_private_key>"
SERVICE_URL="bri-3"
BPI_NATS_SERVER_URL="localhost:4222"
DATABASE_URL="postgresql://postgres:example@localhost:5432/postgres" # DB connection string
DID_REGISTRY="0x03d5003bf0e79c5f5223588f347eba39afbc3818" # Sepolia did registry https://sepolia.etherscan.io/address/0x03d5003bf0e79c5f5223588f347eba39afbc3818#code
DID_BPI_OPERATOR_PUBLIC_KEY="<bpi_operator_public_key>" # bpi_operator_public_key = public key of the bpi operator that represents the issuer of the JWT token
DID_BPI_OPERATOR_PRIVATE_KEY="<bpi_operator_private_key>" # bpi_operator_private_key = private key of the bpi operator that is used to sign the issued JWT token
DID_NETWORK="sepolia" # network used to resolve dids
INFURA_PROVIDER_API_KEY="<infura_api_key>" # API key of the infura account used to connect to the network
SERVICE_URL="bri-3" # JWT token audience
BPI_NATS_SERVER_URL="localhost:4222" # URL of the local NATS server instance used by the BPI
BPI_NATS_SERVER_USER="bpi_operator"
BPI_NATS_SERVER_PASS="liftboiliftboiliftboiliftboi1"
BPI_ENCRYPTION_KEY_K_PARAM="yzkXp3vY_AZQ3YfLv9GMRTYkjUOpn9x18gPkoFvoUxQ"
BPI_ENCRYPTION_KEY_K_PARAM="yzkXp3vY_AZQ3YfLv9GMRTYkjUOpn9x18gPkoFvoUxQ" # Encryption key params used by the BPI for Bpi Messages encryption at rest
BPI_ENCRYPTION_KEY_KTY_PARAM="oct"
SNARKJS_CIRCUITS_PATH="zeroKnowledgeArtifacts/circuits/"
VSM_CYCLE_PERIOD_IN_SECS=15
VSM_CYCLE_TX_BATCH_SIZE=5
CCSM_NETWORK="<hardhat | goerli | ganache>"
ALCHEMY_GOERLI_PRIVATE_KEY="<alchemy_goerli_testnet_private_key>"
ALCHEMY_URL="https://eth-goerli.g.alchemy.com/v2/<alchemy_api>"
GANACHE_URL="<ganache_rpc_server_url>"
GANACHE_ACCOUNT_PRIVATE_KEY="<ganache_account_private_key>"
MERKLE_TREE_HASH_ALGH="sha256"
SNARKJS_CIRCUITS_PATH="zeroKnowledgeArtifacts/circuits/" # used to construct the path to the circuit artifacts for a specific workstep by following this convention:
# SNARKJS_CIRCUITS_PATH + <workstep_name_in_snake_case>/<workstep_name_in_snake_case> + suffix for the artifact. Artifact suffixes:
# Circuit proving key = 'final.zkey'
# Circuit verification key = '_verification_key.json'
# Compiled circuit = '_js/<workstep_name_in_snake_case>.wasm'
# Witness calculator = '_js/witness_calculator.js'
# Witness file = '_js/witness.txt'
VSM_CYCLE_PERIOD_IN_SECS=15 # How many seconds before each VSM cycle
VSM_CYCLE_TX_BATCH_SIZE=5 # How many transactions to execute in the single VSM cycle
MERKLE_TREE_HASH_ALGH="sha256" # Hash algorithm used in creation of Merkle Tree
3 changes: 0 additions & 3 deletions examples/bri-3/.gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# compiled output
/dist
/node_modules
/zeroKnowledgeArtifacts/ptau
/zeroKnowledgeArtifacts/circuits
src/bri/zeroKnowledgeProof/services/circuit/snarkjs/*.sol
/zeroKnowledgeArtifacts/blockchain/ethereum/artifacts
/typechain-types
/cache
/zeroKnowledgeArtifacts/circuits

# Logs
logs
Expand Down
25 changes: 3 additions & 22 deletions examples/bri-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ $ npm run prisma:generate # generate the prisma client
$ npm run prisma:migrate:dev # migrate the db to latest state
$ npx prisma db seed # seed db

$ npx prisma migrate reset # reset the db to initial state, remove all data and apply seed

```

## Messaging
Expand All @@ -45,28 +47,7 @@ Relevant information can be found in ./docs/nats/nats-configuration.md

## Environment configuration

Can be found in ./env.sample. Explanation:

```bash
DATABASE_URL="postgresql://postgres:example@localhost:5432/postgres" # DB connection string
GOERLI_RPC_URL="" # Any GOERLI RPC url i.e. "https://rpc.ankr.com/eth_goerli". This is used to resolve dids
GOERLI_SERVICE_DID="did:ethr:0x5:<bpi_operator_public_key>" # bpi_operator_public_key = public key of the bpi operator that represents the issuer of the JWT token
GOERLI_SERVICE_SIGNER_PRIVATE_KEY="<bpi_operator_private_key>" # bpi_operator_private_key = private key of the bpi operator that is used to sign the issued JWT token
SERVICE_URL="bri-3" # JWT token audience
BPI_NATS_SERVER_URL="localhost:4222" # URL of the local NATS server instance used by the BPI
BPI_NATS_SERVER_USER="bpi_operator"
BPI_NATS_SERVER_PASS="liftboiliftboiliftboiliftboi1"
BPI_ENCRYPTION_KEY_K_PARAM="yzkXp3vY_AZQ3YfLv9GMRTYkjUOpn9x18gPkoFvoUxQ" # Encryption key params used by the BPI for Bpi Messages encryption at rest
BPI_ENCRYPTION_KEY_KTY_PARAM="oct"
SNARKJS_CIRCUITS_PATH="zeroKnowledgeArtifacts/circuits/" # used to construct the path to the circuit artifacts for a specific workstep by following this convention:
# SNARKJS_CIRCUITS_PATH + <workstep_name_in_snake_case>/<workstep_name_in_snake_case> + suffix for the artifact. Artifact suffixes:
# Circuit proving key = '_circuit_final.zkey'
# Circuit verification key = '_circuit_verification_key.json'
# Compiled circuit = '_circuit.wasm'
VSM_CYCLE_PERIOD_IN_SECS=15 # How many seconds before each VSM cycle
VSM_CYCLE_TX_BATCH_SIZE=5 # How many transactions to execute in the single VSM cycle
MERKLE_TREE_HASH_ALGH="sha256" # Hash algorithm used in creation of Merkle Tree
```
Can be found in ./env.sample.

Relevant information on DID Auth can be found in ./docs/dids/did-authentication.md

Expand Down
10 changes: 5 additions & 5 deletions examples/bri-3/docs/dids/did-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ Hence, Bri-3 utilizes the self-sovereign nature of decentralized identifiers (DI

## Environment Variables Explanation

**GOERLI_RPC_URL**= "<Any GOERLI_RPC_URL i.e. _https://rpc.ankr.com/eth_goerli_>"
**DID_REGISTRY**= "<address of the did registry smart contract>"

#This is used to resolve dids.
#This is did registry address on a given network used to resolve dids. Example:https://sepolia.etherscan.io/address/0x03d5003bf0e79c5f5223588f347eba39afbc3818#code

**GOERLI_SERVICE_DID**="did:ethr:0x5:<bpi_operator_public_key>"
**DID_BPI_OPERATOR_PUBLIC_KEY**="did:ethr:sepolia:<bpi_operator_public_key>"

#bpi_operator_public_key = public key of the bpi operator that represents the issuer of the JWT token. Users can retrieve their public key by accessing their blockchain account settings or using a wallet provider like [MetaMask](https://metamask.io/).

where
1. did - the did URI scheme identifier
2. ethr - the identifier for the DID method
3. 0x5 - Specify GOERLI Test Network
3. sepolia - Specify SEPOLIA Test Network
4. bpi_operator_public_key - the DID method-specific identifier

**GOERLI_SERVICE_SIGNER_PRIVATE_KEY**="<bpi_operator_private_key>"
**DID_BPI_OPERATOR_PRIVATE_KEY**="<bpi_operator_private_key>"

#bpi_operator_private_key = private key of the bpi operator that is used to sign the issued JWT token. Similar to the public key. For more information on how to view and access the public and private keys, please refer to the [MetaMask support](https://support.metamask.io/hc/en-us/articles/360015488791-How-to-view-your-account-details-and-public-address).

Expand Down
2 changes: 1 addition & 1 deletion examples/bri-3/hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type import('hardhat/config').HardhatUserConfig */

require('@nomiclabs/hardhat-ethers');
require('@nomicfoundation/hardhat-ethers');
require('@nomicfoundation/hardhat-toolbox');
require('dotenv/config');
module.exports = {
Expand Down
Loading
Loading