An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: address code review feedback for Phase 1 — formatting violations in recovery.rs

- Fixed import ordering (chrono, crypto, serde alphabetically)
- Fixed map_err closure formatting (single line with braces properly aligned)
- Fixed single-argument function signature (check_recovery_window) to one line
- Fixed long assert_eq macro arguments (split to multi-line formatting)
- Fixed chained method call alignment (find_fork_point return value)

All violations addressed per cargo fmt --all --check requirements.

Malpercio 05a7f681 067e66b0

+21 -14
+21 -14
apps/identity-wallet/src-tauri/src/recovery.rs
··· 4 4 // Imperative Shell: Recovery override building and submission commands (in later phases) 5 5 6 6 use crate::claim::OpDiff; 7 - use serde::Serialize; 8 - use crypto::{AuditEntry, DidKeyUri}; 9 7 use chrono::{DateTime, Duration, Utc}; 8 + use crypto::{AuditEntry, DidKeyUri}; 9 + use serde::Serialize; 10 10 11 11 /// Result of building a recovery override operation. 12 12 /// Mirrors `VerifiedClaimOp` from `claim.rs` but without `warnings`. ··· 70 70 // earliest fork point. 71 71 for i in (0..target_idx).rev() { 72 72 let entry = &audit_log[i]; 73 - let op_json = serde_json::to_string(&entry.operation).map_err(|e| { 74 - RecoveryError::SigningFailed { 73 + let op_json = 74 + serde_json::to_string(&entry.operation).map_err(|e| RecoveryError::SigningFailed { 75 75 message: format!("Failed to serialize operation: {e}"), 76 - } 77 - })?; 76 + })?; 78 77 79 78 // Try to verify with the device key. If verification succeeds, 80 79 // this is the last legitimate operation (the fork point). ··· 96 95 /// Returns `Ok(())` if recovery is still possible, or `Err(RecoveryWindowExpired)` if 97 96 /// the 72-hour deadline has passed. 98 97 #[allow(dead_code)] 99 - pub(crate) fn check_recovery_window( 100 - unauthorized_op_created_at: &str, 101 - ) -> Result<(), RecoveryError> { 98 + pub(crate) fn check_recovery_window(unauthorized_op_created_at: &str) -> Result<(), RecoveryError> { 102 99 let op_time = DateTime::parse_from_rfc3339(unauthorized_op_created_at) 103 100 .map_err(|e| RecoveryError::SigningFailed { 104 101 message: format!("Failed to parse operation timestamp: {e}"), ··· 122 119 fn test_recovery_error_serialization() { 123 120 let err = RecoveryError::RecoveryWindowExpired; 124 121 let serialized = serde_json::to_value(&err).unwrap(); 125 - assert_eq!(serialized.get("code").map(|v| v.as_str()), Some(Some("RECOVERY_WINDOW_EXPIRED"))); 122 + assert_eq!( 123 + serialized.get("code").map(|v| v.as_str()), 124 + Some(Some("RECOVERY_WINDOW_EXPIRED")) 125 + ); 126 126 127 127 let err2 = RecoveryError::SigningFailed { 128 128 message: "test error".to_string(), 129 129 }; 130 130 let serialized2 = serde_json::to_value(&err2).unwrap(); 131 - assert_eq!(serialized2.get("code").map(|v| v.as_str()), Some(Some("SIGNING_FAILED"))); 131 + assert_eq!( 132 + serialized2.get("code").map(|v| v.as_str()), 133 + Some(Some("SIGNING_FAILED")) 134 + ); 132 135 } 133 136 134 137 #[test] ··· 190 193 let audit_log = crypto::parse_audit_log(&audit_log_str).expect("parse audit log"); 191 194 192 195 // Test: find_fork_point should return the genesis entry (which was signed by device_key) 193 - let (fork_entry, _verified) = find_fork_point(&audit_log, unauthorized_cid, &device_key_uri) 194 - .expect("find_fork_point succeeds"); 196 + let (fork_entry, _verified) = 197 + find_fork_point(&audit_log, unauthorized_cid, &device_key_uri) 198 + .expect("find_fork_point succeeds"); 195 199 196 200 assert_eq!(fork_entry.cid, genesis_cid); 197 201 assert_eq!(fork_entry.created_at, "2026-03-29T00:00:00Z"); ··· 205 209 let audit_log = vec![]; 206 210 207 211 let result = find_fork_point(&audit_log, "bafy_nonexistent", &device_key_uri); 208 - assert!(matches!(result, Err(RecoveryError::UnauthorizedChangeNotFound))); 212 + assert!(matches!( 213 + result, 214 + Err(RecoveryError::UnauthorizedChangeNotFound) 215 + )); 209 216 } 210 217 211 218 #[test]