1package sqlite
2
3import (
4 "github.com/charmbracelet/soft-serve/server/auth"
5 "golang.org/x/crypto/ssh"
6)
7
8// UserOptions are options for creating a user.
9type UserOptions struct {
10 // Admin is whether the user is an admin.
11 Admin bool
12 // PublicKeys are the user's public keys.
13 PublicKeys []ssh.PublicKey
14}
15
16// User represents a user.
17type User struct {
18 username string
19 isAdmin bool
20 publicKeys []ssh.PublicKey
21}
22
23var _ auth.User = (*User)(nil)
24
25// IsAdmin implements auth.User.
26func (u *User) IsAdmin() bool {
27 return u.isAdmin
28}
29
30// PublicKeys implements auth.User.
31func (u *User) PublicKeys() []ssh.PublicKey {
32 if u.publicKeys == nil {
33 return []ssh.PublicKey{}
34 }
35
36 return u.publicKeys
37}
38
39// Username implements auth.User.
40func (u *User) Username() string {
41 return u.username
42}