Documentation
    Preparing search index...

    Function buildShellCapabilities

    • Build the shell's static capability set from adapter configuration.

      Returns the conformant NAP-SHELL domains/protocols shape (consumed by @napplet/shim >=0.13 via @napplet/nap@0.12's createShellEnvironment + makeSupports) alongside the flat naps array (consumed by @napplet/shim >=0.9.0) and the sandbox array.

      Bare domain inc + inc:NAP-01..inc:NAP-06. Conditional: relay+outbox prepended when hooks.relayPool; upload appended when hooks.upload; intent appended when hooks.intent.isAvailable(); link appended when hooks.link.isAvailable(); common appended when hooks.common.isAvailable().

      Sandbox permissions are left empty by default — host apps may extend after construction. Sandbox entries (and any host-app extensions) MUST use the canonical perm:<permission> form — e.g. 'perm:popups', 'perm:modals', 'perm:downloads'. Napplets rely on the perm: prefix to distinguish sandbox permissions from NAP-capability lookups; see the living NIP-5D at https://github.com/nostr-protocol/nips/pull/2303/

      The structured shape the released @napplet/shim@0.13 actually reads via @napplet/nap@0.12's createShellEnvironment + makeSupports:

      • domains — bare NAP domain names (the naps set MINUS the inc:NAP-NN protocol strings) with the same conditional entries (relay/outbox under hooks.relayPool, upload/intent/link/common under their hooks). Any perm:<x> sandbox entries are appended here too — the 0.13 shim resolves supports('perm:<x>') as a plain domains membership check.
      • protocols{ inc: ['NAP-01'..'NAP-06'] }, derived from NAP_INC_PROTOCOLS by stripping the inc: prefix.

      Emitted as a SUPERSET alongside naps/sandbox (TERM-05 back-compat).

      Parameters

      • hooks: ShellAdapter

        The ShellAdapter provided by the host app

      Returns ShellCapabilities

      ShellCapabilities with domains/protocols (conformant 0.13 shape) plus naps (NAP vocab) and sandbox (perm:-prefixed) arrays

      const caps = buildShellCapabilities(hooks);
      // caps.domains => ['relay','outbox','identity','storage','inc','theme','keys','media','notify','config','resource','cvm']
      // (relay + outbox present when hooks.relayPool is provided; 'upload'/'intent'
      // appended under their hooks; perm:<x> sandbox entries appended when extended)
      // caps.protocols => { inc: ['NAP-01','NAP-02','NAP-03','NAP-04','NAP-05','NAP-06'] }
      // caps.naps => ['relay','outbox','identity','storage','inc','theme','keys','media','notify','config','resource','cvm',
      // 'inc:NAP-01','inc:NAP-02','inc:NAP-03','inc:NAP-04','inc:NAP-05','inc:NAP-06']
      // (relay + outbox present when hooks.relayPool is provided; 'upload'
      // appended when hooks.upload is provided; 'intent' appended when
      // hooks.intent.isAvailable() is true)
      // caps.sandbox => [] // host app may extend with 'perm:popups', etc.