Skip to main content

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 processes
  • FileStorage(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_backed is always False for Python keys (honest)

Status: Implemented (Phase 6) — 27 tests passing

Metadata

Release files for nostr-secure-enclave 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nostr-secure-enclave 0.1.0
File Size Uploaded
nostr_secure_enclave-0.1.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nostr-secure-enclave 0.1.0
File Interpreter ABI Platform
nostr_secure_enclave-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / nostr_secure_enclave-0.1.0.tar.gz

Download URL nostr_secure_enclave-0.1.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8e05dfd746f88905443ee76e6cc16e44ffbdc657e7cc42ca4dc3a16f61f632bb
BLAKE2b-256 checksum
How to use checksums
5da0ebd2f3f920d16c38abe68719db4a2cac5f9ca46837b7b67039d5e898499c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / nostr_secure_enclave-0.1.0-py3-none-any.whl

Download URL nostr_secure_enclave-0.1.0-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1918c8b55052d118d118f6bdbd7d384e44bee5961e1e5a2ca19adfe7c717e7e5
BLAKE2b-256 checksum
How to use checksums
8a046893940b56d27924d9a06b793d2c1ae8d50619e80469602129dfb781e8c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page