Skip to content

Commit

Permalink
Merge pull request #1 from pavelnikolov/discrete-log-solution
Browse files Browse the repository at this point in the history
discrete log solution
  • Loading branch information
pavelnikolov authored Jul 25, 2024
2 parents a0e018b + 85f93e9 commit 59a53a4
Show file tree
Hide file tree
Showing 14 changed files with 781 additions and 194 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
client.Dockerfile
server.Dockerfile
README.md
docker-compose.yml
target/
82 changes: 82 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Create and publish a Docker image

on:
push:
branches: ['main']

env:
REGISTRY: ghcr.io
SERVER_IMAGE_NAME: pavelnikolov/zkpauth-server
CLIENT_IMAGE_NAME: pavelnikolov/zkpauth-client

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for client images
id: meta_client
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.CLIENT_IMAGE_NAME }}
tags: |
type=sha
- name: Extract metadata (tags, labels) for server images
id: meta_server
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.SERVER_IMAGE_NAME }}
tags: |
type=sha
- name: Build and push client image
id: push_client
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
file: client.Dockerfile
tags: ${{ steps.meta_client.outputs.tags }}
labels: ${{ steps.meta_client.outputs.labels }}

- name: Build and push server image
id: push_server
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: true
file: server.Dockerfile
tags: ${{ steps.meta_server.outputs.tags }}
labels: ${{ steps.meta_server.outputs.labels }}

- name: Generate client image artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.CLIENT_IMAGE_NAME}}
subject-digest: ${{ steps.push_client.outputs.digest }}
push-to-registry: true


- name: Generate server image artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.SERVER_IMAGE_NAME}}
subject-digest: ${{ steps.push_server.outputs.digest }}
push-to-registry: true
32 changes: 32 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and push Docker images

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Setup protocol buffers
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Checkout code
uses: actions/checkout@v4

- name: Build
run: cargo build --verbose

- name: Run tests
run: cargo test --verbose

- name: Run clippy
run: cargo clippy --verbose
82 changes: 82 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'zkpauth-server'",
"cargo": {
"args": [
"build",
"--bin=zkpauth-server",
"--package=zkp-auth"
],
"filter": {
"name": "zkpauth-server",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'zkpauth-server'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=zkpauth-server",
"--package=zkp-auth"
],
"filter": {
"name": "zkpauth-server",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug executable 'zkpauth-client'",
"cargo": {
"args": [
"build",
"--bin=zkpauth-client",
"--package=zkp-auth"
],
"filter": {
"name": "zkpauth-client",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
},
{
"type": "lldb",
"request": "launch",
"name": "Debug unit tests in executable 'zkpauth-client'",
"cargo": {
"args": [
"test",
"--no-run",
"--bin=zkpauth-client",
"--package=zkp-auth"
],
"filter": {
"name": "zkpauth-client",
"kind": "bin"
}
},
"args": [],
"cwd": "${workspaceFolder}"
}
]
}
84 changes: 15 additions & 69 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ name = "zkpauth-client"
path = "src/client.rs"

[dependencies]
num-bigint = "0.4.6"
num-bigint = {version = "0.4.6", features = ["rand"]}
num-traits = "0.2"
prost = "0.13"
rand = "0.8.5"
sha2 = "0.10"
hex = "0.4"
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
tonic = "0.12"

uuid = { version = "1", features = ["v4"] }

[build-dependencies]
tonic-build = "0.12"
Loading

0 comments on commit 59a53a4

Please sign in to comment.