@@ -69,7 +69,7 @@ fn main() -> Result<(), Error> {
6969 } else {
7070 bail ! ( "Must specify a 64-character private key and a user ID, e.g.: `bpb restore [-f] YOUR_PRIVATE_KEY \" Name <email@example.com>\" [TIMESTAMP]`" )
7171 }
72- } ,
72+ }
7373 Some ( "fingerprint" ) => print_fingerprint ( ) ,
7474 Some ( "key-id" ) => print_key_id ( ) ,
7575 Some ( "sign-hex" ) => {
@@ -84,7 +84,7 @@ fn main() -> Result<(), Error> {
8484 None => {
8585 print_help_message ( ) ?;
8686 std:: process:: exit ( 3 )
87- } ,
87+ }
8888 _ => {
8989 if args. any ( |arg| gpg_sign_arg ( & arg) ) {
9090 verify_commit ( )
@@ -269,7 +269,12 @@ fn to_32_bytes(slice: &String) -> Result<[u8; 32], Error> {
269269 Ok ( array)
270270}
271271
272- fn restore_from_private_key ( private_key : String , user_id : String , timestamp_opt : Option < u64 > , force : bool ) -> Result < ( ) , Error > {
272+ fn restore_from_private_key (
273+ private_key : String ,
274+ user_id : String ,
275+ timestamp_opt : Option < u64 > ,
276+ force : bool ,
277+ ) -> Result < ( ) , Error > {
273278 // Check for existing configuration and handle force flag
274279 let existing_config = Config :: load ( ) . ok ( ) ;
275280
@@ -289,7 +294,10 @@ fn restore_from_private_key(private_key: String, user_id: String, timestamp_opt:
289294 // 1. Remove keychain entry
290295 let service = config. service ( ) ;
291296 let account = config. user_id ( ) ;
292- println ! ( "Removing existing keychain entry for service: {}, account: {}" , service, account) ;
297+ println ! (
298+ "Removing existing keychain entry for service: {}, account: {}" ,
299+ service, account
300+ ) ;
293301
294302 let _ = std:: process:: Command :: new ( "security" )
295303 . args ( [ "delete-generic-password" , "-s" , service] )
@@ -309,18 +317,24 @@ fn restore_from_private_key(private_key: String, user_id: String, timestamp_opt:
309317
310318 // Validate the private key format
311319 if private_key. len ( ) != 64 {
312- bail ! ( "Invalid private key length: expected 64 characters, got {}" , private_key. len( ) ) ;
320+ bail ! (
321+ "Invalid private key length: expected 64 characters, got {}" ,
322+ private_key. len( )
323+ ) ;
313324 }
314325
315326 // Try to decode the hex string to get the private key bytes
316327 let secret_bytes = match hex:: decode ( private_key) {
317328 Ok ( bytes) => {
318329 if bytes. len ( ) != 32 {
319- bail ! ( "Invalid private key decoded length: expected 32 bytes, got {}" , bytes. len( ) ) ;
330+ bail ! (
331+ "Invalid private key decoded length: expected 32 bytes, got {}" ,
332+ bytes. len( )
333+ ) ;
320334 }
321335 bytes
322336 }
323- Err ( _) => bail ! ( "Failed to decode private key. It should be a valid hex string." )
337+ Err ( _) => bail ! ( "Failed to decode private key. It should be a valid hex string." ) ,
324338 } ;
325339
326340 // Convert to 32-byte array
0 commit comments