{"id":"stackyzdev/nanoid","name":"nanoid","scope":"stackyzdev","platform":"roblox","description":"Mirrored from the Wally registry.","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"3a8594fd219f4551db2e787af4d66787751fb5d50b0c378853602a8e24ea36c2","likes":0,"downloads":0,"install":"forest install stackyzdev/nanoid","url":"https://forest.dev/p/roblox/stackyzdev/nanoid","files":"https://api.forest.dev/ai/package/roblox/stackyzdev/nanoid/files","readme":"# Nano ID (Roblox)\n\nA tiny, URL-friendly, unique string ID generator for Roblox (Luau).\n\nThis package is a Roblox implementation of **Nano ID**, the original project by Andrey Sitnik:\nhttps://github.com/ai/nanoid\n\n## Why Nano ID\n\n- **Short IDs:** uses the URL-safe alphabet (`A-Za-z0-9_-`) style with a compact default size.\n- **Simple API:** one function to generate IDs.\n- **Customizable:** supports custom size and custom alphabet.\n\n## How It Works\n\nLike the original Nano ID approach, this implementation generates IDs by:\n\n1. Choosing an alphabet (default: URL-friendly symbols).\n2. Picking random characters from that alphabet.\n3. Repeating until the target length is reached (default: `21`).\n\n### Security\n\nThe original Nano ID emphasizes cryptographic randomness.\nIn this Roblox version, randomness comes from `Random.new()`.\nIf you need strict cryptographic guarantees, review your platform constraints and threat model before using generated IDs for security-sensitive use cases.\n\n### Defaults\n\n- Default ID size: `21`\n- Default alphabet: URL-friendly Nano ID alphabet\n\n### Collision Notes\n\nCollision probability depends on:\n\n- Alphabet length\n- ID size\n- Total number of generated IDs\n\nLarger alphabets and longer IDs reduce collision risk.\n\n## Usage\n\n### Wally\n\n```toml\n[dependencies]\nnanoid = \"stackyzdev/nanoid@0.1.0\"\n```\n\n### Luau\n\n```luau\nlocal nanoid = require(path.to.nanoid)\n\nlocal id = nanoid()\nprint(id) -- e.g. V1StGXR8_Z5jdHi6B-myT\n\nlocal shortId = nanoid(10)\nprint(shortId)\n\nlocal custom = nanoid(12, \"1234567890abcdef\")\nprint(custom)\n```\n\n## API\n\n```luau\ngenerate(size: number?, alphabet: string?) -> string\n```\n\n- `size` (optional): target length of the ID (default: `21`)\n- `alphabet` (optional): characters used to build the ID\n\n## Credits\n\n- Original Nano ID by Andrey Sitnik and contributors: https://github.com/ai/nanoid\n","readmeTruncated":false}