jsonwebtoken/crypto/
eddsa.rsuse ring::signature;
use crate::algorithms::Algorithm;
use crate::errors::Result;
use crate::serialization::b64_encode;
pub(crate) fn alg_to_ec_verification(alg: Algorithm) -> &'static signature::EdDSAParameters {
match alg {
Algorithm::EdDSA => &signature::ED25519,
_ => unreachable!("Tried to get EdDSA alg for a non-EdDSA algorithm"),
}
}
pub fn sign(key: &[u8], message: &[u8]) -> Result<String> {
let signing_key = signature::Ed25519KeyPair::from_pkcs8_maybe_unchecked(key)?;
let out = signing_key.sign(message);
Ok(b64_encode(out))
}