@@ -8,7 +8,7 @@ use auths_core::config::EnvironmentConfig;
88use auths_core:: signing:: PassphraseProvider ;
99use auths_core:: storage:: keychain:: { KeyAlias , get_platform_keychain} ;
1010use auths_crypto:: did_key:: ed25519_pubkey_to_did_key;
11- use auths_sdk:: domains:: ci:: bundle:: { build_identity_bundle, generate_ci_passphrase } ;
11+ use auths_sdk:: domains:: ci:: bundle:: build_identity_bundle;
1212use auths_sdk:: domains:: ci:: forge:: Forge ;
1313use auths_sdk:: domains:: ci:: token:: CiToken ;
1414use ring:: signature:: KeyPair ;
@@ -41,7 +41,7 @@ const CI_DEVICE_ALIAS: &str = "ci-release-device";
4141pub fn run_rotate (
4242 repo_override : Option < String > ,
4343 max_age_secs : u64 ,
44- auto_passphrase : bool ,
44+ _auto_passphrase : bool ,
4545 _passphrase_provider : Arc < dyn PassphraseProvider + Send + Sync > ,
4646 _env_config : & EnvironmentConfig ,
4747 repo_path : & Path ,
@@ -73,20 +73,20 @@ pub fn run_rotate(
7373 . ok_or_else ( || anyhow ! ( "No keys found in keychain" ) ) ?
7474 . to_string ( ) ;
7575
76- // Handle passphrase
77- let ci_pass = if auto_passphrase {
78- let pass = generate_ci_passphrase ( ) ;
79- println ! ( "\x1b [2mAuto-generated new CI passphrase (64-char hex).\x1b [0m" ) ;
80- Zeroizing :: new ( pass)
81- } else {
82- let pass = rpassword:: prompt_password ( "New CI device passphrase: " )
83- . context ( "Failed to read passphrase" ) ?;
84- let confirm = rpassword:: prompt_password ( "Confirm passphrase: " )
85- . context ( "Failed to read confirmation" ) ?;
86- if pass != confirm {
87- return Err ( anyhow ! ( "Passphrases do not match" ) ) ;
76+ // Handle passphrase — rotate always reuses the existing key,
77+ // so we need the ORIGINAL passphrase to decrypt it.
78+ let ci_pass = {
79+ #[ allow( clippy:: disallowed_methods) ]
80+ let env_pass = std:: env:: var ( "AUTHS_PASSPHRASE" ) . ok ( ) ;
81+ if let Some ( pass) = env_pass {
82+ println ! ( "\x1b [2mUsing passphrase from AUTHS_PASSPHRASE env var.\x1b [0m" ) ;
83+ Zeroizing :: new ( pass)
84+ } else {
85+ let pass =
86+ rpassword:: prompt_password ( "Passphrase for existing ci-release-device key: " )
87+ . context ( "Failed to read passphrase" ) ?;
88+ Zeroizing :: new ( pass)
8889 }
89- Zeroizing :: new ( pass)
9090 } ;
9191
9292 // Regenerate file keychain
0 commit comments