pub trait KeyPair: Sized {
    fn new(
        public_key: &[u8],
        private_key: &[u8],
        version: String
    ) -> Result<Self, Error>; fn sign(&self, message: &[u8]) -> Signature; }
Expand description

A cryptographic key pair for digitally signing data.

Required Methods

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.

Signs a JSON object.

Parameters
  • message: An arbitrary series of bytes to sign.

Implementors