apiculture

Types

pub type Error =
  error.Error
pub type Key =
  key.Key
pub type KeyConfig =
  key.KeyConfig

Values

pub fn alphabet_characters(
  alphabet: alphabet.Alphabet,
) -> List(String)
pub fn alphabet_size(alphabet: alphabet.Alphabet) -> Int
pub fn base32_crockford() -> encoding.Encoding
pub fn base32_hex() -> encoding.Encoding
pub fn base32_rfc() -> encoding.Encoding
pub fn base32_rfc_unpadded() -> encoding.Encoding
pub fn base64_url() -> encoding.Encoding
pub fn checksum_format(
  csum: checksum.Checksum,
  bytes: BitArray,
  format_with: fn(BitArray) -> String,
) -> String
pub fn checksum_mismatch_error() -> error.Error
pub fn checksum_verify(
  csum: checksum.Checksum,
  bytes: BitArray,
  expected: BitArray,
) -> Bool
pub fn default_generate() -> Result(key.Key, error.Error)

Generate a default format key without a prefix.

This produces a key in the format: <base62-random><checksum>

pub fn default_prefixed(
  prefix: String,
) -> Result(key.Key, error.Error)

Generate a default format key with the given prefix.

This produces a key in the format: <prefix>_<base62-random><checksum>

The prefix should be a short semantic identifier (e.g., “sk”, “token”, “key”).

pub fn duplicate_characters_error() -> error.Error
pub fn empty_alphabet_error() -> error.Error
pub fn encoding_decode(
  enc: encoding.Encoding,
  input: String,
) -> Result(BitArray, error.Error)
pub fn encoding_encode(
  enc: encoding.Encoding,
  bytes: BitArray,
) -> String
pub fn encoding_name(enc: encoding.Encoding) -> String
pub fn encoding_uses_padding(enc: encoding.Encoding) -> Bool
pub fn hex_lower() -> encoding.Encoding
pub fn hex_upper() -> encoding.Encoding
pub fn invalid_byte_count_error() -> error.Error
pub fn invalid_encoding_error() -> error.Error
pub fn key_bytes(k: key.Key) -> BitArray
pub fn key_from_bytes(
  config: key.KeyConfig,
  bytes: BitArray,
) -> Result(key.Key, error.Error)
pub fn key_from_ulid(
  input: String,
) -> Result(key.Key, error.Error)
pub fn key_from_ulid_with(
  config: key.KeyConfig,
  input: String,
) -> Result(key.Key, error.Error)
pub fn key_from_uuid(
  input: String,
) -> Result(key.Key, error.Error)
pub fn key_from_uuid_with(
  config: key.KeyConfig,
  input: String,
) -> Result(key.Key, error.Error)
pub fn key_generate(
  config: key.KeyConfig,
) -> Result(key.Key, error.Error)
pub fn key_new() -> key.KeyConfig
pub fn key_value(k: key.Key) -> String
pub fn key_with_alphabet(
  config: key.KeyConfig,
  alphabet: alphabet.Alphabet,
) -> key.KeyConfig
pub fn key_with_checksum(
  config: key.KeyConfig,
  checksum: checksum.Checksum,
) -> key.KeyConfig
pub fn key_with_encoding(
  config: key.KeyConfig,
  encoding: encoding.Encoding,
) -> key.KeyConfig
pub fn key_with_prefix(
  config: key.KeyConfig,
  prefix: String,
) -> key.KeyConfig
pub fn key_with_random_bytes(
  config: key.KeyConfig,
  count: Int,
) -> key.KeyConfig
pub fn key_with_random_chars(
  config: key.KeyConfig,
  count: Int,
) -> key.KeyConfig
pub fn key_with_separator(
  config: key.KeyConfig,
  separator: String,
) -> key.KeyConfig
pub fn key_without_checksum(
  config: key.KeyConfig,
) -> key.KeyConfig
pub fn malformed_input_error() -> error.Error
pub fn new_alphabet(
  chars: String,
) -> Result(alphabet.Alphabet, error.Error)
pub fn secure_random_unavailable_error() -> error.Error
pub fn single_character_alphabet_error() -> error.Error
Search Document