/** * Minimal key-value storage adapter. * Pass `localStorage` in browser environments, or any Map-backed adapter for Node.js / tests. */ export interface IPluginStorage { getItem(key: string): string | null; setItem(key: string, value: string): void; } /** * Minimal event emitter interface for the plugin events API. * Compatible with Node.js EventEmitter, matrix-js-sdk MatrixClient, and similar clients. */ export interface IPluginEventClient { on(event: string, handler: (...args: any[]) => void): void; off(event: string, handler: (...args: any[]) => void): void; } /** * In-memory storage implementation — used as the default when no storage adapter is provided. */ export class MemoryStorage implements IPluginStorage { private readonly store = new Map(); /** @inheritdoc */ getItem(key: string): string | null { return this.store.get(key) ?? null; } /** @inheritdoc */ setItem(key: string, value: string): void { this.store.set(key, value); } }