Struct identity_iota::verification::jose::jws::CompactJwsEncoder
source · pub struct CompactJwsEncoder<'a> { /* private fields */ }
Expand description
A JWS encoder supporting the Compact JWS serialization format.
Implementations§
source§impl<'payload> CompactJwsEncoder<'payload>
impl<'payload> CompactJwsEncoder<'payload>
sourcepub fn new(
payload: &'payload [u8],
protected_header: &JwsHeader
) -> Result<CompactJwsEncoder<'payload>, Error>
pub fn new( payload: &'payload [u8], protected_header: &JwsHeader ) -> Result<CompactJwsEncoder<'payload>, Error>
Start the process of encoding a JWS. This prepares the values that need to be signed. See
Self::into_jws
for information on how to proceed.
§Options
This will prepare a JWS with a non-detached payload that satisfies the requirements of CharSet::Default
. See
Self::new_with_options
for alternative configurations.
sourcepub fn new_with_options(
payload: &'payload [u8],
protected_header: &JwsHeader,
options: CompactJwsEncodingOptions
) -> Result<CompactJwsEncoder<'payload>, Error>
pub fn new_with_options( payload: &'payload [u8], protected_header: &JwsHeader, options: CompactJwsEncodingOptions ) -> Result<CompactJwsEncoder<'payload>, Error>
Similar to Self::new
, but with more configuration options. See
CompactJwsEncodingOptions
.
sourcepub fn signing_input(&self) -> &[u8] ⓘ
pub fn signing_input(&self) -> &[u8] ⓘ
The signing input. This has been computed according to the JWS Signing Input Formula using the protected header and payload given in the constructor.
sourcepub fn into_jws(self, signature: &[u8]) -> String
pub fn into_jws(self, signature: &[u8]) -> String
convert this into a JWS. The signature
value is expected to be
the signature on Self::signing_input
by the private key corresponding to the public key
referenced in the JWS header in accordance with the alg
value of said header.