Skip to main content

EcdsaFactoryExt

Trait EcdsaFactoryExt 

Source
pub trait EcdsaFactoryExt {
    // Required method
    fn ecdsa(&self, label: impl AsRef<str>, spec: EcdsaSpec) -> EcdsaKeyPair;
}
Expand description

Extension trait to hang ECDSA helpers off the core Factory.

Required Methods§

Source

fn ecdsa(&self, label: impl AsRef<str>, spec: EcdsaSpec) -> EcdsaKeyPair

Generate (or retrieve from cache) an ECDSA keypair fixture.

The label identifies this keypair within your test suite. In deterministic mode, seed + label + spec always produces the same key.

§Examples
use uselesskey_core::{Factory, Seed};
use uselesskey_ecdsa::{EcdsaFactoryExt, EcdsaSpec};

let seed = Seed::from_env_value("test-seed").unwrap();
let fx = Factory::deterministic(seed);
let keypair = fx.ecdsa("auth-service", EcdsaSpec::es256());

let pem = keypair.private_key_pkcs8_pem();
assert!(pem.contains("BEGIN PRIVATE KEY"));

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl EcdsaFactoryExt for Factory

Source§

fn ecdsa(&self, label: impl AsRef<str>, spec: EcdsaSpec) -> EcdsaKeyPair

Implementors§