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

api_key

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

1 unstable release

0.1.0 Mar 25, 2024

#9 in #random-string

Download history 117/week @ 2024-03-21 27/week @ 2024-03-28 12/week @ 2024-04-04

156 downloads per month

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–4.5MB
~76K SLoC