Documentation
¶
Index ¶
- type Backend
- type FirestoreBackend
- func (backend *FirestoreBackend) GetCredential(ctx context.Context, credentialID []byte) (*webauthn.Credential, error)
- func (backend *FirestoreBackend) SetAuthenticateRequest(ctx context.Context, req *WebAuthnAuthenticateRequest) error
- func (backend *FirestoreBackend) SetCredential(ctx context.Context, credential *webauthn.Credential) error
- func (backend *FirestoreBackend) SetRegisterRequest(ctx context.Context, req *WebAuthnRegisterRequest) error
- type InMemoryBackend
- func (backend *InMemoryBackend) GetCredential(ctx context.Context, credentialID []byte) (*webauthn.Credential, error)
- func (backend *InMemoryBackend) SetAuthenticateRequest(ctx context.Context, req *WebAuthnAuthenticateRequest) error
- func (backend *InMemoryBackend) SetCredential(ctx context.Context, credential *webauthn.Credential) error
- func (backend *InMemoryBackend) SetRegisterRequest(ctx context.Context, req *WebAuthnRegisterRequest) error
- type WebAuthnAuthenticateRequest
- type WebAuthnRegisterRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { GetCredential(ctx context.Context, credentialID []byte) (*webauthn.Credential, error) SetAuthenticateRequest(ctx context.Context, req *WebAuthnAuthenticateRequest) error SetCredential(ctx context.Context, credential *webauthn.Credential) error SetRegisterRequest(ctx context.Context, req *WebAuthnRegisterRequest) error }
A Backend stores credentials and requests.
type FirestoreBackend ¶
type FirestoreBackend struct {
// contains filtered or unexported fields
}
FirestoreBackend is used to store data in firestore.
func NewFirestoreBackend ¶
func NewFirestoreBackend(client *firestore.Client) *FirestoreBackend
NewFirestoreBackend creates a new Firestore backend.
func (*FirestoreBackend) GetCredential ¶
func (backend *FirestoreBackend) GetCredential(ctx context.Context, credentialID []byte) (*webauthn.Credential, error)
GetCredential gets a WebAuthn credential from storage.
func (*FirestoreBackend) SetAuthenticateRequest ¶
func (backend *FirestoreBackend) SetAuthenticateRequest(ctx context.Context, req *WebAuthnAuthenticateRequest) error
SetAuthenticateRequest sets a WebAuthn authenticate request in storage.
func (*FirestoreBackend) SetCredential ¶
func (backend *FirestoreBackend) SetCredential(ctx context.Context, credential *webauthn.Credential) error
SetCredential sets a WebAuthn credential in storage.
func (*FirestoreBackend) SetRegisterRequest ¶
func (backend *FirestoreBackend) SetRegisterRequest(ctx context.Context, req *WebAuthnRegisterRequest) error
SetRegisterRequest sets a WebAuthn register request in storage.
type InMemoryBackend ¶
type InMemoryBackend struct {
// contains filtered or unexported fields
}
A InMemoryBackend stores data in-memory.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates a new InMemoryBackend.
func (*InMemoryBackend) GetCredential ¶
func (backend *InMemoryBackend) GetCredential(ctx context.Context, credentialID []byte) (*webauthn.Credential, error)
GetCredential retrieves a credential.
func (*InMemoryBackend) SetAuthenticateRequest ¶
func (backend *InMemoryBackend) SetAuthenticateRequest(ctx context.Context, req *WebAuthnAuthenticateRequest) error
SetAuthenticateRequest is a no-op.
func (*InMemoryBackend) SetCredential ¶
func (backend *InMemoryBackend) SetCredential(ctx context.Context, credential *webauthn.Credential) error
SetCredential saves a credential.
func (*InMemoryBackend) SetRegisterRequest ¶
func (backend *InMemoryBackend) SetRegisterRequest(ctx context.Context, req *WebAuthnRegisterRequest) error
SetRegisterRequest is a no-op.
type WebAuthnAuthenticateRequest ¶
type WebAuthnAuthenticateRequest struct { Options *webauthn.PublicKeyCredentialRequestOptions `json:"options"` Credential *webauthn.PublicKeyAssertionCredential `json:"credential"` }
WebAuthnAuthenticateRequest is the authenticate request info and credential.
func (WebAuthnAuthenticateRequest) GetID ¶
func (req WebAuthnAuthenticateRequest) GetID() string
GetID gets the ID for the request.
type WebAuthnRegisterRequest ¶
type WebAuthnRegisterRequest struct { Options *webauthn.PublicKeyCredentialCreationOptions `json:"options"` Credential *webauthn.PublicKeyCreationCredential `json:"credential"` }
WebAuthnRegisterRequest is the register request info and credential.
func (WebAuthnRegisterRequest) GetID ¶
func (req WebAuthnRegisterRequest) GetID() string
GetID gets the ID for the request.