2022-11-17 21:53:36 +00:00
|
|
|
//! Helpers to use cryptographic data types in nettext
|
|
|
|
|
2022-11-22 13:56:58 +00:00
|
|
|
pub use dryoc::*;
|
2022-11-17 21:53:36 +00:00
|
|
|
|
2022-11-22 13:56:58 +00:00
|
|
|
use dryoc::types::{Bytes, StackByteArray};
|
2022-11-17 21:53:36 +00:00
|
|
|
|
2022-11-22 13:56:58 +00:00
|
|
|
use crate::enc;
|
2022-11-17 21:53:36 +00:00
|
|
|
|
2022-11-22 13:56:58 +00:00
|
|
|
pub type SigningKeyPair = sign::SigningKeyPair<sign::PublicKey, sign::SecretKey>;
|
2022-11-17 21:53:36 +00:00
|
|
|
|
2022-11-22 13:56:58 +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
|
|
|
}
|