fix(encryption): rename os_random to random_seed and fix ESK derivation in tests

Rename os_random field to random_seed per review feedback. Fix tests
that constructed SharedSecretKey with a hardcoded EphemeralSecretKey
instead of deriving it via EphemeralSecretKey::new.
This commit is contained in:
Marvin Jones
2026-06-29 09:10:43 -04:00
parent 060a83879b
commit 6155bd9a37
55 changed files with 147 additions and 160 deletions
@@ -42,7 +42,7 @@ pub fn compute_circuit_output(
}
InputAccountIdentity::PrivateAuthorizedInit {
vpk,
os_random,
random_seed,
nsk,
identifier,
} => {
@@ -74,14 +74,14 @@ pub fn compute_circuit_output(
&PrivateAccountKind::Regular(*identifier),
&npk,
vpk,
os_random,
random_seed,
new_nullifier,
new_nonce,
);
}
InputAccountIdentity::PrivateAuthorizedUpdate {
vpk,
os_random,
random_seed,
nsk,
membership_proof,
identifier,
@@ -111,14 +111,14 @@ pub fn compute_circuit_output(
&PrivateAccountKind::Regular(*identifier),
&npk,
vpk,
os_random,
random_seed,
new_nullifier,
new_nonce,
);
}
InputAccountIdentity::PrivateUnauthorized {
vpk,
os_random,
random_seed,
npk,
identifier,
} => {
@@ -149,14 +149,14 @@ pub fn compute_circuit_output(
&PrivateAccountKind::Regular(*identifier),
npk,
vpk,
os_random,
random_seed,
new_nullifier,
new_nonce,
);
}
InputAccountIdentity::PrivatePdaInit {
vpk,
os_random,
random_seed,
npk,
identifier,
seed: _,
@@ -199,14 +199,14 @@ pub fn compute_circuit_output(
},
npk,
vpk,
os_random,
random_seed,
new_nullifier,
new_nonce,
);
}
InputAccountIdentity::PrivatePdaUpdate {
vpk,
os_random,
random_seed,
nsk,
membership_proof,
identifier,
@@ -247,7 +247,7 @@ pub fn compute_circuit_output(
},
&npk,
vpk,
os_random,
random_seed,
new_nullifier,
new_nonce,
);
@@ -270,7 +270,7 @@ fn emit_private_output(
kind: &PrivateAccountKind,
npk: &NullifierPublicKey,
vpk: &ViewingPublicKey,
os_random: &[u8; 32],
random_seed: &[u8; 32],
new_nullifier: (Nullifier, CommitmentSetDigest),
new_nonce: Nonce,
) {
@@ -281,7 +281,7 @@ fn emit_private_output(
let commitment_post = Commitment::new(account_id, &post_with_updated_nonce);
let esk = EphemeralSecretKey::new(account_id, os_random, &new_nonce);
let esk = EphemeralSecretKey::new(account_id, random_seed, &new_nonce);
let (shared_secret, epk) = SharedSecretKey::encapsulate_deterministic(vpk, &esk);
// Currently the view tag is properlty generated for all accounts.