Rename RAD_SEED to RAD_KEYGEN_SEED

More explicit.
This commit is contained in:
cloudhead
2024-04-26 10:38:54 +02:00
parent fe5757d122
commit a3ffe51ddf
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ fn formula(root: &Path, test: impl AsRef<Path>) -> Result<TestFormula, Box<dyn s
.env("LANG", "C")
.env("USER", "alice")
.env(env::RAD_PASSPHRASE, "radicle")
.env(env::RAD_SEED, RAD_SEED)
.env(env::RAD_KEYGEN_SEED, RAD_SEED)
.env(env::RAD_RNG_SEED, "0")
.env(env::RAD_LOCAL_TIME, "1671125284")
.envs(git::env::GIT_DEFAULT_CONFIG)
+4 -4
View File
@@ -43,7 +43,7 @@ pub mod env {
/// RNG seed. Must be convertible to a `u64`.
pub const RAD_RNG_SEED: &str = "RAD_RNG_SEED";
/// Private key seed. Used for generating deterministic keypairs.
pub const RAD_SEED: &str = "RAD_SEED";
pub const RAD_KEYGEN_SEED: &str = "RAD_KEYGEN_SEED";
/// Show radicle hints.
pub const RAD_HINT: &str = "RAD_HINT";
/// Environment variable to set to overwrite the commit date for both
@@ -115,16 +115,16 @@ pub mod env {
/// Return the seed stored in the [`RAD_SEED`] environment variable, or generate a random one.
pub fn seed() -> crypto::Seed {
if let Ok(seed) = var(RAD_SEED) {
if let Ok(seed) = var(RAD_KEYGEN_SEED) {
let Ok(seed) = (0..seed.len())
.step_by(2)
.map(|i| u8::from_str_radix(&seed[i..i + 2], 16))
.collect::<Result<Vec<u8>, _>>()
else {
panic!("env::seed: invalid hexadecimal value set in `{RAD_SEED}`");
panic!("env::seed: invalid hexadecimal value set in `{RAD_KEYGEN_SEED}`");
};
let Ok(seed): Result<[u8; 32], _> = seed.try_into() else {
panic!("env::seed: invalid seed length set in `{RAD_SEED}`");
panic!("env::seed: invalid seed length set in `{RAD_KEYGEN_SEED}`");
};
crypto::Seed::new(seed)
} else {