refactor(core/org): drop unreachable unwrap in unwrap_org_key; assert hex in OrgId test
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TJo44YM3UbBjro2fG6NrKy
This commit is contained in:
@@ -304,9 +304,9 @@ pub fn unwrap_org_key(wrapped: &[u8], ed25519_seed: &Zeroizing<[u8; 32]>) -> Res
|
||||
return Err(RelicarioError::Format("wrapped key blob too short".into()));
|
||||
}
|
||||
|
||||
let ephemeral_pk = x25519_dalek::PublicKey::from(
|
||||
<[u8; 32]>::try_from(&wrapped[..32]).unwrap()
|
||||
);
|
||||
let mut eph_bytes = [0u8; 32];
|
||||
eph_bytes.copy_from_slice(&wrapped[..32]);
|
||||
let ephemeral_pk = x25519_dalek::PublicKey::from(eph_bytes);
|
||||
let encrypted = &wrapped[32..];
|
||||
|
||||
let recipient_sk = ed25519_seed_to_x25519_secret(ed25519_seed);
|
||||
@@ -359,6 +359,7 @@ mod tests {
|
||||
fn org_id_is_16_hex_chars() {
|
||||
let id = OrgId::new();
|
||||
assert_eq!(id.0.len(), 16);
|
||||
assert!(id.0.chars().all(|c| c.is_ascii_hexdigit()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user