Struct mithril_common::crypto_helper::ProtocolKey
source · pub struct ProtocolKey<T>where
T: Serialize + DeserializeOwned,{ /* private fields */ }
Expand description
A ProtocolKey is a wrapped that add Serialization capabilities.
When using serde to (de)serialize it will done using json hex (see key_decode_hex and key_encode_hex).
Implementations§
source§impl ProtocolKey<VerifyingKey>
impl ProtocolKey<VerifyingKey>
source§impl<T> ProtocolKey<T>where
T: Serialize + DeserializeOwned,
impl<T> ProtocolKey<T>where
T: Serialize + DeserializeOwned,
sourcepub fn from_json_hex(hex_string: &str) -> StdResult<Self>
pub fn from_json_hex(hex_string: &str) -> StdResult<Self>
Create an instance from a JSON hex representation
sourcepub fn to_json_hex(&self) -> StdResult<String>
pub fn to_json_hex(&self) -> StdResult<String>
Create a JSON hash representation of the key
sourcepub fn key_to_json_hex(key: &T) -> StdResult<String>
pub fn key_to_json_hex(key: &T) -> StdResult<String>
Create a JSON hash representation of the given key
sourcepub fn write_json_hex_to_file(&self, path: &Path) -> StdResult<()>
pub fn write_json_hex_to_file(&self, path: &Path) -> StdResult<()>
Write to file in JSON hex format
sourcepub fn read_json_hex_from_file(path: &Path) -> StdResult<Self>
pub fn read_json_hex_from_file(path: &Path) -> StdResult<Self>
Read from file in JSON hex format
source§impl ProtocolKey<Signature>
impl ProtocolKey<Signature>
sourcepub fn from_bytes_hex(hex_string: &str) -> StdResult<Self>
pub fn from_bytes_hex(hex_string: &str) -> StdResult<Self>
Create an instance from a bytes hex representation
sourcepub fn from_bytes(bytes: &[u8]) -> StdResult<Self>
pub fn from_bytes(bytes: &[u8]) -> StdResult<Self>
Create an instance from a bytes representation
sourcepub fn to_bytes_hex(&self) -> String
pub fn to_bytes_hex(&self) -> String
Create a bytes hash representation of the key
sourcepub fn key_to_bytes_hex(key: &Signature) -> String
pub fn key_to_bytes_hex(key: &Signature) -> String
Create a bytes hash representation of the given key
Trait Implementations§
source§impl<T> Clone for ProtocolKey<T>
impl<T> Clone for ProtocolKey<T>
source§fn clone(&self) -> ProtocolKey<T>
fn clone(&self) -> ProtocolKey<T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T> Debug for ProtocolKey<T>
impl<T> Debug for ProtocolKey<T>
source§impl<T> Deref for ProtocolKey<T>where
T: Serialize + DeserializeOwned,
impl<T> Deref for ProtocolKey<T>where
T: Serialize + DeserializeOwned,
source§impl<'de, T> Deserialize<'de> for ProtocolKey<T>
impl<'de, T> Deserialize<'de> for ProtocolKey<T>
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<ProtocolKey<MKProof>> for MKProof
impl From<ProtocolKey<MKProof>> for MKProof
source§fn from(value: ProtocolKey<MKProof>) -> Self
fn from(value: ProtocolKey<MKProof>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<OpCert>> for OpCert
impl From<ProtocolKey<OpCert>> for OpCert
source§fn from(value: ProtocolKey<OpCert>) -> Self
fn from(value: ProtocolKey<OpCert>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<Signature>> for Signature
impl From<ProtocolKey<Signature>> for Signature
source§fn from(value: ProtocolKey<Signature>) -> Self
fn from(value: ProtocolKey<Signature>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<SigningKey>> for SigningKey
impl From<ProtocolKey<SigningKey>> for SigningKey
source§fn from(value: ProtocolKey<SigningKey>) -> Self
fn from(value: ProtocolKey<SigningKey>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<StmAggrSig<CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>>>> for StmAggrSig<Blake2b<U32>>
impl From<ProtocolKey<StmAggrSig<CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>>>> for StmAggrSig<Blake2b<U32>>
source§fn from(value: ProtocolKey<StmAggrSig<Blake2b<U32>>>) -> Self
fn from(value: ProtocolKey<StmAggrSig<Blake2b<U32>>>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<StmAggrVerificationKey<CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>>>> for StmAggrVerificationKey<Blake2b<U32>>
impl From<ProtocolKey<StmAggrVerificationKey<CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>>>> for StmAggrVerificationKey<Blake2b<U32>>
source§fn from(value: ProtocolKey<StmAggrVerificationKey<Blake2b<U32>>>) -> Self
fn from(value: ProtocolKey<StmAggrVerificationKey<Blake2b<U32>>>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<StmSig>> for StmSig
impl From<ProtocolKey<StmSig>> for StmSig
source§fn from(value: ProtocolKey<StmSig>) -> Self
fn from(value: ProtocolKey<StmSig>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<Sum6KesSig>> for Sum6KesSig
impl From<ProtocolKey<Sum6KesSig>> for Sum6KesSig
source§fn from(value: ProtocolKey<Sum6KesSig>) -> Self
fn from(value: ProtocolKey<Sum6KesSig>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<VerificationKeyPoP>> for StmVerificationKeyPoP
impl From<ProtocolKey<VerificationKeyPoP>> for StmVerificationKeyPoP
source§fn from(value: ProtocolKey<StmVerificationKeyPoP>) -> Self
fn from(value: ProtocolKey<StmVerificationKeyPoP>) -> Self
Converts to this type from the input type.
source§impl From<ProtocolKey<VerifyingKey>> for VerifyingKey
impl From<ProtocolKey<VerifyingKey>> for VerifyingKey
source§fn from(value: ProtocolKey<VerifyingKey>) -> Self
fn from(value: ProtocolKey<VerifyingKey>) -> Self
Converts to this type from the input type.
source§impl From<Signature> for ProtocolKey<Signature>
impl From<Signature> for ProtocolKey<Signature>
source§impl From<SigningKey> for ProtocolKey<SigningKey>
impl From<SigningKey> for ProtocolKey<SigningKey>
source§impl From<StmAggrSig<CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>>> for ProtocolKey<StmAggrSig<Blake2b<U32>>>
impl From<StmAggrSig<CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>>> for ProtocolKey<StmAggrSig<Blake2b<U32>>>
source§fn from(value: StmAggrSig<Blake2b<U32>>) -> Self
fn from(value: StmAggrSig<Blake2b<U32>>) -> Self
Converts to this type from the input type.
source§impl From<StmAggrVerificationKey<CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>>> for ProtocolKey<StmAggrVerificationKey<Blake2b<U32>>>
impl From<StmAggrVerificationKey<CoreWrapper<CtVariableCoreWrapper<Blake2bVarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>>> for ProtocolKey<StmAggrVerificationKey<Blake2b<U32>>>
source§fn from(value: StmAggrVerificationKey<Blake2b<U32>>) -> Self
fn from(value: StmAggrVerificationKey<Blake2b<U32>>) -> Self
Converts to this type from the input type.
source§impl From<Sum6KesSig> for ProtocolKey<Sum6KesSig>
impl From<Sum6KesSig> for ProtocolKey<Sum6KesSig>
source§impl From<VerificationKeyPoP> for ProtocolKey<StmVerificationKeyPoP>
impl From<VerificationKeyPoP> for ProtocolKey<StmVerificationKeyPoP>
source§fn from(value: StmVerificationKeyPoP) -> Self
fn from(value: StmVerificationKeyPoP) -> Self
Converts to this type from the input type.
source§impl From<VerifyingKey> for ProtocolKey<VerifyingKey>
impl From<VerifyingKey> for ProtocolKey<VerifyingKey>
source§impl<T> PartialEq for ProtocolKey<T>
impl<T> PartialEq for ProtocolKey<T>
source§impl<T> Serialize for ProtocolKey<T>
impl<T> Serialize for ProtocolKey<T>
source§impl<T> TryFrom<&ProtocolKey<T>> for String
impl<T> TryFrom<&ProtocolKey<T>> for String
source§impl<T> TryFrom<&str> for ProtocolKey<T>
impl<T> TryFrom<&str> for ProtocolKey<T>
source§impl<T> TryFrom<ProtocolKey<T>> for String
impl<T> TryFrom<ProtocolKey<T>> for String
source§impl<T> TryFrom<String> for ProtocolKey<T>
impl<T> TryFrom<String> for ProtocolKey<T>
impl<T> Copy for ProtocolKey<T>
impl<T> Eq for ProtocolKey<T>
impl<T> StructuralPartialEq for ProtocolKey<T>where
T: Serialize + DeserializeOwned,
Auto Trait Implementations§
impl<T> Freeze for ProtocolKey<T>where
T: Freeze,
impl<T> RefUnwindSafe for ProtocolKey<T>where
T: RefUnwindSafe,
impl<T> Send for ProtocolKey<T>where
T: Send,
impl<T> Sync for ProtocolKey<T>where
T: Sync,
impl<T> Unpin for ProtocolKey<T>where
T: Unpin,
impl<T> UnwindSafe for ProtocolKey<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.