Struct ssi_claims::JwsVec
source · pub struct JwsVec(/* private fields */);
Expand description
Implementations§
source§impl JwsVec
impl JwsVec
pub fn new(bytes: Vec<u8>) -> Result<JwsVec, InvalidJws<Vec<u8>>>
sourcepub unsafe fn new_unchecked(bytes: Vec<u8>) -> JwsVec
pub unsafe fn new_unchecked(bytes: Vec<u8>) -> JwsVec
§Safety
The input bytes
must represent a valid compact JWS.
pub fn from_signing_bytes_and_signature( signing_bytes: Vec<u8>, signature: &[u8], ) -> Result<JwsVec, InvalidJws<Vec<u8>>>
sourcepub fn new_detached(header: Header, signature: &[u8]) -> JwsVec
pub fn new_detached(header: Header, signature: &[u8]) -> JwsVec
Creates a new detached JWS.
Detached means the payload will not appear in the JWS.
sourcepub unsafe fn from_signing_bytes_and_signature_unchecked(
signing_bytes: Vec<u8>,
signature: Vec<u8>,
) -> JwsVec
pub unsafe fn from_signing_bytes_and_signature_unchecked( signing_bytes: Vec<u8>, signature: Vec<u8>, ) -> JwsVec
§Safety
The input signing_bytes
and signature
must form a valid compact JWS
once concatenated with a .
.
pub fn as_compact_jws(&self) -> &JwsSlice
pub fn into_signing_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
sourcepub fn into_decoded(self) -> Result<DecodedJws<'static>, DecodeError>
pub fn into_decoded(self) -> Result<DecodedJws<'static>, DecodeError>
Decodes the entire JWS while preserving the signing bytes so they can be verified.
pub fn into_url_safe(self) -> Result<JwsBuf, JwsVec>
pub fn into_jws_string(self) -> Result<JwsString, JwsVec>
Methods from Deref<Target = JwsSlice>§
pub fn len(&self) -> usize
pub fn decode_header(&self) -> Result<Header, InvalidHeader>
sourcepub fn decode_payload(
&self,
header: &Header,
) -> Result<Cow<'_, [u8]>, DecodeError>
pub fn decode_payload( &self, header: &Header, ) -> Result<Cow<'_, [u8]>, DecodeError>
Decode the payload bytes.
The header is necessary to know how the payload is encoded.
pub fn decode_signature(&self) -> Result<JwsSignature, DecodeError>
sourcepub fn decode(&self) -> Result<DecodedJws<'_, Cow<'_, [u8]>>, DecodeError>
pub fn decode(&self) -> Result<DecodedJws<'_, Cow<'_, [u8]>>, DecodeError>
Decodes the entire JWS.
sourcepub fn signing_bytes(&self) -> &[u8] ⓘ
pub fn signing_bytes(&self) -> &[u8] ⓘ
Returns the signing bytes.
It is the concatenation of the Base64 encoded headers, a period ‘.’ and the Base64 encoded payload.
pub fn as_bytes(&self) -> &[u8] ⓘ
sourcepub async fn verify<V>(
&self,
params: V,
) -> Result<Result<(), Invalid>, ProofValidationError>
pub async fn verify<V>( &self, params: V, ) -> Result<Result<(), Invalid>, ProofValidationError>
Verify the JWS signature.
This will only check the signature and not the validity of the decoded payload. For instance if the payload is a set of JWT claims, those claims will not be validated.
To perform a more precise verification, specify use a specialized T
instead of the default Vec<u8>
The params
argument provides all the verification parameters required
to validate the claims and proof.
§What verification parameters should I use?
Any type that providing a JWKResolver
through the ResolverProvider
trait will be fine. Notable implementors are:
VerificationParameters
: A good default providing many other common verification parameters that are not necessary here.JWK
: allows you to put a JWK asparams
, which will resolve into itself. Can be useful if you don’t need key resolution because you know in advance what key was used to sign the JWS.
§Passing the parameters by reference
If the validation traits are implemented for P
, they will be
implemented for &P
as well. This means the parameters can be passed
by move or by reference.
Trait Implementations§
source§impl IntoDecodedJwt for JwsVec
impl IntoDecodedJwt for JwsVec
source§fn into_decoded_custom_jwt<C>(
self,
) -> Result<DecodedJws<'static, JWTClaims<C>>, DecodeError>where
C: DeserializeOwned,
fn into_decoded_custom_jwt<C>(
self,
) -> Result<DecodedJws<'static, JWTClaims<C>>, DecodeError>where
C: DeserializeOwned,
fn into_decoded_jwt(self) -> Result<DecodedJws<'static, JWTClaims>, DecodeError>
source§impl ToDecodedJwt for JwsVec
impl ToDecodedJwt for JwsVec
source§fn to_decoded_custom_jwt<C>(
&self,
) -> Result<DecodedJws<'_, JWTClaims<C>>, DecodeError>where
C: DeserializeOwned,
fn to_decoded_custom_jwt<C>(
&self,
) -> Result<DecodedJws<'_, JWTClaims<C>>, DecodeError>where
C: DeserializeOwned,
source§fn to_decoded_jwt(&self) -> Result<DecodedJws<'_, JWTClaims>, DecodeError>
fn to_decoded_jwt(&self) -> Result<DecodedJws<'_, JWTClaims>, DecodeError>
source§async fn verify_jwt<V>(
&self,
verifier: &V,
) -> Result<Result<(), Invalid>, ProofValidationError>
async fn verify_jwt<V>( &self, verifier: &V, ) -> Result<Result<(), Invalid>, ProofValidationError>
Auto Trait Implementations§
impl Freeze for JwsVec
impl RefUnwindSafe for JwsVec
impl Send for JwsVec
impl Sync for JwsVec
impl Unpin for JwsVec
impl UnwindSafe for JwsVec
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
source§impl<T> BorrowUnordered for T
impl<T> BorrowUnordered for T
fn as_unordered(&self) -> &Unordered<T>
source§impl<T> FmtForward for T
impl<T> FmtForward for T
source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
impl<T, U, C> IntoWithContext<U, C> for Twhere
U: FromWithContext<T, C>,
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.source§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
source§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
source§impl<T> PipeDeref for T
impl<T> PipeDeref for T
source§impl<T> PipeRef for T
impl<T> PipeRef for T
source§impl<T> ResourceProvider<()> for T
impl<T> ResourceProvider<()> for T
source§fn get_resource(&self) -> &()
fn get_resource(&self) -> &()
T
.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
source§fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
tap
in debug builds, and does nothing in release builds.source§fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
source§fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
tap_mut
in debug builds, and does nothing in release builds.source§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
source§fn tap_ref<F, R>(self, func: F) -> Self
fn tap_ref<F, R>(self, func: F) -> Self
source§fn tap_ref_dbg<F, R>(self, func: F) -> Self
fn tap_ref_dbg<F, R>(self, func: F) -> Self
tap_ref
in debug builds, and does nothing in release builds.source§fn tap_ref_mut<F, R>(self, func: F) -> Self
fn tap_ref_mut<F, R>(self, func: F) -> Self
source§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
source§fn tap_borrow<F, R>(self, func: F) -> Self
fn tap_borrow<F, R>(self, func: F) -> Self
source§fn tap_borrow_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_dbg<F, R>(self, func: F) -> Self
tap_borrow
in debug builds, and does nothing in release builds.source§fn tap_borrow_mut<F, R>(self, func: F) -> Self
fn tap_borrow_mut<F, R>(self, func: F) -> Self
source§impl<T> TapDeref for T
impl<T> TapDeref for T
source§fn tap_deref_dbg<F, R>(self, func: F) -> Self
fn tap_deref_dbg<F, R>(self, func: F) -> Self
tap_deref
in debug builds, and does nothing in release builds.source§fn tap_deref_mut<F, R>(self, func: F) -> Self
fn tap_deref_mut<F, R>(self, func: F) -> Self
self
for modification.