8 releases (5 breaking)
Uses new Rust 2024
| 0.45.0-alpha.1 | May 19, 2026 |
|---|---|
| 0.44.1 | Nov 9, 2025 |
| 0.43.0 | Jul 28, 2025 |
| 0.42.1 | Jun 28, 2025 |
| 0.0.0 | Apr 4, 2024 |
#1825 in Authentication
Used in n34
1MB
28K
SLoC
Nostr Keyring
Thin wrapper around the system keyring that stores Keys objects without forcing you to handle secret material manually.
The crate keeps all serialization in-memory and relies on the OS-provided credential store (macOS Keychain, Windows Credential Manager, Secret Service, etc.).
Getting started
use nostr_keyring::prelude::*;
fn main() -> Result<()> {
let keyring = NostrKeyring::new("my-nostr-app");
// Save a key
let keys = Keys::parse("nsec1j4c6269y9w0q2er2xjw8sv2ehyrtfxq3jwgdlxj6qfn8z4gjsq5qfvfk99")?;
keyring.set("example", &keys)?;
// Get it
let restored: Keys = keyring.get("example")?;
assert_eq!(keys.public_key(), restored.public_key());
Ok(())
}
More examples can be found in the examples directory.
Crate Feature Flags
The following crate feature flags are available:
| Feature | Default | Description |
|---|---|---|
async |
No | Enable async APIs |
Changelog
All notable changes to this library are documented in the CHANGELOG.md.
State
This library is in an ALPHA state, things that are implemented generally work but the API will change in breaking ways.
Donations
rust-nostr is free and open-source. This means we do not earn any revenue by selling it. Instead, we rely on your financial support. If you actively use any of the rust-nostr libs/software/services, then please donate.
License
This project is distributed under the MIT software license - see the LICENSE file for details
Dependencies
~10–25MB
~291K SLoC