nostrbasedocs
Start building
API reference
.md

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

GroupStateBackupEntry

interface GroupStateBackupEntry {
  key: string;
  value: string;
}

GroupStateBackup

interface GroupStateBackup {
  format: "nostrbase-group-state";
  version: 1;
  namespace: string;
  account: string;
  device: string;
  entries: GroupStateBackupEntry[];
  checksum: string;
}

GroupStateBackupImport

interface GroupStateBackupImport {
  imported: number;
  skipped: number;
}

exportGroupStateBackup

/** Export encrypted Marmot state without exposing plaintext MLS material. */
declare function exportGroupStateBackup(
  adapter: GroupStateAdapter,
  namespace: string,
  account: string,
  device: string,
): Promise<GroupStateBackup>;

importGroupStateBackup

/** Import encrypted state for the same account, namespace, and stable device ID. */
declare function importGroupStateBackup(
  adapter: GroupStateAdapter,
  archive: GroupStateBackup | string,
  namespace: string,
  account: string,
  device: string,
): Promise<GroupStateBackupImport>;

Search guides, API methods, and protocols.