nostrbasedocs
Start building
API reference
.md

Read the private tables guide. Signatures below come from the published SDK declarations. Access SDK services through db; use their constructors only when integrating at a lower level.

NostrbasePrivateTables

/** Personal tables: ciphertext is public, plaintext is available only to its author. */
declare class NostrbasePrivateTables<
  DB extends SchemaShape<DB>,
> implements QueryHost {}

constructor

constructor(host: NostrbaseClient<DB>);

from

from<K extends keyof DB & string>(table: K): QueryBuilder<DB[K]>;

decode

decode<T extends object>(event: NostrEvent, table: string): Promise<Row<T> | null>;

execute

execute<T extends object>(
  table: string,
  state: QueryState,
): Promise<Result<Row<T>[]>>;

subscribe

subscribe<K extends keyof DB & string>(
  table: K,
  callback: (change: ChangePayload<DB[K]>) => void,
  onError?: (error: NostrbaseError) => void,
): Promise<{
  unsubscribe(): void;
}>;

close

close(): void;

Search guides, API methods, and protocols.