Skip to content

Commit e0365d6

Browse files
committed
Fix some imports
1 parent 0195f2c commit e0365d6

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

nucypher-core/src/dkg.rs

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
use alloc::boxed::Box;
22
use alloc::string::String;
3+
use alloc::vec::Vec;
34
use core::fmt;
45

56
use chacha20poly1305::aead::{Aead, AeadCore, KeyInit};
67
use chacha20poly1305::{ChaCha20Poly1305, Key, Nonce};
78
use ferveo::api::{CiphertextHeader, FerveoVariant};
89
use generic_array::typenum::Unsigned;
910
use rand_core::{CryptoRng, RngCore};
10-
use serde::{Deserialize, Serialize};
11+
use serde::{Deserialize, Deserializer, Serialize, Serializer};
12+
use serde_json;
1113
use umbral_pre::serde_bytes; // TODO should this be in umbral?
1214

1315
use crate::access_control::AccessControlPolicy;
1416
use crate::conditions::Context;
15-
use crate::dkg::session::{SessionSharedSecret, SessionStaticKey};
17+
use crate::dkg::session::{SessionSharedSecret, SessionStaticKey, SessionSecretFactory};
1618
use crate::versioning::{
1719
messagepack_deserialize, messagepack_serialize, DeserializationError, ProtocolObject,
1820
ProtocolObjectInner,
@@ -617,26 +619,41 @@ impl ProtocolObject<'_> for EncryptedThresholdDecryptionResponse {}
617619

618620
#[cfg(test)]
619621
mod tests {
622+
use crate::dkg::session::{SessionSharedSecret, SessionStaticSecret, SessionSecretFactory, SessionStaticKey};
623+
use crate::dkg::{
624+
decrypt_with_shared_secret, encrypt_with_shared_secret, DecryptionError, NonceSize,
625+
ThresholdDecryptionRequest, EncryptedThresholdDecryptionRequest,
626+
ThresholdDecryptionResponse, EncryptedThresholdDecryptionResponse,
627+
};
628+
use crate::{AuthenticatedData, Conditions};
620629
use alloc::vec;
621630
use alloc::vec::Vec;
622631
use alloc::boxed::Box;
623-
use ferveo::api::{encrypt as ferveo_encrypt, DkgPublicKey, FerveoVariant, SecretBox};
632+
use core::clone::Clone;
633+
use ferveo::api::{DkgPublicKey, FerveoVariant, SecretBox, encrypt as ferveo_encrypt};
624634
use generic_array::typenum::Unsigned;
635+
use rand::SeedableRng;
636+
use rand::rngs::StdRng;
625637
use rand_core::RngCore;
638+
use serde::{Deserialize, Serialize};
639+
use serde_json;
640+
use x25519_dalek::{PublicKey, StaticSecret};
626641

627642
use crate::access_control::AccessControlPolicy;
628-
use crate::conditions::{Conditions, Context};
629-
use crate::dkg::session::{SessionSharedSecret, SessionStaticSecret};
630-
use crate::dkg::{
631-
decrypt_with_shared_secret, encrypt_with_shared_secret, DecryptionError, NonceSize,
632-
};
633-
use crate::versioning::{ProtocolObject, ProtocolObjectInner};
634-
use crate::{
635-
AuthenticatedData, EncryptedThresholdDecryptionRequest,
636-
EncryptedThresholdDecryptionResponse, SessionSecretFactory, SessionStaticKey,
637-
ThresholdDecryptionRequest, ThresholdDecryptionResponse,
643+
use crate::conditions::Context;
644+
use crate::versioning::{
645+
messagepack_deserialize, messagepack_serialize, DeserializationError, ProtocolObject,
646+
ProtocolObjectInner,
638647
};
639648

649+
#[cfg(feature = "deterministic_encryption")]
650+
#[derive(Serialize, Deserialize)]
651+
pub struct TestVector {
652+
pub seed: u8,
653+
pub plaintext: Vec<u8>,
654+
pub ciphertext: Box<[u8]>,
655+
}
656+
640657
#[test]
641658
fn decryption_with_shared_secret() {
642659
let service_secret = SessionStaticSecret::random();
@@ -860,13 +877,6 @@ mod tests {
860877
.is_err());
861878
}
862879

863-
#[cfg(feature = "deterministic_encryption")]
864-
pub struct TestVector {
865-
pub seed: u8,
866-
pub plaintext: Vec<u8>,
867-
pub ciphertext: Box<[u8]>,
868-
}
869-
870880
#[cfg(feature = "deterministic_encryption")]
871881
pub fn generate_test_vectors() -> Vec<TestVector> {
872882
let mut test_vectors = Vec::new();

0 commit comments

Comments
 (0)