{"name":"crypto-random-string","version":"3.2.0","description":"Generate a cryptographically strong random string","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/crypto-random-string.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["random","string","text","id","identifier","slug","salt","pin","crypto","strong","secure","hex","secret","protect"],"dependencies":{"type-fest":"^0.8.1"},"devDependencies":{"ava":"^2.1.0","tsd":"^0.11.0","xo":"^0.25.3"},"gitHead":"9b3a4704ab94a94f48197c4eb9c7409829b279a3","bugs":{"url":"https://github.com/sindresorhus/crypto-random-string/issues"},"homepage":"https://github.com/sindresorhus/crypto-random-string#readme","_id":"crypto-random-string@3.2.0","_nodeVersion":"10.18.1","_npmVersion":"6.14.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-8vPu5bsKaq2uKRy3OL7h1Oo7RayAWB8sYexLKAqvCXVib8SxgbmoF1IN4QMKjBv8uI8mp5gPPMbiRah25GMrVQ==","shasum":"d513ef0c2ac6ff7cad5769de585d9bf2ad5a2b4d","tarball":"http://registry-npm.ywwl.com/crypto-random-string/download/crypto-random-string-3.2.0.tgz","fileCount":5,"unpackedSize":10003,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeYzZxCRA9TVsSAnZWagAApSkQAJKxMu5zaFkuylCktqAI\ntazc69qy6VFkdA1F/oa29e700OMf4lKk+29I1MJ3myXDu/wUN18zkrqfPfH2\nx+56X28wHFyZ66ZvpCV7U15bJBk8c7Styn/KVc2WWHBf1tN08JNAqJFDOp8r\ng2b32ek/X+iGftwp7GdCjVahuRsR3clREtbi1184JWRFHoB5c1v9ewWGqJ7s\nHcI+Lh8pypTgwMuMRz6WYO60DQrf0LqtZRldU6DURSh6HlkZ4A0B+8LLwKsn\nqcctiWRtFMDPRGtO84xTvJyWUiISrJPo1jePqj03sScQH7WnNsp7uxLFiUry\naC7AiNgzDBZ+Cqq+yGFn4HxUwc3ZLCdBoxosiCX3WT+pUwQ6bbitnLzIPwgn\nAiJmLooMzqu0KFAtVUkmi5hTK9aXwpU2efOGJlstWgQgcIhMwj+1HYBRbovG\ncE6X77lFqs9wZQIaVxTgzCFZMXgSnG9wVf4Olfb30vPw2znXWWbjF6ky+bKz\nFcjan88uVdEcMgAKoVeZlh9oqgxZebY2MoMog63bX2MLORW79RtwXWZqo4aJ\nmp4h0/cusVFCz4gP0BRehZC8b7NgDofWZ1xwJnfRN0pHey8TxJxKnp6rjvjw\npxmjzyMBdIs/8xSIT00/sGP3hJxWpX/4eHfTqZ+AzkJR0DbDzcHeMc1o1f6W\ni6HQ\r\n=XJcy\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICIumThkXKRmbL20Hmq60hD08cHzBbKE8kMqq4VSbiqrAiAMGrnUfzS/KL+19VVHe5ohDFLEXiB3CIGT0KRGNqxQRA=="}],"size":3771,"noattachment":false,"key":"/crypto-random-string/-/crypto-random-string-3.2.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/crypto-random-string_3.2.0_1583560304604_0.14857320893519166"},"_hasShrinkwrap":false,"readme":"# crypto-random-string\n\n> Generate a [cryptographically strong](https://en.wikipedia.org/wiki/Strong_cryptography) random string\n\nCan be useful for creating an identifier, slug, salt, PIN code, fixture, etc.\n\nWorks in Node.js and browsers.\n\n## Install\n\n```sh\nnpm install crypto-random-string\n```\n\n## Usage\n\n```js\nimport cryptoRandomString from 'crypto-random-string';\n\ncryptoRandomString({length: 10});\n//=> '2cf05d94db'\n\ncryptoRandomString({length: 10, type: 'base64'});\n//=> 'YMiMbaQl6I'\n\ncryptoRandomString({length: 10, type: 'url-safe'});\n//=> 'YN-tqc8pOw'\n\ncryptoRandomString({length: 10, type: 'numeric'});\n//=> '8314659141'\n\ncryptoRandomString({length: 6, type: 'distinguishable'});\n//=> 'CDEHKM'\n\ncryptoRandomString({length: 10, type: 'ascii-printable'});\n//=> '`#Rt8$IK>B'\n\ncryptoRandomString({length: 10, type: 'alphanumeric'});\n//=> 'DMuKL8YtE7'\n\ncryptoRandomString({length: 10, characters: 'abc'});\n//=> 'abaaccabac'\n```\n\n## API\n\n### cryptoRandomString(options)\n\nReturns a randomized string. [Hex](https://en.wikipedia.org/wiki/Hexadecimal) by default.\n\n### cryptoRandomStringAsync(options)\n\nReturns a promise which resolves to a randomized string. [Hex](https://en.wikipedia.org/wiki/Hexadecimal) by default.\n\nFor most use-cases, there's really no good reason to use this async version. From the Node.js docs:\n\n> The `crypto.randomBytes()` method will not complete until there is sufficient entropy available. This should normally never take longer than a few milliseconds. The only time when generating the random bytes may conceivably block for a longer period of time is right after boot, when the whole system is still low on entropy.\n\nIn general, anything async comes with some overhead on it's own.\n\n```js\nimport {cryptoRandomStringAsync} from 'crypto-random-string';\n\nawait cryptoRandomStringAsync({length: 10});\n//=> '2cf05d94db'\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): ``!\"#$%&\\'()*+,-./0123456789:;<=>?@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## Related\n\n- [random-int](https://github.com/sindresorhus/random-int) - Generate a random integer\n- [random-float](https://github.com/sindresorhus/random-float) - Generate a random float\n- [random-item](https://github.com/sindresorhus/random-item) - Get a random item from an array\n- [random-boolean](https://github.com/arthurvr/random-boolean) - Get a random boolean\n- [random-obj-key](https://github.com/sindresorhus/random-obj-key) - Get a random key from an object\n- [random-obj-prop](https://github.com/sindresorhus/random-obj-prop) - Get a random property from an object\n- [unique-random](https://github.com/sindresorhus/unique-random) - Generate random numbers that are consecutively unique\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-crypto-random-string?utm_source=npm-crypto-random-string&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n","publish_time":1583560304758,"_cnpm_publish_time":1583560304758,"dist-tags":{"latest":"6.0.0"}}