Documentation
    Preparing search index...

    Interface OriginRegistry

    Registry mapping each shell-created iframe Window to its windowId, verified NIP-5D identity, and the MessagePort bound by its single napplet.hello. The Window is only used to authenticate the hello; all NAP traffic uses the bound port (NIP-5D, nostr-protocol/nips#2303).

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

    originRegistry.register(iframe.contentWindow, 'napp-1');
    const id = originRegistry.getWindowId(iframe.contentWindow); // 'napp-1'
    interface OriginRegistry {
        bindPort(windowId: string, port: MessagePort): boolean;
        clear(): void;
        getAllWindowIds(): string[];
        getEnvironment(win: Window): ShellEnvironment | undefined;
        getIdentity(win: Window): OriginIdentity | undefined;
        getIframeWindow(windowId: string): Window | null;
        getNappletTarget(windowId: string): NappletMessageTarget | null;
        getPort(windowId: string): MessagePort | undefined;
        getRegistrationId(win: Window): number | undefined;
        getWindowId(win: Window): string | undefined;
        isSpent(win: Window): boolean;
        postToNapplet(windowId: string, message: unknown): boolean;
        register(win: Window, windowId: string, identity?: OriginIdentity): void;
        setEnvironment(win: Window, environment: ShellEnvironment): void;
        unregister(windowId: string): void;
    }
    Index

    Methods