Nostr Secure Enclave — server-side key management for AI entities, bots, and backend services
Project description
nostr-secure-enclave
Python package for Nostr Secure Enclave. Server-side key management for AI entities, bots, and backend services.
Package: nostr-secure-enclave (PyPI)
Implementation
Pure Python using cryptography for AES-256-GCM + secp256k1 for Schnorr signing (BIP-340).
Use Cases
- OpenClaw / AI entity identity
- Bot process keypairs
- Backend service identity
- MCP tool server signing
API
import os
from nse import NSE, NostrEvent
from nse.storage import FileStorage
# Initialize with master key + persistent storage
nse = NSE(
master_key=os.environ['NSE_MASTER_KEY'],
storage=FileStorage('.nse'),
)
# Generate on first run
if not nse.exists():
info = nse.generate()
print(f"Identity: {info.npub}")
# Sign events
signed = nse.sign(NostrEvent(
kind=1,
content="Hello Nostr",
tags=[],
created_at=int(time.time()),
))
# Read identity (no unlock needed)
pubkey = nse.get_public_key()
npub = nse.get_npub()
# Wipe everything
nse.destroy()
Storage Backends
MemoryStorage— testing / ephemeral processesFileStorage(directory)— persistent file storage
Security Notes
- AES-256-GCM encryption with unique IV per operation
- Best-effort memory zeroing after signing (
bytearray.fill(0)) - Python's GC may retain copies of key material — this is a documented limitation
hardware_backedis alwaysFalsefor Python keys (honest)
Status: Implemented (Phase 6) — 27 tests passing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nostr_secure_enclave-0.1.0.tar.gz.
File metadata
- Download URL: nostr_secure_enclave-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e05dfd746f88905443ee76e6cc16e44ffbdc657e7cc42ca4dc3a16f61f632bb
|
|
| MD5 |
5d140cf73b6de8cb30946cabf9b0bd90
|
|
| BLAKE2b-256 |
5da0ebd2f3f920d16c38abe68719db4a2cac5f9ca46837b7b67039d5e898499c
|
File details
Details for the file nostr_secure_enclave-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nostr_secure_enclave-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1918c8b55052d118d118f6bdbd7d384e44bee5961e1e5a2ca19adfe7c717e7e5
|
|
| MD5 |
0f5dee628b6708408212b606414f0d6d
|
|
| BLAKE2b-256 |
8a046893940b56d27924d9a06b793d2c1ae8d50619e80469602129dfb781e8c0
|