use std::convert::TryFrom;
use rstest::fixture;
use crate::identity::{Author, KeyPair};
use crate::test_utils::constants::DEFAULT_PRIVATE_KEY;
#[fixture]
pub fn private_key() -> String {
DEFAULT_PRIVATE_KEY.into()
}
#[fixture]
pub fn public_key() -> Author {
let key_pair = KeyPair::from_private_key_str(DEFAULT_PRIVATE_KEY).unwrap();
Author::try_from(key_pair.public_key().to_owned()).unwrap()
}
#[fixture]
pub fn key_pair(#[default(DEFAULT_PRIVATE_KEY)] private_key: &str) -> KeyPair {
KeyPair::from_private_key_str(private_key).unwrap()
}
#[fixture]
pub fn random_key_pair() -> KeyPair {
KeyPair::new()
}