Documentation
    Preparing search index...

    Interface BrowserDeps

    Browser-specific singletons that the adapter bridges to the runtime. These use browser APIs (Window, localStorage, postMessage, CustomEvent) that the runtime cannot access directly.

    interface BrowserDeps {
        aclStore: {
            block(pubkey: string, dTag: string, aggregateHash: string): void;
            check(
                pubkey: string,
                dTag: string,
                aggregateHash: string,
                capability:
                    | "relay:read"
                    | "relay:write"
                    | "cache:read"
                    | "cache:write"
                    | "hotkey:forward"
                    | "state:read"
                    | "state:write"
                    | "identity:read"
                    | "keys:bind"
                    | "keys:forward"
                    | "media:control"
                    | "notify:send"
                    | "notify:channel"
                    | "theme:read"
                    | "config:read"
                    | "resource:fetch"
                    | "cvm:call"
                    | "outbox:read"
                    | "outbox:write"
                    | "upload:write"
                    | "intent:read"
                    | "intent:write",
            ): boolean;
            clear(): void;
            getAllEntries(): AclEntry[];
            getEntry(
                pubkey: string,
                dTag: string,
                aggregateHash: string,
            ): AclEntry | undefined;
            getStateQuota(pubkey: string, dTag: string, aggregateHash: string): number;
            grant(
                pubkey: string,
                dTag: string,
                aggregateHash: string,
                capability:
                    | "relay:read"
                    | "relay:write"
                    | "cache:read"
                    | "cache:write"
                    | "hotkey:forward"
                    | "state:read"
                    | "state:write"
                    | "identity:read"
                    | "keys:bind"
                    | "keys:forward"
                    | "media:control"
                    | "notify:send"
                    | "notify:channel"
                    | "theme:read"
                    | "config:read"
                    | "resource:fetch"
                    | "cvm:call"
                    | "outbox:read"
                    | "outbox:write"
                    | "upload:write"
                    | "intent:read"
                    | "intent:write",
            ): void;
            isBlocked(pubkey: string, dTag: string, aggregateHash: string): boolean;
            load(): void;
            persist(): void;
            revoke(
                pubkey: string,
                dTag: string,
                aggregateHash: string,
                capability:
                    | "relay:read"
                    | "relay:write"
                    | "cache:read"
                    | "cache:write"
                    | "hotkey:forward"
                    | "state:read"
                    | "state:write"
                    | "identity:read"
                    | "keys:bind"
                    | "keys:forward"
                    | "media:control"
                    | "notify:send"
                    | "notify:channel"
                    | "theme:read"
                    | "config:read"
                    | "resource:fetch"
                    | "cvm:call"
                    | "outbox:read"
                    | "outbox:write"
                    | "upload:write"
                    | "intent:read"
                    | "intent:write",
            ): void;
            unblock(pubkey: string, dTag: string, aggregateHash: string): void;
        };
        audioManager: {
            get count(): number;
            get version(): number;
            clear(): void;
            get(windowId: string): AudioSource | undefined;
            getSources(): Map<string, AudioSource>;
            has(windowId: string): boolean;
            mute(windowId: string, muted: boolean): void;
            register(windowId: string, nappletClass: string, title: string): void;
            unregister(windowId: string): void;
            updateState(windowId: string, update: { title?: string }): void;
        };
        manifestCache: {
            clear(): void;
            get(pubkey: string, dTag: string): ManifestCacheEntry | undefined;
            has(pubkey: string, dTag: string, hash: string): boolean;
            load(): void;
            persist(): void;
            remove(pubkey: string, dTag: string): void;
            set(entry: ManifestCacheEntry): void;
        };
        nappKeyRegistry: {
            clear(): void;
            clearPendingUpdate(windowId: string): void;
            getAllEntries(): SessionEntry[];
            getEntry(pubkey: string): SessionEntry | undefined;
            getPendingUpdate(windowId: string): PendingUpdate | undefined;
            getPubkey(windowId: string): string | undefined;
            getWindowId(pubkey: string): string | undefined;
            isRegistered(windowId: string): boolean;
            register(windowId: string, entry: SessionEntry): void;
            setPendingUpdate(windowId: string, update: PendingUpdate): void;
            unregister(windowId: string): void;
        };
        originRegistry: {
            clear(): void;
            getAllWindowIds(): string[];
            getIdentity(
                win: Window,
            ): { aggregateHash: string; dTag: string } | undefined;
            getIframeWindow(windowId: string): Window | null;
            getWindowId(win: Window): string | undefined;
            register(
                win: Window,
                windowId: string,
                identity?: { aggregateHash: string; dTag: string },
            ): void;
            unregister(windowId: string): void;
        };
    }
    Index

    Properties

    aclStore: {
        block(pubkey: string, dTag: string, aggregateHash: string): void;
        check(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
            capability:
                | "relay:read"
                | "relay:write"
                | "cache:read"
                | "cache:write"
                | "hotkey:forward"
                | "state:read"
                | "state:write"
                | "identity:read"
                | "keys:bind"
                | "keys:forward"
                | "media:control"
                | "notify:send"
                | "notify:channel"
                | "theme:read"
                | "config:read"
                | "resource:fetch"
                | "cvm:call"
                | "outbox:read"
                | "outbox:write"
                | "upload:write"
                | "intent:read"
                | "intent:write",
        ): boolean;
        clear(): void;
        getAllEntries(): AclEntry[];
        getEntry(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
        ): AclEntry | undefined;
        getStateQuota(pubkey: string, dTag: string, aggregateHash: string): number;
        grant(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
            capability:
                | "relay:read"
                | "relay:write"
                | "cache:read"
                | "cache:write"
                | "hotkey:forward"
                | "state:read"
                | "state:write"
                | "identity:read"
                | "keys:bind"
                | "keys:forward"
                | "media:control"
                | "notify:send"
                | "notify:channel"
                | "theme:read"
                | "config:read"
                | "resource:fetch"
                | "cvm:call"
                | "outbox:read"
                | "outbox:write"
                | "upload:write"
                | "intent:read"
                | "intent:write",
        ): void;
        isBlocked(pubkey: string, dTag: string, aggregateHash: string): boolean;
        load(): void;
        persist(): void;
        revoke(
            pubkey: string,
            dTag: string,
            aggregateHash: string,
            capability:
                | "relay:read"
                | "relay:write"
                | "cache:read"
                | "cache:write"
                | "hotkey:forward"
                | "state:read"
                | "state:write"
                | "identity:read"
                | "keys:bind"
                | "keys:forward"
                | "media:control"
                | "notify:send"
                | "notify:channel"
                | "theme:read"
                | "config:read"
                | "resource:fetch"
                | "cvm:call"
                | "outbox:read"
                | "outbox:write"
                | "upload:write"
                | "intent:read"
                | "intent:write",
        ): void;
        unblock(pubkey: string, dTag: string, aggregateHash: string): void;
    }

    Type Declaration

    • block: function
      • Block a napp identity entirely (all capabilities denied).

        Parameters

        • pubkey: string

          The napp's pubkey

        • dTag: string

          The napp's dTag

        • aggregateHash: string

          The napp's build hash

        Returns void

    • check: function
      • Check if a napp identity has a specific capability. Returns true for unknown identities (permissive default).

        Parameters

        • pubkey: string

          The napp's pubkey

        • dTag: string

          The napp's dTag

        • aggregateHash: string

          The napp's build hash

        • capability:
              | "relay:read"
              | "relay:write"
              | "cache:read"
              | "cache:write"
              | "hotkey:forward"
              | "state:read"
              | "state:write"
              | "identity:read"
              | "keys:bind"
              | "keys:forward"
              | "media:control"
              | "notify:send"
              | "notify:channel"
              | "theme:read"
              | "config:read"
              | "resource:fetch"
              | "cvm:call"
              | "outbox:read"
              | "outbox:write"
              | "upload:write"
              | "intent:read"
              | "intent:write"

          The capability to check

        Returns boolean

        True if the capability is granted and the napp is not blocked

    • clear: function
    • getAllEntries: function
    • getEntry: function
      • Get the external ACL entry for a napp identity.

        Parameters

        • pubkey: string

          The napp's pubkey

        • dTag: string

          The napp's dTag

        • aggregateHash: string

          The napp's build hash

        Returns AclEntry | undefined

        The ACL entry, or undefined if no explicit entry exists

    • getStateQuota: function
      • Get the state quota for a napp identity.

        Parameters

        • pubkey: string

          The napp's pubkey

        • dTag: string

          The napp's dTag

        • aggregateHash: string

          The napp's build hash

        Returns number

        The quota in bytes (defaults to DEFAULT_STATE_QUOTA)

    • grant: function
      • Grant a capability to a napp identity.

        Parameters

        • pubkey: string

          The napp's pubkey

        • dTag: string

          The napp's dTag

        • aggregateHash: string

          The napp's build hash

        • capability:
              | "relay:read"
              | "relay:write"
              | "cache:read"
              | "cache:write"
              | "hotkey:forward"
              | "state:read"
              | "state:write"
              | "identity:read"
              | "keys:bind"
              | "keys:forward"
              | "media:control"
              | "notify:send"
              | "notify:channel"
              | "theme:read"
              | "config:read"
              | "resource:fetch"
              | "cvm:call"
              | "outbox:read"
              | "outbox:write"
              | "upload:write"
              | "intent:read"
              | "intent:write"

          The capability to grant

        Returns void

    • isBlocked: function
      • Check if a napp identity is blocked.

        Parameters

        • pubkey: string

          The napp's pubkey

        • dTag: string

          The napp's dTag

        • aggregateHash: string

          The napp's build hash

        Returns boolean

        True if the identity is blocked

    • load: function
    • persist: function
    • revoke: function
      • Revoke a capability from a napp identity.

        Parameters

        • pubkey: string

          The napp's pubkey

        • dTag: string

          The napp's dTag

        • aggregateHash: string

          The napp's build hash

        • capability:
              | "relay:read"
              | "relay:write"
              | "cache:read"
              | "cache:write"
              | "hotkey:forward"
              | "state:read"
              | "state:write"
              | "identity:read"
              | "keys:bind"
              | "keys:forward"
              | "media:control"
              | "notify:send"
              | "notify:channel"
              | "theme:read"
              | "config:read"
              | "resource:fetch"
              | "cvm:call"
              | "outbox:read"
              | "outbox:write"
              | "upload:write"
              | "intent:read"
              | "intent:write"

          The capability to revoke

        Returns void

    • unblock: function
      • Unblock a napp identity.

        Parameters

        • pubkey: string

          The napp's pubkey

        • dTag: string

          The napp's dTag

        • aggregateHash: string

          The napp's build hash

        Returns void

    audioManager: {
        get count(): number;
        get version(): number;
        clear(): void;
        get(windowId: string): AudioSource | undefined;
        getSources(): Map<string, AudioSource>;
        has(windowId: string): boolean;
        mute(windowId: string, muted: boolean): void;
        register(windowId: string, nappletClass: string, title: string): void;
        unregister(windowId: string): void;
        updateState(windowId: string, update: { title?: string }): void;
    }

    Type Declaration

    • get count(): number

      Number of active audio sources.

    • get version(): number

      Current version counter (incremented on every change).

    • clear: function
    • get: function
    • getSources: function
    • has: function
      • Check if a window has a registered audio source.

        Parameters

        • windowId: string

          The window identifier

        Returns boolean

        True if the window has an active audio source

    • mute: function
      • Mute or unmute an audio source and notify the napplet via postMessage.

        Parameters

        • windowId: string

          The window identifier

        • muted: boolean

          True to mute, false to unmute

        Returns void

        audioManager.mute('win-1', true); // mute
        audioManager.mute('win-1', false); // unmute
    • register: function
      • Register a new audio source for a window.

        Parameters

        • windowId: string

          The window identifier

        • nappletClass: string

          The napplet class/type (e.g., 'music-player')

        • title: string

          Human-readable title for the audio source

        Returns void

    • unregister: function
      • Unregister an audio source for a window.

        Parameters

        • windowId: string

          The window identifier to remove

        Returns void

    • updateState: function
      • Update the state of an audio source (e.g., change title).

        Parameters

        • windowId: string

          The window identifier

        • update: { title?: string }

          Partial update with optional title

        Returns void

    manifestCache: {
        clear(): void;
        get(pubkey: string, dTag: string): ManifestCacheEntry | undefined;
        has(pubkey: string, dTag: string, hash: string): boolean;
        load(): void;
        persist(): void;
        remove(pubkey: string, dTag: string): void;
        set(entry: ManifestCacheEntry): void;
    }

    Type Declaration

    nappKeyRegistry: {
        clear(): void;
        clearPendingUpdate(windowId: string): void;
        getAllEntries(): SessionEntry[];
        getEntry(pubkey: string): SessionEntry | undefined;
        getPendingUpdate(windowId: string): PendingUpdate | undefined;
        getPubkey(windowId: string): string | undefined;
        getWindowId(pubkey: string): string | undefined;
        isRegistered(windowId: string): boolean;
        register(windowId: string, entry: SessionEntry): void;
        setPendingUpdate(windowId: string, update: PendingUpdate): void;
        unregister(windowId: string): void;
    }

    Type Declaration

    originRegistry: {
        clear(): void;
        getAllWindowIds(): string[];
        getIdentity(
            win: Window,
        ): { aggregateHash: string; dTag: string } | undefined;
        getIframeWindow(windowId: string): Window | null;
        getWindowId(win: Window): string | undefined;
        register(
            win: Window,
            windowId: string,
            identity?: { aggregateHash: string; dTag: string },
        ): void;
        unregister(windowId: string): void;
    }

    Type Declaration

    • clear: function
    • getAllWindowIds: function
    • getIdentity: function
      • Get identity metadata for a registered Window.

        Parameters

        • win: Window

          The Window reference to look up

        Returns { aggregateHash: string; dTag: string } | undefined

        Identity metadata, or undefined if not registered or no identity set

    • getIframeWindow: function
      • Look up the Window reference for a given windowId.

        Parameters

        • windowId: string

          The window identifier to look up

        Returns Window | null

        The Window reference, or null if not found

    • getWindowId: function
      • Look up the windowId for a given Window reference.

        Parameters

        • win: Window

          The Window reference (typically from event.source)

        Returns string | undefined

        The windowId string, or undefined if not registered

    • register: function
      • Register a window reference with a windowId and optional identity metadata.

        Parameters

        • win: Window

          The iframe's contentWindow reference

        • windowId: string

          The unique identifier for this napplet window

        • Optionalidentity: { aggregateHash: string; dTag: string }

          Optional NIP-5D identity metadata (dTag and aggregateHash)

        Returns void

    • unregister: function
      • Unregister a window by its windowId, removing the mapping.

        Parameters

        • windowId: string

          The window identifier to remove

        Returns void