metadata

package
v0.17.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: BSD-3-Clause Imports: 16 Imported by: 6

Documentation

Overview

Package metadata handles metadata validation instrumentation.

Index

Constants

View Source
const (
	// ProductionMDSRoot is the root certificate for the MDS.
	//
	// See: https://secure.globalsign.com/cacert/root-r3.crt
	ProductionMDSRoot = "" /* 1156-byte string literal not displayed */

	// ProductionMDSURL is the Production MDS URL.
	ProductionMDSURL = "https://mds.fidoalliance.org"

	// ConformanceMDSRoot is the root certificate for the MDS Conformance Suite.
	//
	// See: https://mds3.fido.tools/pki/MDS3ROOT.crt
	ConformanceMDSRoot = "" /* 828-byte string literal not displayed */

	// ExampleMDSRoot is the example root certificate for the MDS.
	//
	// See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1-ps-20250521.html#sctn-examples
	ExampleMDSRoot = "" /* 2088-byte string literal not displayed */
)
View Source
const (
	HeaderX509URI         = "x5u"
	HeaderX509Certificate = "x5c"
)

Variables

View Source
var (
	ErrNotInitialized = errors.New("metadata: not initialized")
)

Functions

func AlgKeyMatch added in v0.5.0

func AlgKeyMatch(key algKeyCose, algs []AuthenticationAlgorithm) bool

func IsUndesiredAuthenticatorStatus

func IsUndesiredAuthenticatorStatus(status AuthenticatorStatus) bool

IsUndesiredAuthenticatorStatus returns whether the supplied authenticator status is desirable or not.

func IsUndesiredAuthenticatorStatusMap added in v0.11.0

func IsUndesiredAuthenticatorStatusMap(status AuthenticatorStatus, values map[AuthenticatorStatus]bool) bool

IsUndesiredAuthenticatorStatusMap returns whether the supplied authenticator status is desirable or not.

func IsUndesiredAuthenticatorStatusSlice added in v0.11.0

func IsUndesiredAuthenticatorStatusSlice(status AuthenticatorStatus, values []AuthenticatorStatus) bool

IsUndesiredAuthenticatorStatusSlice returns whether the supplied authenticator status is desirable or not.

func ValidateStatusReports added in v0.11.0

func ValidateStatusReports(reports []StatusReport, desired, undesired []AuthenticatorStatus) (err error)

ValidateStatusReports checks a list of StatusReport structs against a list of desired and undesired AuthenticatorStatus values. If the reports contain all of the desired and none of the undesired status reports then no error is returned otherwise an error describing the issue is returned.

Types

type AuthenticationAlgorithm added in v0.5.0

type AuthenticationAlgorithm string

AuthenticationAlgorithm represents the authentication algorithm supported by an authenticator.

See: https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#authentication-algorithms

const (
	// ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW is an ECDSA signature on the NIST secp256r1 curve which must have raw R and
	// S buffers, encoded in big-endian order.
	ALG_SIGN_SECP256R1_ECDSA_SHA256_RAW AuthenticationAlgorithm = "secp256r1_ecdsa_sha256_raw"

	// ALG_SIGN_SECP256R1_ECDSA_SHA256_DER is a DER ITU-X690-2008 encoded ECDSA signature RFC5480 on the NIST secp256r1
	// curve.
	ALG_SIGN_SECP256R1_ECDSA_SHA256_DER AuthenticationAlgorithm = "secp256r1_ecdsa_sha256_der"

	// ALG_SIGN_RSASSA_PSS_SHA256_RAW is a RSASSA-PSS RFC3447 signature must have raw S buffers, encoded in big-endian
	// order RFC4055 RFC4056.
	ALG_SIGN_RSASSA_PSS_SHA256_RAW AuthenticationAlgorithm = "rsassa_pss_sha256_raw"

	// ALG_SIGN_RSASSA_PSS_SHA256_DER is a DER ITU-X690-2008 encoded OCTET STRING (not BIT STRING!) containing the
	// RSASSA-PSS RFC3447 signature RFC4055 RFC4056.
	ALG_SIGN_RSASSA_PSS_SHA256_DER AuthenticationAlgorithm = "rsassa_pss_sha256_der"

	// ALG_SIGN_SECP256K1_ECDSA_SHA256_RAW is an ECDSA signature on the secp256k1 curve which must have raw R and S
	// buffers, encoded in big-endian order.
	ALG_SIGN_SECP256K1_ECDSA_SHA256_RAW AuthenticationAlgorithm = "secp256k1_ecdsa_sha256_raw"

	// ALG_SIGN_SECP256K1_ECDSA_SHA256_DER is a DER ITU-X690-2008 encoded ECDSA signature RFC5480 on the secp256k1 curve.
	ALG_SIGN_SECP256K1_ECDSA_SHA256_DER AuthenticationAlgorithm = "secp256k1_ecdsa_sha256_der"

	// ALG_SIGN_SM2_SM3_RAW is a Chinese SM2 elliptic curve based signature algorithm combined with SM3 hash algorithm
	// OSCCA-SM2 OSCCA-SM3.
	ALG_SIGN_SM2_SM3_RAW AuthenticationAlgorithm = "sm2_sm3_raw"

	// ALG_SIGN_RSA_EMSA_PKCS1_SHA256_RAW is the EMSA-PKCS1-v1_5 signature as defined in RFC3447.
	ALG_SIGN_RSA_EMSA_PKCS1_SHA256_RAW AuthenticationAlgorithm = "rsa_emsa_pkcs1_sha256_raw"

	// ALG_SIGN_RSA_EMSA_PKCS1_SHA256_DER is a DER ITU-X690-2008 encoded OCTET STRING (not BIT STRING!) containing the
	// EMSA-PKCS1-v1_5 signature as defined in RFC3447.
	ALG_SIGN_RSA_EMSA_PKCS1_SHA256_DER AuthenticationAlgorithm = "rsa_emsa_pkcs1_sha256_der"

	// ALG_SIGN_RSASSA_PSS_SHA384_RAW is a RSASSA-PSS RFC3447 signature must have raw S buffers, encoded in big-endian
	// order RFC4055 RFC4056.
	ALG_SIGN_RSASSA_PSS_SHA384_RAW AuthenticationAlgorithm = "rsassa_pss_sha384_raw"

	// ALG_SIGN_RSASSA_PSS_SHA512_RAW is a RSASSA-PSS RFC3447 signature must have raw S buffers, encoded in big-endian
	// order RFC4055 RFC4056.
	ALG_SIGN_RSASSA_PSS_SHA512_RAW AuthenticationAlgorithm = "rsassa_pss_sha512_raw"

	// ALG_SIGN_RSASSA_PKCSV15_SHA256_RAW is a RSASSA-PKCS1-v1_5 RFC3447 with SHA256(aka RS256) signature must have raw
	// S buffers, encoded in big-endian order RFC8017 RFC4056.
	ALG_SIGN_RSASSA_PKCSV15_SHA256_RAW AuthenticationAlgorithm = "rsassa_pkcsv15_sha256_raw"

	// ALG_SIGN_RSASSA_PKCSV15_SHA384_RAW is a RSASSA-PKCS1-v1_5 RFC3447 with SHA384(aka RS384) signature must have raw S buffers, encoded in big-endian order RFC8017 RFC4056.
	ALG_SIGN_RSASSA_PKCSV15_SHA384_RAW AuthenticationAlgorithm = "rsassa_pkcsv15_sha384_raw"

	// ALG_SIGN_RSASSA_PKCSV15_SHA512_RAW is a RSASSA-PKCS1-v1_5 RFC3447 with SHA512(aka RS512) signature must have raw
	// S buffers, encoded in big-endian order RFC8017 RFC4056.
	ALG_SIGN_RSASSA_PKCSV15_SHA512_RAW AuthenticationAlgorithm = "rsassa_pkcsv15_sha512_raw"

	// ALG_SIGN_RSASSA_PKCSV15_SHA1_RAW is a RSASSA-PKCS1-v1_5 RFC3447 with SHA1(aka RS1) signature must have raw S
	// buffers, encoded in big-endian order RFC8017 RFC4056.
	ALG_SIGN_RSASSA_PKCSV15_SHA1_RAW AuthenticationAlgorithm = "rsassa_pkcsv15_sha1_raw"

	// ALG_SIGN_SECP384R1_ECDSA_SHA384_RAW is an ECDSA signature on the NIST secp384r1 curve with SHA384(aka: ES384)
	// which must have raw R and S buffers, encoded in big-endian order.
	ALG_SIGN_SECP384R1_ECDSA_SHA384_RAW AuthenticationAlgorithm = "secp384r1_ecdsa_sha384_raw"

	// ALG_SIGN_SECP521R1_ECDSA_SHA512_RAW is an ECDSA signature on the NIST secp512r1 curve with SHA512(aka: ES512)
	// which must have raw R and S buffers, encoded in big-endian order.
	ALG_SIGN_SECP521R1_ECDSA_SHA512_RAW AuthenticationAlgorithm = "secp521r1_ecdsa_sha512_raw"

	// ALG_SIGN_ED25519_EDDSA_SHA512_RAW is an EdDSA signature on the curve 25519, which must have raw R and S buffers,
	// encoded in big-endian order.
	ALG_SIGN_ED25519_EDDSA_SHA512_RAW AuthenticationAlgorithm = "ed25519_eddsa_sha512_raw"

	// ALG_SIGN_ED448_EDDSA_SHA512_RAW is an EdDSA signature on the curve Ed448, which must have raw R and S buffers,
	// encoded in big-endian order.
	ALG_SIGN_ED448_EDDSA_SHA512_RAW AuthenticationAlgorithm = "ed448_eddsa_sha512_raw"
)

type AuthenticatorAttestationType

type AuthenticatorAttestationType string

AuthenticatorAttestationType represents the attestation type supported by an authenticator. Each constant has a case-sensitive string representation used in the authoritative metadata for FIDO authenticators.

See: https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#authenticator-attestation-types

const (
	// BasicFull - Indicates full basic attestation, based on an attestation private key shared among a class of authenticators (i.e. same model). Authenticators must provide its attestation signature during the registration process for the same reason. The attestation trust anchor is shared with FIDO Servers out of band (as part of the Metadata). This sharing process should be done according to [UAFMetadataService].
	BasicFull AuthenticatorAttestationType = "basic_full"

	// BasicSurrogate - Just syntactically a Basic Attestation. The attestation object self-signed, i.e. it is signed using the UAuth.priv key, i.e. the key corresponding to the UAuth.pub key included in the attestation object. As a consequence it does not provide a cryptographic proof of the security characteristics. But it is the best thing we can do if the authenticator is not able to have an attestation private key.
	BasicSurrogate AuthenticatorAttestationType = "basic_surrogate"

	// Ecdaa - Indicates use of elliptic curve based direct anonymous attestation as defined in [FIDOEcdaaAlgorithm]. Support for this attestation type is optional at this time. It might be required by FIDO Certification.
	Ecdaa AuthenticatorAttestationType = "ecdaa"

	// AttCA - Indicates PrivacyCA attestation as defined in [TCG-CMCProfile-AIKCertEnroll]. Support for this attestation type is optional at this time. It might be required by FIDO Certification.
	AttCA AuthenticatorAttestationType = "attca"

	// AnonCA In this case, the authenticator uses an Anonymization CA which dynamically generates per-credential attestation certificates such that the attestation statements presented to Relying Parties do not provide uniquely identifiable information, i.e., that might be used for tracking purposes. The applicable [WebAuthn] attestation formats "fmt" are Google SafetyNet Attestation "android-safetynet", Android Keystore Attestation "android-key", Apple Anonymous Attestation "apple", and Apple Application Attestation "apple-appattest".
	AnonCA AuthenticatorAttestationType = "anonca"

	// None - Indicates absence of attestation.
	None AuthenticatorAttestationType = "none"
)

type AuthenticatorAttestationTypes added in v0.11.0

type AuthenticatorAttestationTypes []AuthenticatorAttestationType

func (AuthenticatorAttestationTypes) HasBasicFull added in v0.11.0

func (t AuthenticatorAttestationTypes) HasBasicFull() bool

type AuthenticatorGetInfo added in v0.5.0

type AuthenticatorGetInfo struct {
	// Versions is a list of supported versions.
	Versions []string

	// Extensions is a list of supported extensions.
	Extensions []string

	// AaGUID is the claimed AAGUID.
	AaGUID uuid.UUID

	// Options is a list of supported options.
	Options map[string]bool

	// MaxMsgSize is the maximum message size supported by the authenticator.
	MaxMsgSize uint

	// PivUvAuthProtocols is a list of supported PIN/UV auth protocols in order of decreasing authenticator preference.
	PivUvAuthProtocols []uint

	// MaxCredentialCountInList is the maximum number of credentials supported in credentialID list at a time by the
	// authenticator.
	MaxCredentialCountInList uint

	// MaxCredentialIdLength is the maximum Credential ID Length supported by the authenticator.
	MaxCredentialIdLength uint

	// Transports is the list of supported transports.
	Transports []string

	// Algorithms is the list of supported algorithms for credential generation, as specified in WebAuthn.
	Algorithms []PublicKeyCredentialParameters

	// MaxSerializedLargeBlobArray is the maximum size, in bytes, of the serialized large-blob array that this
	// authenticator can store.
	MaxSerializedLargeBlobArray uint

	// ForcePINChange indicates if the PIN must be changed.
	ForcePINChange bool

	// MinPINLength specifies the current minimum PIN length, in Unicode code points, the authenticator enforces for ClientPIN.
	MinPINLength uint

	// FirmwareVersion indicates the firmware version of the authenticator model identified by AAGUID.
	FirmwareVersion uint

	// MaxCredBlobLength indicates the maximum credential blob length in bytes supported by the authenticator.
	MaxCredBlobLength uint

	// MaxRPIDsForSetMinPINLength specifies the max number of RP IDs that authenticator can set via setMinPINLength
	// subcommand.
	MaxRPIDsForSetMinPINLength uint

	// PreferredPlatformUvAttempts specifies the preferred number of invocations of the
	// getPinUvAuthTokenUsingUvWithPermissions subCommand the platform may attempt before falling back to the
	// getPinUvAuthTokenUsingPinWithPermissions subCommand or displaying an error.
	PreferredPlatformUvAttempts uint

	// UvModality specifies the user verification modality supported by the authenticator via authenticatorClientPIN's
	// getPinUvAuthTokenUsingUvWithPermissions subcommand.
	UvModality uint

	// Certifications specifies a list of authenticator certifications.
	Certifications map[string]float64

	// RemainingDiscoverableCredentials if present indicates the estimated number of additional discoverable credentials
	// that can be stored.
	RemainingDiscoverableCredentials uint

	// VendorPrototypeConfigCommands if present the authenticator supports the authenticatorConfig vendorPrototype
	// subcommand, and its value is a list of authenticatorConfig vendorCommandId values supported, which MAY be empty.
	VendorPrototypeConfigCommands []uint
}

AuthenticatorGetInfo is a structure representing the AuthenticatorGetInfo dictionary.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-agid

type AuthenticatorGetInfoJSON added in v0.11.0

type AuthenticatorGetInfoJSON struct {
	// Versions is a list of supported CTAP versions.
	Versions []string `json:"versions"`

	// Extensions is a list of supported extensions.
	Extensions []string `json:"extensions"`

	// AaGUID is the claimed AAGUID.
	AaGUID string `json:"aaguid"`

	// Options is a map of supported options.
	Options map[string]bool `json:"options"`

	// MaxMsgSize is the maximum message size supported by the authenticator.
	MaxMsgSize uint `json:"maxMsgSize"`

	// PivUvAuthProtocols is a list of supported PIN/UV auth protocols in order of decreasing authenticator preference.
	PivUvAuthProtocols []uint `json:"pinUvAuthProtocols"`

	// MaxCredentialCountInList is the maximum number of credentials supported in credentialID list at a time.
	MaxCredentialCountInList uint `json:"maxCredentialCountInList"`

	// MaxCredentialIdLength is the maximum Credential ID Length supported by the authenticator.
	MaxCredentialIdLength uint `json:"maxCredentialIdLength"`

	// Transports is the list of supported transports.
	Transports []string `json:"transports"`

	// Algorithms is the list of supported algorithms for credential generation.
	Algorithms []PublicKeyCredentialParameters `json:"algorithms"`

	// MaxSerializedLargeBlobArray is the maximum size, in bytes, of the serialized large-blob array.
	MaxSerializedLargeBlobArray uint `json:"maxSerializedLargeBlobArray"`

	// ForcePINChange indicates if the PIN must be changed.
	ForcePINChange bool `json:"forcePINChange"`

	// MinPINLength specifies the current minimum PIN length, in Unicode code points.
	MinPINLength uint `json:"minPINLength"`

	// FirmwareVersion indicates the firmware version of the authenticator model identified by AAGUID.
	FirmwareVersion uint `json:"firmwareVersion"`

	// MaxCredBlobLength indicates the maximum credential blob length in bytes.
	MaxCredBlobLength uint `json:"maxCredBlobLength"`

	// MaxRPIDsForSetMinPINLength specifies the max number of RP IDs that can be set via setMinPINLength subcommand.
	MaxRPIDsForSetMinPINLength uint `json:"maxRPIDsForSetMinPINLength"`

	// PreferredPlatformUvAttempts specifies the preferred number of UV attempts before falling back to PIN.
	PreferredPlatformUvAttempts uint `json:"preferredPlatformUvAttempts"`

	// UvModality specifies the user verification modality supported by the authenticator.
	UvModality uint `json:"uvModality"`

	// Certifications specifies a map of authenticator certifications.
	Certifications map[string]float64 `json:"certifications"`

	// RemainingDiscoverableCredentials indicates the estimated number of additional discoverable credentials that
	// can be stored.
	RemainingDiscoverableCredentials uint `json:"remainingDiscoverableCredentials"`

	// VendorPrototypeConfigCommands is a list of supported authenticatorConfig vendorCommandId values.
	VendorPrototypeConfigCommands []uint `json:"vendorPrototypeConfigCommands"`
}

AuthenticatorGetInfoJSON is the JSON representation of the AuthenticatorGetInfo struct. The members mirror the fields returned by the CTAP authenticatorGetInfo command.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-agid

func (AuthenticatorGetInfoJSON) Parse added in v0.11.0

func (j AuthenticatorGetInfoJSON) Parse() (info AuthenticatorGetInfo, err error)

type AuthenticatorStatus

type AuthenticatorStatus string

AuthenticatorStatus describes the status of an authenticator model as identified by its AAID/AAGUID and potentially some additional information (such as a specific attestation key).

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-authnr-stat

const (
	// NotFidoCertified - This authenticator is not FIDO certified.
	NotFidoCertified AuthenticatorStatus = "NOT_FIDO_CERTIFIED"

	// FidoCertified - This authenticator has passed FIDO functional certification. This certification scheme is phased out and will be replaced by FIDO_CERTIFIED_L1.
	FidoCertified AuthenticatorStatus = "FIDO_CERTIFIED"

	// UserVerificationBypass - Indicates that malware is able to bypass the user verification. This means that the authenticator could be used without the user's consent and potentially even without the user's knowledge.
	//nolint:gosec
	UserVerificationBypass AuthenticatorStatus = "USER_VERIFICATION_BYPASS"

	// AttestationKeyCompromise - Indicates that an attestation key for this authenticator is known to be compromised. Additional data should be supplied, including the key identifier and the date of compromise, if known.
	AttestationKeyCompromise AuthenticatorStatus = "ATTESTATION_KEY_COMPROMISE"

	// UserKeyRemoteCompromise - This authenticator has identified weaknesses that allow registered keys to be compromised and should not be trusted. This would include both, i.e. weak entropy that causes predictable keys to be generated or side channels that allow keys or signatures to be forged, guessed or extracted.
	UserKeyRemoteCompromise AuthenticatorStatus = "USER_KEY_REMOTE_COMPROMISE"

	// UserKeyPhysicalCompromise - This authenticator has known weaknesses in its key protection mechanism(s) that allow user keys to be extracted by an adversary in physical possession of the device.
	UserKeyPhysicalCompromise AuthenticatorStatus = "USER_KEY_PHYSICAL_COMPROMISE"

	// UpdateAvailable - A software or firmware update is available for the device. Additional data should be supplied including a URL where users can obtain an update and the date the update was published.
	UpdateAvailable AuthenticatorStatus = "UPDATE_AVAILABLE"

	// Retired - The authenticator vendor has decided to retire the product, and this authenticator should not be
	// accepted any longer.
	//
	// See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#dom-authenticatorstatus-retired
	Retired AuthenticatorStatus = "RETIRED"

	// Revoked - The FIDO Alliance has determined that this authenticator should not be trusted for any reason, for example if it is known to be a fraudulent product or contain a deliberate backdoor.
	Revoked AuthenticatorStatus = "REVOKED"

	// SelfAssertionSubmitted - The authenticator vendor has completed and submitted the self-certification checklist to the FIDO Alliance. If this completed checklist is publicly available, the URL will be specified in StatusReportJSON.url.
	SelfAssertionSubmitted AuthenticatorStatus = "SELF_ASSERTION_SUBMITTED"

	// FidoCertifiedL1 - The authenticator has passed FIDO Authenticator certification at level 1. This level is the more strict successor of FIDO_CERTIFIED.
	FidoCertifiedL1 AuthenticatorStatus = "FIDO_CERTIFIED_L1"

	// FidoCertifiedL1plus - The authenticator has passed FIDO Authenticator certification at level 1+. This level is the more than level 1.
	FidoCertifiedL1plus AuthenticatorStatus = "FIDO_CERTIFIED_L1plus"

	// FidoCertifiedL2 - The authenticator has passed FIDO Authenticator certification at level 2. This level is more strict than level 1+.
	FidoCertifiedL2 AuthenticatorStatus = "FIDO_CERTIFIED_L2"

	// FidoCertifiedL2plus - The authenticator has passed FIDO Authenticator certification at level 2+. This level is more strict than level 2.
	FidoCertifiedL2plus AuthenticatorStatus = "FIDO_CERTIFIED_L2plus"

	// FidoCertifiedL3 - The authenticator has passed FIDO Authenticator certification at level 3. This level is more strict than level 2+.
	FidoCertifiedL3 AuthenticatorStatus = "FIDO_CERTIFIED_L3"

	// FidoCertifiedL3plus - The authenticator has passed FIDO Authenticator certification at level 3+. This level is more strict than level 3.
	FidoCertifiedL3plus AuthenticatorStatus = "FIDO_CERTIFIED_L3plus"

	// FIPS140CertifiedL1 - The authenticator has passed FIPS 140 certification at overall level 1.
	FIPS140CertifiedL1 AuthenticatorStatus = "FIPS140_CERTIFIED_L1"

	// FIPS140CertifiedL2 - The authenticator has passed FIPS 140 certification at overall level 2.
	FIPS140CertifiedL2 AuthenticatorStatus = "FIPS140_CERTIFIED_L2"

	// FIPS140CertifiedL3 - The authenticator has passed FIPS 140 certification at overall level 3.
	FIPS140CertifiedL3 AuthenticatorStatus = "FIPS140_CERTIFIED_L3"

	// FIPS140CertifiedL4 - The authenticator has passed FIPS 140 certification at overall level 4.
	FIPS140CertifiedL4 AuthenticatorStatus = "FIPS140_CERTIFIED_L4"
)

func DefaultUndesiredAuthenticatorStatuses added in v0.11.0

func DefaultUndesiredAuthenticatorStatuses() []AuthenticatorStatus

DefaultUndesiredAuthenticatorStatuses returns a copy of the defaultUndesiredAuthenticatorStatus slice.

type BiometricAccuracyDescriptor

type BiometricAccuracyDescriptor struct {
	// SelfAttestedFRR is the false rejection rate [ISO19795-1] for a single template, i.e. the percentage of
	// verification transactions with truthful claims of identity that are incorrectly denied.
	SelfAttestedFRR float64 `json:"selfAttestedFRR"`

	// SelfAttestedFAR is the false acceptance rate [ISO19795-1] for a single template, i.e. the percentage of
	// verification transactions with wrongful claims of identity that are incorrectly confirmed.
	SelfAttestedFAR float64 `json:"selfAttestedFAR"`

	// ImposterAttackPresentationAcceptRateThreshold is the threshold for Impostor Attack Presentation Accept Rate
	// (IAPAR) is the proportion of impostor attack presentations using the same presentation attack instrument (PAI)
	// species that result in accept [isoiec-30107-3]. For biometric certification requirements
	// [FIDOBiometricsRequirements], certification can be achieved for an IAPAR threshold of less than 7% OR less than
	// 15% for each of the PAI species tested.
	ImposterAttackPresentationAcceptRateThreshold float64 `json:"iAPARThreshold"`

	// MaxTemplates is the maximum number of alternative templates from different fingers allowed.
	MaxTemplates uint16 `json:"maxTemplates"`

	// MaxRetries is the maximum number of false attempts before the authenticator will block this method (at least for
	// some time). 0 means it will never block.
	MaxRetries uint16 `json:"maxRetries"`

	// BlockSlowdown is the enforced minimum number of seconds wait time after blocking (i.e. due to forced reboot or
	// similar).0 means that this user verification method will be blocked either permanently or until an alternative
	// user verification method succeeded. All alternative user verification methods MUST be specified appropriately in
	// the metadata in userVerificationDetails.
	BlockSlowdown uint16 `json:"blockSlowdown"`
}

BiometricAccuracyDescriptor is a structure representing the BiometricAccuracyDescriptor dictionary. It describes relevant accuracy/complexity aspects in the case of a biometric user verification method.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-bad

type BiometricStatusReport

type BiometricStatusReport struct {
	// CertLevel is the achieved level of the biometric certification of this biometric component of the authenticator.
	CertLevel uint16

	// Modality is a single USER_VERIFY short form case-sensitive string name constant, representing biometric modality.
	Modality string

	// EffectiveDate is an ISO-8601 formatted date since when the certLevel achieved, if applicable. If no date is
	// given, the status is assumed to be effective while present.
	EffectiveDate time.Time

	// CertificationDescriptor describes the externally visible aspects of the Biometric Certification evaluation.
	CertificationDescriptor string

	// CertificateNumber is the unique identifier for the issued Biometric Certification.
	CertificateNumber string

	// CertificationPolicyVersion is the version of the Biometric Certification Policy the implementation is Certified
	// to, i.e. "1.0.0".
	CertificationPolicyVersion string

	// CertificationRequirementsVersion is the version of the Biometric Requirements [FIDOBiometricsRequirements] the
	// implementation is certified to, i.e. "1.0.0".
	CertificationRequirementsVersion string
}

BiometricStatusReport is a structure representing the BiometricStatusReport dictionary. Contains the current BiometricStatusReport of one of the authenticator's biometric component.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-bio-stat-rep

type BiometricStatusReportJSON added in v0.11.0

type BiometricStatusReportJSON struct {
	// CertLevel is the achieved level of the biometric certification of this biometric component.
	CertLevel uint16 `json:"certLevel"`

	// Modality is a single USER_VERIFY short form string constant representing the biometric modality.
	Modality string `json:"modality"`

	// EffectiveDate is an ISO-8601 formatted date since when the certLevel was achieved.
	EffectiveDate string `json:"effectiveDate"`

	// CertificationDescriptor describes the externally visible aspects of the Biometric Certification evaluation.
	CertificationDescriptor string `json:"certificationDescriptor"`

	// CertificateNumber is the unique identifier for the issued Biometric Certification.
	CertificateNumber string `json:"certificateNumber"`

	// CertificationPolicyVersion is the version of the Biometric Certification Policy, i.e. "1.0.0".
	CertificationPolicyVersion string `json:"certificationPolicyVersion"`

	// CertificationRequirementsVersion is the version of the Biometric Requirements, i.e. "1.0.0".
	CertificationRequirementsVersion string `json:"certificationRequirementsVersion"`
}

BiometricStatusReportJSON is the JSON representation of the BiometricStatusReport struct.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-bio-stat-rep

func (BiometricStatusReportJSON) Parse added in v0.11.0

func (j BiometricStatusReportJSON) Parse() (report BiometricStatusReport, err error)

type Clock added in v0.11.0

type Clock interface {
	// Now returns the current time.
	Now() time.Time
}

Clock is an interface used to implement clock functionality in various metadata areas.

type CodeAccuracyDescriptor

type CodeAccuracyDescriptor struct {
	// Base is the numeric system base (radix) of the code, i.e. 10 in the case of decimal digits.
	Base uint16 `json:"base"`

	// MinLength is the minimum number of digits of the given base required for that code, i.e. 4 in the case of 4
	// digits.
	MinLength uint16 `json:"minLength"`

	// MaxRetries is the maximum number of false attempts before the authenticator will block this method (at least for
	// some time). 0 means it will never block.
	MaxRetries uint16 `json:"maxRetries"`

	// BlockSlowdown is the enforced minimum number of seconds wait time after blocking (i.e. due to forced reboot or
	// similar). 0 means this user verification method will be blocked, either permanently, or until an alternative user
	// verification method method succeeded. All alternative user verification methods MUST be specified appropriately
	// in the Metadata in userVerificationDetails.
	BlockSlowdown uint16 `json:"blockSlowdown"`
}

CodeAccuracyDescriptor is a structure representing the CodeAccuracyDescriptor dictionary. It describes the relevant accuracy/complexity aspects of passcode user verification methods.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-cad

type Decoder added in v0.11.0

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder handles decoding and specialized parsing of the metadata blob.

func NewDecoder added in v0.11.0

func NewDecoder(opts ...DecoderOption) (decoder *Decoder, err error)

NewDecoder returns a new metadata decoder.

func (*Decoder) Decode added in v0.11.0

func (d *Decoder) Decode(r io.Reader) (payload *PayloadJSON, err error)

Decode the blob from an io.Reader. This function will close the io.ReadCloser after completing.

func (*Decoder) DecodeBytes added in v0.11.0

func (d *Decoder) DecodeBytes(bytes []byte) (payload *PayloadJSON, err error)

DecodeBytes handles decoding raw bytes. If you have a read closer it's suggested to use Decoder.Decode.

func (*Decoder) Parse added in v0.11.0

func (d *Decoder) Parse(payload *PayloadJSON) (metadata *Metadata, err error)

Parse handles parsing of the raw JSON values of the metadata blob. Should be used after using Decoder.Decode or Decoder.DecodeBytes.

type DecoderOption added in v0.11.0

type DecoderOption func(decoder *Decoder) (err error)

DecoderOption is a representation of a function that can set options within a decoder.

func WithIgnoreEntryParsingErrors added in v0.11.0

func WithIgnoreEntryParsingErrors() DecoderOption

WithIgnoreEntryParsingErrors is a DecoderOption which ignores errors when parsing individual entries. The values for these entries will exist as an unparsed entry.

func WithRootCertificate added in v0.11.0

func WithRootCertificate(value string) DecoderOption

WithRootCertificate overrides the root certificate used to validate the authenticity of the metadata payload.

type DisplayPNGCharacteristicsDescriptor

type DisplayPNGCharacteristicsDescriptor struct {
	// Width of the image.
	Width uint32 `json:"width"`

	// Height of the image.
	Height uint32 `json:"height"`

	// BitDepth is bits per sample or per palette index.
	BitDepth byte `json:"bitDepth"`

	// ColorType defines the PNG image type.
	ColorType byte `json:"colorType"`

	// Compression method used to compress the image data.
	Compression byte `json:"compression"`

	// Filter method is the preprocessing method applied to the image data before compression.
	Filter byte `json:"filter"`

	// Interlace method is the transmission order of the image data.
	Interlace byte `json:"interlace"`

	// Plte is a number 1 to 256 representing palette entries.
	Plte []RGBPaletteEntry `json:"plte"`
}

DisplayPNGCharacteristicsDescriptor is a structure representing the DisplayPNGCharacteristicsDescriptor MDS3.1 dictionary. It describes a PNG image characteristics as defined in the PNG [PNG] spec for IHDR (image header) and PLTE (palette table).

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-dpngcd

type EcdaaTrustAnchor

type EcdaaTrustAnchor struct {
	// X is the base64url encoding of the result of ECPoint2ToB of the ECPoint2 X.
	X string `json:"X"`

	// Y is the base64url encoding of the result of ECPoint2ToB of the ECPoint2 Y.
	Y string `json:"Y"`

	// C is the base64url encoding of the result of BigNumberToB(c).
	C string `json:"c"`

	// SX is the base64url encoding of the result of BigNumberToB(sx).
	SX string `json:"sx"`

	// SY is the base64url encoding of the result of BigNumberToB(sy).
	SY string `json:"sy"`

	// G1Curve is the name of the Barreto-Naehrig elliptic curve for G1. "BN_P256", "BN_P638", "BN_ISOP256", and
	// "BN_ISOP512" are supported.
	G1Curve string `json:"G1Curve"`
}

EcdaaTrustAnchor is a structure representing the EcdaaTrustAnchor dictionary. In the case of ECDAA attestation, the ECDAA-Issuer's trust anchor MUST be specified in this field.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-ecdaata

type Entry added in v0.11.0

type Entry struct {
	// Aaid is the AAID of the authenticator this metadata BLOB payload entry relates to. This field MUST be set if
	// the authenticator implements FIDO UAF.
	Aaid string

	// AaGUID is the Authenticator Attestation GUID. This field MUST be set if the authenticator implements FIDO2.
	AaGUID uuid.UUID

	// AttestationCertificateKeyIdentifiers is a list of the attestation certificate public key identifiers encoded as
	// hex string. This field MUST be set if neither aaid nor aaguid are set.
	AttestationCertificateKeyIdentifiers []string

	// MetadataStatement is the metadataStatement JSON object as defined in FIDOMetadataStatement.
	MetadataStatement Statement

	// BiometricStatusReports is the status of the FIDO Biometric Certification of one or more biometric components of
	// the Authenticator.
	BiometricStatusReports []BiometricStatusReport

	// StatusReports is an array of status reports applicable to this authenticator.
	StatusReports []StatusReport

	// TimeOfLastStatusChange is an ISO-8601 formatted date since when the status report array was set to the current
	// value.
	TimeOfLastStatusChange time.Time

	// RogueListURL is a URL of a list of rogue (i.e. untrusted) individual authenticators.
	RogueListURL *url.URL

	// RogueListHash is the hash value computed over the Base64url encoding of the UTF-8 representation of the JSON
	// encoded rogueList available at rogueListURL (with type rogueListEntry[]). This hash value MUST be present and
	// non-empty whenever rogueListURL is present.
	RogueListHash string
}

Entry is a structure representing the Metadata BLOB Payload Entry dictionary.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-mds-blob-pe

type EntryError added in v0.11.0

type EntryError struct {
	// Error is the parsing error that occurred.
	Error error

	// EntryJSON is the raw JSON entry that failed to parse.
	EntryJSON
}

EntryError represents an EntryJSON that failed to parse, along with the error that occurred.

type EntryJSON added in v0.11.0

type EntryJSON struct {
	// Aaid is the AAID of the authenticator. Set if the authenticator implements FIDO UAF.
	Aaid string `json:"aaid"`

	// AaGUID is the Authenticator Attestation GUID. Set if the authenticator implements FIDO2.
	AaGUID string `json:"aaguid"`

	// AttestationCertificateKeyIdentifiers is a list of attestation certificate public key identifiers (hex).
	AttestationCertificateKeyIdentifiers []string `json:"attestationCertificateKeyIdentifiers"`

	// MetadataStatement is the metadataStatement JSON object as defined in FIDOMetadataStatement.
	MetadataStatement StatementJSON `json:"metadataStatement"`

	// BiometricStatusReports is the biometric certification status of one or more biometric components.
	BiometricStatusReports []BiometricStatusReportJSON `json:"biometricStatusReports"`

	// StatusReports is an array of status reports applicable to this authenticator.
	StatusReports []StatusReportJSON `json:"statusReports"`

	// TimeOfLastStatusChange is an ISO-8601 formatted date since when the status report array was set.
	TimeOfLastStatusChange string `json:"timeOfLastStatusChange"`

	// RogueListURL is a URL of a list of rogue (i.e. untrusted) individual authenticators.
	RogueListURL string `json:"rogueListURL"`

	// RogueListHash is the hash value computed over the Base64url encoding of the rogueList at rogueListURL.
	RogueListHash string `json:"rogueListHash"`
}

EntryJSON is an intermediary JSON/JWT structure representing the Metadata BLOB Payload Entry dictionary and the JSON representation of the Entry struct.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-mds-blob-pe

func (EntryJSON) Parse added in v0.11.0

func (j EntryJSON) Parse() (entry Entry, err error)

type Error added in v0.12.0

type Error struct {
	// Short name for the type of error that has occurred.
	Type string `json:"type"`

	// Additional details about the error.
	Details string `json:"error"`

	// Information to help debug the error.
	DevInfo string `json:"debug"`
}

func (*Error) Error added in v0.12.0

func (e *Error) Error() string

type ExtensionDescriptor

type ExtensionDescriptor struct {
	// ID identifies the extension.
	ID string `json:"id"`

	// Tag of the extension if this was assigned. TAGs are assigned to extensions if they could appear in an assertion.
	Tag uint16 `json:"tag"`

	// Data contains arbitrary data further describing the extension and/or data needed to correctly process the
	// extension.
	Data string `json:"data"`

	// FailIfUnknown indicates whether unknown extensions must be ignored (false) or must lead to an error (true) when
	// the extension is to be processed by the FIDO Server, FIDO Client, ASM, or FIDO Authenticator.
	FailIfUnknown bool `json:"fail_if_unknown"`
}

ExtensionDescriptor is a structure representing the ExtensionDescriptor dictionary. This descriptor contains an extension supported by the authenticator.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-ed

type KeyScope added in v0.14.0

type KeyScope string

KeyScope represents the scope of keys generated and maintained by an authenticator model.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-md-keys

const (
	// KeyScopeNone is the zero value indicating the field is absent (defaults to PublicKeyCredentialSource).
	KeyScopeNone KeyScope = ""

	// PublicKeyCredentialSource indicates the authenticator only generates/maintains main FIDO credentials.
	PublicKeyCredentialSource KeyScope = "public-key-credential-source" //nolint:gosec

	// DeviceSupplementalPublicKeys indicates the authenticator only generates/maintains device-scoped supplemental
	// public keys (SPK extension).
	DeviceSupplementalPublicKeys KeyScope = "device-spk"

	// ProviderSupplementalPublicKeys indicates the authenticator only generates/maintains provider-scoped supplemental
	// public keys (SPK extension).
	ProviderSupplementalPublicKeys KeyScope = "provider-spk"
)

type MDSGetEndpointsRequest

type MDSGetEndpointsRequest struct {
	// Endpoint is the URL of the local server endpoint, i.e. https://webauthn.io/
	Endpoint string `json:"endpoint"`
}

MDSGetEndpointsRequest is the request sent to the conformance metadata getEndpoints endpoint.

type MDSGetEndpointsResponse

type MDSGetEndpointsResponse struct {
	// Status is the status of the response.
	Status string `json:"status"`

	// Result is an array of urls, each pointing to a MetadataTOCPayload.
	Result []string `json:"result"`
}

MDSGetEndpointsResponse is the response received from a conformance metadata getEndpoints request.

type Metadata

type Metadata struct {
	// Parsed contains the successfully parsed BLOB payload entries.
	Parsed Parsed

	// Unparsed contains entries that failed to parse, along with their errors.
	Unparsed []EntryError
}

Metadata represents a FIDO Metadata Service BLOB in either a fully parsed or partially parsed state.

func Fetch added in v0.11.0

func Fetch() (metadata *Metadata, err error)

Fetch creates a new HTTP client and gets the production metadata, decodes it, and parses it. This is an instrumentation simplification that makes it easier to either just grab the latest metadata or for implementers to see the rough process of retrieving it to implement any of their own logic.

func (*Metadata) ToMap added in v0.11.0

func (m *Metadata) ToMap() (metadata map[uuid.UUID]*Entry)

type MultiDeviceCredentialSupport added in v0.14.0

type MultiDeviceCredentialSupport string

MultiDeviceCredentialSupport describes whether an authenticator supports multi-device credentials (passkeys).

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-md-keys

const (
	// MultiDeviceCredentialUnsupported indicates all private keys are designed to stay within the authenticator
	// boundary. This is the implicit default when the field is absent.
	MultiDeviceCredentialUnsupported MultiDeviceCredentialSupport = "unsupported"

	// MultiDeviceCredentialExplicit indicates the authenticator explicitly marks keys as multi-device or single-device
	// via the Backup Eligibility flag.
	MultiDeviceCredentialExplicit MultiDeviceCredentialSupport = "explicit"

	// MultiDeviceCredentialImplicit indicates all private keys relating to Public Key Credential Source may be backed
	// up.
	MultiDeviceCredentialImplicit MultiDeviceCredentialSupport = "implicit"
)

type Parsed added in v0.11.0

type Parsed struct {
	// The legalHeader, which MUST be in each BLOB, is an indication of the acceptance of the relevant legal agreement
	// for using the MDS.
	LegalHeader string

	// The serial number of this Metadata BLOB Payload. This serial number MUST be incremented whenever the contents
	// of the BLOB changes. Serial numbers MUST be consecutive and strictly monotonic, i.e. the successor BLOB will
	// have a no value exactly incremented by one.
	Number int

	// ISO-8601 formatted date when the next update will be provided at latest. The use of this field is discouraged
	// and may be removed in a future version of the spec.
	NextUpdate time.Time

	// List of zero or more MetadataBLOBPayloadEntry objects.
	Entries []Entry
}

Parsed is a structure representing the Metadata BLOB Payload dictionary.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-mds-blob-payload

type PassKeyAuthenticatorAAGUID added in v0.11.0

type PassKeyAuthenticatorAAGUID struct {
	Name      string `json:"name"`
	IconDark  string `json:"icon_dark,omitempty"`
	IconLight string `json:"icon_light,omitempty"`
}

PassKeyAuthenticatorAAGUID is a type that represents the individual schema entry from the Passkey Developer AAGUID listing. Used with PasskeyAuthenticator.

See: https://github.com/passkeydeveloper/passkey-authenticator-aaguids

type PasskeyAuthenticator added in v0.11.0

type PasskeyAuthenticator map[string]PassKeyAuthenticatorAAGUID

PasskeyAuthenticator is a type that represents the schema from the Passkey Developer AAGUID listing.

See: https://github.com/passkeydeveloper/passkey-authenticator-aaguids

type PatternAccuracyDescriptor

type PatternAccuracyDescriptor struct {
	// MinComplexity is the number of possible patterns (having the minimum length) out of which exactly one would be
	// the right one, i.e. 1/probability in the case of equal distribution.
	MinComplexity uint32 `json:"minComplexity"`

	// MaxRetries is the maximum number of false attempts before the authenticator will block authentication using this
	// method (at least temporarily). 0 means it will never block.
	MaxRetries uint16 `json:"maxRetries"`

	// BlockSlowdown is the enforced minimum number of seconds wait time after blocking (due to forced reboot or similar
	// mechanism). 0 means this user verification method will be blocked, either permanently, or until an alternative
	// user verification method method succeeded. All alternative user verification methods MUST be specified
	// appropriately in the metadata under userVerificationDetails.
	BlockSlowdown uint16 `json:"blockSlowdown"`
}

PatternAccuracyDescriptor is a structure representing the PatternAccuracyDescriptor dictionary. It describes relevant accuracy/complexity aspects in the case that a pattern is used as the user verification method.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-pad

type PayloadJSON added in v0.11.0

type PayloadJSON struct {
	// LegalHeader is an indication of the acceptance of the relevant legal agreement for using the MDS.
	LegalHeader string `json:"legalHeader"`

	// Number is the serial number of this Metadata BLOB Payload.
	Number int `json:"no"`

	// NextUpdate is an ISO-8601 formatted date when the next update will be provided at latest.
	NextUpdate string `json:"nextUpdate"`

	// Entries is a list of zero or more MetadataBLOBPayloadEntry objects.
	Entries []EntryJSON `json:"entries"`
}

PayloadJSON is an intermediary JSON/JWT representation of the Metadata BLOB Payload dictionary and the JSON representation of the Parsed struct.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-mds-blob-payload

func (PayloadJSON) Parse added in v0.11.0

func (j PayloadJSON) Parse() (payload Parsed, err error)

type Provider added in v0.11.0

type Provider interface {
	// GetEntry returns a MDS3 payload entry given a AAGUID.
	GetEntry(ctx context.Context, aaguid uuid.UUID) (entry *Entry, err error)

	// GetValidateEntry returns true if this provider requires an entry to exist with a AAGUID matching the attestation
	// statement during registration.
	GetValidateEntry(ctx context.Context) (validate bool)

	// GetValidateEntryPermitZeroAAGUID returns true if attestation statements with zerod AAGUID should be permitted
	// when considering the result from GetValidateEntry. i.e. if the AAGUID is zeroed, and GetValidateEntry returns
	// true, and this implementation returns true, the attestation statement will pass validation.
	GetValidateEntryPermitZeroAAGUID(ctx context.Context) (skip bool)

	// GetValidateTrustAnchor returns true if trust anchor validation of attestation statements is enforced during
	// registration.
	GetValidateTrustAnchor(ctx context.Context) (validate bool)

	// GetValidateStatus returns true if the status reports for an authenticator should be validated against desired and
	// undesired statuses.
	GetValidateStatus(ctx context.Context) (validate bool)

	// GetValidateAttestationTypes if true will enforce checking that the provided attestation is possible with the
	// given authenticator.
	GetValidateAttestationTypes(ctx context.Context) (validate bool)

	// ValidateStatusReports returns nil if the provided authenticator status reports are desired.
	ValidateStatusReports(ctx context.Context, reports []StatusReport) (err error)
}

The Provider is an interface which describes the elements required to satisfy validation of metadata.

type PublicKeyAlgAndEncoding added in v0.5.0

type PublicKeyAlgAndEncoding string

PublicKeyAlgAndEncoding represents the public key format supported by an authenticator during registration.

See: https://fidoalliance.org/specs/common-specs/fido-registry-v2.2-ps-20220523.html#public-key-representation-formats

const (
	// ALG_KEY_ECC_X962_RAW is a raw ANSI X9.62 formatted Elliptic Curve public key.
	ALG_KEY_ECC_X962_RAW PublicKeyAlgAndEncoding = "ecc_x962_raw"

	// ALG_KEY_ECC_X962_DER is a DER ITU-X690-2008 encoded ANSI X.9.62 formatted SubjectPublicKeyInfo RFC5480 specifying an elliptic curve public key.
	ALG_KEY_ECC_X962_DER PublicKeyAlgAndEncoding = "ecc_x962_der"

	// ALG_KEY_RSA_2048_RAW is a raw encoded 2048-bit RSA public key RFC3447.
	ALG_KEY_RSA_2048_RAW PublicKeyAlgAndEncoding = "rsa_2048_raw"

	// ALG_KEY_RSA_2048_DER is a ASN.1 DER [ITU-X690-2008] encoded 2048-bit RSA RFC3447 public key RFC4055.
	ALG_KEY_RSA_2048_DER PublicKeyAlgAndEncoding = "rsa_2048_der"

	// ALG_KEY_COSE is a COSE_Key format, as defined in Section 7 of RFC8152. This encoding includes its own field for indicating the public key algorithm.
	ALG_KEY_COSE PublicKeyAlgAndEncoding = "cose"
)

type PublicKeyCredentialParameters added in v0.5.0

type PublicKeyCredentialParameters struct {
	// Type is the credential type, typically "public-key".
	Type string `json:"type"`

	// Alg is the COSE algorithm identifier.
	Alg webauthncose.COSEAlgorithmIdentifier `json:"alg"`
}

PublicKeyCredentialParameters describes a credential type and algorithm pair per the WebAuthn specification. It is used in AuthenticatorGetInfo to describe the algorithms supported by an authenticator.

See: https://www.w3.org/TR/webauthn-3/#dictdef-publickeycredentialparameters

type RGBPaletteEntry added in v0.11.0

type RGBPaletteEntry struct {
	// R is the red channel sample value.
	R uint16 `json:"r"`

	// G is the green channel sample value.
	G uint16 `json:"g"`

	// B is the blue channel sample value.
	B uint16 `json:"b"`
}

RGBPaletteEntry is a structure representing the RGBPaletteEntry dictionary. It describes an RGB three-sample tuple palette entry.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-rgbpe

type RealClock added in v0.11.0

type RealClock struct{}

RealClock is just a real clock.

func (RealClock) Now added in v0.11.0

func (RealClock) Now() time.Time

Now returns the current time.

type RogueListEntry

type RogueListEntry struct {
	// Sk is the base64url encoding of the rogue authenticator's secret key.
	Sk string `json:"sk"`

	// Data is the ISO-8601 formatted date since when this entry is effective.
	Date string `json:"date"`
}

RogueListEntry is a structure representing the RogueListEntry dictionary.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-rogue-list-entry

type Statement added in v0.11.0

type Statement struct {
	// The LegalHeader, if present, contains a legal guide for accessing and using metadata, which itself MAY contain
	// URL(s) pointing to further information, such as a full Terms and Conditions statement.
	LegalHeader string

	// Aaid is the Authenticator Attestation ID.
	Aaid string

	// AaGUID is the Authenticator Attestation GUID.
	AaGUID uuid.UUID

	// AttestationCertificateKeyIdentifiers is a list of the attestation certificate public key identifiers encoded as
	// hex string.
	AttestationCertificateKeyIdentifiers []string

	// FriendlyNames contains friendly names (i.e., public trade name) of the authenticator in multiple languages.
	FriendlyNames map[string]string

	// Description is a human-readable, short description of the authenticator, in English.
	Description string

	// AlternativeDescriptions is a list of human-readable short descriptions of the authenticator in different
	// languages.
	AlternativeDescriptions map[string]string

	// AuthenticatorVersion is the earliest (i.e. lowest) trustworthy authenticatorVersion meeting the requirements
	// specified in this metadata statement.
	AuthenticatorVersion uint32

	// ProtocolFamily is the FIDO protocol family. The values "uaf", "u2f", and "fido2" are supported.
	ProtocolFamily string

	// Schema is the Metadata Schema version.
	Schema uint16

	// Upv is the FIDO unified protocol version(s) (related to the specific protocol family) supported by this
	// authenticator.
	Upv []Version

	// AuthenticationAlgorithms is the list of authentication algorithms supported by the authenticator.
	AuthenticationAlgorithms []AuthenticationAlgorithm

	// PublicKeyAlgAndEncodings is the list of public key formats supported by the authenticator during registration
	// operations.
	PublicKeyAlgAndEncodings []PublicKeyAlgAndEncoding

	// AttestationTypes is the supported attestation type(s).
	AttestationTypes AuthenticatorAttestationTypes

	// UserVerificationDetails is a list of alternative VerificationMethodANDCombinations.
	UserVerificationDetails [][]VerificationMethodDescriptor

	// KeyProtection is a 16-bit number representing the bit fields defined by the KEY_PROTECTION constants in the FIDO
	// Registry of Predefined Values.
	KeyProtection []string

	// IsKeyRestricted is set to true or it is omitted, if the Uauth private key is restricted by the authenticator to
	// only sign valid FIDO signature assertions. This entry is set to false, if the authenticator doesn't restrict the
	// Uauth key to only sign valid FIDO signature assertions.
	IsKeyRestricted bool

	// IsFreshUserVerificationRequired is set to true or it is omitted, if Uauth key usage always requires a fresh user
	// verification. This entry is set to false, if the Uauth key can be used without requiring a fresh user
	// verification, i.e. without any additional user interaction, if the user was verified a (potentially configurable)
	// caching time ago.
	IsFreshUserVerificationRequired bool

	// MatcherProtection is a 16-bit number representing the bit fields defined by the MATCHER_PROTECTION constants in
	// the FIDO Registry of Predefined Values.
	MatcherProtection []string

	// CryptoStrength is the authenticator's overall claimed cryptographic strength in bits (sometimes also called
	// security strength or security level).
	CryptoStrength uint16

	// AttachmentHint is a 32-bit number representing the bit fields defined by the ATTACHMENT_HINT constants in the
	// FIDO Registry of Predefined Values.
	AttachmentHint []string

	// TcDisplay is a 16-bit number representing a combination of the bit flags defined by the
	// TRANSACTION_CONFIRMATION_DISPLAY constants in the FIDO Registry of Predefined Values.
	TcDisplay []string

	// TcDisplayContentType is the supported MIME content type [RFC2049] for the transaction confirmation display, such
	// as text/plain or image/png.
	TcDisplayContentType string

	// TcDisplayPNGCharacteristics is a list of alternative [DisplayPNGCharacteristicsDescriptor]. Each of these entries
	// is one alternative of supported image characteristics for displaying a PNG image.
	TcDisplayPNGCharacteristics []DisplayPNGCharacteristicsDescriptor

	// AttestationRootCertificates is a list of root certificates. Each element of this array represents a PKIX
	// [RFC5280] X.509 certificate that is a valid trust anchor for this authenticator model.
	// Multiple certificates might be used for different batches of the same model.
	// The array does not represent a certificate chain, but only the trust anchor of that chain.
	// A trust anchor can be a root certificate, an intermediate CA certificate, or even the attestation certificate
	// itself.
	AttestationRootCertificates []*x509.Certificate

	// EcdaaTrustAnchors is a list of trust anchors used for ECDAA attestation. This entry MUST be present if and only
	// if attestationType includes ATTESTATION_ECDAA.
	EcdaaTrustAnchors []EcdaaTrustAnchor

	// Icon is a 'data:' url [RFC2397] encoded [PNG] or [SVG11] (light mode) icon for the Authenticator (i.e., depicting
	// the security key). This icon is intended to be shown to users by RPs. Use of [SVG11] format is mandatory if any
	// of the iconDark, providerLogoLight and/or providerLogoDark is used in addition to icon. Use of [SVG11] is
	// recommended if only icon is used. The icon is more specific than the provider logo and should be shown if
	// present.
	Icon *url.URL

	// IconDark is a 'data:' url [RFC2397] encoded [SVG11] dark mode icon for the Authenticator (i.e., depicting the
	// security key). This icon is intended to be shown to users by RPs. The icon is more specific than the provider
	// logo and should be shown if present.
	IconDark *url.URL

	// ProviderLogoLight is a 'data:' url [RFC2397] encoded [SVG11] light mode icon for the provider (i.e., logomark of
	// the passkey provider). The SVG MUST meet all of the requirements defined in § 4.1 SVG requirements. This icon
	// is intended to be shown to users by RPs.
	ProviderLogoLight *url.URL

	// ProviderLogoDark is a 'data:' url [RFC2397] encoded [SVG11] dark mode icon for the provider (i.e., logomark of
	// the passkey provider). The SVG MUST meet all of the requirements defined in § 4.1 SVG requirements. This icon
	// is intended to be shown to users by RPs.
	ProviderLogoDark *url.URL

	// SupportedExtensions is a list of extensions supported by the authenticator.
	SupportedExtensions []ExtensionDescriptor

	// KeyScope of keys generated and maintained by this authenticator model.
	KeyScope KeyScope

	// MultiDeviceCredentialSupport describes the support for multi-device credentials.
	MultiDeviceCredentialSupport MultiDeviceCredentialSupport

	// AuthenticatorGetInfo describes supported versions, extensions, AAGUID of the device and its capabilities.
	AuthenticatorGetInfo AuthenticatorGetInfo

	// CredentialExportProtocolConfigURL specifies the URL for retrieving the configuration details for the credential
	// export protocol (CXP).
	CredentialExportProtocolConfigURL *url.URL
}

Statement is a structure representing the Metadata Statement dictionary. Authenticator metadata statements are used directly by the FIDO server at a relying party, but the information contained in the authoritative statement is used in several other places.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-md-keys

func (*Statement) Verifier added in v0.11.0

func (s *Statement) Verifier(x5cis []*x509.Certificate) (opts x509.VerifyOptions)

type StatementJSON added in v0.11.0

type StatementJSON struct {
	// LegalHeader contains a legal guide for accessing and using metadata.
	LegalHeader string `json:"legalHeader"`

	// Aaid is the Authenticator Attestation ID. Set if the authenticator implements FIDO UAF.
	Aaid string `json:"aaid"`

	// AaGUID is the Authenticator Attestation GUID. Set if the authenticator implements FIDO2.
	AaGUID string `json:"aaguid"`

	// AttestationCertificateKeyIdentifiers is a list of attestation certificate public key identifiers (hex).
	AttestationCertificateKeyIdentifiers []string `json:"attestationCertificateKeyIdentifiers"`

	// FriendlyNames contains friendly names of the authenticator in multiple languages.
	FriendlyNames map[string]string `json:"friendlyNames"`

	// Description is a human-readable, short description of the authenticator, in English.
	Description string `json:"description"`

	// AlternativeDescriptions is a list of human-readable short descriptions in different languages.
	AlternativeDescriptions map[string]string `json:"alternativeDescriptions"`

	// AuthenticatorVersion is the earliest trustworthy authenticatorVersion meeting the requirements in this statement.
	AuthenticatorVersion uint32 `json:"authenticatorVersion"`

	// ProtocolFamily is the FIDO protocol family. The values "uaf", "u2f", and "fido2" are supported.
	ProtocolFamily string `json:"protocolFamily"`

	// Schema is the Metadata Schema version.
	Schema uint16 `json:"schema"`

	// Upv is the FIDO unified protocol version(s) supported by this authenticator.
	Upv []Version `json:"upv"`

	// AuthenticationAlgorithms is the list of authentication algorithms supported by the authenticator.
	AuthenticationAlgorithms []AuthenticationAlgorithm `json:"authenticationAlgorithms"`

	// PublicKeyAlgAndEncodings is the list of public key formats supported during registration operations.
	PublicKeyAlgAndEncodings []PublicKeyAlgAndEncoding `json:"publicKeyAlgAndEncodings"`

	// AttestationTypes is the supported attestation type(s).
	AttestationTypes []AuthenticatorAttestationType `json:"attestationTypes"`

	// UserVerificationDetails is a list of alternative VerificationMethodANDCombinations.
	UserVerificationDetails [][]VerificationMethodDescriptor `json:"userVerificationDetails"`

	// KeyProtection is the key protection type(s).
	KeyProtection []string `json:"keyProtection"`

	// IsKeyRestricted indicates if the Uauth private key is restricted to only sign valid FIDO signature assertions.
	IsKeyRestricted bool `json:"isKeyRestricted"`

	// IsFreshUserVerificationRequired indicates if Uauth key usage always requires a fresh user verification.
	IsFreshUserVerificationRequired bool `json:"isFreshUserVerificationRequired"`

	// MatcherProtection is the matcher protection type(s).
	MatcherProtection []string `json:"matcherProtection"`

	// CryptoStrength is the authenticator's overall claimed cryptographic strength in bits.
	CryptoStrength uint16 `json:"cryptoStrength"`

	// AttachmentHint is the attachment hint(s).
	AttachmentHint []string `json:"attachmentHint"`

	// TcDisplay is the transaction confirmation display type(s).
	TcDisplay []string `json:"tcDisplay"`

	// TcDisplayContentType is the supported MIME content type for the transaction confirmation display.
	TcDisplayContentType string `json:"tcDisplayContentType"`

	// TcDisplayPNGCharacteristics is a list of alternative DisplayPNGCharacteristicsDescriptor.
	TcDisplayPNGCharacteristics []DisplayPNGCharacteristicsDescriptor `json:"tcDisplayPNGCharacteristics"`

	// AttestationRootCertificates is a list of base64-encoded trust anchor certificates for this authenticator model.
	AttestationRootCertificates []string `json:"attestationRootCertificates"`

	// EcdaaTrustAnchors is a list of trust anchors used for ECDAA attestation.
	EcdaaTrustAnchors []EcdaaTrustAnchor `json:"ecdaaTrustAnchors"`

	// Icon is a data: URL encoded PNG or SVG (light mode) icon for the Authenticator.
	Icon string `json:"icon"`

	// IconDark is a data: URL encoded SVG dark mode icon for the Authenticator.
	IconDark string `json:"iconDark"`

	// ProviderLogoLight is a data: URL encoded SVG light mode icon for the provider.
	ProviderLogoLight string `json:"providerLogoLight"`

	// ProviderLogoDark is a data: URL encoded SVG dark mode icon for the provider.
	ProviderLogoDark string `json:"providerLogoDark"`

	// SupportedExtensions is a list of extensions supported by the authenticator.
	SupportedExtensions []ExtensionDescriptor `json:"supportedExtensions"`

	// KeyScope of keys generated and maintained by this authenticator model.
	KeyScope KeyScope `json:"keyScope"`

	// MultiDeviceCredentialSupport describes the support for multi-device credentials.
	MultiDeviceCredentialSupport MultiDeviceCredentialSupport `json:"multiDeviceCredentialSupport"`

	// AuthenticatorGetInfo describes supported versions, extensions, AAGUID of the device and its capabilities.
	AuthenticatorGetInfo AuthenticatorGetInfoJSON `json:"authenticatorGetInfo"`

	// CredentialExportProtocolConfigURL specifies the URL for the credential export protocol (CXP) configuration.
	CredentialExportProtocolConfigURL string `json:"cxpConfigURL"`
}

StatementJSON is the JSON representation of the Statement struct.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-md-keys

func (StatementJSON) Parse added in v0.11.0

func (j StatementJSON) Parse() (statement Statement, err error)

Parse converts StatementJSON into a Statement object, validating and parsing its fields. Returns an error on failure.

type StatusReport

type StatusReport struct {
	// Status of the authenticator. Additional fields MAY be set depending on this value.
	Status AuthenticatorStatus

	// EffectiveDate is an ISO-8601 formatted date since when the status code was set, if applicable. If no date is
	// given, the status is assumed to be effective while present.
	EffectiveDate time.Time

	// AuthenticatorVersion is the authenticator version (firmware version) that this status report relates to. In the
	// case of FIDO_CERTIFIED* status values, the status applies to higher authenticatorVersions until there is a new
	// statusReport.
	AuthenticatorVersion uint32

	// BatchCertificate is a Base64-encoded [RFC4648] (not base64url!) DER [ITU-X690-2008] PKIX certificate value
	// related to the current status, if applicable.
	BatchCertificate *x509.Certificate

	// Certificate is a Base64-encoded [RFC4648] (not base64url!) DER [ITU-X690-2008] PKIX certificate value related to
	// the current status, if applicable. This field will typically not be present if field batchCertificate is present.
	Certificate *x509.Certificate

	// URL is a HTTPS URL where additional information may be found related to the current status, if applicable.
	URL *url.URL

	// CertificationDescriptor describes the externally visible aspects of the Authenticator Certification evaluation.
	CertificationDescriptor string

	// CertificateNumber is the unique identifier for the issued Certification.
	CertificateNumber string

	// CertificationPolicyVersion is the version of the Authenticator Certification Policy the implementation is
	// Certified to, i.e. "1.0.0".
	CertificationPolicyVersion string

	// CertificationProfiles is a list of certification profile strings. Each entry represents a supported
	// certification profile, i.e. "consumer" or "enterprise".
	CertificationProfiles []string

	// CertificationRequirementsVersion is the Document Version of the Authenticator Security Requirements (DV)
	// [FIDOAuthenticatorSecurityRequirements] the implementation is certified to, i.e. "1.2.0".
	CertificationRequirementsVersion string

	// SunsetDate is an ISO-8601 formatted date since when the status will expire, if applicable. If no date is given,
	// the status is assumed to not have a scheduled expiry.
	SunsetDate *time.Time

	// FIPSRevision is the revision number of the FIPS 140 specification, i.e. "3" in the case of FIPS 140-3. This
	// entry MUST be present if and only if the status entry is one of FIPS140_CERTIFIED_L*.
	FIPSRevision uint32

	// FIPSPhysicalSecurityLevel is the "physical security level" of the FIPS certification. This entry MUST be present
	// if and only if the status entry is one of FIPS140_CERTIFIED_L*. It MUST reflect the physical security level
	// which might deviate from the overall level.
	FIPSPhysicalSecurityLevel uint32
}

StatusReport is a structure representing the StatusReport dictionary. Contains an AuthenticatorStatus and additional data associated with it, if any.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-stat-rep

type StatusReportJSON added in v0.11.0

type StatusReportJSON struct {
	// Status of the authenticator. Additional fields MAY be set depending on this value.
	Status AuthenticatorStatus `json:"status"`

	// EffectiveDate is an ISO-8601 formatted date since when the status code was set.
	EffectiveDate string `json:"effectiveDate"`

	// AuthenticatorVersion is the authenticator version (firmware version) that this status report relates to.
	AuthenticatorVersion uint32 `json:"authenticatorVersion"`

	// BatchCertificate is a Base64-encoded DER PKIX certificate related to the current status.
	BatchCertificate string `json:"batchCertificate"`

	// Certificate is a Base64-encoded DER PKIX certificate related to the current status.
	Certificate string `json:"certificate"`

	// URL is a HTTPS URL where additional information may be found related to the current status.
	URL string `json:"url"`

	// CertificationDescriptor describes the externally visible aspects of the Authenticator Certification evaluation.
	CertificationDescriptor string `json:"certificationDescriptor"`

	// CertificateNumber is the unique identifier for the issued Certification.
	CertificateNumber string `json:"certificateNumber"`

	// CertificationPolicyVersion is the version of the Authenticator Certification Policy, i.e. "1.0.0".
	CertificationPolicyVersion string `json:"certificationPolicyVersion"`

	// CertificationProfiles is a list of supported certification profiles, i.e. "consumer" or "enterprise".
	CertificationProfiles []string `json:"certificationProfiles"`

	// CertificationRequirementsVersion is the Document Version of the Authenticator Security Requirements, i.e. "1.2.0".
	CertificationRequirementsVersion string `json:"certificationRequirementsVersion"`

	// SunsetDate is an ISO-8601 formatted date when the status will expire.
	SunsetDate string `json:"sunsetDate"`

	// FIPSRevision is the revision number of the FIPS 140 specification, i.e. "3" for FIPS 140-3.
	FIPSRevision uint32 `json:"fipsRevision"`

	// FIPSPhysicalSecurityLevel is the physical security level of the FIPS certification.
	FIPSPhysicalSecurityLevel uint32 `json:"fipsPhysicalSecurityLevel"`
}

StatusReportJSON is the JSON representation of the StatusReport struct.

See: https://fidoalliance.org/specs/mds/fido-metadata-service-v3.1.1-rd-20251016.html#sctn-stat-rep

func (StatusReportJSON) Parse added in v0.11.0

func (j StatusReportJSON) Parse() (report StatusReport, err error)

type VerificationMethodDescriptor

type VerificationMethodDescriptor struct {
	// UserVerificationMethod is a single USER_VERIFY constant (see [FIDORegistry]), not a bit flag combination. This
	// value MUST be non-zero.
	UserVerificationMethod string `json:"userVerificationMethod"`

	// CaDesc nay optionally be used in the case of method USER_VERIFY_PASSCODE.
	CaDesc CodeAccuracyDescriptor `json:"caDesc"`

	// BaDesc may optionally be used in the case of method USER_VERIFY_FINGERPRINT, USER_VERIFY_VOICEPRINT,
	// USER_VERIFY_FACEPRINT, USER_VERIFY_EYEPRINT, or USER_VERIFY_HANDPRINT.
	BaDesc BiometricAccuracyDescriptor `json:"baDesc"`

	// PaDesc may optionally be used in case of method USER_VERIFY_PATTERN.
	PaDesc PatternAccuracyDescriptor `json:"paDesc"`
}

VerificationMethodDescriptor is a structure representing the VerificationMethodDescriptor dictionary. It describes a descriptor for a specific base user verification method as implemented by the authenticator.

See: https://fidoalliance.org/specs/mds/fido-metadata-statement-v3.1-ps-20250521.html#sctn-type-vmd

type Version

type Version struct {
	// Major version.
	Major uint16 `json:"major"`

	// Minor version.
	Minor uint16 `json:"minor"`
}

Version is a structure representing the Version FIDO UAF Protocol 1.2 dictionary and represents a generic version with major and minor fields.

See: https://fidoalliance.org/specs/fido-uaf-v1.2-ps-20201020/fido-uaf-protocol-v1.2-ps-20201020.html#version-interface

Directories

Path Synopsis
providers
cached
Package cached handles a metadata.Provider implementation that both downloads and caches the MDS3 blob.
Package cached handles a metadata.Provider implementation that both downloads and caches the MDS3 blob.
memory
Package memory handles a metadata.Provider implementation that solely exists in memory.
Package memory handles a metadata.Provider implementation that solely exists in memory.

Jump to

Keyboard shortcuts

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