Std.Crypto.Kx
Std.Crypto.Kx — X25519 Diffie-Hellman key agreement (RFC 7748).
Types
type SecretKey
type PublicKey
Values
generate : Task Error SecretKey
A fresh random secret key. A `Task`: it reads the operating system's
publicKey : SecretKey -> PublicKey
The public key of a secret key — the half you send to the peer.
publicKeyFromBase64 : String -> Result Error PublicKey
Load a public key from standard base64.
publicKeyFromBytes : String -> Result Error PublicKey
Load a public key from its 32 bytes. `Err` on a wrong length. (Any 32
publicKeyToBase64 : PublicKey -> String
The standard base64 of a public key.
publicKeyToBytes : PublicKey -> String
The 32 bytes of a public key.
secretKeyFromBase64 : Secret -> Result Error SecretKey
Load a secret key from the standard base64 of its 32 bytes.
secretKeyFromBytes : Secret -> Result Error SecretKey
Load a secret key from its 32 bytes. `Err` when the length is not 32.
secretKeyToBase64 : SecretKey -> Secret
The standard base64 of a secret key, still wrapped in a `Secret`.
secretKeyToBytes : SecretKey -> Secret
The 32 bytes of a secret key, still wrapped in a `Secret`.
sharedSecret : SecretKey -> PublicKey -> Result Error Secret
`sharedSecret mySecret theirPublic` — the 32-byte X25519 shared secret,