fix: inline Noise responder public key

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
viyatb-oai
2026-06-09 15:45:20 -07:00
parent fead5a9a12
commit 7a153b809a

View File

@@ -78,17 +78,6 @@ impl NoiseChannelPublicKey {
}
}
pub(crate) fn from_raw(
dh: &<X25519 as Dh>::PubKey,
kem: &<AwsLcMlKem768 as Kem>::PubKey,
) -> Self {
Self {
suite: NOISE_CHANNEL_SUITE.to_string(),
x25519_public_key: STANDARD.encode(dh),
mlkem768_public_key: STANDARD.encode(kem.as_slice()),
}
}
fn decode(
&self,
) -> Result<(<X25519 as Dh>::PubKey, <AwsLcMlKem768 as Kem>::PubKey), NoiseChannelError> {
@@ -235,9 +224,14 @@ impl PendingResponderHandshake {
.ok_or(NoiseChannelError::InvalidMessage(
"handshake request is missing initiator static key",
))?;
let initiator_public_key = NoiseChannelPublicKey {
suite: NOISE_CHANNEL_SUITE.to_string(),
x25519_public_key: STANDARD.encode(remote.dh()),
mlkem768_public_key: STANDARD.encode(remote.kem().as_slice()),
};
Ok(Self {
handshake,
initiator_public_key: NoiseChannelPublicKey::from_raw(remote.dh(), remote.kem()),
initiator_public_key,
payload: payload[..payload_len].to_vec(),
})
}