Struct jws::compact::DecodedMessage

source ·
pub struct DecodedMessage {
    pub header: JsonObject,
    pub payload: Vec<u8>,
}
Expand description

A compact JWS message with header and payload, but without signature.

The signature is left off because the signature can only be computed from (and verified for) a serialized message, whereas this struct represents a mostly decoded message (the payload is still raw bytes).

You can call decode_verify to decode and verify a message. Alternatively, you can call split_encoded_parts, decode the parts and then use a Verifier manually. The latter allows you to access the decoded message, even if it’s signature is invalid.

Fields

header: JsonObjectpayload: Vec<u8>

Implementations

Create a new message from a header and a payload.

Create a new DecodedMessage by decoding the header and payload of a JWS Compact Serialization message.

Parse the payload as JSON using serde.

The type must implement the serde::Deserialize trait

Parse the payload as a JsonValue.

This method avoids the need for type annotations.

Parse the payload as a JsonObject.

This method avoids the need for type annotations.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.