#random-string #key #base62 #base32 #scheme #uuid #api

api_key

Generate api key in rust supports base32, base62, string, uuid4, uuid5

1 unstable release

0.1.0 Mar 25, 2024

#5 in #base62

MIT license

21KB
718 lines

api_key

A Rust utility for generating API keys including random strings, UUIDs, and keys based on specific encoding schemes like Base32 and Base62.

Rust port of https://github.com/pauldenver/generate-api-key

Example for generating random string with prefix

 let options = StringGenerator {
    prefix: String::from("PREFIX"),
    ..StringGenerator::default()
  };

  let key: ApiKeyResults = api_key::string(options);

  assert!(match key {
    ApiKeyResults::String(d) => d.starts_with("PREFIX"),
    _ => false,
  })
  • improve crate documentation
  • improve README

Dependencies

~3.5–4.5MB
~76K SLoC