Add a method to create a pre shared key when you already have the raw bytes (#1570)

This commit is contained in:
Rüdiger Klaehn 2020-05-13 17:08:12 +02:00 committed by GitHub
parent 06721128f1
commit a83654ca4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,6 +55,11 @@ const FINGERPRINT_SIZE: usize = 16;
pub struct PreSharedKey([u8; KEY_SIZE]);
impl PreSharedKey {
/// Create a new pre shared key from raw bytes
pub fn new(data: [u8; KEY_SIZE]) -> Self {
Self(data)
}
/// Compute PreSharedKey fingerprint identical to the go-libp2p fingerprint.
/// The computation of the fingerprint is not specified in the spec.
///