refactor(noise/protocol): align DHStateHybrid with non-null DHState

- Match the tightened `copyFrom` signature on DHState by making the
  primary `other` parameter non-null while keeping `remote` nullable
  (a missing peer is meaningful for hybrid algorithms).
- Note the inheritance relationship between the single- and two-arg
  copyFrom overloads.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
yet 2026-05-15 17:57:22 +04:00
parent c04027774f
commit 2655aa7636

View File

@ -37,6 +37,9 @@ interface DHStateHybrid : DHState {
*/
fun generateKeyPair(remote: DHState?)
// Note: copyFrom(other) is inherited from DHState; the two-arg overload
// below adds the remote-peer parameter required by hybrid algorithms.
/**
* Copies the key values from another DH object of the same type.
*
@ -46,7 +49,7 @@ interface DHStateHybrid : DHState {
* @throws IllegalStateException The other or remote DH object does not have
* the same type as this object.
*/
fun copyFrom(other: DHState?, remote: DHState?)
fun copyFrom(other: DHState, remote: DHState?)
/**
* Specifies the local peer object prior to setting a public key