apiculture/key

Types

pub type Key {
  Key(value: String, bytes: BitArray)
}

Constructors

  • Key(value: String, bytes: BitArray)
pub type KeyConfig {
  KeyConfig(
    byte_count: option.Option(Int),
    char_count: option.Option(Int),
    alphabet: option.Option(alphabet.Alphabet),
    encoding: option.Option(encoding.Encoding),
    prefix: option.Option(String),
    separator: option.Option(String),
    checksum: option.Option(checksum.Checksum),
    checksum_bytes: option.Option(Int),
  )
}

Constructors

Values

pub fn bytes(key: Key) -> BitArray

Returns the raw bytes that were used to generate the key.

pub fn generate(config: KeyConfig) -> Result(Key, error.Error)
pub fn new() -> KeyConfig
pub fn value(key: Key) -> String

Returns the string value of the key.

pub fn with_alphabet(
  config: KeyConfig,
  alphabet: alphabet.Alphabet,
) -> KeyConfig
pub fn with_checksum(
  config: KeyConfig,
  checksum: checksum.Checksum,
) -> KeyConfig
pub fn with_checksum_bytes(
  config: KeyConfig,
  count: Int,
) -> KeyConfig
pub fn with_encoding(
  config: KeyConfig,
  encoding: encoding.Encoding,
) -> KeyConfig
pub fn with_prefix(
  config: KeyConfig,
  prefix: String,
) -> KeyConfig
pub fn with_random_bytes(
  config: KeyConfig,
  count: Int,
) -> KeyConfig
pub fn with_random_chars(
  config: KeyConfig,
  count: Int,
) -> KeyConfig
pub fn with_separator(
  config: KeyConfig,
  separator: String,
) -> KeyConfig
pub fn without_checksum(config: KeyConfig) -> KeyConfig
Search Document