mocku2f

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key struct {
	KeyHandle  []byte
	PrivateKey *ecdsa.PrivateKey

	// Cert is the Key attestation certificate.
	Cert []byte

	// PreferRPID instructs the Key to use favor using the RPID for Webauthn
	// ceremonies, even if the U2F App ID extension is present.
	PreferRPID bool
	// IgnoreAllowedCredentials allows the Key to sign a Webauthn
	// CredentialAssertion even it its KeyHandle is not among the allowed
	// credentials.
	IgnoreAllowedCredentials bool
	// SetUV sets the UV (user verification) bit on signatures if true.
	// SetUV should be paired only with WebAuthn login/registration methods, as
	// it makes Key mimic a WebAuthn device.
	SetUV bool
	// AllowResidentKey allows creation of resident credentials.
	// There's no actual change in Key's behavior other than allowing such requests
	// to proceed.
	// AllowResidentKey should be paired only with WebAuthn registration methods,
	// as it makes Key mimic a WebAuthn device.
	AllowResidentKey bool
	// contains filtered or unexported fields
}

func Create

func Create() (*Key, error)

func CreateWithKeyHandle

func CreateWithKeyHandle(keyHandle []byte) (*Key, error)

func (*Key) AuthenticateRaw

func (muk *Key) AuthenticateRaw(appHash, challengeHash []byte) ([]byte, error)

AuthenticateRaw signs low-level U2F authentication data. Most callers should use either SignResponse or SignAssertion.

func (*Key) Counter

func (muk *Key) Counter() uint32

func (*Key) RegisterRaw

func (muk *Key) RegisterRaw(appHash, challengeHash []byte) ([]byte, error)

RegisterRaw signs low-level U2F registration data. Most callers should use either RegisterResponse or SignCredentialCreation.

func (*Key) SetCounter

func (muk *Key) SetCounter(counter uint32)

func (*Key) SetPasswordless

func (muk *Key) SetPasswordless()

SetPasswordless sets common passwordless options in Key. Options are AllowResidentKey, IgnoreAllowedCredentials and SetUV.

func (*Key) SignAssertion

func (muk *Key) SignAssertion(origin string, assertion *wantypes.CredentialAssertion) (*wantypes.CredentialAssertionResponse, error)

SignAssertion signs a WebAuthn assertion following the U2F-compat-getAssertion algorithm.

func (*Key) SignCredentialCreation

func (muk *Key) SignCredentialCreation(origin string, cc *wantypes.CredentialCreation) (*wantypes.CredentialCreationResponse, error)

SignCredentialCreation signs a WebAuthn credential creation request following the U2F-compat-makeCredential algorithm.

Jump to

Keyboard shortcuts

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