{"id":22820789,"url":"https://github.com/sidoshi/random-string","last_synced_at":"2025-04-10T23:52:35.880Z","repository":{"id":34999849,"uuid":"195268117","full_name":"sidoshi/random-string","owner":"sidoshi","description":"Create cryptographically random strings on browser and node.","archived":false,"fork":false,"pushed_at":"2023-01-04T03:41:04.000Z","size":1275,"stargazers_count":6,"open_issues_count":14,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-10T23:52:30.760Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sidoshi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-04T15:48:12.000Z","updated_at":"2023-06-08T07:27:58.000Z","dependencies_parsed_at":"2023-01-15T11:46:31.282Z","dependency_job_id":null,"html_url":"https://github.com/sidoshi/random-string","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidoshi%2Frandom-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidoshi%2Frandom-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidoshi%2Frandom-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidoshi%2Frandom-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidoshi","download_url":"https://codeload.github.com/sidoshi/random-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317705,"owners_count":21083528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-12T15:27:12.557Z","updated_at":"2025-04-10T23:52:35.861Z","avatar_url":"https://github.com/sidoshi.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Cryptographic Random String\n\n[![Build Status](https://travis-ci.org/sidoshi/random-string.svg?branch=master)](https://travis-ci.org/sidoshi/random-string)\n\nLibrary to create cryptographically random strings.\n\n## Install\n\n```bash\nnpm i @sidoshi/random-string\n```\n\n## Usage\n\n```js\nimport { randomstring, charsets } from '@sidoshi/random-string';\n\n// =\u003e Alphanumeric string of length 32\nconsole.log(randomstring());\n\n// =\u003e Alphanumeric string of length 10\nconsole.log(randomstring(10));\n\n// =\u003e Alphabetic string of length 32\nconsole.log(randomstring({ characters: charsets.alphabetic }));\n\n// =\u003e Numeric string of length 10\nconsole.log(randomstring({ characters: charsets.numeric, length: 10 }));\n\n// =\u003e String of length 50 with custom character set\nconsole.log(\n  randomstring({ characters: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567', length: 50 })\n);\n\n// =\u003e Composing predefined charsets\nconsole.log(\n  randomstring({ characters: charsets.numeric + charsets.symbols, length: 50 })\n);\n```\n\n## API\n\n- `charsets` - Predefined character sets\n  - `alphanumeric`\n  - `alphabetic`\n  - `loweralpha`\n  - `upperalpha`\n  - `numeric`\n  - `hex`\n  - `symbols`\n\n* `randomstring(size?)` - Generate a random string of given size. (default: 30)\n\n- `randomstring(options?)` - Generate a random string using given options\n  - `length` - Length of the specified string. (default: 30)\n  - `characters` - Character set to use to generate string (default: `charsets.alphanumeric`). Can be one of the predifined `charsets` or a custom\n    string. Throws if `characters.length` \u003e 65536.\n\n## Licence\n\nMIT © [Siddharth Doshi](https://sid.sh)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidoshi%2Frandom-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidoshi%2Frandom-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidoshi%2Frandom-string/lists"}