Skip to content

Commit

Permalink
refactor ratchet tree nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
rainliu committed Sep 4, 2023
1 parent debd8a1 commit f9ff9d9
Show file tree
Hide file tree
Showing 6 changed files with 569 additions and 549 deletions.
2 changes: 1 addition & 1 deletion rmls/src/group/proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::extensibility::Extensions;
use crate::framing::{GroupID, ProtocolVersion};
use crate::key_package::KeyPackage;
use crate::key_schedule::PreSharedKeyID;
use crate::ratchet_tree::*;
use crate::ratchet_tree::leaf_node::LeafNode;
use crate::utilities::error::*;
use crate::utilities::serde::*;
use crate::utilities::tree_math::*;
Expand Down
14 changes: 7 additions & 7 deletions rmls/src/key_package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::extensibility::Extensions;
use crate::framing::*;
use crate::key_package::builder::KeyPackageBuilder;
use crate::key_schedule::*;
use crate::ratchet_tree::*;
use crate::ratchet_tree::leaf_node::*;
use crate::utilities::{error::*, serde::*};

/// [RFC9420 Sec.5.2](https://www.rfc-editor.org/rfc/rfc9420.html#section-5.2) KeyPackageRef
Expand Down Expand Up @@ -145,7 +145,7 @@ impl KeyPackage {
pub(crate) fn new(
crypto_provider: &impl CryptoProvider,
crypto_config: CryptoConfig,
credential: Credential,
_credential: Credential,
signature_key_pair: &SignatureKeyPair,
) -> Result<Self> {
if crypto_provider
Expand All @@ -159,18 +159,18 @@ impl KeyPackage {
// Create a new HPKE key pair
let mut ikm = vec![0u8; crypto_provider.hash(crypto_config.cipher_suite)?.size()];
crypto_provider.rand().fill(&mut ikm)?;
let init_key = crypto_provider
let _init_key = crypto_provider
.hpke(crypto_config.cipher_suite)?
.kem_derive_key_pair(&ikm)?;

Ok(Self::default())
}

pub(crate) fn from_keys(
crypto_provider: &impl CryptoProvider,
crypto_config: CryptoConfig,
credential: Credential,
init_key: HPKEPublicKey,
_crypto_provider: &impl CryptoProvider,
_crypto_config: CryptoConfig,
_credential: Credential,
_init_key: HPKEPublicKey,
) -> Result<Self> {
Ok(Self::default())
}
Expand Down
Loading

0 comments on commit f9ff9d9

Please sign in to comment.