mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-29 10:29:32 +00:00
Rebased
This commit is contained in:
parent
de26d92e5d
commit
5b667fa302
@ -74,7 +74,8 @@ impl PrivateKey {
|
||||
|
||||
let sk = k256::SecretKey::from_slice(value).map_err(|_e| LeeError::InvalidPrivateKey)?;
|
||||
|
||||
let hashed: [u8; 32] = Sha256::digest(sk.public_key().to_encoded_point(true).as_bytes()).into();
|
||||
let hashed: [u8; 32] =
|
||||
Sha256::digest(sk.public_key().to_encoded_point(true).as_bytes()).into();
|
||||
|
||||
let sk = sk.to_nonzero_scalar();
|
||||
|
||||
|
||||
Binary file not shown.
@ -7,8 +7,9 @@ use zeroize::Zeroizing;
|
||||
|
||||
pub mod python_path;
|
||||
|
||||
/// NSK and VSK as fixed-length zeroizing byte arrays.
|
||||
type PrivateKeyPair = (Zeroizing<[u8; 32]>, Zeroizing<[u8; 32]>);
|
||||
/// NSK (32 bytes) and VSK (64 bytes, the ML-KEM-768 seed `d || z`) as fixed-length zeroizing byte
|
||||
/// arrays.
|
||||
type PrivateKeyPair = (Zeroizing<[u8; 32]>, Zeroizing<[u8; 64]>);
|
||||
|
||||
// TODO: encrypt at rest alongside broader wallet storage encryption work.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
@ -239,13 +240,13 @@ impl KeycardWallet {
|
||||
};
|
||||
|
||||
let vsk = {
|
||||
if raw_vsk.len() != 32 {
|
||||
if raw_vsk.len() != 64 {
|
||||
return Err(PyErr::new::<pyo3::exceptions::PyValueError, _>(format!(
|
||||
"expected 32-byte VSK from keycard, got {} bytes",
|
||||
"expected 64-byte VSK from keycard, got {} bytes",
|
||||
raw_vsk.len()
|
||||
)));
|
||||
}
|
||||
let mut arr = Zeroizing::new([0_u8; 32]);
|
||||
let mut arr = Zeroizing::new([0_u8; 64]);
|
||||
arr.copy_from_slice(&raw_vsk);
|
||||
arr
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user