Getting started
sigport puts a Nostr sign-in panel in your app. It finds what the visitor already has (a browser extension, a wallet, passkey support) and ranks the ways to sign in to match. Every way is an adapter, and you choose which ones to offer.
Install
npm i @sigport/elementsUsing React, Vue, Svelte or Solid? Install @sigport/react, @sigport/vue, @sigport/svelte or @sigport/solid instead. Each one brings the elements and the core with it. See Frameworks.
Add the panel
<script type="module">
import '@sigport/elements/define';
</script>
<sigport-signin app-name="My app"></sigport-signin>That is the whole setup. @sigport/elements/define registers <sigport-signin> and <sigport-button> with every built-in adapter.
If you'd rather show a button that opens the panel in a dialog:
<sigport-button app-name="My app"></sigport-button>Get the account
Both elements fire sigport-signin with the account, and sigport-signout when the visitor signs out:
document.querySelector('sigport-signin').addEventListener('sigport-signin', async (event) => {
const account = event.detail.account;
const note = await account.signEvent({ kind: 1, content: 'hello', tags: [], created_at: Math.floor(Date.now() / 1000) });
});The account is an applesauce IAccount. It has pubkey, signEvent, and nip04 / nip44 encryption when the signer supports it.
Accounts are remembered in localStorage, so a returning visitor finds theirs at the top of the panel. Keys are never stored in the clear: local keys are encrypted with a password (NIP-49), and guest keys live only in memory.