ids/nanoid

A module for generating NanoIDs, i.e., tiny, secure, URL-friendly, and unique string IDs.

Constants

pub const default_alphabet: BitString = <<
  "_-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ":utf8,
>>

The default alphabet used when generating NanoIDs.

pub const default_size: Int = 21

The default size of the generated NanoIDs.

Functions

pub fn generate() -> String

Generates a (random) NanoID. The NanoID produced by this function is generated using a cryptographically secure random number generator.

Usage

import ids/nanoid

let assert Ok(id) = nanoid.generate()
Search Document