Skip to main content

Signer

Trait Signer 

Source
pub trait Signer: Send + Sync {
    // Required methods
    fn alg(&self) -> JwsAlgorithm;
    fn kid(&self) -> Option<&str>;
    fn sign<'life0, 'life1, 'async_trait>(
        &'life0 self,
        signing_input: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SignError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Produces JWS signatures.

A signer binds one key and one algorithm. Private keys live behind it, in a key store, an HSM or a cloud service, which is why signing is async. The signature is returned in the JWS form of the algorithm: raw r || s for ECDSA, never DER.

Required Methods§

Source

fn alg(&self) -> JwsAlgorithm

The algorithm every signature of this signer uses.

Source

fn kid(&self) -> Option<&str>

The key id to put in a header, if the signer has one.

Source

fn sign<'life0, 'life1, 'async_trait>( &'life0 self, signing_input: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SignError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Signs signing_input.

§Errors

A SignError wrapping whatever the backend reports.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§