nettext/src/crypto/mod.rs

22 lines
542 B
Rust
Raw Normal View History

2022-11-17 21:53:36 +00:00
//! Helpers to use cryptographic data types in nettext
pub use dryoc::*;
2022-11-17 21:53:36 +00:00
use dryoc::types::{Bytes, StackByteArray};
2022-11-17 21:53:36 +00:00
use crate::enc;
2022-11-17 21:53:36 +00:00
pub type SigningKeyPair = sign::SigningKeyPair<sign::PublicKey, sign::SecretKey>;
2022-11-17 21:53:36 +00:00
impl<const N: usize> enc::Encode for StackByteArray<N> {
fn term(&self) -> enc::Result<'_> {
Ok(enc::bytes(self.as_slice()))
}
}
impl enc::Encode for sign::SigningKeyPair<sign::PublicKey, sign::SecretKey> {
fn term(&self) -> enc::Result<'_> {
Ok(enc::bytes(self.secret_key.as_slice()))
}
2022-11-17 21:53:36 +00:00
}