Skip to content

API ​

createSigport ​

ts
import { createSigport } from '@sigport/core';
const sigport = createSigport(options);
OptionTypeDefault
adaptersAdapter[]required. all() gives every built-in one
includestring[]keep only these ids
excludestring[]drop these ids
app{ name, url?, image? }{ name: 'sigport', url: location.origin }
storageStorageLike | nulllocalStorage; null remembers nothing
namespacestring'sigport', so accounts are kept at sigport:accounts:v1
messagesRecord<code, string>error sentences to override
plan(detected) => PlanplanSignIn
scopePageScopeglobalThis
waitMsnumber300: how long wallets get to announce themselves
onSignIn(account) => void
onSignOut() => void

Nothing touches the page until detect() runs, so a session is safe to create during server rendering.

Session ​

MemberDoes
getState()The current state
subscribe(listener)Calls listener(state) on every change; returns the unsubscribe
detect()Reads the page once and plans the list; later calls return the first result
recheck()Reads the page again
choose(id)What a row does: one-click sign-in, or open the view or catalog
openCatalog(id)Opens an adapter's list of apps
back()Back to the list; stops pairing
run(actionId, values)Runs an action of the open view
startPairing()Shows the open view's pairing code and waits for the signer
signInWith(account)Signs in with an account made elsewhere
resume(account)Signs in with a remembered account, unlocking it if needed
signOut()Signs out; the account stays remembered
forget(account)Drops a remembered account
dismissError()Clears the error
adapter(id), viewOf(id)An adapter and its resolved view
adapters, manager, appThe adapters in use, applesauce's AccountManager, the app info
destroy()Stops listening

State ​

FieldType
status'idle' | 'detecting' | 'ready'
plan{ shown: PlannedOption[], others: PlannedOption[] } | null
availabilityRecord<id, 'ready' | 'missing' | 'outdated' | 'unsupported'>
installedRecord<id, string[]>: catalog apps found in the page
screen{ name: 'list' } | { name: 'view', adapter } | { name: 'catalog', adapter } | { name: 'unlock', adapter, account }
pairing{ uri } | null
busyboolean
errorstring | null, in plain words
accountsremembered IAccount[], throwaways excluded
activeIAccount | null

all ​

ts
import { all, BUILT_IN_IDS } from '@sigport/core/all';
all({ include?, exclude?, extension?, remote?, metamask?, passkey?, local?, guest? });

Returns the built-in adapters in kernl's order (extension, remote, metamask, onekey, okx, passkey, local, readonly, guest), each with its options.

defineAdapter ​

Returns the adapter you give it, typed. See Writing an adapter.

planSignIn ​

ts
planSignIn(detected: { id, kind, availability, links? }[]): { shown, others }

The ranking, as a pure function.

Presentation helpers ​

HelperReturns
describeRows(sigport, state){ shown: Row[], others: Row[] } ready to draw
describeRow(sigport, option, state)One Row
describeCatalog(sigport, id, state)An adapter's apps, installed ones first
describeAccount(account){ name, via }
describeError(reason, messages?)A sentence

Accounts ​

Export
createAccounts({ storage, namespace, types })applesauce AccountManager, restored and saved
SafeAccountManagerrefuses nsec and seed-words accounts
PLAINTEXT_KEY_ACCOUNT_TYPES['nsec', 'seed-words']
checkedWalletKey, checkedWalletEventverify what a wallet returns
WalletProviderSignera signer over any NIP-07-shaped provider

Elements ​

Export from @sigport/elements
SigportSignInthe panel class (registers nothing)
SigportButtonthe button-and-dialog class
DEFAULT_STRINGSevery word the panel shows
graphitethe stylesheet

@sigport/elements/define registers <sigport-signin> and <sigport-button> with every built-in adapter.

Attributes: app-name, include, exclude, snap-id, relays, namespace, theme, bare, hide-footer. Properties: sigport, strings. Events: sigport-signin (detail.account), sigport-signout.

MIT licensed.