From 22cdce51026f9d9e24ae751fae428b9bfbf07843 Mon Sep 17 00:00:00 2001 From: Oleksandr Pravdyvyi Date: Mon, 1 Sep 2025 14:06:43 +0300 Subject: [PATCH] fix: comments fix --- key_protocol/src/key_protocol_core/mod.rs | 60 +---------------------- nssa/src/signature/private_key.rs | 3 +- 2 files changed, 2 insertions(+), 61 deletions(-) diff --git a/key_protocol/src/key_protocol_core/mod.rs b/key_protocol/src/key_protocol_core/mod.rs index 3b8092e..ab5840c 100644 --- a/key_protocol/src/key_protocol_core/mod.rs +++ b/key_protocol/src/key_protocol_core/mod.rs @@ -1,14 +1,9 @@ use std::collections::HashMap; -use anyhow::Result; use k256::AffinePoint; use serde::{Deserialize, Serialize}; -use crate::key_management::{ - constants_types::{CipherText, Nonce}, - ephemeral_key_holder::EphemeralKeyHolder, - KeyChain, -}; +use crate::key_management::KeyChain; pub type PublicKey = AffinePoint; @@ -18,33 +13,6 @@ pub struct NSSAUserData { pub accounts: HashMap, } -///A strucure, which represents all the visible(public) information -/// -/// known to each node about account `address` -/// -/// Main usage is to encode data for other account -#[derive(Serialize, Clone)] -pub struct NSSAUserDataPublicMask { - pub nullifier_public_key: AffinePoint, - pub viewing_public_key: AffinePoint, -} - -impl NSSAUserDataPublicMask { - pub fn encrypt_data( - ephemeral_key_holder: &EphemeralKeyHolder, - viewing_public_key_receiver: AffinePoint, - data: &[u8], - ) -> (CipherText, Nonce) { - //Using of parent NSSAUserData fuction - NSSAUserData::encrypt_data(ephemeral_key_holder, viewing_public_key_receiver, data) - } - - //ToDo: Part of a private keys update - // pub fn make_tag(&self) -> Tag { - // self.address.value()[0] - // } -} - impl NSSAUserData { pub fn new() -> Self { let key_holder = KeyChain::new_os_random(); @@ -90,24 +58,6 @@ impl NSSAUserData { self.key_holder.get_pub_account_signing_key(address) } - pub fn encrypt_data( - ephemeral_key_holder: &EphemeralKeyHolder, - viewing_public_key_receiver: AffinePoint, - data: &[u8], - ) -> (CipherText, Nonce) { - ephemeral_key_holder.encrypt_data(viewing_public_key_receiver, data) - } - - pub fn decrypt_data( - &self, - ephemeral_public_key_sender: AffinePoint, - ciphertext: CipherText, - nonce: Nonce, - ) -> Result, aes_gcm::Error> { - self.key_holder - .decrypt_data(ephemeral_public_key_sender, ciphertext, nonce) - } - pub fn update_account_balance(&mut self, address: nssa::Address, new_balance: u128) { self.accounts .entry(address) @@ -119,14 +69,6 @@ impl NSSAUserData { // pub fn make_tag(&self) -> Tag { // self.address.value()[0] // } - - ///Produce account public mask - pub fn make_account_public_mask(&self) -> NSSAUserDataPublicMask { - NSSAUserDataPublicMask { - nullifier_public_key: self.key_holder.nullifer_public_key, - viewing_public_key: self.key_holder.viewing_public_key, - } - } } impl Default for NSSAUserData { diff --git a/nssa/src/signature/private_key.rs b/nssa/src/signature/private_key.rs index abe5af6..667fc30 100644 --- a/nssa/src/signature/private_key.rs +++ b/nssa/src/signature/private_key.rs @@ -48,7 +48,6 @@ mod tests { #[test] fn test_produce_key() { - let key = PrivateKey::new_os_random(); - println!("{:?}", key.0); + let _key = PrivateKey::new_os_random(); } }