Documentation ¶
Index ¶
- func CryptRead(rd io.Reader, g KeyGenerator, passwd []byte) ([]byte, error)
- func CryptReadFile(name string, g KeyGenerator, passwd []byte) ([]byte, error)
- func CryptWrite(wr io.Writer, g KeyGenerator, passwd, data []byte) error
- func CryptWriteFile(name string, g KeyGenerator, passwd, data []byte) error
- func ReadAuthCreds(rd io.Reader, ac *AuthCreds) (err error)
- func ReadAuthCredsFile(name string, ac *AuthCreds) error
- func WriteAuthCreds(wr io.Writer, ac *AuthCreds) (err error)
- func WriteAuthCredsFile(name string, ac *AuthCreds) error
- type Argon2idKeyGen
- type AuthCreds
- type BasicAuth
- type CertConfig
- type KeyGenerator
- type TLSServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CryptReadFile ¶
func CryptReadFile(name string, g KeyGenerator, passwd []byte) ([]byte, error)
func CryptWrite ¶
func CryptWrite(wr io.Writer, g KeyGenerator, passwd, data []byte) error
func CryptWriteFile ¶
func CryptWriteFile(name string, g KeyGenerator, passwd, data []byte) error
func ReadAuthCredsFile ¶
func WriteAuthCredsFile ¶
Types ¶
type Argon2idKeyGen ¶
type AuthCreds ¶
type AuthCreds struct {
// contains filtered or unexported fields
}
func NewAuthCreds ¶
func NewAuthCreds(keyGen KeyGenerator) *AuthCreds
func (*AuthCreds) CheckString ¶
type BasicAuth ¶
type BasicAuth struct { Realm string Creds *AuthCreds `json:"-"` FailMinDelay time.Duration FailMaxDelay time.Duration FailMsg func(user string, rq *http.Request) SuccessMsg func(user string, rq *http.Request) }
func (*BasicAuth) Protect ¶
func (ba *BasicAuth) Protect(h http.HandlerFunc) http.HandlerFunc
type CertConfig ¶
type KeyGenerator ¶
type KeyGenerator interface { // When salt is not nil, Generate takes passwd and salt and derives a key // from them returning also the given salt. If salt is nil, Generate first // creates a random salt and then derives the key returing also the new // salt. Generate(passwd, salt []byte) (key, nsalt []byte, err error) }
type TLSServer ¶
type TLSServer struct { Addr string CertFile string KeyFile string KeyGen KeyGenerator }
func (*TLSServer) ListenAndServe ¶
Inspred by https://gist.github.com/tjamet/c9a53127c9bec54f62ed94685de85875
Click to show internal directories.
Click to hide internal directories.