authenticator

package
v0.0.0-...-c41ce58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssertionInternalResponse

type AssertionInternalResponse struct {
	AuthenticatorData protocol.URLEncodedBase64 `json:"authenticatorData"`
	ClientDataJSON    protocol.URLEncodedBase64 `json:"clientDataJSON"`
	Signature         protocol.URLEncodedBase64 `json:"signature"`
}

AssertionInternalResponse holds the internal data of an assertion response.

type AssertionResponse

type AssertionResponse struct {
	ID       string                    `json:"id"`
	RawID    string                    `json:"rawId"`
	Type     string                    `json:"type"`
	Response AssertionInternalResponse `json:"response"`
}

AssertionResponse holds an assertion response.

type MockAuthenticator

type MockAuthenticator struct {
	CredSources map[string]*pubKeyCredSource
}

MockAuthenticator is a functional mock of a webauthn/FIDO authenticator device.

It supports fido-u2f attestation and assertion, using the P256 curve, with direct attestation,
using a provided CA certificate and private key to serve as an Attestation CA.

func New

func New() *MockAuthenticator

New creates a MockAuthenticator.

func (*MockAuthenticator) Assert

func (ma *MockAuthenticator) Assert(requesterOrigin string, params *protocol.PublicKeyCredentialRequestOptions) ([]byte, error)

Assert creates a credential assertion for a relying party that's already registered via Authenticate. Returns a JSON object containing the assertion response.

func (*MockAuthenticator) Authenticate

func (ma *MockAuthenticator) Authenticate(parentCertPath, parentKeyPath, requesterOrigin string, params *protocol.CredentialCreation) ([]byte, error)

Authenticate generates a webauthn credential based on the provided parameters, signed by the given parent CA. Returns a JSON object containing the authentication response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL