Trait ruma_signatures::KeyPair
[−]
[src]
pub trait KeyPair: Sized { fn new(
public_key: &[u8],
private_key: &[u8],
version: String
) -> Result<Self, Error>; fn sign(&self, message: &[u8]) -> Signature; }
A cryptographic key pair for digitally signing data.
Required Methods
fn new(
public_key: &[u8],
private_key: &[u8],
version: String
) -> Result<Self, Error>
public_key: &[u8],
private_key: &[u8],
version: String
) -> Result<Self, Error>
Initializes a new key pair.
Parameters
- public_key: The public key of the key pair.
- private_key: The private key of the key pair.
- version: The "version" of the key used for this signature. Versions are used as an identifier to distinguish signatures generated from different keys but using the same algorithm on the same homeserver.
Errors
Returns an error if the public and private keys provided are invalid for the implementing algorithm.
fn sign(&self, message: &[u8]) -> Signature
Implementors
impl KeyPair for Ed25519KeyPair