forked from pterodactyl/sftp-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
credentials.go
32 lines (26 loc) · 975 Bytes
/
credentials.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
package main
// AuthenticationRequest ... An authentication request to the SFTP server.
type AuthenticationRequest struct {
User string `json:"username"`
Pass string `json:"password"`
IP string `json:"ip"`
SessionID []byte `json:"session_id"`
ClientVersion []byte `json:"client_version"`
}
// AuthenticationResponse ... An authentication response from the SFTP server.
type AuthenticationResponse struct {
Server string `json:"server"`
Token string `json:"token"`
Permissions []string `json:"permissions"`
}
// InvalidCredentialsError ... An error emitted when credentials are invalid.
type InvalidCredentialsError struct {
}
func (ice InvalidCredentialsError) Error() string {
return "the credentials provided were invalid"
}
// IsInvalidCredentialsError ... Checks if an error is a InvalidCredentialsError.
func IsInvalidCredentialsError(err error) bool {
_, ok := err.(*InvalidCredentialsError)
return ok
}