diff --git a/apps/desktop/desktop_native/win_webauthn/src/plugin/crypto.rs b/apps/desktop/desktop_native/win_webauthn/src/plugin/crypto.rs index 9476f2e106a..c2572ede1b8 100644 --- a/apps/desktop/desktop_native/win_webauthn/src/plugin/crypto.rs +++ b/apps/desktop/desktop_native/win_webauthn/src/plugin/crypto.rs @@ -17,7 +17,6 @@ use windows::{ BCRYPT_SHA256_ALG_HANDLE, }, }; -use windows_core::Owned; use crate::{ plugin::WEBAUTHN_PLUGIN_OPERATION_REQUEST, util::webauthn_call, ErrorKind, WinWebAuthnError, @@ -238,10 +237,12 @@ pub(super) fn hash_sha256(data: &[u8]) -> Result, windows::core::Error> let mut hash_buffer: Vec> = Vec::with_capacity(hash_output_len); unsafe { { - // Temporarily treat the buffer byte slice to fit BCryptFinishHash parameter arguments. + // Temporarily treat the buffer byte slice to fit BCryptFinishHash parameter + // arguments. let hash_slice: &mut [u8] = mem::transmute(hash_buffer.spare_capacity_mut()); BCryptFinishHash(sha256.handle, hash_slice, 0).ok()?; - // The hash handle is not usable after calling BCryptFinishHash, drop to clean up internal state. + // The hash handle is not usable after calling BCryptFinishHash, drop to clean + // up internal state. drop(sha256); } // SAFETY: BCryptFinishHash initializes the buffer @@ -342,7 +343,8 @@ impl OwnedRequestHash { /// Calculate a SHA-256 hash over the request. /// /// # Safety - /// The caller must ensure that: `request.pbEncodedRequest` points to a valid non-null byte string of length `request.cbEncodedRequest`. + /// The caller must ensure that: `request.pbEncodedRequest` points to a valid non-null byte + /// string of length `request.cbEncodedRequest`. pub(super) unsafe fn from_request( request: &WEBAUTHN_PLUGIN_OPERATION_REQUEST, ) -> Result { @@ -368,7 +370,8 @@ impl<'a> RequestHash<'a> { Self(hash) } } -/// Public key for verifying a signature over an operation request or user verification response buffer. +/// Public key for verifying a signature over an operation request or user verification response +/// buffer. pub struct VerifyingKey { /// Length of buffer cbPublicKey: u32, @@ -419,9 +422,8 @@ mod tests { BCRYPT_RSAKEY_BLOB, BCRYPT_RSAPUBLIC_MAGIC, }; - use crate::plugin::crypto::{verify_signature, RequestHash, Signature, VerifyingKey}; - use super::hash_sha256; + use crate::plugin::crypto::{verify_signature, RequestHash, Signature, VerifyingKey}; #[test] fn test_sha256_serializes_properly() { diff --git a/apps/desktop/desktop_native/win_webauthn/src/plugin/mod.rs b/apps/desktop/desktop_native/win_webauthn/src/plugin/mod.rs index 065b42f1a60..30b92c043eb 100644 --- a/apps/desktop/desktop_native/win_webauthn/src/plugin/mod.rs +++ b/apps/desktop/desktop_native/win_webauthn/src/plugin/mod.rs @@ -159,7 +159,8 @@ impl WebAuthnPlugin { /// /// # Arguments /// - `request`: UI and transaction context for the user verification prompt. - /// - `operation_request_hash`: The SHA-256 hash of the original operation request buffer related to this user verification request. + /// - `operation_request_hash`: The SHA-256 hash of the original operation request buffer + /// related to this user verification request. pub fn perform_user_verification( &self, request: PluginUserVerificationRequest, diff --git a/apps/desktop/desktop_native/win_webauthn/src/plugin/types.rs b/apps/desktop/desktop_native/win_webauthn/src/plugin/types.rs index 6e1dd102629..8f0c27df519 100644 --- a/apps/desktop/desktop_native/win_webauthn/src/plugin/types.rs +++ b/apps/desktop/desktop_native/win_webauthn/src/plugin/types.rs @@ -417,7 +417,8 @@ impl WEBAUTHN_PLUGIN_OPERATION_REQUEST { /// [webauthn_plugin_get_operation_signing_public_key](crate::plugin::crypto::webauthn_plugin_get_operation_signing_public_key). /// /// # Safety - /// The caller must ensure that `request.pbRequestSignature` points to a valid non-null byte string of length `request.cbRequestSignature`. + /// The caller must ensure that `request.pbRequestSignature` points to a valid non-null byte + /// string of length `request.cbRequestSignature`. pub(super) unsafe fn signature(&self) -> Signature<'_> { // SAFETY: The caller must make sure that the encoded request is valid. let signature =