Skip to content

Commit

Permalink
clips (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
Firstyear authored Jan 1, 2024
1 parent f4c363e commit fe7a717
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions fido-mds/src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn user_verification_method_yk5lightning(
) -> Result<Vec<Vec<UserVerificationMethod>>, ()> {
// We know the

let code_accuracy = match uvm_and.get(0).and_then(|inner| inner.get(1)) {
let code_accuracy = match uvm_and.first().and_then(|inner| inner.get(1)) {
Some(UserVerificationMethod::PasscodeInternal(cad)) => cad.clone(),
res => {
error!("Expected UVM::PasscodeInternal, found {:?}", res);
Expand All @@ -192,7 +192,7 @@ fn user_verification_method_yk5lightning(
fn user_verification_method_rsads100(
uvm_and: &[Vec<UserVerificationMethod>],
) -> Result<Vec<Vec<UserVerificationMethod>>, ()> {
let code_accuracy = match uvm_and.get(0).and_then(|inner| inner.get(1)) {
let code_accuracy = match uvm_and.first().and_then(|inner| inner.get(1)) {
Some(UserVerificationMethod::PasscodeExternal(cad)) => cad.clone(),
res => {
error!("Expected UVM::PasscodeInternal, found {:?}", res);
Expand Down Expand Up @@ -268,7 +268,7 @@ fn user_verification_method_authenton1(
uvm_and: &[Vec<UserVerificationMethod>],
) -> Result<Vec<Vec<UserVerificationMethod>>, ()> {
debug!(?uvm_and);
let code_accuracy = match uvm_and.get(0).and_then(|inner| inner.get(2)) {
let code_accuracy = match uvm_and.first().and_then(|inner| inner.get(2)) {
Some(UserVerificationMethod::PasscodeExternal(cad)) => cad.clone(),
res => {
error!("Expected UVM::PasscodeInternal, found {:?}", res);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ impl From<BioSubCommand> for Option<BTreeMap<Value, Value>> {
),
])),
FingerprintEnumerateEnrollments => None,
FingerprintSetFriendlyName(t) => t.try_into().ok(),
FingerprintSetFriendlyName(t) => Some(t.into()),
FingerprintRemoveEnrollment(id) => {
Some(BTreeMap::from([(Value::Integer(0x01), Value::Bytes(id))]))
}
Expand Down
8 changes: 4 additions & 4 deletions webauthn-rs-core/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ pub(crate) fn verify_packed_attestation(

// Must have at least one x509 cert, this is the leaf certificate.
let attestn_cert = arr_x509
.get(0)
.first()
.ok_or(WebauthnError::AttestationStatementX5CInvalid)?;

trace!(?attestn_cert);
Expand Down Expand Up @@ -676,7 +676,7 @@ pub(crate) fn verify_fidou2f_attestation(

// Let certificate public key be the public key conveyed by att_cert.
let cerificate_public_key = arr_x509
.get(0)
.first()
.ok_or(WebauthnError::AttestationStatementX5CInvalid)?;

// If certificate public key is not an Elliptic Curve (EC) public key over the P-256 curve, terminate this algorithm and return an appropriate error.
Expand Down Expand Up @@ -824,7 +824,7 @@ pub(crate) fn verify_tpm_attestation(

// Must have at least one x509 cert
let aik_cert = arr_x509
.get(0)
.first()
.ok_or(WebauthnError::AttestationStatementX5CInvalid)?;

// Verify that the public key specified by the parameters and unique fields of pubArea is
Expand Down Expand Up @@ -1346,7 +1346,7 @@ pub(crate) fn verify_android_safetynet_attestation(
.get_x5c_chain()?
.ok_or(SafetyNetError::MissingCertChain)?;

let leaf_cert = certs.get(0).ok_or(SafetyNetError::BadCert)?;
let leaf_cert = certs.first().ok_or(SafetyNetError::BadCert)?;

// Verify with the internal certificate.
let jws: compact_jwt::Jws<SafteyNetAttestResponse> = jwsu.validate_embeded()?;
Expand Down
2 changes: 1 addition & 1 deletion webauthn-rs-core/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ impl WebauthnCore {
policy
} else {
let policy = creds
.get(0)
.first()
.map(|cred| cred.registration_policy.to_owned())
.ok_or(WebauthnError::CredentialNotFound)?;

Expand Down

0 comments on commit fe7a717

Please sign in to comment.