Documentation ¶
Index ¶
- Constants
- Variables
- func CreateBegin(w http.ResponseWriter, r *http.Request)
- func CreateFinish(w http.ResponseWriter, r *http.Request)
- func GenerateSecureKey(n int) ([]byte, error)
- func Init()
- func SignCSR(w http.ResponseWriter, r *http.Request)
- type AuthKeyRequest
- type CSRRequest
- type CertificateResponse
- type Store
- func (store *Store) GetWebauthnSession(key string, r *http.Request) (webauthn.SessionData, error)
- func (store *Store) SaveWebauthnSession(key string, data *webauthn.SessionData, r *http.Request, w http.ResponseWriter) error
- func (store *Store) Set(sessionName string, age int, key string, value interface{}, r *http.Request, ...) error
Constants ¶
const DefaultEncryptionKeyLength = 32
DefaultEncryptionKeyLength is the length of the generated encryption keys used for session management.
const UserSession = "user-session"
const UserSessionMaxAge = 30 // 30 seconds
const WebauthnSession = "webauthn-session"
Two sessions, one for webauthn registration/login, one for persisting login after webauthn is done
const WebauthnSessionMaxAge = 30 // 30 seconds
Variables ¶
var ErrInsufficientBytesRead = errors.New("insufficient bytes read")
ErrInsufficientBytesRead is returned in the rare case that an unexpected number of bytes are returned from the crypto/rand reader when creating session cookie encryption keys.
var ErrMarshal = errors.New("error unmarshaling data")
ErrMarshal is returned if unexpected data is present in a webauthn session.
Functions ¶
func CreateBegin ¶
func CreateBegin(w http.ResponseWriter, r *http.Request)
func CreateFinish ¶
func CreateFinish(w http.ResponseWriter, r *http.Request)
func GenerateSecureKey ¶
GenerateSecureKey reads and returns n bytes from the crypto/rand reader
Types ¶
type AuthKeyRequest ¶
type AuthKeyRequest struct {
AuthPublicKey string `json:"authPublicKey"`
}
type CSRRequest ¶
type CSRRequest struct {
CSR string `json:"CSR"`
}
type CertificateResponse ¶
type CertificateResponse struct {
Certificate string `json:"certificate"`
}
type Store ¶
type Store struct {
*sessions.CookieStore
}
Store is a wrapper around sessions.CookieStore which provides some helper methods related to webauthn operations.
func (*Store) GetWebauthnSession ¶
GetWebauthnSession unmarshals and returns the webauthn session information from the session cookie.
func (*Store) SaveWebauthnSession ¶
func (store *Store) SaveWebauthnSession(key string, data *webauthn.SessionData, r *http.Request, w http.ResponseWriter) error
SaveWebauthnSession marhsals and saves the webauthn data to the provided key given the request and responsewriter