touch_grass/cryptography/sign

Produce a signature over a binary with a private key.

Modelled on the WebCrypto SubtleCrypto.sign(algorithm, key, data) API. The request is a record { key, data } where key is a key in the shape produced by a successful CreateKey effect (Eddsa({ kty, crv, x, d })) and data is the binary to sign. The algorithm is taken from the key’s variant tag.

Types

A decoded signing request: the algorithm, its private key material and the data to sign.

pub type Request {
  EddsaSign(private_key: BitArray, data: BitArray)
}

Constructors

  • EddsaSign(private_key: BitArray, data: BitArray)

Values

pub fn decode(
  lift: value.Value(a, b),
) -> Result(Request, break.Reason(a, b))
pub fn encode(
  result: Result(BitArray, String),
) -> value.Value(m, c)
pub const label: String
pub fn lift() -> isomorphic.Type(a)
pub fn lower() -> isomorphic.Type(a)
Search Document