midas/effect
The effect module defines signatures for standard side effects.
Types
Function accepts a module and function and returns bundled code.
Fallible as code might fail compilation
pub type Bundle(t) =
fn(String, String) -> fn(fn(Result(String, String)) -> t) -> t
A function to export key material as JSON
All keys have a valid JSON encoding
pub type ExportJsonWebKey(t, key) =
fn(key) -> fn(fn(json.Json) -> t) -> t
pub type Fetch(t) =
fn(request.Request(BitArray)) -> fn(
fn(Result(response.Response(BitArray), FetchError)) -> t,
) -> t
pub type FetchError {
NetworkError(String)
UnableToReadBody
NotImplemented
}
Constructors
-
NetworkError(String) -
UnableToReadBody -
NotImplemented
algorithm, extractable, uses may fail if uses does not match algorithm
pub type GenerateKeypair(t, key) =
fn(KeyPairAlgorithm, Bool, List(KeyUsage)) -> fn(
fn(Result(KeyPair(key), String)) -> t,
) -> t
pub type Hash(t) =
fn(HashAlgorithm, BitArray) -> fn(fn(BitArray) -> t) -> t
platform agnostic copy of the type in gleam_crypto.
pub type HashAlgorithm {
Sha1
Sha256
Sha384
Sha512
}
Constructors
-
Sha1 -
Sha256 -
Sha384 -
Sha512
pub type KeyPair(key) {
KeyPair(public: key, private: key)
}
Constructors
-
KeyPair(public: key, private: key)
pub type KeyPairAlgorithm {
EcKeyGenParams(name: String, named_curve: String)
}
Constructors
-
EcKeyGenParams(name: String, named_curve: String)
pub type KeyUsage {
CanEncrypt
CanDecrypt
CanSign
CanVerify
CanDeriveKey
CanDeriveBits
CanWrapKey
CanUnwrapKey
}
Constructors
-
CanEncrypt -
CanDecrypt -
CanSign -
CanVerify -
CanDeriveKey -
CanDeriveBits -
CanWrapKey -
CanUnwrapKey
May fail for non existant directory or file system permissions.
pub type Log(t) =
fn(String) -> fn(fn(Nil) -> t) -> t
May fail for non existant directory or file system permissions.
pub type ReadDirectory(t) =
fn(String) -> fn(fn(Result(List(String), String)) -> t) -> t
can fail if no port available.
pub type Serve(t) =
fn(
option.Option(Int),
fn(request.Request(BitArray)) -> response.Response(BitArray),
) -> fn(fn(Result(Int, String)) -> t) -> t
pub type Sign(t, key) =
fn(SignAlgorithm, key, BitArray) -> fn(
fn(Result(BitArray, String)) -> t,
) -> t
pub type SignAlgorithm {
EcdsaParams(hash: HashAlgorithm)
}
Constructors
-
EcdsaParams(hash: HashAlgorithm)
Does not fail if configured
pub type StrongRandom(t) =
fn(Int) -> fn(fn(BitArray) -> t) -> t
Uri might not exist or resolve
pub type Visit(t) =
fn(uri.Uri) -> fn(fn(Result(Nil, String)) -> t) -> t
Can fail on permissions
pub type WriteFile(t) =
fn(String) -> fn(fn(Result(Nil, String)) -> t) -> t
Values
pub fn describe_fetch_error(reason: FetchError) -> String