Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
randombit committed Jan 15, 2025
1 parent f6099f2 commit 0032b10
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::types::CspSecretKey;
use crate::vault::api::{VetKdCspVault, VetKdEncryptedKeyShareCreationVaultError};
use crate::{key_id::KeyId, LocalCspVault};
use assert_matches::assert_matches;
use ic_crypto_internal_bls12_381_vetkd::{G2Affine, Scalar, TransportPublicKey};
use ic_crypto_internal_bls12_381_vetkd::{G2Affine, Scalar};
use ic_crypto_internal_multi_sig_bls12381::types as multi_types;
use ic_crypto_internal_threshold_sig_bls12381::types as threshold_types;
use ic_crypto_test_utils_reproducible_rng::reproducible_rng;
Expand All @@ -13,12 +13,6 @@ use ic_types_test_utils::ids::canister_test_id;
use rand::{CryptoRng, Rng, SeedableRng};
use rand_chacha::ChaCha20Rng;

fn create_transport_public_key<R: CryptoRng + Rng>(rng: &mut R) -> TransportPublicKey {
let g2 = G2Affine::hash("ic-crypto-test".as_bytes(), &rng.gen::<[u8; 32]>());
TransportPublicKey::deserialize(&g2.serialize())
.expect("Failed to deserialize G2Affine")
}

#[test]
fn should_correctly_create_encrypted_vetkd_key_share() {
let rng = &mut reproducible_rng();
Expand Down Expand Up @@ -138,7 +132,7 @@ impl CreateVetKdKeyShareTestSetup {
pub fn new<R: Rng + CryptoRng>(rng: &mut R) -> Self {
let master_secret_key = Scalar::random(rng);
let master_public_key = G2Affine::from(G2Affine::generator() * &master_secret_key);
let transport_secret_key = TransportSecretKey::generate(rng);
let transport_public_key = G2Affine::hash("ic-crypto-vetkd-test".as_bytes(), &rng.gen::<[u8; 32]>());
let key_id = KeyId::from([123; 32]);
let derivation_path = ExtendedDerivationPath {
caller: canister_test_id(234).get(),
Expand All @@ -150,7 +144,7 @@ impl CreateVetKdKeyShareTestSetup {
Self {
master_secret_key,
master_public_key: master_public_key.serialize().to_vec(),
transport_public_key: transport_secret_key.public_key().serialize().to_vec(),
transport_public_key: transport_public_key.serialize().to_vec(),
key_id,
derivation_path,
derivation_id,
Expand Down

0 comments on commit 0032b10

Please sign in to comment.