{"id":13527480,"url":"https://github.com/crypto-utils/uid-safe","last_synced_at":"2025-04-01T09:31:34.239Z","repository":{"id":17964246,"uuid":"20955910","full_name":"crypto-utils/uid-safe","owner":"crypto-utils","description":"URL and cookie safe UIDs","archived":false,"fork":false,"pushed_at":"2021-02-18T02:28:45.000Z","size":57,"stargazers_count":142,"open_issues_count":0,"forks_count":10,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-31T09:37:56.370Z","etag":null,"topics":["javascript","nodejs","uid"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/crypto-utils.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","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":"2014-06-18T09:01:07.000Z","updated_at":"2025-03-28T02:50:03.000Z","dependencies_parsed_at":"2022-09-26T21:40:43.637Z","dependency_job_id":null,"html_url":"https://github.com/crypto-utils/uid-safe","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crypto-utils%2Fuid-safe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crypto-utils%2Fuid-safe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crypto-utils%2Fuid-safe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crypto-utils%2Fuid-safe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crypto-utils","download_url":"https://codeload.github.com/crypto-utils/uid-safe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246616143,"owners_count":20806064,"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":["javascript","nodejs","uid"],"created_at":"2024-08-01T06:01:48.917Z","updated_at":"2025-04-01T09:31:33.938Z","avatar_url":"https://github.com/crypto-utils.png","language":"JavaScript","readme":"# uid-safe\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nURL and cookie safe UIDs\n\nCreate cryptographically secure UIDs safe for both cookie and URL usage.\nThis is in contrast to modules such as [uid2](https://www.npmjs.com/package/uid2)\nwhose UIDs are actually skewed due to the use of `%` and unnecessarily\ntruncate the UID. Use this if you could still use UIDs with `-` and `_` in\nthem.\n\n## Installation\n\n```sh\n$ npm install uid-safe\n```\n\n## API\n\n```js\nvar uid = require('uid-safe')\n```\n\n### uid(byteLength, callback)\n\nAsynchronously create a UID with a specific byte length. Because `base64`\nencoding is used underneath, this is not the string length. For example,\nto create a UID of length 24, you want a byte length of 18.\n\n```js\nuid(18, function (err, string) {\n  if (err) throw err\n  // do something with the string\n})\n```\n\n### uid(byteLength)\n\nAsynchronously create a UID with a specific byte length and return a\n`Promise`.\n\n**Note**: To use promises in Node.js _prior to 0.12_, promises must be\n\"polyfilled\" using `global.Promise = require('bluebird')`.\n\n```js\nuid(18).then(function (string) {\n  // do something with the string\n})\n```\n\n### uid.sync(byteLength)\n\nA synchronous version of above.\n\n```js\nvar string = uid.sync(18)\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/uid-safe.svg\n[npm-url]: https://npmjs.org/package/uid-safe\n[node-version-image]: https://img.shields.io/node/v/uid-safe.svg\n[node-version-url]: https://nodejs.org/en/download/\n[travis-image]: https://img.shields.io/travis/crypto-utils/uid-safe/master.svg\n[travis-url]: https://travis-ci.org/crypto-utils/uid-safe\n[coveralls-image]: https://img.shields.io/coveralls/crypto-utils/uid-safe/master.svg\n[coveralls-url]: https://coveralls.io/r/crypto-utils/uid-safe?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/uid-safe.svg\n[downloads-url]: https://npmjs.org/package/uid-safe\n","funding_links":[],"categories":["JavaScript","Generation"],"sub_categories":["JavaScript"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrypto-utils%2Fuid-safe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrypto-utils%2Fuid-safe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrypto-utils%2Fuid-safe/lists"}