Quick Start
pubkey.locker allows developers and systems to resolve public keys using standard command-line utilities. You can fetch registered keys directly in authorized_keys format or JSON.
Local Development
Clone the repository and install runtime dependencies with Node.js 20+.
git clone [email protected]:pranabeshsingh/pubkey_locker.git cd pubkey_locker npm install cp .env.example .env # Edit .env with Oracle Wallet credentials npm run dev
Environment Variables
All configuration is loaded via environment variables or a local .env file:
| Variable | Description | Example |
|---|---|---|
| PORT | Application HTTP port (default: 3002) | 3002 |
| ORACLE_USER | Oracle DB username | ADMIN |
| ORACLE_PASSWORD | Database password | •••••••• |
| ORACLE_CONNECT_STRING | TNS alias in tnsnames.ora | pubkeylocker_tp |
| ORACLE_WALLET_LOCATION | Path to extracted wallet directory | /opt/pubkey-locker/wallet |
| ADMIN_TOKEN | Secret token for admin API endpoints | secret_token_123 |
Bundle Specification
Public key bundles are JSON objects containing keys, handle metadata, and ownership proofs.
{
"version": 1,
"handle": "alice",
"keys": [
{
"type": "ssh-ed25519",
"publicKey": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGd0+bO44D6kG5Z3f6T2fX9x3B8l4N5q2e6Y8X0w1a2b [email protected]",
"fingerprint": "SHA256:d8k3J7mNp9Q1vX4yZ2w8kL5mN7pQ9rS2tU4vW6xY8zA"
}
],
"proof": {
"message": "register alice",
"signature": "u7P9fX2kL8mN4pQ1rS5tU7vW9xY2zA3bC5dE7fG9hI1jK3lM5nO7pQ9rS1tU3vW5",
"signedBy": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGd0+bO44D6kG5Z3f6T2fX9x3B8l4N5q2e6Y8X0w1a2b"
}
}
Supported Key Types
pubkey.locker enforces strict schema validation on the type field. The
registry currently accepts the following 5 public key standards:
| Type Identifier | Standard | Description & Use Case |
|---|---|---|
ssh-ed25519 |
Ed25519 | Modern high-speed Edwards-curve keys. Recommended for all modern SSH deployments. |
ssh-rsa |
RSA | Traditional RSA public keys for legacy infrastructure and older SSH servers. |
ssh-ecdsa |
ECDSA | NIST elliptic curve public keys (P-256, P-384, P-521). |
pgp |
OpenPGP | OpenPGP public keys for Git commit signing and email encryption. |
age |
age-encryption | Modern, simple public keys for secret management and file encryption. |
Each key object inside the keys array requires type,
publicKey (minimum 10 characters), and a non-empty
fingerprint (typically SHA256).
Ownership Proofs
To prevent handle squatting and unauthorized overrides, every uploaded bundle must
provide a cryptographic signature challenge in the proof object.
Proof Object Structure
| Field | Type | Requirement |
|---|---|---|
message |
string |
The registration challenge statement (e.g. "register alice").
|
signature |
string |
Base64-encoded signature of message generated by the signing
private key.
|
signedBy |
string | Public key string corresponding to the private key used to produce the signature. |
Generating a Proof with OpenSSH
You can generate an ownership signature challenge using standard OpenSSH client tools:
# 1. Create registration message echo -n "register alice" > challenge.txt # 2. Sign the challenge with your SSH key ssh-keygen -Y sign -n "pubkey.locker" -f ~/.ssh/id_ed25519 challenge.txt # 3. Base64-encode the resulting signature file for JSON inclusion base64 -w 0 challenge.txt.sig
API Reference
Checks application and Oracle Database connectivity.
curl https://pubkey.locker/health
# Response 200 OK
{"ok": true, "db": true}
Returns the total number of registered public key bundles stored in the database.
curl https://pubkey.locker/api/counts
# Response 200 OK
{"total": 128}
Performs dry-run JSON schema and proof validation without persisting to the database.
curl -X POST https://pubkey.locker/api/validate \
-H "Content-Type: application/json" \
-d '{"version":1,"handle":"alice",...}'
# Response 200 OK
{"valid": true}
Validates and stores a signed key bundle in Oracle Autonomous Database.
curl -X POST https://pubkey.locker/api/keys \
-H "Content-Type: application/json" \
-d '{"version":1,"handle":"alice",...}'
# Response 201 Created
{"id": "6a9f73d8-5081-4b11-9a7c-1349f7ba3e12", "handle": "alice"}
Resolves the latest registered bundle for the specified handle.
curl https://pubkey.locker/api/keys/alice
# Response 200 OK
{"version": 1, "handle": "alice", "keys": [...], "proof": {...}}
Lists stored bundles. Protected with X-Admin-Token.
curl https://pubkey.locker/api/bundles?limit=50 \
-H "X-Admin-Token: your_admin_token"
# Response 200 OK
[{"id": "...", "handle": "alice", "createdAt": "2026-10-20T18:00:00.000Z"}]
Permanently deletes a stored bundle by UUID. Protected with
X-Admin-Token.
curl -X DELETE https://pubkey.locker/api/keys/6a9f73d8-5081-4b11-9a7c-1349f7ba3e12 \ -H "X-Admin-Token: your_admin_token" # Response 204 No Content
OpenSSH Integration
Configure OpenSSH daemon to resolve user keys directly from pubkey.locker using
AuthorizedKeysCommand in /etc/ssh/sshd_config:
# In /etc/ssh/sshd_config AuthorizedKeysCommand /usr/local/bin/pubkey-resolve %u AuthorizedKeysCommandUser nobody
Create the resolver script in /usr/local/bin/pubkey-resolve:
#!/bin/sh
set -e
USER="$1"
curl -sSf "https://pubkey.locker/${USER}.keys" || exit 0
Deployment & Systemd
Production runs as a systemd service managed behind Caddy reverse proxy on port 3002:
# Update and restart service cd /opt/pubkey-locker git pull origin master npm ci --omit=dev sudo systemctl restart pubkey-locker # Validate and reload Caddy without restarting sudo caddy validate --config /etc/caddy/Caddyfile sudo caddy reload --config /etc/caddy/Caddyfile
Security Model
- Private Keys: Never uploaded or stored. Private keys remain on client machines.
- Ownership Verification: Registration requires a signature challenge signed by the key.
-
Admin Endpoints: Authenticated strictly with high-entropy
X-Admin-Token. - Oracle Cloud Wallet: Excluded from git repositories, stored with restricted permissions.