Integration
D00R has no API server. Anything that can read Solana accounts and sign transactions can integrate: a wallet, a bot, a profile page, an AI agent.
Find an inbox
import { PublicKey } from "@solana/web3.js"
const PROGRAM = new PublicKey("xk7UkNkjzd9axDvF1eLrUqoVbyjaEaVJwj8siR3mXhK")
const inboxOf = (owner: PublicKey) =>
PublicKey.findProgramAddressSync([Buffer.from("inbox"), owner.toBuffer()], PROGRAM)[0]
const byName = (name: string) =>
PublicKey.findProgramAddressSync([Buffer.from("name"), Buffer.from(name)], PROGRAM)[0]
Read the Inbox account and show the sender its terms and record before they knock: bond, mint, window, received, replied, kept, expired, and kept_amount per mint.
List open knocks
// every open knock to one recipient: memcmp on `recipient` at offset 8
const knocks = await connection.getProgramAccounts(PROGRAM, {
filters: [{ memcmp: { offset: 8, bytes: recipient.toBase58() } }],
})
Use offset 40 for sender to list a wallet's sent knocks.
Encrypt a message
The program does not check the format; this is the contract between clients.
- Wallet key:
secret = sha256(signMessage("D00R message key\n\nSigning this makes the key that locks and unlocks your D00R messages. It is free and sends nothing.\n\nWallet: <base58 address>"))(UTF-8), X25519 public key from that secret. Ed25519 signatures are deterministic, so the same wallet gets the same key on any device. The inbox publishes it asencryption_key; a sender attaches theirs asreply_key. - Shared key:
HKDF-SHA256(X25519(my_secret, their_public), salt "D00R v1", info "message" or "reply", 32 bytes). Sender and recipient compute the same one, so each can re-read the whole thread. - Ciphertext:
0x01 || nonce(12) || AES-256-GCM(plaintext, nonce, shared_key)(ciphertext plus 16-byte tag). Overhead 29 bytes, so 560 bytes carry 531 bytes of UTF-8 text. The first line of a message is its subject. - Reply: the same format with info "reply", in the
replyinstruction'smessageargument. An empty reply is allowed.
The app's implementation is web/app/app/lib/crypto.ts.
Transaction size
The largest knock with two compute-budget instructions in front measures 1,074 bytes (1,170 with a sponsor paying the fee), under Solana's 1,232-byte limit.
For AI agents
An agent knocks exactly like a person: it holds USDC or SOL, encrypts its message to the inbox key and calls send_knock. Its bond comes back when the human replies, or by itself after the window.