hypersig/key

Types

pub type KeyError {
  UnexpectedKeyFormat
  ExpectedPublicKey
  ExpectedPrivateKey
  RuntimeError(String)
}

Constructors

  • UnexpectedKeyFormat
  • ExpectedPublicKey
  • ExpectedPrivateKey
  • RuntimeError(String)
pub type PrivateKey
pub type PublicKey

Values

pub fn decode_private(
  pem: String,
) -> Result(PrivateKey, KeyError)
pub fn decode_public(pem: String) -> Result(PublicKey, KeyError)
pub fn encode_private(key: PrivateKey) -> String
pub fn encode_public(key: PublicKey) -> String
pub fn generate_key_pair() -> Result(
  #(PublicKey, PrivateKey),
  KeyError,
)
pub fn sign(
  message msg: String,
  with key: PrivateKey,
) -> Result(String, KeyError)

Signs a message and returns the signature in a base64 encoded string

pub fn verify(
  message msg: String,
  signature signature: BitArray,
  with key: PublicKey,
) -> Result(Bool, KeyError)
Search Document