
Decentralized Diffie-Hellman Key Exchange System
Note: KeyPears is a work-in-progress open-source password manager and cryptocurrency wallet. The design decisions described here represent our development approach and may evolve before our official release.
We're excited to share a major architectural milestone: KeyPears now has a working Rust backend with our first proof-of-concept endpoint. This marks a significant shift in our technical approach, bringing the performance, security, and cross-platform benefits of Rust to our core cryptography and API layer.
When we started building KeyPears, we knew cryptography and security would be central to everything we do. After evaluating different approaches, we chose to build our backend entirely in Rust for several compelling reasons:
Cryptographic operations—hashing, encryption, key derivation—are CPU-intensive. Rust's zero-cost abstractions and lack of garbage collection mean we can achieve performance comparable to C/C++ without sacrificing safety. For operations users will perform thousands of times (encrypting secrets, computing hashes, deriving keys), this performance matters.
Password managers and cryptocurrency wallets are high-value targets for attackers. Rust's ownership system and borrow checker eliminate entire classes of vulnerabilities at compile time:
These guarantees mean our cryptographic code has fewer attack surfaces by design.
KeyPears needs to run everywhere: Windows, macOS, Linux, Android, and iOS. Rust compiles to native code on all these platforms with consistent behavior. The same cryptographic library (rs-lib) that powers our server also powers our Tauri desktop app and will eventually power our mobile apps.
This eliminates the "works on my machine" problem and ensures that a secret encrypted on iOS can be decrypted on Windows with identical cryptographic operations.
Rust's type system helps us encode security invariants at compile time. For example, we can use the type system to ensure that:
This compile-time verification catches bugs before they reach production.
Our Rust backend consists of two main packages:
rs-lib: Core Cryptography Libraryrs-lib is a shared Rust library containing all our cryptographic implementations:
This library is pure Rust with no external dependencies beyond well-audited cryptography crates. It's designed to be portable and reusable across all our platforms.
rs-node: KeyPears Node (API Server)rs-node is our API server—what we call a "KeyPears node." It uses the Axum web framework to expose REST endpoints that clients can use for cryptographic operations and vault synchronization.
Key features:
utoipa/api/docsThe node is designed to be self-hostable. Anyone can run their own KeyPears node for full sovereignty over their data.
Our first working endpoint is a Blake3 hashing service at /api/blake3. You can try it right now:
curl -X POST https://keypears.com/api/blake3 \
-H "Content-Type: application/json" \
-d '{"data": "Hello, KeyPears!"}'
This returns:
{
"hash": "a1b2c3d4..."
}
Blake3 is our hashing algorithm of choice for KeyPears. It's:
We use Blake3 throughout KeyPears:
This proof-of-concept demonstrates the full stack working:
rs-node) receives the requestrs-lib) performs the Blake3 hash/api/* requests to the Rust nodeWhile our backend is Rust, our frontend remains TypeScript. This gives us the best of both worlds:
Our architecture uses:
The Tauri app embeds the same rs-lib cryptography that powers the KeyPears node. This means the desktop app has full offline capability—it doesn't need a server for cryptographic operations. The server is only needed for synchronization across devices.
In production, we run a dual-server setup:
The Node.js server forwards all /api/* requests to the Rust node via http-proxy-middleware. This gives us:
Both services run in a single Docker container on AWS Fargate, deployed via ECS.
One of the benefits of Rust's utoipa library is automatic OpenAPI documentation generation. You can explore our API interactively at:
This Swagger UI is generated directly from our Rust code. Every endpoint, request type, and response type is documented with examples. As we add new endpoints, the documentation updates automatically.
The Blake3 endpoint is just the beginning. We're actively building:
alice@example.com ↔ bob@example2.com)All of these features will be built on the same foundation: Rust for security-critical operations, TypeScript for user interfaces.
Everything we're building is open source under Apache 2.0. You can:
The KeyPears node is designed to be self-hostable. Our deployment documentation walks through:
We want KeyPears to be decentralized by default. Anyone should be able to run a node, just like anyone can run an email server.
Building KeyPears with Rust has been an excellent decision. The language's emphasis on safety, performance, and correctness aligns perfectly with our security requirements. The Blake3 proof-of-concept validates our architecture: Rust backend for cryptography, TypeScript frontend for user experience, and a clean API boundary between them.
We're excited to continue building. If you're interested in following along, check out:
We'll continue sharing our progress through these blog posts. Next up: vault encryption and key derivation in Rust.