Skip to content

Commit

Permalink
refactor into Message API
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr. Capybara committed Oct 16, 2023
1 parent a49eac9 commit 851a13f
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 373 deletions.
29 changes: 5 additions & 24 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use curves::EdCurvePoint;
use rug::Integer;

/*
TODO:
TODO:
- refactor z, z_x, z_y into message
- fix tag authentication failure
- update usage examples in docs
- Fix benches
*/
*/

/// Module for all EC operations.
pub mod curves;
Expand All @@ -20,24 +21,6 @@ pub mod sha3 {
/// Module for encrypt, decrypt, and sign functions.
pub mod ops;

#[derive(Debug)]
/// An object containing the necessary fields for symmetric encryptions and decryptions.
pub struct SymmetricCryptogram {
/// nonce
pub z: Vec<u8>,
}

#[derive(Debug)]
/// An object containing the necessary fields for asymmetric encryptions and decryptions.
pub struct ECCryptogram {
/// Z_x is the x coordinate of the public nonce
pub z_x: Integer,
/// Z_y is the y coordinate of the public nonce
pub z_y: Integer,
/// c represents the ciphertext of an encryption
pub t: Vec<u8>,
}

#[derive(Debug)]
/// An object containing the necessary fields for Schnorr signatures.
pub struct Signature {
Expand All @@ -61,10 +44,8 @@ impl Clone for Signature {
pub struct KeyPair {
/// String indicating the owner of the key, can be arbitrary
pub owner: String,
/// Curve Point X coordinate
pub pub_x: Integer,
/// Curve Point Y coordinate
pub pub_y: Integer,
/// Public encryption key
pub pub_key: EdCurvePoint,
/// value representing secret scalar, None if KeyType is PUBLIC
pub priv_key: Vec<u8>,
/// Date key was generated
Expand Down
Loading

0 comments on commit 851a13f

Please sign in to comment.