pub struct JoseSignature {
pub payload: Ipld,
pub signature: String,
pub algorithm: String,
}Expand description
DAG-JOSE signature wrapper for IPLD data
This structure represents a signed IPLD payload using JWS (JSON Web Signature). The signature ensures data integrity and authenticity.
Fields§
§payload: IpldThe signed payload (as IPLD)
signature: StringThe JWS signature string
algorithm: StringAlgorithm used for signing
Implementations§
Source§impl JoseSignature
impl JoseSignature
Sourcepub fn verify_hs256(&self, secret: &[u8]) -> Result<bool>
pub fn verify_hs256(&self, secret: &[u8]) -> Result<bool>
Sourcepub fn verify_rs256(&self, public_key_pem: &[u8]) -> Result<bool>
pub fn verify_rs256(&self, public_key_pem: &[u8]) -> Result<bool>
Sourcepub fn to_dag_jose(&self) -> Result<Vec<u8>>
pub fn to_dag_jose(&self) -> Result<Vec<u8>>
Encode the JoseSignature to DAG-JOSE format
Returns a JSON representation compatible with DAG-JOSE spec
Sourcepub fn from_dag_jose(data: &[u8]) -> Result<Self>
pub fn from_dag_jose(data: &[u8]) -> Result<Self>
Decode from DAG-JOSE format
Parses a JSON representation in DAG-JOSE format
Trait Implementations§
Source§impl Clone for JoseSignature
impl Clone for JoseSignature
Source§fn clone(&self) -> JoseSignature
fn clone(&self) -> JoseSignature
Returns a duplicate 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 Debug for JoseSignature
impl Debug for JoseSignature
Source§impl<'de> Deserialize<'de> for JoseSignature
impl<'de> Deserialize<'de> for JoseSignature
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 PartialEq for JoseSignature
impl PartialEq for JoseSignature
Source§impl Serialize for JoseSignature
impl Serialize for JoseSignature
impl StructuralPartialEq for JoseSignature
Auto Trait Implementations§
impl Freeze for JoseSignature
impl RefUnwindSafe for JoseSignature
impl Send for JoseSignature
impl Sync for JoseSignature
impl Unpin for JoseSignature
impl UnwindSafe for JoseSignature
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 more