Documentation
¶
Overview ¶
Package auth provides in-memory user credentials and role-based action permissions, modeled on FameView (杰控) 用户权限: operators, engineers and admins with gated actions. Credentials are salted SHA-256 hashes; the package depends only on the standard library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an in-memory set of users keyed by name.
func (*Store) AddUser ¶
AddUser registers a new user with the given role. The name must be non-empty and not already present. The password is stored as a salted hash.
func (*Store) Authenticate ¶
Authenticate returns the user and true when name exists and password matches. The stored hash is compared in constant time; a missing user still performs a hash so timing does not reveal whether the account exists.
func (*Store) SetPassword ¶
SetPassword replaces an existing user's password, generating a fresh salt.