// ─── Key material ──────────────────────────────────────────────────────────── export interface KeyFile { pub_key: string; // hex Ed25519 public key (32 bytes) priv_key: string; // hex Ed25519 private key (64 bytes) x25519_pub: string; // hex X25519 public key (32 bytes) x25519_priv: string; // hex X25519 private key (32 bytes) } // ─── Contact ───────────────────────────────────────────────────────────────── export interface Contact { address: string; // Ed25519 pubkey hex — blockchain address x25519Pub: string; // X25519 pubkey hex — encryption key username?: string; // @name from registry contract alias?: string; // local nickname addedAt: number; // unix ms } // ─── Messages ───────────────────────────────────────────────────────────────── export interface Envelope { sender_pub: string; // X25519 hex recipient_pub: string; // X25519 hex nonce: string; // hex 24 bytes ciphertext: string; // hex NaCl box timestamp: number; // unix seconds } export interface Message { id: string; from: string; // X25519 pubkey of sender text: string; timestamp: number; mine: boolean; } // ─── Chat ──────────────────────────────────────────────────────────────────── export interface Chat { contactAddress: string; // Ed25519 pubkey hex contactX25519: string; // X25519 pubkey hex username?: string; alias?: string; lastMessage?: string; lastTime?: number; unread: number; } // ─── Contact request ───────────────────────────────────────────────────────── export interface ContactRequest { from: string; // Ed25519 pubkey hex x25519Pub: string; // X25519 pubkey hex; empty until fetched from identity username?: string; intro: string; // plaintext intro (stored on-chain) timestamp: number; txHash: string; } // ─── Transaction ───────────────────────────────────────────────────────────── export interface TxRecord { hash: string; type: string; from: string; to?: string; amount?: number; fee: number; timestamp: number; status: 'confirmed' | 'pending'; } // ─── Node info ─────────────────────────────────────────────────────────────── export interface NetStats { total_blocks: number; total_txs: number; peer_count: number; chain_id: string; } export interface NodeSettings { nodeUrl: string; contractId: string; // username_registry contract }