-
Notifications
You must be signed in to change notification settings - Fork 180
e2e test using passport and EU-ID #1281
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
base: dev
Are you sure you want to change the base?
Changes from 4 commits
01fc82e
57f08dd
b55c152
2241b6a
231f5f2
bdb2ed5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # Dependencies | ||
| **/node_modules/ | ||
| **/.pnp | ||
| **/.pnp.js | ||
| node_modules | ||
|
|
||
| # Build outputs | ||
| **/dist/ | ||
| **/build/ | ||
| **/.next/ | ||
| **/out/ | ||
|
|
||
| # Testing | ||
| **/coverage/ | ||
| **/.nyc_output/ | ||
|
|
||
| # Yarn (keep .yarnrc.yml and .yarn/releases for Docker) | ||
| **/.yarn/cache/ | ||
| **/.yarn/unplugged/ | ||
| **/.yarn/build-state.yml | ||
| **/.yarn/install-state.gz | ||
| # !.yarnrc.yml is not ignored - we need it for Docker | ||
| # !.yarn/releases/ is not ignored - we need it for Docker | ||
|
|
||
| # Environment variables | ||
| **/.env* | ||
| !**/.env.example | ||
|
|
||
| # Logs | ||
| **/*.log | ||
| **/npm-debug.log* | ||
| **/yarn-debug.log* | ||
| **/yarn-error.log* | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| **/.DS_Store | ||
| Thumbs.db | ||
|
|
||
| # IDEs | ||
| **/.vscode/ | ||
| **/.idea/ | ||
| **/*.swp | ||
| **/*.swo | ||
| **/*~ | ||
|
|
||
| # Git | ||
| .git | ||
| .gitignore | ||
| .gitattributes | ||
|
|
||
| # CI/CD | ||
| **/.github/ | ||
| **/.gitlab/ | ||
| **/.circleci/ | ||
|
|
||
| # Documentation | ||
| **/README.md | ||
| **/docs/ | ||
| **/*.md | ||
| !package.json | ||
|
|
||
| # Compiled circuits (large files) | ||
| circuits/build/ | ||
| circuits/output/ | ||
| **/ptau/ | ||
| **/*.sym | ||
| **/*.r1cs | ||
| # Exclude large circuit files but keep the ones needed by ts-api | ||
| **/*.zkey | ||
| **/*.wasm | ||
| !sdk/tests/ts-api/utils/assests/*.zkey | ||
| !sdk/tests/ts-api/utils/assests/*.wasm | ||
|
|
||
| # Contract artifacts | ||
| contracts/artifacts/ | ||
| contracts/cache/ | ||
| contracts/typechain-types/ | ||
|
|
||
| # Mobile app builds | ||
| app/ios/build/ | ||
| app/android/build/ | ||
| app/android/.gradle/ | ||
| app/android/app/build/ | ||
|
|
||
| # Noir build artifacts | ||
| noir/target/ | ||
|
|
||
| # Temp files | ||
| **/*.tsbuildinfo | ||
| **/tmp/ | ||
| **/temp/ | ||
| **/.cache/ | ||
|
|
||
| # Private modules | ||
| app/android/android-passport-nfc-reader/ | ||
|
|
||
| # CI-generated tarballs | ||
| mobile-sdk-alpha-ci.tgz | ||
| **/mobile-sdk-alpha-*.tgz | ||
| /tmp/mobile-sdk-alpha*.tgz | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,6 +9,7 @@ | |
| "packages/*", | ||
| "prover/tests", | ||
| "scripts/tests", | ||
| "sdk/tests/*", | ||
| "sdk/*" | ||
| ] | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,47 @@ | ||||||||||||||||||||||||||||
| services: | ||||||||||||||||||||||||||||
| # TypeScript API Service | ||||||||||||||||||||||||||||
| ts-api: | ||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||
| context: ../.. # Build from monorepo root (two levels up) | ||||||||||||||||||||||||||||
| dockerfile: sdk/tests/ts-api/Dockerfile | ||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||
| - "3000:3000" | ||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||
| - NODE_ENV=production | ||||||||||||||||||||||||||||
| - PORT=3000 | ||||||||||||||||||||||||||||
| healthcheck: | ||||||||||||||||||||||||||||
| test: ["CMD", "curl", "-f", "http://localhost:3000/health"] | ||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chainVerify that healthcheck commands are available in containers. The healthchecks rely on Also applies to: 32-32 🏁 Script executed: #!/bin/bash
# Verify if curl/wget are available in the Dockerfiles or base images
echo "Checking ts-api Dockerfile for curl availability:"
if [ -f "sdk/tests/ts-api/Dockerfile" ]; then
cat sdk/tests/ts-api/Dockerfile | grep -i "curl\|apt-get\|apk"
else
echo "ts-api Dockerfile not found"
fi
echo -e "\nChecking go-api Dockerfile for wget availability:"
if [ -f "sdk/tests/go-api/Dockerfile" ]; then
cat sdk/tests/go-api/Dockerfile | grep -i "wget\|apt-get\|apk"
else
echo "go-api Dockerfile not found"
fiLength of output: 346 🏁 Script executed: #!/bin/bash
echo "Displaying first 50 lines of ts-api Dockerfile:"
sed -n '1,50p' sdk/tests/ts-api/DockerfileLength of output: 1779 Install curl in ts-api Dockerfile runner stage RUN apk --no-cache add curlbefore running the healthcheck. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| interval: 30s | ||||||||||||||||||||||||||||
| timeout: 10s | ||||||||||||||||||||||||||||
| retries: 3 | ||||||||||||||||||||||||||||
| start_period: 40s | ||||||||||||||||||||||||||||
| restart: unless-stopped | ||||||||||||||||||||||||||||
| networks: | ||||||||||||||||||||||||||||
| - api-network | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| # Go API Service | ||||||||||||||||||||||||||||
| go-api: | ||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||
| context: ../.. # Build from monorepo root (two levels up) | ||||||||||||||||||||||||||||
| dockerfile: sdk/tests/go-api/Dockerfile | ||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||
| - "8080:8080" | ||||||||||||||||||||||||||||
| environment: | ||||||||||||||||||||||||||||
| - PORT=8080 | ||||||||||||||||||||||||||||
| healthcheck: | ||||||||||||||||||||||||||||
| test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8080/health"] | ||||||||||||||||||||||||||||
| interval: 30s | ||||||||||||||||||||||||||||
| timeout: 10s | ||||||||||||||||||||||||||||
| retries: 3 | ||||||||||||||||||||||||||||
| start_period: 40s | ||||||||||||||||||||||||||||
| restart: unless-stopped | ||||||||||||||||||||||||||||
| networks: | ||||||||||||||||||||||||||||
| - api-network | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| networks: | ||||||||||||||||||||||||||||
| api-network: | ||||||||||||||||||||||||||||
| driver: bridge | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||
| ts-api-logs: | ||||||||||||||||||||||||||||
| go-api-logs: | ||||||||||||||||||||||||||||
|
Comment on lines
+45
to
+47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Declared volumes are not mounted to any service. The volumes Example of mounting volumes: ts-api:
build:
context: ../..
dockerfile: sdk/tests/ts-api/Dockerfile
ports:
- "3000:3000"
+ volumes:
+ - ts-api-logs:/app/logs
environment:
- NODE_ENV=production📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Binaries and build artifacts | ||
| go-api | ||
| *.exe | ||
| *.dll | ||
| *.so | ||
| *.dylib | ||
| *.test | ||
|
|
||
| # Go build cache | ||
| .cache/ | ||
|
|
||
| # IDE files | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
| .DS_Store? | ||
| ._* | ||
| .Spotlight-V100 | ||
| .Trashes | ||
| ehthumbs.db | ||
|
|
||
| # Git | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # Docker files (except the one being used) | ||
| .dockerignore | ||
|
|
||
| # Documentation | ||
| *.md | ||
|
|
||
| # Test files | ||
| *_test.go | ||
|
|
||
| # Logs | ||
| *.log | ||
|
|
||
| # Temporary files | ||
| *.tmp |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,52 @@ | ||||||||||||||
| # Multi-stage build for Go API | ||||||||||||||
| FROM golang:1.23-alpine AS builder | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pin base images to reduce supply-chain risk Avoid floating golang:1.23-alpine and alpine:latest; pin minor versions or digests for reproducible, auditable builds. Examples: -FROM golang:1.23-alpine AS builder
+FROM golang:1.23.3-alpine3.20 AS builder
...
-FROM alpine:latest AS runner
+FROM alpine:3.20 AS runnerOr use digests if your pipeline supports them. Also applies to: 25-25 🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| # Set working directory | ||||||||||||||
| WORKDIR /app | ||||||||||||||
|
|
||||||||||||||
| # Install git and ca-certificates (needed for go modules) | ||||||||||||||
| RUN apk --no-cache add git ca-certificates | ||||||||||||||
|
|
||||||||||||||
| # Copy go mod files first for better Docker layer caching | ||||||||||||||
| COPY sdk/tests/go-api/go.mod sdk/tests/go-api/go.sum ./sdk/tests/go-api/ | ||||||||||||||
| COPY sdk/sdk-go/go.mod sdk/sdk-go/go.sum ./sdk/sdk-go/ | ||||||||||||||
|
|
||||||||||||||
| # Download dependencies first (this layer will be cached if go.mod/go.sum don't change) | ||||||||||||||
| WORKDIR /app/sdk/tests/go-api | ||||||||||||||
| RUN go mod download | ||||||||||||||
| RUN go mod tidy | ||||||||||||||
|
|
||||||||||||||
| # Now copy the source code (use absolute paths from /app) | ||||||||||||||
| COPY sdk/sdk-go/ /app/sdk/sdk-go/ | ||||||||||||||
| COPY sdk/tests/go-api/ /app/sdk/tests/go-api/ | ||||||||||||||
| RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o go-api . | ||||||||||||||
|
|
||||||||||||||
| # Production stage - minimal Alpine image | ||||||||||||||
| FROM alpine:latest AS runner | ||||||||||||||
|
|
||||||||||||||
| # Install ca-certificates, wget for health check, and create non-root user | ||||||||||||||
| RUN apk --no-cache add ca-certificates wget \ | ||||||||||||||
| && addgroup --system --gid 1001 appgroup \ | ||||||||||||||
| && adduser --system --uid 1001 --ingroup appgroup appuser | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+28
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix Alpine user/group creation flags (build will fail) Alpine (BusyBox) uses -S, not --system. Current commands are Debian-style and likely error. -RUN apk --no-cache add ca-certificates wget \
- && addgroup --system --gid 1001 appgroup \
- && adduser --system --uid 1001 --ingroup appgroup appuser
+RUN apk --no-cache add ca-certificates wget \
+ && addgroup -g 1001 -S appgroup \
+ && adduser -u 1001 -S -G appgroup appuser📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| # Set working directory | ||||||||||||||
| WORKDIR /app | ||||||||||||||
|
|
||||||||||||||
| # Copy the binary from builder stage | ||||||||||||||
| COPY --from=builder --chown=appuser:appgroup /app/sdk/tests/go-api/go-api . | ||||||||||||||
|
|
||||||||||||||
| # Switch to non-root user | ||||||||||||||
| USER appuser | ||||||||||||||
|
|
||||||||||||||
| # Expose port 8080 | ||||||||||||||
| EXPOSE 8080 | ||||||||||||||
|
|
||||||||||||||
| # Set environment variables | ||||||||||||||
| ENV PORT=8080 | ||||||||||||||
|
|
||||||||||||||
| # Health check | ||||||||||||||
| HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | ||||||||||||||
| CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1 | ||||||||||||||
|
|
||||||||||||||
| # Run the binary | ||||||||||||||
| CMD ["./go-api"] | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Go API for SelfBackendVerifier Testing | ||
|
|
||
| This is a Go API server that provides endpoints for testing the SelfBackendVerifier functionality, equivalent to the TypeScript API version. | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Initialize Go module dependencies: | ||
| ```bash | ||
| go mod tidy | ||
| ``` | ||
|
|
||
| 2. Build the project: | ||
| ```bash | ||
| go build -o go-api | ||
| ``` | ||
|
|
||
| 3. Run the server: | ||
| ```bash | ||
| ./go-api | ||
| ``` | ||
|
|
||
| Or run directly with Go: | ||
| ```bash | ||
| go run main.go | ||
| ``` | ||
|
|
||
| ## API Endpoints | ||
|
|
||
| ### Health Check | ||
| ``` | ||
| GET /health | ||
| ``` | ||
| Returns server status and timestamp. | ||
|
|
||
| ### Verify Attestation | ||
| ``` | ||
| POST /api/verify | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "attestationId": 1, | ||
| "proof": { | ||
| "a": ["...", "..."], | ||
| "b": [["...", "..."], ["...", "..."]], | ||
| "c": ["...", "..."] | ||
| }, | ||
| "publicSignals": ["...", "...", "..."], | ||
| "userContextData": "..." | ||
| } | ||
| ``` | ||
|
|
||
| ### Environment Variables | ||
|
|
||
| - `PORT`: Server port (default: 8080) | ||
|
|
||
| ### Storage | ||
|
|
||
| This API uses in-memory storage for testing purposes: | ||
| - Verification configuration is hard-coded (minimum age: 18, excludes PAK/IRN, OFAC enabled) | ||
| - Configuration data is stored in memory | ||
| - Data is lost when server restarts | ||
|
|
||
|
|
||
| ## Docker Setup | ||
|
|
||
| ### Building and Running with Docker | ||
|
|
||
| **Option 1: Using the build script (Recommended)** | ||
| ```bash | ||
| # From the monorepo root directory | ||
| ./sdk/tests/go-api/docker-build.sh | ||
|
|
||
| # Run the container | ||
| docker run -p 8080:8080 selfxyz-go-api:latest | ||
| ``` | ||
|
|
||
| **Option 2: Manual Docker build** | ||
| ```bash | ||
| # From the monorepo root directory | ||
| docker build -f sdk/tests/go-api/Dockerfile -t selfxyz-go-api:latest . | ||
|
|
||
| # Run the container | ||
| docker run -p 8080:8080 selfxyz-go-api:latest | ||
| ``` | ||
|
|
||
| **Option 3: Using Docker Compose** | ||
| ```bash | ||
| # From the go-api directory | ||
| cd sdk/tests/go-api | ||
| docker-compose up --build | ||
| ``` | ||
|
|
||
| The Docker container includes: | ||
| - Health check endpoint at `/health` | ||
| - Automatic restart policy | ||
| - Non-root user for security | ||
|
|
||
| ### Docker Environment Variables | ||
|
|
||
| - `PORT`: Server port (default: 8080) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*Global ignore of .md may strip LICENSE/NOTICE from images — add allowlist to maintain compliance
Unintentionally excluding license/notice docs can create compliance issues for distributed images.
Apply allowlist rules:
📝 Committable suggestion
🤖 Prompt for AI Agents