Function generate_key

Source
pub fn generate_key(lifetime: Option<Duration>) -> PeerKey
Expand description

It generates a new random 32-char authentication PeerKey.

It can be an expiring or permanent key.

§Panics

It would panic if the lifetime: Duration + Duration is more than Duration::MAX.

§Arguments

  • lifetime: if None the key will be permanent.