Skip to content

Commit

Permalink
Adding tests (and some minor fixes the tests revealed)
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Sirringhaus authored and msirringhaus committed Jul 30, 2024
1 parent 06785ff commit 77572e2
Show file tree
Hide file tree
Showing 7 changed files with 449 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/ctap2_discoverable_creds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fn extract_associated_large_blobs(key: Vec<u8>, array: Vec<LargeBlobArrayElement
let plaintext = cipher.decrypt(e.nonce.as_slice().into(), payload).ok();
plaintext
})
.map(|d| flate3::inflate(&d))
.map(|d| flate3::inflate(&d)) // TODO: Check resulting length and compare to orig_size
.map(|d| String::from_utf8_lossy(&d).to_string())
.collect();
valid_elements
Expand Down
3 changes: 3 additions & 0 deletions examples/prf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ fn main() {
Ok(StatusUpdate::SelectResultNotice(_, _)) => {
panic!("Unexpected select device notice")
}
Ok(StatusUpdate::LargeBlobData(..)) => {
panic!("Unexpected large blob data request")
}
Err(RecvError) => {
println!("STATUS: end");
return;
Expand Down
7 changes: 7 additions & 0 deletions src/ctap2/commands/get_assertion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,7 @@ pub mod test {
),
)),
cred_blob: None,
large_blob_key: None,
},
options: GetAssertionOptions {
user_presence: Some(true),
Expand Down Expand Up @@ -1158,6 +1159,7 @@ pub mod test {
),
)),
cred_blob: None,
large_blob_key: None,
},
options: GetAssertionOptions {
user_presence: None,
Expand Down Expand Up @@ -1204,6 +1206,7 @@ pub mod test {
},
)),
cred_blob: None,
large_blob_key: None,
},
options: GetAssertionOptions {
user_presence: None,
Expand All @@ -1226,6 +1229,7 @@ pub mod test {
app_id: None,
hmac_secret: Some(HmacGetSecretOrPrf::PrfUnmatched),
cred_blob: None,
large_blob_key: None,
},
options: GetAssertionOptions {
user_presence: None,
Expand Down Expand Up @@ -2897,6 +2901,9 @@ pub mod test {
},
attachment: AuthenticatorAttachment::Unknown,
extensions: AuthenticationExtensionsClientOutputs::default(),
user_selected: None,
large_blob_key: None,
large_blob_array: None,
};

let mut dev = Device::new_skipping_serialization("commands/get_assertion")
Expand Down
Loading

0 comments on commit 77572e2

Please sign in to comment.