touch_grass/cryptography/create_key

Generate a cryptographic key pair.

Modelled on the WebCrypto SubtleCrypto.generateKey API. The request names the algorithm as a variant and the result carries the exported key material tagged with the same algorithm.

The request variant is [Eddsa(opts)] it can be extended while maintaining compatibility Currently only EdDSA (Ed25519) is supported.

The exported key follows the JSON Web Key (JWK) shape for an OKP key Eddsa({ kty, crv, x, d }), where x is the raw public key and d the raw private seed (as binaries rather than base64url strings).

Types

The requested key algorithm.

pub type Algorithm {
  Eddsa
}

Constructors

  • Eddsa

An exported key pair.

pub type Key {
  EddsaKey(public_key: BitArray, private_key: BitArray)
}

Constructors

  • EddsaKey(public_key: BitArray, private_key: BitArray)

Values

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