https://github.com/tinywasm/user
user management library
https://github.com/tinywasm/user
Last synced: 2 months ago
JSON representation
user management library
- Host: GitHub
- URL: https://github.com/tinywasm/user
- Owner: tinywasm
- License: mit
- Created: 2026-02-19T17:00:45.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-04-03T02:56:35.000Z (3 months ago)
- Last Synced: 2026-04-03T08:55:47.167Z (3 months ago)
- Language: Go
- Size: 230 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# tinywasm/user

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.
## Documentation
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — What & Why: schema, contracts, design principles
- [docs/SKILL.md](docs/SKILL.md) — API contract, configuration, UI modules, and usage snippets
> **Note**: RBAC is now integrated into the User module (see ARCHITECTURE.md).
## Diagrams
- [docs/diagrams/AUTH_FLOW.md](docs/diagrams/AUTH_FLOW.md) — Local login credential validation
- [docs/diagrams/SESSION_FLOW.md](docs/diagrams/SESSION_FLOW.md) — Session lifecycle
- [docs/diagrams/USER_CRUD_FLOW.md](docs/diagrams/USER_CRUD_FLOW.md) — User creation pipeline
- [docs/diagrams/OAUTH_FLOW.md](docs/diagrams/OAUTH_FLOW.md) — OAuth begin/callback flow (all branches)
- [docs/diagrams/LAN_AUTH_FLOW.md](docs/diagrams/LAN_AUTH_FLOW.md) — LAN login: RUT validation + IP allowlist check
- [docs/diagrams/LAN_IP_FLOW.md](docs/diagrams/LAN_IP_FLOW.md) — LAN IP management: RegisterLAN, AssignLANIP, RevokeLANIP, GetLANIPs, UnregisterLAN
## Initialization
```go
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](docs/SKILL.md).
## Status
> Implementation pending. Documentation complete.