Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libwebauthn-tests/tests/signature_roundtrip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async fn test_ctap2_signature_roundtrip() {
);

let (attestation_signature, x5c) = match &registration.attestation_statement {
Ctap2AttestationStatement::PackedOrAndroid(stmt) => (
Some(Ctap2AttestationStatement::PackedOrAndroid(stmt)) => (
stmt.signature.as_ref(),
stmt.certificates
.first()
Expand Down
2 changes: 1 addition & 1 deletion libwebauthn/src/ops/u2f.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl UpgradableResponse<MakeCredentialResponse, MakeCredentialRequest> for Regis
let resp = Ctap2MakeCredentialResponse {
format: String::from("fido-u2f"),
authenticator_data,
attestation_statement,
attestation_statement: Some(attestation_statement),
enterprise_attestation: None,
large_blob_key: None,
unsigned_extension_outputs: None,
Expand Down
21 changes: 14 additions & 7 deletions libwebauthn/src/ops/webauthn/make_credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use super::{
pub struct MakeCredentialResponse {
pub format: String,
pub authenticator_data: AuthenticatorData<MakeCredentialsResponseExtensions>,
pub attestation_statement: Ctap2AttestationStatement,
pub attestation_statement: Option<Ctap2AttestationStatement>,
pub enterprise_attestation: Option<bool>,
pub large_blob_key: Option<Vec<u8>>,
pub unsigned_extensions_output: MakeCredentialsResponseUnsignedExtensions,
Expand Down Expand Up @@ -144,7 +144,12 @@ impl WebAuthnIDLResponse for MakeCredentialResponse {
let (format, attestation_statement) = if scrub_attestation {
("none", &none_statement)
} else {
(self.format.as_str(), &self.attestation_statement)
(
self.format.as_str(),
self.attestation_statement
.as_ref()
.unwrap_or(&none_statement),
)
};
let attestation_object_bytes =
build_attestation_object(format, attestation_statement, &authenticator_data_bytes)?;
Expand Down Expand Up @@ -1796,7 +1801,7 @@ mod tests {
MakeCredentialResponse {
format: "none".to_string(),
authenticator_data,
attestation_statement: Ctap2AttestationStatement::None(BTreeMap::new()),
attestation_statement: Some(Ctap2AttestationStatement::None(BTreeMap::new())),
enterprise_attestation: None,
large_blob_key: None,
unsigned_extensions_output: MakeCredentialsResponseUnsignedExtensions::default(),
Expand Down Expand Up @@ -2104,10 +2109,12 @@ mod tests {
MakeCredentialResponse {
format: "fido-u2f".to_string(),
authenticator_data,
attestation_statement: Ctap2AttestationStatement::FidoU2F(FidoU2fAttestationStmt {
signature: ByteBuf::from(vec![0xAA; 16]),
certificates: vec![ByteBuf::from(vec![0xBB; 8])],
}),
attestation_statement: Some(Ctap2AttestationStatement::FidoU2F(
FidoU2fAttestationStmt {
signature: ByteBuf::from(vec![0xAA; 16]),
certificates: vec![ByteBuf::from(vec![0xBB; 8])],
},
)),
enterprise_attestation: None,
large_blob_key: None,
unsigned_extensions_output: MakeCredentialsResponseUnsignedExtensions::default(),
Expand Down
3 changes: 2 additions & 1 deletion libwebauthn/src/proto/ctap2/model/make_credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,9 @@ pub struct Ctap2MakeCredentialResponse {
#[serde(index = 0x02)]
pub authenticator_data: AuthenticatorData<Ctap2MakeCredentialsResponseExtensions>,

#[serde(skip_serializing_if = "Option::is_none")]
#[serde(index = 0x03)]
pub attestation_statement: Ctap2AttestationStatement,
pub attestation_statement: Option<Ctap2AttestationStatement>,

#[serde(skip_serializing_if = "Option::is_none")]
#[serde(index = 0x04)]
Expand Down
Loading