pub fn signer_from_bytes(&self, input: impl AsRef<[u8]>) -> Result<HmacJwsSigner, JoseError> {
        (|| -> anyhow::Result<HmacJwsSigner> {
            let input = input.as_ref();

            let min_key_len = self.hash_algorithm().output_len();
            if input.len() < min_key_len {
                bail!(
                    "Secret key size must be larger than or equal to {}: {}",
                    min_key_len,
                    input.len()
                );
            }

            let private_key = PKey::hmac(input)?;

            Ok(HmacJwsSigner {
                algorithm: self.clone(),
                private_key,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
/// Return a signer from a secret key.
///
/// # Arguments
/// * `data` - A secret key.
Return a signer from a secret key.
Return a signer from a secret key .
pub fn signer_from_bytes(&self, input: impl AsRef<[u8]>) -> Result<HmacJwsSigner, JoseError> {
        (|| -> anyhow::Result<HmacJwsSigner> {
            let input = input.as_ref();
            let min_key_len = self.hash_algorithm().output_len();
            if input.len() < min_key_len {
                bail!(
                    "Secret key size must be larger than or equal to {}: {}",
                    min_key_len,
                    input.len()
                );
            }
            let private_key = PKey::hmac(input)?;
            Ok(HmacJwsSigner {
                algorithm: self.clone(),
                private_key,
                key_id: None,
            })
        })()
        .map_err(|err| JoseError::InvalidKeyFormat(err))
    }
pub fn signer_from_bytes ( & self , input : impl AsRef < [ u8 ] > ) -> Result < HmacJwsSigner , JoseError > { ( | | -> anyhow :: Result < HmacJwsSigner > { let input = input . as_ref ( ) ; let min_key_len = self . hash_algorithm ( ) . output_len ( ) ; if input . len ( ) < min_key_len { bail ! ( " " min_key_len input len ( ) ) ; } let private_key = PKey :: hmac ( input ) ? ; Ok ( HmacJwsSigner { algorithm : self . clone ( ) , private_key , key_id : None , } ) } ) ( ) . map_err ( | err | JoseError :: InvalidKeyFormat ( err ) ) }
Return a signer from a secret key.
Return a signer from a secret key .
&self
input
impl AsRef<[u8]>
&self
input
impl AsRef<[u8]>