Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateSecureKey(n int) ([]byte, error)
- 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(key string, value interface{}, r *http.Request, w http.ResponseWriter) (err error)
Constants ¶
const DefaultEncryptionKeyLength = 32
DefaultEncryptionKeyLength is the length of the generated encryption keys used for session management.
const WebauthnSession = "webauthn-session"
WebauthnSession is the name of the session cookie used to manage session- related information.
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 GenerateSecureKey ¶
GenerateSecureKey reads and returns n bytes from the crypto/rand reader
Types ¶
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