webtyp/user is the stable identity value shared by webtyp/auth and
webtyp/rbac. It contains no router, no persistence, and no policy.
- Stable values only:
SubjectIDandSubject. - No service: authentication sessions and RBAC decisions live in siblings.
- WASM-safe: the root imports no database or provider packages.
package user
type SubjectID string
type Subject struct {
ID SubjectID
Email string
Name string
Avatar string
}
// Encode/Decode helpers for typed transport (model.FieldWriter/Reader) may
// be provided; no other exported API.import (
"webtyp.com/user"
"webtyp.com/auth/authority"
"webtyp.com/rbac"
)
// auth resolves a Subject
var _ auth.SubjectStore = (*authority.Module)(nil) // returns user.Subject
// rbac evaluates by SubjectID
rb.Can(string(s.ID), resource, action)
// or rb.Can(string(user.SubjectID), ...) when typedauth.SubjectStore.GetOrCreateSubject and auth.SessionIssuer.IssueSession
use user.SubjectID; rbac.Service.Can accepts the same identifier as
plain string to stay dependency-minimal while representing user.SubjectID.
user.SubjectIDis the only cross-library person reference.- Auth owns creating/resolving
Subject; rbac owns storing/evaluating assignments bySubjectID.