{"id":24744608,"url":"https://github.com/piyush-bhatt/crypto-random-string","last_synced_at":"2025-11-05T19:01:33.474Z","repository":{"id":45221624,"uuid":"330375255","full_name":"piyush-bhatt/crypto-random-string","owner":"piyush-bhatt","description":"Deno module to generate a cryptographically strong random string","archived":false,"fork":false,"pushed_at":"2022-12-09T17:53:34.000Z","size":22,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-24T11:04:16.369Z","etag":null,"topics":["crypto","deno","random","random-generator","random-string","typescript"],"latest_commit_sha":null,"homepage":"https://deno.land/x/crypto_random_string","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/piyush-bhatt.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":"2021-01-17T11:29:47.000Z","updated_at":"2025-04-12T03:24:23.000Z","dependencies_parsed_at":"2023-01-25T22:46:39.783Z","dependency_job_id":null,"html_url":"https://github.com/piyush-bhatt/crypto-random-string","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/piyush-bhatt/crypto-random-string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyush-bhatt%2Fcrypto-random-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyush-bhatt%2Fcrypto-random-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyush-bhatt%2Fcrypto-random-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyush-bhatt%2Fcrypto-random-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piyush-bhatt","download_url":"https://codeload.github.com/piyush-bhatt/crypto-random-string/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyush-bhatt%2Fcrypto-random-string/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003901,"owners_count":26083641,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["crypto","deno","random","random-generator","random-string","typescript"],"created_at":"2025-01-28T02:19:09.465Z","updated_at":"2025-10-10T12:31:13.215Z","avatar_url":"https://github.com/piyush-bhatt.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crypto-random-string\n\n\u003e Generate a [cryptographically strong](https://en.wikipedia.org/wiki/Strong_cryptography) random string\n\nDeno module based on [crypto-random-string](https://github.com/sindresorhus/crypto-random-string). Useful for creating an identifier, slug, salt, PIN code, fixture, etc.\n\n## Import Module\n\n```typescript\nimport { cryptoRandomString } from \"https://deno.land/x/crypto_random_string@1.0.0/mod.ts\"\n// or\nimport { cryptoRandomString } from \"https://github.com/piyush-bhatt/crypto-random-string/raw/main/mod.ts\"\n```\n\n## Usage\n\n**NOTE:** Outputs shown below are merely examples. The function will generate random string each time.\n\n\n```typescript\n\ncryptoRandomString({length: 10}); // '0696cb9e70'\n\ncryptoRandomString({length: 10, type: 'base64'}); // 'dw3mgWC5uO'\n\ncryptoRandomString({length: 10, type: 'url-safe'}); // '0pN1Y2Jz.X'\n\ncryptoRandomString({length: 10, type: 'numeric'}); // '1639380067'\n\ncryptoRandomString({length: 6, type: 'distinguishable'}); // 'H4HH5D'\n\ncryptoRandomString({length: 10, type: 'ascii-printable'}); // '#I\u0026J.GP./9'\n\ncryptoRandomString({length: 10, type: 'alphanumeric'}); // 'ZtgC2J6aU5'\n\ncryptoRandomString({length: 10, characters: 'abc'}); // 'abcabccbcc'\n\n```\n\n## API\n\n### cryptoRandomString(options)\n\nReturns a randomized string. [Hex](https://en.wikipedia.org/wiki/Hexadecimal) by default.\n\n\n#### options\n\nType: `object`\n\n##### length\n\n*Required*\\\nType: `number`\n\nLength of the returned string.\n\n##### type\n\nType: `string`\\\nDefault: `'hex'`\\\nValues: `'hex' | 'base64' | 'url-safe' | 'numeric' | 'distinguishable' | 'ascii-printable' | 'alphanumeric'`\n\nUse only characters from a predefined set of allowed characters.\n\nCannot be set at the same time as the `characters` option.\n\nThe `distinguishable` set contains only uppercase characters that are not easily confused: `CDEHKMPRTUWXY012458`. It can be useful if you need to print out a short string that you'd like users to read and type back in with minimal errors. For example, reading a code off of a screen that needs to be typed into a phone to connect two devices.\n\nThe `ascii-printable` set contains all [printable ASCII characters](https://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters): ``!\"#$%\u0026\\'()*+,-./0123456789:;\u003c=\u003e?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~`` Useful for generating passwords where all possible ASCII characters should be used.\n\nThe `alphanumeric` set contains uppercase letters, lowercase letters, and digits: `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`. Useful for generating [nonce](https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/nonce) values.\n\n##### characters\n\nType: `string`\\\nMinimum length: `1`\\\nMaximum length: `65536`\n\nUse only characters from a custom set of allowed characters.\n\nCannot be set at the same time as the `type` option.\n\n## Licensing\n\n[MIT](https://github.com/piyush-bhatt/crypto-random-string/blob/main/LICENSE) licensed\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyush-bhatt%2Fcrypto-random-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiyush-bhatt%2Fcrypto-random-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyush-bhatt%2Fcrypto-random-string/lists"}