mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-04 06:13:10 +00:00
clean up and fmt/clippy
This commit is contained in:
parent
ed373067fb
commit
9f753c0333
@ -10,8 +10,6 @@ use crate::key_management::{
|
|||||||
secret_holders::{PrivateKeyHolder, SecretSpendingKey},
|
secret_holders::{PrivateKeyHolder, SecretSpendingKey},
|
||||||
};
|
};
|
||||||
|
|
||||||
const TWO_POWER_31: u32 = (2u32).pow(31);
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct ChildKeysPrivate {
|
pub struct ChildKeysPrivate {
|
||||||
pub value: (KeyChain, nssa::Account),
|
pub value: (KeyChain, nssa::Account),
|
||||||
@ -20,21 +18,6 @@ pub struct ChildKeysPrivate {
|
|||||||
pub cci: Option<u32>,
|
pub cci: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChildKeysPrivate {
|
|
||||||
fn nth_child_nonharden_hash(&self, cci: u32) -> [u8; 64] {
|
|
||||||
/// TODO: logic required
|
|
||||||
panic!("Nonharden keys not yet designed for private state")
|
|
||||||
}
|
|
||||||
|
|
||||||
fn nth_child_harden_hash(&self, cci: u32) -> [u8; 64] {
|
|
||||||
let mut hash_input = vec![];
|
|
||||||
// hash_input.extend_from_slice(self.csk.value());
|
|
||||||
//hash_input.extend_from_slice(&(cci - TWO_POWER_31).to_le_bytes());
|
|
||||||
|
|
||||||
hmac_sha512::HMAC::mac(hash_input, self.ccc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl KeyNode for ChildKeysPrivate {
|
impl KeyNode for ChildKeysPrivate {
|
||||||
fn root(seed: [u8; 64]) -> Self {
|
fn root(seed: [u8; 64]) -> Self {
|
||||||
let hash_value = hmac_sha512::HMAC::mac(seed, b"NSSA_master_priv");
|
let hash_value = hmac_sha512::HMAC::mac(seed, b"NSSA_master_priv");
|
||||||
@ -127,7 +110,6 @@ impl KeyNode for ChildKeysPrivate {
|
|||||||
let isk = ssk.generate_child_incoming_viewing_secret_key(cci);
|
let isk = ssk.generate_child_incoming_viewing_secret_key(cci);
|
||||||
let ovk = ssk.generate_child_outgoing_viewing_secret_key(cci);
|
let ovk = ssk.generate_child_outgoing_viewing_secret_key(cci);
|
||||||
|
|
||||||
//TODO: separate out into its own function
|
|
||||||
let npk: NullifierPublicKey = {
|
let npk: NullifierPublicKey = {
|
||||||
let mut hasher = sha2::Sha256::new();
|
let mut hasher = sha2::Sha256::new();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user