Trait massa_models::secure_share::SecureShareContent
source · pub trait SecureShareContent{
// Provided methods
fn sign(
&self,
keypair: &KeyPair,
content_hash: &Hash,
) -> Result<Signature, ModelsError> { ... }
fn verify_signature(
&self,
public_key: &PublicKey,
content_hash: &Hash,
signature: &Signature,
) -> Result<(), ModelsError> { ... }
fn new_verifiable<Ser: Serializer<Self>, ID: Id>(
self,
content_serializer: Ser,
keypair: &KeyPair,
chain_id: u64,
) -> Result<SecureShare<Self, ID>, ModelsError> { ... }
fn compute_hash(
&self,
content_serialized: &[u8],
content_creator_pub_key: &PublicKey,
_chain_id: u64,
) -> Hash { ... }
fn compute_signed_hash(
&self,
_public_key: &PublicKey,
content_hash: &Hash,
) -> Hash { ... }
fn serialize(
signature: &Signature,
creator_public_key: &PublicKey,
serialized_content: &[u8],
buffer: &mut Vec<u8>,
) -> Result<(), SerializeError> { ... }
fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>, Deser: Deserializer<Self>, ID: Id>(
content_serializer: Option<&dyn Serializer<Self>>,
signature_deserializer: &SignatureDeserializer,
creator_public_key_deserializer: &PublicKeyDeserializer,
content_deserializer: &Deser,
buffer: &'a [u8],
chain_id: u64,
) -> IResult<&'a [u8], SecureShare<Self, ID>, E> { ... }
}
Expand description
Trait that define a structure that can be signed for secure sharing.
Provided Methods§
sourcefn sign(
&self,
keypair: &KeyPair,
content_hash: &Hash,
) -> Result<Signature, ModelsError>
fn sign( &self, keypair: &KeyPair, content_hash: &Hash, ) -> Result<Signature, ModelsError>
Sign the SecureShare given the content
sourcefn verify_signature(
&self,
public_key: &PublicKey,
content_hash: &Hash,
signature: &Signature,
) -> Result<(), ModelsError>
fn verify_signature( &self, public_key: &PublicKey, content_hash: &Hash, signature: &Signature, ) -> Result<(), ModelsError>
verify signature
sourcefn new_verifiable<Ser: Serializer<Self>, ID: Id>(
self,
content_serializer: Ser,
keypair: &KeyPair,
chain_id: u64,
) -> Result<SecureShare<Self, ID>, ModelsError>
fn new_verifiable<Ser: Serializer<Self>, ID: Id>( self, content_serializer: Ser, keypair: &KeyPair, chain_id: u64, ) -> Result<SecureShare<Self, ID>, ModelsError>
Using the provided key-pair, applies a cryptographic signature, and packages the data required to share and verify the data in a trust-free network of peers.
sourcefn compute_hash(
&self,
content_serialized: &[u8],
content_creator_pub_key: &PublicKey,
_chain_id: u64,
) -> Hash
fn compute_hash( &self, content_serialized: &[u8], content_creator_pub_key: &PublicKey, _chain_id: u64, ) -> Hash
Compute hash
sourcefn compute_signed_hash(
&self,
_public_key: &PublicKey,
content_hash: &Hash,
) -> Hash
fn compute_signed_hash( &self, _public_key: &PublicKey, content_hash: &Hash, ) -> Hash
Compute hash used for signature
sourcefn serialize(
signature: &Signature,
creator_public_key: &PublicKey,
serialized_content: &[u8],
buffer: &mut Vec<u8>,
) -> Result<(), SerializeError>
fn serialize( signature: &Signature, creator_public_key: &PublicKey, serialized_content: &[u8], buffer: &mut Vec<u8>, ) -> Result<(), SerializeError>
Serialize the secured structure
sourcefn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>, Deser: Deserializer<Self>, ID: Id>(
content_serializer: Option<&dyn Serializer<Self>>,
signature_deserializer: &SignatureDeserializer,
creator_public_key_deserializer: &PublicKeyDeserializer,
content_deserializer: &Deser,
buffer: &'a [u8],
chain_id: u64,
) -> IResult<&'a [u8], SecureShare<Self, ID>, E>
fn deserialize<'a, E: ParseError<&'a [u8]> + ContextError<&'a [u8]>, Deser: Deserializer<Self>, ID: Id>( content_serializer: Option<&dyn Serializer<Self>>, signature_deserializer: &SignatureDeserializer, creator_public_key_deserializer: &PublicKeyDeserializer, content_deserializer: &Deser, buffer: &'a [u8], chain_id: u64, ) -> IResult<&'a [u8], SecureShare<Self, ID>, E>
Deserialize the secured structure
Object Safety§
This trait is not object safe.