-
Notifications
You must be signed in to change notification settings - Fork 3
/
ifaces.go
36 lines (29 loc) · 823 Bytes
/
ifaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package passkey
import (
"github.com/go-webauthn/webauthn/webauthn"
)
// Logger is a simple logger interface
type Logger interface {
Errorf(format string, v ...any)
Debugf(format string, v ...any)
Infof(format string, v ...any)
Warnf(format string, v ...any)
}
// User is a user with webauthn credentials
type User interface {
webauthn.User
PutCredential(webauthn.Credential)
}
// UserStore is a persistent storage for users and credentials
type UserStore interface {
Create(username string) (User, error)
Update(User) error
Get(userID []byte) (User, error)
GetByName(username string) (User, error)
}
// SessionStore is a storage for session data
type SessionStore[T webauthn.SessionData | UserSessionData] interface {
Create(data T) (string, error)
Delete(token string)
Get(token string) (*T, bool)
}