use std::{convert::TryFrom, marker::PhantomData}; use crate::{Binding, Error, PublicKey, Randomizer, SigType, Signature, SpendAuth}; /// A refinement type indicating that the inner `[u8; 32]` represents an /// encoding of a RedJubJub secret key. #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub struct SecretKeyBytes { bytes: [u8; 32], _marker: PhantomData, } impl From<[u8; 32]> for SecretKeyBytes { fn from(bytes: [u8; 32]) -> SecretKeyBytes { SecretKeyBytes { bytes, _marker: PhantomData, } } } impl From> for [u8; 32] { fn from(refined: SecretKeyBytes) -> [u8; 32] { refined.bytes } } /// A RedJubJub secret key. // XXX PartialEq, Eq? #[derive(Copy, Clone, Debug)] pub struct SecretKey { // fields _marker: PhantomData, } impl From> for SecretKeyBytes { fn from(pk: SecretKey) -> SecretKeyBytes { unimplemented!(); } } // XXX could this be a From impl? impl TryFrom> for SecretKey { type Error = Error; fn try_from(bytes: SecretKeyBytes) -> Result { unimplemented!(); } } impl<'a, T: SigType> From<&'a SecretKey> for PublicKey { fn from(sk: &'a SecretKey) -> PublicKey { unimplemented!(); } } impl SecretKey { /// Randomize this public key with the given `randomizer`. pub fn randomize(&self, randomizer: Randomizer) -> PublicKey { unimplemented!(); } } impl SecretKey { /// Create a Zcash `BindingSig` on `msg` using this `SecretKey`. // Similar to signature::Signer but without boxed errors. pub fn sign(&self, msg: &[u8]) -> Signature { // could use sign_inner unimplemented!(); } } impl SecretKey { /// Create a Zcash `SpendAuthSig` on `msg` using this `SecretKey`. // Similar to signature::Signer but without boxed errors. pub fn sign(&self, msg: &[u8]) -> Signature { // could use sign_inner unimplemented!(); } }