Skip to content

API key added to CLI tool and PKG#43

Merged
FayKn merged 22 commits intomainfrom
api-key
Jan 29, 2026
Merged

API key added to CLI tool and PKG#43
FayKn merged 22 commits intomainfrom
api-key

Conversation

@FayKn
Copy link
Contributor

@FayKn FayKn commented Jan 22, 2026

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces API-key-based authentication (backed by an optional PostgreSQL database) for the PKG signing-key endpoint and adds corresponding CLI support, alongside a few related robustness and compatibility tweaks.

Changes:

  • Add optional Postgres connection/pool wiring and API-key guard routing for /v2/.../sign/key in the PKG server.
  • Add API-key support to pg-cli enc for retrieving signing keys without interactive auth; improve CLI JSON parsing error handling.
  • Update a few supporting pieces (sqlx/tokio deps, dev docker-compose + seed SQL, aes-gcm nonce API adjustments, unix-only file mode setting).

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
pg-pkg/src/server.rs Adds optional DB pool setup + API-key guarded route for /sign/key.
pg-pkg/src/opts.rs Adds database_url CLI/env option; updates default IRMA URL.
pg-pkg/src/middleware/irma.rs Adds IrmaAuthType::Key that validates API keys via Postgres.
pg-pkg/src/handlers/start.rs Removes an unused import.
pg-pkg/src/generate.rs Makes unix-only permission setting conditional for portability.
pg-pkg/docker-compose.dev.yml Adds a dev Postgres/Adminer compose setup for local API-key testing.
pg-pkg/api_keys.sql Adds schema + seed data for api_keys table.
pg-pkg/Cargo.toml Adds sqlx/tokio deps and enables clap env parsing.
pg-core/src/client/rust/mod.rs Updates AES-GCM nonce usage to match API expectations.
pg-cli/src/opts.rs Adds --api-key option for encryption flow.
pg-cli/src/encrypt.rs Uses API-key flow for signing key retrieval; improves identity JSON parse errors.
pg-cli/src/client.rs Fixes Client::new return type signature; removes unused struct.
Cargo.lock Dependency lockfile updates for new crates/features.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI commented Jan 22, 2026

@FayKn I've opened a new pull request, #44, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: FayKn <61050421+FayKn@users.noreply.github.com>
@FayKn FayKn changed the title fixed bug in cli tool API key added to CLI tool and PKG Jan 22, 2026
@FayKn FayKn merged commit f12140e into main Jan 29, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants