kernl API
    Preparing search index...

    Function createAuthHooks

    • kehto AuthHooks over the applesauce AccountManager.

      getSigner returns null while nobody is signed in and for read-only accounts, so the runtime refuses writes instead of failing inside a signer that throws. When kehto names the requesting window, the signer it gets back puts every signEvent through consent first, so a destructive write an applet asks for is shown to the user and signed only on yes (kehto's runtime signs applet publishes here and asks nobody). Without a window the shell is signing for itself and the plain signer is returned.

      Parameters

      • accounts: AccountManager

        The shell's account manager.

      • consent: SigningConsent

        The gate from createSigningConsent.

      Returns AuthHooks

      Hooks for ShellAdapter.auth.

      const auth = createAuthHooks(accounts, consent);
      auth.getUserPubkey(); // hex pubkey or null
      await auth.getSigner('applet-1')?.signEvent?.(profileTemplate); // asks the user first