An open API service indexing awesome lists of open source software.

https://github.com/tinywasm/user

user management library
https://github.com/tinywasm/user

Last synced: 2 months ago
JSON representation

user management library

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.