User management library for the tinywasm ecosystem. Handles user entities,
password authentication, OAuth providers (Google, Microsoft), LAN (local network)
authentication by RUT + IP, and session management.
Applications import tinywasm/user directly to configure session behaviour, and use its
isomorphic UI modules for authentication workflows.
- docs/ARCHITECTURE.md — What & Why: schema, contracts, design principles
- docs/SKILL.md — API contract, configuration, UI modules, and usage snippets
Note: RBAC is now integrated into the User module (see ARCHITECTURE.md).
- docs/diagrams/AUTH_FLOW.md — Local login credential validation
- docs/diagrams/SESSION_FLOW.md — Session lifecycle
- docs/diagrams/USER_CRUD_FLOW.md — User creation pipeline
- docs/diagrams/OAUTH_FLOW.md — OAuth begin/callback flow (all branches)
- docs/diagrams/LAN_AUTH_FLOW.md — LAN login: RUT validation + IP allowlist check
- docs/diagrams/LAN_IP_FLOW.md — LAN IP management: RegisterLAN, AssignLANIP, RevokeLANIP, GetLANIPs, UnregisterLAN
import "github.com/tinywasm/user"
// ...
// Initialize the user module directly with an ORM db instance
err := user.Init(db, user.Config{
CookieName: "session_id", // default: "session"
TokenTTL: 86400, // default: 86400 (24h)
TrustProxy: true, // default: false
OAuthProviders: []user.OAuthProvider{
&user.GoogleProvider{
ClientID: os.Getenv("GOOGLE_CLIENT_ID"),
ClientSecret: os.Getenv("GOOGLE_CLIENT_SECRET"),
RedirectURL: "https://example.com/oauth/callback",
},
},
})
if err != nil {
// handle error
}For detailed API usage and module integration guidance, refer to docs/SKILL.md.
Implementation pending. Documentation complete.