Skip to content

Commit

Permalink
feat(cli): add unit test for empty updater private key password (#8096)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Oct 25, 2023
1 parent ae75004 commit a635ec2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tooling/cli/src/helpers/updater_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,19 @@ where
.map_err(|e| minisign::PError::new(minisign::ErrorKind::Io, e))?;
Ok(BufReader::new(file))
}

#[cfg(test)]
mod tests {
const PRIVATE_KEY: &str = "dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5dkpDN09RZm5GeVAzc2RuYlNzWVVJelJRQnNIV2JUcGVXZUplWXZXYXpqUUFBQkFBQUFBQUFBQUFBQUlBQUFBQTZrN2RnWGh5dURxSzZiL1ZQSDdNcktiaHRxczQwMXdQelRHbjRNcGVlY1BLMTBxR2dpa3I3dDE1UTVDRDE4MXR4WlQwa1BQaXdxKy9UU2J2QmVSNXhOQWFDeG1GSVllbUNpTGJQRkhhTnROR3I5RmdUZi90OGtvaGhJS1ZTcjdZU0NyYzhQWlQ5cGM9Cg==";

// we use minisign=0.7.3 to prevent a breaking change
#[test]
fn empty_password_is_valid() {
let path = std::env::temp_dir().join("minisign-password-text.txt");
std::fs::write(&path, b"TAURI").expect("failed to write test file");

let secret_key =
super::secret_key(PRIVATE_KEY.into(), Some("".into())).expect("failed to resolve secret key");
super::sign_file(&secret_key, &path).expect("failed to sign file");
}
}

0 comments on commit a635ec2

Please sign in to comment.