nostrbasedocs
Start building
API reference
.md

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

NostrbaseAuth

declare class NostrbaseAuth {}

Properties

get revision(): number;
/** Replaced on every auth revision. The previous signal aborts before pending sign-in work. */
get revisionSignal(): AbortSignal;
/** @internal True when the current auth transition has completed, including failed sign-in. */
get revisionSettled(): boolean;

onRevisionSettled

/** @internal Observe completed auth transitions without emitting a public successful sign-in. */
onRevisionSettled(callback: () => void): {
  unsubscribe(): void;
};

constructor

constructor(signer?: Signer);

signInWithSigner

signInWithSigner(signer: Signer): Promise<Result<Session>>;

signInWithExtension

signInWithExtension(): Promise<Result<Session>>;

signInWithPrivateKey

signInWithPrivateKey(key: Uint8Array | string): Promise<Result<Session>>;

exportKey

/** Export only a password-encrypted NIP-49 key from the active local PrivateKeySigner. */
exportKey(password: string, options?: KeyEncryptionOptions): Promise<Result<string>>;

signInWithEncryptedKey

/** Recover a local signer from a password-encrypted NIP-49 key without exposing raw bytes. */
signInWithEncryptedKey(
  ncryptsec: string,
  password: string,
  options?: KeyDecryptionOptions,
): Promise<Result<Session>>;

getSession

getSession(): Promise<Result<Session>>;

getUser

getUser(): Promise<Result<User>>;

signOut

signOut(): Promise<Result<null>>;

onAuthStateChange

onAuthStateChange(callback: (event: AuthChange, session: Session | null) => void): {
  data: {
    subscription: {
      unsubscribe(): void;
    };
  };
};

requireSigner

requireSigner(): Promise<{
  signer: Signer;
  session: Session;
}>;

dispose

dispose(): void;

Search guides, API methods, and protocols.