A simplified implementation of pubky-core demonstrating public-key based key-value storage
This is a minimal viable product (MVP) version of pubky-core, focusing on the core functionality:
- Public key based authentication using ed25519
- Key-value storage with PUT/GET/DELETE operations
- Simple HTTP server for storage access
✅ Create keypairs (ed25519) ✅ Store and retrieve data using public keys ✅ HTTP API for storage operations ✅ In-memory storage backend
pubky-core-mvp/
├── Cargo.toml # Workspace configuration
├── common/ # Shared types and crypto
│ └── src/
│ └── lib.rs # Keypair, PublicKey, Signature
├── server/ # HTTP server for storage
│ └── src/
│ ├── main.rs # Server entry point
│ ├── storage.rs # In-memory storage
│ └── routes.rs # HTTP routes
└── examples/
└── basic_usage.rs # Example usage
cargo run --bin serverThe server will start on http://127.0.0.1:3000
In a separate terminal:
cargo run --example basic_usageuse pubky_common::Keypair;
// Create a new keypair
let keypair = Keypair::random();
let public_key = keypair.public_key();
println!("Public Key: {}", public_key);
// Store data
// PUT http://localhost:3000/{public_key}/data/hello.txt
// Body: "Hello, Pubky!"
// Retrieve data
// GET http://localhost:3000/{public_key}/data/hello.txtStore data at the specified path for a public key.
Example:
curl -X PUT http://localhost:3000/abc123.../my-app/data.txt \
-d "Hello World"Retrieve data from the specified path.
Example:
curl http://localhost:3000/abc123.../my-app/data.txtDelete data at the specified path.
Example:
curl -X DELETE http://localhost:3000/abc123.../my-app/data.txtList all keys under a path prefix.
Example:
curl http://localhost:3000/abc123.../my-app/| Feature | pubky-core | This MVP |
|---|---|---|
| Storage Backend | LMDB (persistent) | In-memory HashMap |
| DHT Integration | Pkarr/Mainline DHT | None |
| TLS Support | Yes (Pubky TLS) | No (HTTP only) |
| Authentication | Session cookies + tokens | Public key in URL |
| Authorization | Capabilities-based | None (simplified) |
| WebDAV | Yes | No |
| Rate Limiting | Yes | No |
| Multiple Storage | GCS, Memory, FS | Memory only |
This MVP uses the same core cryptographic dependencies as pubky-core:
ed25519-dalek(v2.1.1) - Ed25519 signaturesrand(v0.9.0) - Random number generationbase32(v0.5.1) - Base32 encoding for keysaxum(v0.8.1) - HTTP server frameworktokio(v1.43.0) - Async runtime
# Build all packages
cargo build
# Build with release optimizations
cargo build --release
# Run tests
cargo testTo extend this MVP towards the full pubky-core functionality:
- Persistent storage - Replace HashMap with LMDB (
heedcrate) - DHT integration - Add Pkarr for public key DNS
- Session management - Implement cookie-based sessions
- TLS support - Add Pubky TLS for secure connections
- Authorization - Implement capabilities-based access control
- Signup flow - Add homeserver signup/signin
MIT
Based on pubky-core by Synonym.