@undernet/auth-core
v0.1.0
Published
Platform-agnostic auth state machine, JWT utilities, and adapter interfaces.
Readme
@undernet/auth-core
Platform-agnostic auth state machine, JWT helpers, and adapter interfaces for Undernet clients. The session store is a Zustand factory that accepts adapters for token storage, async prefs, the HTTP backend, biometric / WebAuthn ceremonies, and OS lifecycle events.
The mobile app composes this against @undernet/auth-expo; web clients
compose against their own browser-side adapters.
Install
bun add @undernet/auth-corePublic API
- JWT helpers:
decodeJwt,getUserIdFromToken,getUsernameFromToken - Adapter interfaces:
ISecureStorageIAsyncStorageIAppStateListener(+AppLifecycleState)ICredentialCeremony(+ WebAuthn-shaped challenge / assertion types)IAuthBackend
- Factory wrappers:
createTokenStorage(ISecureStorage): ITokenStoragecreateCurrentUserStore(IAsyncStorage): ICurrentUserStorecreateBiometricPref(IAsyncStorage): IBiometricPrefcreateBootstrap(deps): IBootstrapcreateSessionStore(deps): { useSessionStore, __resetForTests }
- State machine types:
SessionStatus,SessionState,SessionStore,BootstrapResult,SignOutOptions
License
MIT — see LICENSE.
Repository
https://github.com/empus/undernet-mobile
