KCl v1.0.4 Kcl.State View Source
On-going KCl session state
Some helpers to maintain state between messages
Link to this section Summary
Link to this section Types
Link to this type
t()
View Source
t() :: %Kcl.State{our_private: term(), our_public: term(), previous_nonce: term(), shared_secret: term(), their_public: term()}
Link to this section Functions
Link to this function
init(our_private, our_public \\ nil)
View Source
init(Kcl.key(), Kcl.key() | nil) :: Kcl.State.t()
Initialize a new state
The private key will be used to derive the public one, if such is not supplied. There is, otherwise, no verification that the supplied keys form a valid pair.
Link to this function
new_peer(state, their_public)
View Source
new_peer(Kcl.State.t(), Kcl.key()) :: Kcl.State.t()
update the state for a new peer
The shared secret is computed from the state and new peer public key.
The previous_nonce value is also reset to 0.