Nostr identity SDK for OpenClaw AI entities — generate keys, sign events, encrypt data
Project description
NostrKey for OpenClaw
Give your AI its own cryptographic identity.
A Python SDK for OpenClaw AI entities to generate Nostr keypairs, sign events, encrypt data, and manage their own sovereign identity on the Nostr protocol.
Install
pip install nostrkey
Quick Start
from nostrkey import Identity
# Create a new AI identity
bot = Identity.generate()
print(f"npub: {bot.npub}")
print(f"nsec: {bot.nsec}")
# Sign a Nostr event
event = bot.sign_event(
kind=1,
content="Hello from an OpenClaw bot!",
tags=[]
)
# Publish to a relay
import asyncio
from nostrkey.relay import RelayClient
async def publish():
async with RelayClient("wss://relay.nostrkeep.com") as relay:
await relay.publish(event)
asyncio.run(publish())
Save & Load Identity
# Save identity to file (encrypted)
bot.save("my-bot.nostrkey", passphrase="strong-passphrase")
# Load it back
bot = Identity.load("my-bot.nostrkey", passphrase="strong-passphrase")
NIP-44 Encryption
from nostrkey.crypto import encrypt, decrypt
# Encrypt a message to another npub
ciphertext = encrypt(
sender_nsec=bot.nsec,
recipient_npub="npub1abc...",
plaintext="secret message"
)
# Decrypt a message
plaintext = decrypt(
recipient_nsec=bot.nsec,
sender_npub="npub1abc...",
ciphertext=ciphertext
)
NIP-46 Bunker (Delegated Signing)
When your bot needs its human sponsor to co-sign:
from nostrkey.bunker import BunkerClient
async def delegated_sign():
bunker = BunkerClient(bot.nsec)
await bunker.connect("bunker://npub1human...?relay=wss://relay.nostrkeep.com")
# Request the human to sign an event
signed = await bunker.sign_event(kind=1, content="Human-approved message")
The OpenClaw Model
OpenClaw bots are sovereign AI entities with their own Nostr identities:
- Human sponsors the bot — pays with credit card via NostrKey
- Bot gets its own npub — generated with this SDK
- Bot signs its own events — posts, DMs, interactions
- Bot stores data in NostrKeep — encrypted, sovereign
- Human vouches annually — CC renewal re-validates accountability
Learn more at loginwithnostr.com/openclaw
NIPs Implemented
| NIP | What | Status |
|---|---|---|
| NIP-01 | Basic protocol (events, signing) | Implemented |
| NIP-04 | Encrypted DMs (legacy) | Implemented |
| NIP-19 | bech32 encoding (npub/nsec/note) | Implemented |
| NIP-44 | Versioned encryption | Implemented |
| NIP-46 | Nostr Connect (bunker) | Implemented |
Part of the Humanjava Ecosystem
- NostrKey — Browser extension + mobile app for humans
- NostrKeep — Encrypted vault storage
- npub.bio — Human-readable identity pages
- Login with Nostr — Auth for any website
License
MIT — Humanjava Enterprises Inc.
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 nostrkey-0.1.0.tar.gz.
File metadata
- Download URL: nostrkey-0.1.0.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a5972b3474e4bbb4680c03f63f4969ceba6e763e8dfdbf9644fd223ecc160f6
|
|
| MD5 |
ceb43ee2bb3d09988a4fae1667c0949e
|
|
| BLAKE2b-256 |
65febbcbc1d5d45efe00526dd51f3c675177405cf60ee2c40dfd52ca274057f5
|
File details
Details for the file nostrkey-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nostrkey-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6826649ab13b0f93aec4fcaa8394013b9d3baa4ee47c2802eb69c6c3a057264
|
|
| MD5 |
ba2341b34a96cac02b7df5a058b8279a
|
|
| BLAKE2b-256 |
cf72512d857a8519a4cec67af5957f7a4904aa593ec23a38e2f68ace927ff53e
|