-module(apiculture@default_key). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/apiculture/default_key.gleam"). -export([generate/0, prefixed/1]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -file("src/apiculture/default_key.gleam", 33). ?DOC( " Generate a default format key without a prefix.\n" "\n" " This produces a key in the format: ``\n" ). -spec generate() -> {ok, apiculture@key:key()} | {error, apiculture@error:error()}. generate() -> _pipe = apiculture@key:new(), _pipe@1 = apiculture@key:with_random_bytes(_pipe, 16), _pipe@2 = apiculture@key:with_encoding( _pipe@1, apiculture@encoding:base62() ), _pipe@3 = apiculture@key:with_checksum( _pipe@2, apiculture@checksum:crc32_checksum() ), _pipe@4 = apiculture@key:with_checksum_bytes(_pipe@3, 4), apiculture@key:generate(_pipe@4). -file("src/apiculture/default_key.gleam", 47). ?DOC( " Generate a default format key with the given prefix.\n" "\n" " This produces a key in the format: `_`\n" "\n" " The prefix should be a short semantic identifier (e.g., \"sk\", \"token\", \"key\").\n" ). -spec prefixed(binary()) -> {ok, apiculture@key:key()} | {error, apiculture@error:error()}. prefixed(Prefix) -> _pipe = apiculture@key:new(), _pipe@1 = apiculture@key:with_random_bytes(_pipe, 16), _pipe@2 = apiculture@key:with_encoding( _pipe@1, apiculture@encoding:base62() ), _pipe@3 = apiculture@key:with_prefix(_pipe@2, Prefix), _pipe@4 = apiculture@key:with_separator(_pipe@3, <<"_"/utf8>>), _pipe@5 = apiculture@key:with_checksum( _pipe@4, apiculture@checksum:crc32_checksum() ), _pipe@6 = apiculture@key:with_checksum_bytes(_pipe@5, 4), apiculture@key:generate(_pipe@6).