spec

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// User Present flag.
	AuthDataFlag_UserPresent = 1 << iota
	// Reserved for future use.
	AuthDataFlag_RFU1
	// User Verified flag.
	AuthDataFlag_UserVerified
	// Reserved for future use.
	AuthDataFlag_RFU2
	// Reserved for future use.
	AuthDataFlag_RFU3
	// Reserved for future use.
	AuthDataFlag_RFU4
	// Attested credential data included.
	AuthDataFlag_AttestedCredentialData
	// Extension data included.
	AuthDataFlag_ExtensionData
)
View Source
const (
	// ClientDataTypeCreate is the type of a client data for a registration.
	ClientDataTypeCreate = "webauthn.create"

	// ClientDataTypeGet is the type of a client data for an authentication.
	ClientDataTypeGet = "webauthn.get"
)

Variables

View Source
var CertExtID_FidoGenCEAAGUID = []int{1, 3, 6, 1, 4, 1, 45724, 1, 1, 4}

const id-fido-gen-ce-aaguid

Functions

func VerifySignature

func VerifySignature(publicKey crypto.PublicKey, keyType pubkey.KeyType, signature, clientDataJSON, authData []byte) (bool, error)

VerifySignature verifies the signature of an attestation or assertion.

Types

type AttestationObject

type AttestationObject struct {
	AuthData []byte         `cbor:"authData"`
	Fmt      string         `cbor:"fmt"`
	AttStmt  map[string]any `cbor:"attStmt"`
	// contains filtered or unexported fields
}

AttestationObject represents the structure of the attestation object.

func (*AttestationObject) AuthenticatorData

func (o *AttestationObject) AuthenticatorData() (*AuthenticatorData, error)

type AttestedCredential

type AttestedCredential struct {
	AAGUID            [16]byte
	CredID            []byte
	CredPublicKeyType pubkey.KeyType
	CredPublicKey     crypto.PublicKey
}

func (*AttestedCredential) Decode

func (c *AttestedCredential) Decode(buf []byte) error

type AuthenticatorAssertionResponse

type AuthenticatorAssertionResponse struct {
	AuthData       []byte
	ClientDataJSON []byte
	Signature      []byte
	UserHandle     []byte
	// contains filtered or unexported fields
}

AuthenticatorAssertionResponse is an authentication response.

func (*AuthenticatorAssertionResponse) AuthenticatorData

func (a *AuthenticatorAssertionResponse) AuthenticatorData() (*AuthenticatorData, error)

func (*AuthenticatorAssertionResponse) ClientData

func (a *AuthenticatorAssertionResponse) ClientData() (*ClientData, error)

func (*AuthenticatorAssertionResponse) Verify

func (a *AuthenticatorAssertionResponse) Verify(publicKey crypto.PublicKey, keyType pubkey.KeyType) error

verifyAssertionSignature checks a signed WebAuthn response against the registered public key of the device.

type AuthenticatorAttestationResponse

type AuthenticatorAttestationResponse struct {
	ClientDataJSON        []byte
	AttestationObjectCBOR []byte
	// contains filtered or unexported fields
}

AuthenticatorAttestationResponse is a registration response.

func (*AuthenticatorAttestationResponse) AttestationObject

func (a *AuthenticatorAttestationResponse) AttestationObject() (*AttestationObject, error)

func (*AuthenticatorAttestationResponse) ClientData

func (*AuthenticatorAttestationResponse) Verify

Verify checks a signed WebAuthn response against the public key of the device.

type AuthenticatorData

type AuthenticatorData struct {
	RPIDHash           [sha256.Size]byte
	Flags              byte
	SignCount          uint32
	AttestedCredential *AttestedCredential
}

AuthenticatorData represents the authenticator data structure.

func (*AuthenticatorData) Decode

func (a *AuthenticatorData) Decode(buf []byte) error

type ClientData

type ClientData struct {
	Type        string `json:"type"`
	Challenge   string `json:"challenge"`
	Origin      string `json:"origin"`
	CrossOrigin *bool  `json:"crossOrigin,omitempty"`
}

func (*ClientData) DecodeChallenge

func (c *ClientData) DecodeChallenge() (challenge.Challenge, error)

type PubKeyCredParam

type PubKeyCredParam struct {
	Type string `json:"type"`
	Alg  int    `json:"alg"`
}

PubKeyCredParam defines a supported type of public key and its signature algorithm.

Jump to

Keyboard shortcuts

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