diff --git a/rust/src/crypto.rs b/rust/src/crypto.rs index 54adfb3b03817014ed87fc7ba1eb84434e136fa1..c0d53cd26bfc90b6495323e776684a4a03f224e5 100644 --- a/rust/src/crypto.rs +++ b/rust/src/crypto.rs @@ -131,6 +131,12 @@ impl DhtCertificate { } } + pub fn from_slice(buffer: &str) -> Box<DhtCertificate> { + unsafe { + Box::from_raw(dht_certificate_import((&*buffer).as_ptr(), buffer.len())) + } + } + pub fn id(&self) -> InfoHash { unsafe { dht_certificate_get_id(&*self)