Versions in this module Expand all Collapse all v0 v0.1.1 Apr 22, 2024 v0.1.0 Apr 21, 2024 Changes in this version + type Action string + const ActionAny + const ActionDelete + const ActionRead + const ActionWrite + func ActionFromString(act string) (Action, error) + type Invite struct + CreatedAt time.Time + Expires time.Time + ID uint64 + PublicKey string + Token string + UUID string + User *User + func Invites(ctx context.Context, d types.Querier, filter *types.Filter) ([]*Invite, error) + func NewInvite(user *User, ttl time.Duration, uuidgen func() string, encryptionKey *[32]byte) (*Invite, error) + func (inv *Invite) Delete(ctx context.Context, d types.Querier) error + func (inv *Invite) Load(ctx context.Context, d types.Querier) error + func (inv *Invite) PrivateKey(encryptionKey *[32]byte) (*ecdh.PrivateKey, error) + func (inv *Invite) Save(ctx context.Context, d types.Querier, update bool) error + func (inv *Invite) TokenComposite() (string, error) + type Permission struct + Actions map[Action]struct{} + Namespaces map[string]struct{} + Target PermissionTarget + func (p *Permission) UnmarshalText(text []byte) error + func (p Permission) MarshalText() ([]byte, error) + type PermissionTarget struct + Patterns []string + Resource Resource + type Remote struct + Address string + CreatedAt time.Time + ID uint64 + Name string + TLSCACert string + TLSServerSAN string + func NewRemote(name, address, tlsCACert, tlsServerSAN string, ...) *Remote + func Remotes(ctx context.Context, d types.Querier, filter *types.Filter) ([]*Remote, error) + func (r *Remote) ClientTLSConfig(encKey *[32]byte) (*tls.Config, error) + func (r *Remote) Delete(ctx context.Context, d types.Querier) error + func (r *Remote) Load(ctx context.Context, d types.Querier) error + func (r *Remote) Save(ctx context.Context, d types.Querier, update bool) error + type Resource string + const ResourceAny + const ResourceRole + const ResourceStore + const ResourceUser + func ResourceFromString(res string) (Resource, error) + type Role struct + ID uint64 + Name string + Permissions []Permission + func Roles(ctx context.Context, d types.Querier, filter *types.Filter) ([]*Role, error) + func (r *Role) Can(action, target string) (bool, error) + func (r *Role) Delete(ctx context.Context, d types.Querier, force bool) error + func (r *Role) Load(ctx context.Context, d types.Querier) error + func (r *Role) Save(ctx context.Context, d types.Querier, update bool) error + type User struct + ID uint64 + Name string + PrivateKey *[32]byte + PrivateKeyHashEnc sql.Null[string] + PublicKey *[32]byte + Roles []*Role + Type UserType + func Users(ctx context.Context, d types.Querier, filter *types.Filter) ([]*User, error) + func (u *User) Can(action, target string) (bool, error) + func (u *User) Delete(ctx context.Context, d types.Querier) error + func (u *User) Load(ctx context.Context, d types.Querier) error + func (u *User) Save(ctx context.Context, d types.Querier, update bool) error + type UserType uint8 + const UserTypeLocal + const UserTypeRemote