# @cistern/consumer Consumer client for retrieving, decrypting, and deleting Cistern memos. ## Usage ### Generate Keypair ```typescript import { createConsumer, serializeKey } from "@cistern/consumer"; const consumer = await createConsumer({ handle: "user.bsky.social", appPassword: "xxxx-xxxx-xxxx-xxxx", }); const keypair = await consumer.generateKeyPair(); console.log(`Public key URI: ${keypair.publicKey}`); console.log(`Private key: ${serializeKey(keypair.privateKey)}`); ``` ### Use Existing Keypair ```typescript import { createConsumer } from "@cistern/consumer"; const consumer = await createConsumer({ handle: "user.bsky.social", appPassword: "xxxx-xxxx-xxxx-xxxx", keypair: { publicKey: "at://did:plc:abc123/app.cistern.pubkey/3jzfcijpj2z", privateKey: "base64-encoded-private-key", }, }); ``` ### List Memos (Polling) ```typescript for await (const memo of consumer.listMemos()) { console.log(`[${memo.tid}] ${memo.text}`); await consumer.deleteMemo(memo.tid); } ``` ### Subscribe to Memos (Real-time) ```typescript for await (const memo of consumer.subscribeToMemos()) { console.log(`[${memo.tid}] ${memo.text}`); await consumer.deleteMemo(memo.tid); } ```