pub struct AuthenticatorData {
pub flags: Flags,
pub counter: Option<u32>,
pub attested_credential_data: Option<AttestedCredentialData>,
pub extensions: Option<Value>,
/* private fields */
}Expand description
The authenticator data structure encodes contextual bindings made by the authenticator. These bindings are controlled by the authenticator itself, and derive their trust from the WebAuthn Relying Party’s assessment of the security properties of the authenticator. In one extreme case, the authenticator may be embedded in the client, and its bindings may be no more trustworthy than the client data. At the other extreme, the authenticator may be a discrete entity with high-security hardware and software, connected to the client over a secure channel. In both cases, the Relying Party receives the authenticator data in the same format, and uses its knowledge of the authenticator to make trust decisions.
Fields§
§flags: FlagsThe flags representing the information of this credential. See Flags for more information.
counter: Option<u32>Signature counter, 32-bit unsigned big-endian integer.
attested_credential_data: Option<AttestedCredentialData>An optional AttestedCredentialData, if present, the Flags::AT needs to be set to true. See AttestedCredentialData for more information. Its length depends on the length of the credential ID and credential public key being attested.
extensions: Option<Value>Extension-defined authenticator data. This is a CBOR RFC8949 map with extension identifiers as keys, and authenticator extension outputs as values. See WebAuthn Extensions for details.
This field uses the generic Value rather than a HashMap or the internal map representation for the
following reasons:
Valuedoes not implementHashso it can’t be used as a key in aHashMap- Even if
Vec<(Value, Value)>is the internal representation of a map inValue, it serializes to an array rather than a map, so in order to serialize it needs to be cloned into aValue::Map.
Instead we just assert that it is a map during deserialization.
Implementations§
Source§impl AuthenticatorData
impl AuthenticatorData
Sourcepub fn new(rp_id: &str, counter: Option<u32>) -> Self
pub fn new(rp_id: &str, counter: Option<u32>) -> Self
Create a new AuthenticatorData object for an RP ID and an optional counter.
The flags will be set to their default values.
Sourcepub fn set_attested_credential_data(self, acd: AttestedCredentialData) -> Self
pub fn set_attested_credential_data(self, acd: AttestedCredentialData) -> Self
Add an AttestedCredentialData to the authenticator data.
This sets the Flags::AT value as well.
Sourcepub fn rp_id_hash(&self) -> &[u8] ⓘ
pub fn rp_id_hash(&self) -> &[u8] ⓘ
Get read access to the RP ID hash
Sourcepub fn set_make_credential_extensions(
self,
extensions: Option<SignedExtensionOutputs>,
) -> Result<Self, Ctap2Error>
pub fn set_make_credential_extensions( self, extensions: Option<SignedExtensionOutputs>, ) -> Result<Self, Ctap2Error>
Set make credential authenticator extensions
Sourcepub fn set_assertion_extensions(
self,
extensions: Option<SignedExtensionOutputs>,
) -> Result<Self, Ctap2Error>
pub fn set_assertion_extensions( self, extensions: Option<SignedExtensionOutputs>, ) -> Result<Self, Ctap2Error>
Set assertion authenticator extensions