Go microservice task API with post-quantum FN-DSA JWT signing. HTTP/Fiber gateway, gRPC between services, PostgreSQL storage.
| Profile | alg | Port | Note |
|---|---|---|---|
FN-DSA-Precomputed-512 | FN-DSA-512 | 5001 | Precomputed LDL tree signer |
FN-DSA-512 | FN-DSA-512 | 5002 | Original signer |
Both profiles emit FN-DSA-512 tokens. Precomputation is internal state, not a JOSE algorithm.
flowchart LR
subgraph Clients
Client["Client"]
K6["k6 Benchmark"]
end
Caddy["Caddy\nReverse Proxy"]
subgraph Gateway
GW["Gateway\n:3000\nHTTP/Fiber\nJWT Verify"]
GWPre["Gateway (Precomputed)\n:5001"]
GWOrig["Gateway (Original)\n:5002"]
end
subgraph Services
Auth["Auth Service\n:3001\ngRPC\nRegister / Sign-In\nJWT Signing"]
Todo["Todo Service\n:3002\ngRPC\nTask CRUD"]
end
DB[("PostgreSQL\n18-alpine")]
subgraph Shared
Pkg["backend/pkg\nJWT / FN-DSA\nKey Loaders"]
end
Client --> Caddy
K6 -->|isolated instances| GWPre
K6 -->|isolated instances| GWOrig
Caddy --> GW
GW --> Auth
GW --> Todo
GWPre --> Auth
GWOrig --> Todo
Auth --> DB
Todo --> DB
Auth -.-> Pkg
Todo -.-> Pkg
GW -.-> Pkg
Benchmark: k6 hits isolated gateway instances on :5001 and :5002.
| Component | Path | Role |
|---|---|---|
| Gateway | backend/gateway/ | HTTP API, JWT verification, benchmark endpoints |
| Auth service | backend/auth-service/ | Registration, sign-in, JWT signing |
| Todo service | backend/todo-service/ | Task CRUD |
| Shared pkg | backend/pkg/ | JWT, FN-DSA signing, key loaders |
| Key generator | backend/cmd/keygen/ | Key generation CLI |
| k6 scripts | backend/k6/ | Benchmark scenarios |
Base: http://localhost:3000
| Method | Path | Result |
|---|---|---|
GET | / | "API OK" |
GET | /health | {"status":"ok"} |
POST | /api/auth/register | Create user (name, email, password) |
POST | /api/auth/signin | Access + refresh tokens (email, password) |
POST | /api/auth/refresh | New token pair (refresh_token) |
POST | /api/benchmark/pure-signing | Isolated signing stats |
POST | /api/benchmark/jwt-issuance | JWT issuance stats |
POST | /api/benchmark/sign | Alias for JWT issuance |
POST | /api/benchmark/token | One benchmark token |
Require Authorization: Bearer <access_token>.
| Method | Path | Result |
|---|---|---|
GET | /api/profile | Current user |
POST | /api/tasks/ | Create task |
GET | /api/tasks/ | List tasks |
GET | /api/tasks/:id | Get task |
PUT | /api/tasks/:id | Update task |
DELETE | /api/tasks/:id | Delete task |
- Go
1.25.7 - Docker Compose
- PostgreSQL
18-alpine(in Compose) - k6
0.50+ protoc,protoc-gen-go,protoc-gen-go-grpcfor proto regeneration
| Variable | Service | Description |
|---|---|---|
APP_MODE | all | dev reads .env; production reads process env |
APP_PORT | gateway | HTTP port |
GRPC_PORT | auth/todo | gRPC port |
AUTH_SERVICE_ADDR | gateway | Auth gRPC address |
TODO_SERVICE_ADDR | gateway | Todo gRPC address |
DB_USER, DB_PASSWORD, DB_NAME, DB_HOST, DB_PORT, DB_SSL_MODE | auth/todo | PostgreSQL |
JWT_DEFAULT_ALG | gateway/auth | Default signing profile |
JWT_ALLOWED_ALGS | gateway/auth | Profile allowlist |
JWT_ISSUER | gateway/auth | Expected issuer |
JWT_TOKEN_DURATION | gateway/auth | Token lifetime (minutes) |
KEYS_DIR | gateway/auth | PEM key directory |
Production-like stack:
cd backend
cp .env.example .env
make keygen
make vendor
make up-build
curl http://localhost/healthLocal dev:
cd backend
make devcd backend
make bench-sign # run benchmarks
make bench-down # stopRemote target:
make client-k6 BASE_URL=https://example.comUseful flags: ISOLATED_ONLY=true, STRESS_ONLY=true, ATTACK_ONLY=true, ITERATIONS=100.
Results go to backend/benchmark-results/.
Run from backend/.
| Target | Action |
|---|---|
make keygen | Generate production keys |
make keygen-all | Generate benchmark keys |
make compile-proto | Regenerate protobuf |
make up-build | Build + start Compose stack |
make down | Stop stack |
make clean | Stop + remove volumes |
make bench-sign | Run benchmark workflow |
make fndsa-check | Run FN-DSA validation |
cd backend
make falcon-kat # FN-DSA known-answer tests
make fndsa-check # Full FN-DSA validationStatistical analysis:
python3 scripts/benchmark_stat_tests.py| File | Topic |
|---|---|
docs/grpc-implementation.md | gRPC contracts, metadata, keep-alive |
docs/skenario-pengujian.md | k6 scenarios, metrics, thresholds |
docs/pengujian-kat-dan-adversarial-fndsa.md | FN-DSA KAT and adversarial tests |
docs/hasil-benchmark-agregat-20-run.md | Aggregate benchmark results |