Documentation
    Preparing search index...

    Variable originRegistryConst

    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;
    } = ...

    Bidirectional registry mapping Window references to windowId strings. Optionally stores NIP-5D identity metadata (dTag and aggregateHash) per window.

    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

    import { originRegistry } from '@kehto/shell';

    originRegistry.register(iframe.contentWindow, 'napp-1');
    const id = originRegistry.getWindowId(iframe.contentWindow); // 'napp-1'