@@ -3,9 +3,9 @@ use std::marker::PhantomData;
33use hkdf:: Hkdf ;
44use rand_core:: { CryptoRng , RngCore } ;
55use sha2:: Sha256 ;
6- use x25519_dalek:: { SharedSecret , StaticSecret } ;
6+ use x25519_dalek:: SharedSecret ;
77
8- use crate :: keys:: { SymmetricKey32 , X25519PublicKey } ;
8+ use crate :: keys:: { SymmetricKey32 , X25519PrivateKey , X25519PublicKey } ;
99use crate :: xeddsa_sign:: Ed25519Signature ;
1010
1111/// A prekey bundle containing the public keys needed to initiate an X3DH key exchange.
@@ -67,12 +67,12 @@ impl<D: DomainSeparator> X3Handshake<D> {
6767 /// # Returns
6868 /// A tuple of (shared secret bytes, ephemeral public key)
6969 pub fn initator < R : RngCore + CryptoRng > (
70- identity_keypair : & StaticSecret ,
70+ identity_keypair : & X25519PrivateKey ,
7171 recipient_bundle : & PrekeyBundle ,
7272 rng : & mut R ,
7373 ) -> ( SymmetricKey32 , X25519PublicKey ) {
74- // Generate ephemeral key for this handshake (using StaticSecret for multiple DH operations)
75- let ephemeral_secret = StaticSecret :: random_from_rng ( rng) ;
74+ // Generate ephemeral key for this handshake (using X25519PrivateKey for multiple DH operations)
75+ let ephemeral_secret = X25519PrivateKey :: random_from_rng ( rng) ;
7676 let ephemeral_public = X25519PublicKey :: from ( & ephemeral_secret) ;
7777
7878 // Perform the 4 Diffie-Hellman operations
@@ -102,9 +102,9 @@ impl<D: DomainSeparator> X3Handshake<D> {
102102 /// # Returns
103103 /// The derived shared secret bytes
104104 pub fn responder (
105- identity_keypair : & StaticSecret ,
106- signed_prekey : & StaticSecret ,
107- onetime_prekey : Option < & StaticSecret > ,
105+ identity_keypair : & X25519PrivateKey ,
106+ signed_prekey : & X25519PrivateKey ,
107+ onetime_prekey : Option < & X25519PrivateKey > ,
108108 initiator_identity : & X25519PublicKey ,
109109 initiator_ephemeral : & X25519PublicKey ,
110110 ) -> SymmetricKey32 {
@@ -135,17 +135,17 @@ mod tests {
135135 let mut rng = OsRng ;
136136
137137 // Alice (initiator) generates her identity key
138- let alice_identity = StaticSecret :: random_from_rng ( rng) ;
138+ let alice_identity = X25519PrivateKey :: random_from_rng ( rng) ;
139139 let alice_identity_pub = X25519PublicKey :: from ( & alice_identity) ;
140140
141141 // Bob (responder) generates his keys
142- let bob_identity = StaticSecret :: random_from_rng ( rng) ;
142+ let bob_identity = X25519PrivateKey :: random_from_rng ( rng) ;
143143 let bob_identity_pub = X25519PublicKey :: from ( & bob_identity) ;
144144
145- let bob_signed_prekey = StaticSecret :: random_from_rng ( rng) ;
145+ let bob_signed_prekey = X25519PrivateKey :: random_from_rng ( rng) ;
146146 let bob_signed_prekey_pub = X25519PublicKey :: from ( & bob_signed_prekey) ;
147147
148- let bob_onetime_prekey = StaticSecret :: random_from_rng ( rng) ;
148+ let bob_onetime_prekey = X25519PrivateKey :: random_from_rng ( rng) ;
149149 let bob_onetime_prekey_pub = X25519PublicKey :: from ( & bob_onetime_prekey) ;
150150
151151 // Create Bob's prekey bundle (with one-time prekey)
@@ -178,14 +178,14 @@ mod tests {
178178 let mut rng = OsRng ;
179179
180180 // Alice (initiator) generates her identity key
181- let alice_identity = StaticSecret :: random_from_rng ( rng) ;
181+ let alice_identity = X25519PrivateKey :: random_from_rng ( rng) ;
182182 let alice_identity_pub = X25519PublicKey :: from ( & alice_identity) ;
183183
184184 // Bob (responder) generates his keys
185- let bob_identity = StaticSecret :: random_from_rng ( rng) ;
185+ let bob_identity = X25519PrivateKey :: random_from_rng ( rng) ;
186186 let bob_identity_pub = X25519PublicKey :: from ( & bob_identity) ;
187187
188- let bob_signed_prekey = StaticSecret :: random_from_rng ( rng) ;
188+ let bob_signed_prekey = X25519PrivateKey :: random_from_rng ( rng) ;
189189 let bob_signed_prekey_pub = X25519PublicKey :: from ( & bob_signed_prekey) ;
190190
191191 // Create Bob's prekey bundle (without one-time prekey)
0 commit comments