{"_id":"@code_with_sachin/uusid","_rev":"7-5aafd704ac102b9b534c326c7571df70","name":"@code_with_sachin/uusid","dist-tags":{"beta":"2.0.0","latest":"3.1.0"},"versions":{"2.0.0":{"name":"@code_with_sachin/uusid","version":"2.0.0","keywords":["uuid","uusid","unique","identifier","random","time-based","collision-resistant","hybrid","secure","id","generator","typescript"],"author":{"name":"Sachin Singh"},"license":"ISC","_id":"@code_with_sachin/uusid@2.0.0","maintainers":[{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"}],"homepage":"https://github.com/CodeWithSachin/uusid#readme","bugs":{"url":"https://github.com/CodeWithSachin/uusid/issues"},"dist":{"shasum":"41db635132e12068851c979ffe820eb8f291d0a2","tarball":"https://registry.npmjs.org/@code_with_sachin/uusid/-/uusid-2.0.0.tgz","fileCount":6,"integrity":"sha512-5vsDeG0A939yDUT0JqDEd+epiopPV4M0Uc/U5kPbq0lYlPHXPcGZFDcVJzWnLzBxfeDSeGqzYj2Z2EcC/f2kDg==","signatures":[{"sig":"MEUCID6vO+RX5tZFE/mmBeNA3aebz+ZYF9piBYlN1XP0zXxLAiEAiyLcNmZrq8DLKBUGthS2Ou+rIeGnldHNjZuDmVoy4sQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24589},"main":"index.js","types":"index.d.ts","engines":{"node":">=14.0.0"},"scripts":{"test":"node test.js","example":"node example.js","benchmark":"node benchmark.js"},"_npmUser":{"name":"code_with_sachin","actor":{"name":"code_with_sachin","type":"user","email":"sachinnnsingh0510@gmail.com"},"email":"sachinnnsingh0510@gmail.com"},"repository":{"url":"git+https://github.com/CodeWithSachin/uusid.git","type":"git"},"_npmVersion":"10.9.2","description":"Ultra Unique Secure ID generator combining UUID4 randomness with UUID1 time-based components for maximum collision resistance","directories":{},"_nodeVersion":"22.13.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/uusid_2.0.0_1751620003296_0.39471963290856915","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@code_with_sachin/uusid","version":"2.0.1","keywords":["uuid","uusid","unique","identifier","random","time-based","collision-resistant","hybrid","secure","id","generator","typescript"],"author":{"name":"Sachin Singh"},"license":"ISC","_id":"@code_with_sachin/uusid@2.0.1","maintainers":[{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"}],"homepage":"https://github.com/CodeWithSachin/uusid#readme","bugs":{"url":"https://github.com/CodeWithSachin/uusid/issues"},"dist":{"shasum":"71e1bb14bdb49bf9168dda6caad07ad017410c29","tarball":"https://registry.npmjs.org/@code_with_sachin/uusid/-/uusid-2.0.1.tgz","fileCount":6,"integrity":"sha512-QkW9iIZ8iw30cXs8xCEo4AofpK3LyYApf32nGZLCzNo3xcGUyTPnOipjzp4aS68FOTYzcllnvzsVvcFWpd4aLQ==","signatures":[{"sig":"MEUCIGfii4XsxtsD7DmXvCazEGix/KsPBRBILLDWPHnNeK3qAiEAvtsV6HPbChqtfm1B7PoXATXlWpO0P3hZHmXIozP0w7c=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27427},"main":"index.js","types":"index.d.ts","engines":{"node":">=14.0.0"},"gitHead":"f18683c029d623e48f5d917203ba9f7c1c51a860","scripts":{"test":"node test.js","example":"node example.js","benchmark":"node benchmark.js"},"_npmUser":{"name":"code_with_sachin","actor":{"name":"code_with_sachin","type":"user","email":"sachinnnsingh0510@gmail.com"},"email":"sachinnnsingh0510@gmail.com"},"repository":{"url":"git+https://github.com/CodeWithSachin/uusid.git","type":"git"},"_npmVersion":"10.9.2","description":"Ultra Unique Secure ID generator combining UUID4 randomness with UUID1 time-based components for maximum collision resistance","directories":{},"_nodeVersion":"22.13.1","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/uusid_2.0.1_1751622648760_0.5763101816811749","host":"s3://npm-registry-packages-npm-production"}},"2.0.3":{"name":"@code_with_sachin/uusid","version":"2.0.3","keywords":["uuid","uusid","unique","identifier","random","time-based","collision-resistant","hybrid","secure","id","generator","typescript"],"author":{"name":"Sachin Singh"},"license":"ISC","_id":"@code_with_sachin/uusid@2.0.3","maintainers":[{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"}],"homepage":"https://github.com/CodeWithSachin/uusid#readme","bugs":{"url":"https://github.com/CodeWithSachin/uusid/issues"},"dist":{"shasum":"b51c9e4ab12e5a71c55797334fc6b4517ad5fa03","tarball":"https://registry.npmjs.org/@code_with_sachin/uusid/-/uusid-2.0.3.tgz","fileCount":6,"integrity":"sha512-qR3OUz/XIM1vR8D+PAzIBUjFpGjPOJCLNWvA8QHxZMx9q9Lc1ia+JRfXp8Cf881JhRLvY8yDBoF2d/DfmMaABw==","signatures":[{"sig":"MEUCIBGzLRgcIK2I6ezswqNyJCYhNUmf3m6ts3zMjvOG3j4DAiEAmF3KyIyyL6zihEj6UsfqiDQ0E4fcinJFTrhZBIhCdDY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27503},"main":"index.js","types":"index.d.ts","engines":{"node":">=14.0.0"},"gitHead":"ddacbcaa3b8560ce3fbfcfff136c9f301012b3ab","scripts":{"test":"node test.js","example":"node example.js","benchmark":"node benchmark.js"},"_npmUser":{"name":"code_with_sachin","actor":{"name":"code_with_sachin","type":"user","email":"sachinnnsingh0510@gmail.com"},"email":"sachinnnsingh0510@gmail.com"},"repository":{"url":"git+https://github.com/CodeWithSachin/uusid.git","type":"git"},"_npmVersion":"10.8.2","description":"Ultra Unique Secure ID generator combining UUID4 randomness with UUID1 time-based components for maximum collision resistance","directories":{},"_nodeVersion":"20.19.3","dependencies":{},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/uusid_2.0.3_1751641754432_0.7056143115570488","host":"s3://npm-registry-packages-npm-production"}},"2.0.4":{"name":"@code_with_sachin/uusid","version":"2.0.4","keywords":["uuid","uusid","unique","identifier","random","time-based","collision-resistant","hybrid","secure","id","generator","typescript"],"author":{"name":"Sachin Singh"},"license":"ISC","_id":"@code_with_sachin/uusid@2.0.4","maintainers":[{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"}],"homepage":"https://github.com/CodeWithSachin/uusid#readme","bugs":{"url":"https://github.com/CodeWithSachin/uusid/issues"},"dist":{"shasum":"837584da4efff9f101836f6a21dafcd4f010ab4a","tarball":"https://registry.npmjs.org/@code_with_sachin/uusid/-/uusid-2.0.4.tgz","fileCount":6,"integrity":"sha512-7FNbhWB3DKrlYr7VLop9mIWsHH6LZUt+y19ppwETx0NiquKzpOVCTxUzZFT+h+rRo2kytYy34hLAesoOEJ6Jzg==","signatures":[{"sig":"MEQCIAV/YuPAN95udgToFSEe1tDM0Na6Y/JslZb+qaBI61Z+AiAmXl9JAs0kGHmdY/085vpXf/dzG1UDt9n+N5MOofvaVw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27611},"main":"index.js","types":"index.d.ts","engines":{"node":">=14.0.0"},"gitHead":"ed88a3ecbeb1c50fa9e3a5a6bf1bd76b24721738","scripts":{"test":"node test.js","example":"node example.js","benchmark":"node benchmark.js"},"_npmUser":{"name":"code_with_sachin","actor":{"name":"code_with_sachin","type":"user","email":"sachinnnsingh0510@gmail.com"},"email":"sachinnnsingh0510@gmail.com"},"repository":{"url":"git+https://github.com/CodeWithSachin/uusid.git","type":"git"},"_npmVersion":"10.8.2","description":"Ultra Unique Secure ID generator combining UUID4 randomness with UUID1 time-based components for maximum collision resistance","directories":{},"_nodeVersion":"20.19.3","dependencies":{},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/uusid_2.0.4_1751910513411_0.5445292899734964","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@code_with_sachin/uusid","version":"3.0.0","keywords":["uuid","uusid","unique","identifier","random","time-based","collision-resistant","hybrid","secure","id","generator","typescript","encrypted","hierarchical","prefixed","base32","url-safe","compact","performance","batch","validation","analysis","metrics","content-based","deterministic","worker-pool","high-volume"],"author":{"name":"Sachin Singh"},"license":"ISC","_id":"@code_with_sachin/uusid@3.0.0","maintainers":[{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"}],"homepage":"https://github.com/CodeWithSachin/uusid#readme","bugs":{"url":"https://github.com/CodeWithSachin/uusid/issues"},"bin":{"uusid":"cli.js"},"dist":{"shasum":"199026f1361b70f71141c0a51ee937ad5a5848fd","tarball":"https://registry.npmjs.org/@code_with_sachin/uusid/-/uusid-3.0.0.tgz","fileCount":7,"integrity":"sha512-27tWtBC9ritE+suzFdJ55PI6Xa1RU5/H231J4E/3F6X5TsXeJnxUKHh+uW1XQSN5YAFDkg0rxdf9iBtMOI6vuQ==","signatures":[{"sig":"MEQCIHwDdg+NsZzTNjs4PDb1zpmZ6GQ//0qCaMnYgP9rFAgyAiArC16Jdw2X9Ku2MpNiWqrd9oq8j4ufQBjDl3TPEBRoNQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66147},"main":"index.js","types":"index.d.ts","engines":{"node":">=14.0.0"},"gitHead":"f166173fdabd0343c4b557d6e6f0913c656d9b88","scripts":{"demo":"npm run example && npm run test && npm run benchmark","test":"node test.js","health":"node -e \"const {healthCheck} = require('./index.js'); healthCheck().then(console.log)\"","example":"node example.js","metrics":"node -e \"const {getMetrics} = require('./index.js'); console.log(getMetrics())\"","prepack":"npm test","validate":"node -e \"const {validate, uusid} = require('./index.js'); console.log(validate(uusid()))\"","benchmark":"node benchmark.js"},"_npmUser":{"name":"code_with_sachin","actor":{"name":"code_with_sachin","type":"user","email":"sachinnnsingh0510@gmail.com"},"email":"sachinnnsingh0510@gmail.com"},"repository":{"url":"git+https://github.com/CodeWithSachin/uusid.git","type":"git"},"_npmVersion":"10.8.2","description":"Ultra Unique Secure ID generator with multiple formats, encryption, hierarchical IDs, and advanced features for modern applications","directories":{},"_nodeVersion":"20.19.3","dependencies":{},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","eslint":"^8.0.0","prettier":"^3.0.0","benchmark":"^2.1.4","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/uusid_3.0.0_1751991185727_0.09402211637368452","host":"s3://npm-registry-packages-npm-production"}},"3.0.1":{"name":"@code_with_sachin/uusid","version":"3.0.1","keywords":["uuid","uusid","unique","identifier","random","time-based","collision-resistant","hybrid","secure","id","generator","typescript","encrypted","hierarchical","prefixed","base32","url-safe","compact","performance","batch","validation","analysis","metrics","content-based","deterministic","worker-pool","high-volume"],"author":{"name":"Sachin Singh"},"license":"ISC","_id":"@code_with_sachin/uusid@3.0.1","maintainers":[{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"}],"homepage":"https://github.com/CodeWithSachin/uusid#readme","bugs":{"url":"https://github.com/CodeWithSachin/uusid/issues"},"bin":{"uusid":"cli.js"},"dist":{"shasum":"60f199f39c3e7b1b95e4c9feb2e6775dd295acc1","tarball":"https://registry.npmjs.org/@code_with_sachin/uusid/-/uusid-3.0.1.tgz","fileCount":7,"integrity":"sha512-TO5IsDGFs5D3BCQYymt+pbv4TVVfESl6D7UPi8xBNLfICZUHOUMz2uJQ/Tw4E48ma1OtGzRJG4P4Ld32XFkXIw==","signatures":[{"sig":"MEUCIG4HzuoeewxGXXMSLvVeWYCKPH5JcF+TKbx/VG+hTEmhAiEAnLrjh2Tgl1Sg8TJWopMCKX+ecO6nVxoh3MztRmmBBgI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67166},"main":"index.js","types":"index.d.ts","engines":{"node":">=14.0.0"},"gitHead":"6830ed54d4d849cec62fca40515a50b4bcb3dcef","scripts":{"demo":"npm run example && npm run test && npm run benchmark","test":"node test.js","health":"node -e \"const {healthCheck} = require('./index.js'); healthCheck().then(console.log)\"","example":"node example.js","metrics":"node -e \"const {getMetrics} = require('./index.js'); console.log(getMetrics())\"","prepack":"npm test","validate":"node -e \"const {validate, uusid} = require('./index.js'); console.log(validate(uusid()))\"","benchmark":"node benchmark.js"},"_npmUser":{"name":"code_with_sachin","actor":{"name":"code_with_sachin","type":"user","email":"sachinnnsingh0510@gmail.com"},"email":"sachinnnsingh0510@gmail.com"},"repository":{"url":"git+https://github.com/CodeWithSachin/uusid.git","type":"git"},"_npmVersion":"10.8.2","description":"Ultra Unique Secure ID generator with multiple formats, encryption, hierarchical IDs, and advanced features for modern applications","directories":{},"_nodeVersion":"20.19.3","dependencies":{},"publishConfig":{"registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.0.0","eslint":"^8.0.0","prettier":"^3.0.0","benchmark":"^2.1.4","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{},"optionalDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/uusid_3.0.1_1751992293726_0.308394229216961","host":"s3://npm-registry-packages-npm-production"}},"3.1.0":{"name":"@code_with_sachin/uusid","version":"3.1.0","description":"Ultra Unique Secure ID generator with multiple formats, encryption, hierarchical IDs, and advanced features for modern applications","main":"./index.js","types":"./index.d.ts","browser":"./browser.mjs","exports":{".":{"types":"./index.d.ts","require":"./index.js","default":"./index.js"},"./server":{"types":"./server.d.ts","require":"./server.js","default":"./server.js"},"./browser":{"types":"./browser.d.ts","import":"./browser.mjs","default":"./browser.mjs"},"./package.json":"./package.json"},"bin":{"uusid":"cli.js"},"scripts":{"test":"node test.js","test:browser":"node test.browser.mjs","benchmark":"node benchmark.js","example":"node example.js","validate":"node -e \"const {validate, uusid} = require('./index.js'); console.log(validate(uusid()))\"","health":"node -e \"const {healthCheck} = require('./index.js'); healthCheck().then(console.log)\"","metrics":"node -e \"const {getMetrics} = require('./index.js'); console.log(getMetrics())\"","demo":"npm run example && npm run test && npm run benchmark","prepack":"npm test && npm run test:browser","start":"node server.js"},"publishConfig":{"registry":"https://registry.npmjs.org/"},"keywords":["uuid","uusid","unique","identifier","random","time-based","collision-resistant","hybrid","secure","id","generator","typescript","encrypted","hierarchical","prefixed","base32","url-safe","compact","performance","batch","validation","analysis","metrics","content-based","deterministic","worker-pool","high-volume"],"author":{"name":"Sachin Singh"},"license":"ISC","repository":{"type":"git","url":"git+https://github.com/CodeWithSachin/uusid.git"},"bugs":{"url":"https://github.com/CodeWithSachin/uusid/issues"},"homepage":"https://github.com/CodeWithSachin/uusid#readme","engines":{"node":">=14.0.0"},"dependencies":{},"devDependencies":{"jest":"^29.0.0","@types/node":"^20.0.0","typescript":"^5.0.0","eslint":"^8.0.0","prettier":"^3.0.0","benchmark":"^2.1.4"},"peerDependencies":{},"optionalDependencies":{},"_id":"@code_with_sachin/uusid@3.1.0","gitHead":"6ef35ed094f8afc878c3d1d27c73e974caa4a966","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-mzgb/70brJwdpCA44DyjvKmOycyOkJEmsfJcJA6wizhRyXpKwVS/rqdGIsEtYzuBfyK+ORYzOSrStFIAWkK83Q==","shasum":"fa1d37ddcd1947efc839a610b1a05f379bdb60cb","tarball":"https://registry.npmjs.org/@code_with_sachin/uusid/-/uusid-3.1.0.tgz","fileCount":11,"unpackedSize":94738,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGrN/wtU+gD4c6Bzmz4vmp5SyHgBM2Tt6NF+1PRkJr4kAiA6Bg5FS6gX7O9qLsMFcGiAokxekwqg3KxW5CjKCD1Hrw=="}]},"_npmUser":{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"},"directories":{},"maintainers":[{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/uusid_3.1.0_1777380281436_0.5747005397325546"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-04T09:06:43.183Z","modified":"2026-04-28T12:44:41.704Z","2.0.0":"2025-07-04T09:06:43.499Z","2.0.1":"2025-07-04T09:50:49.030Z","2.0.3":"2025-07-04T15:09:14.628Z","2.0.4":"2025-07-07T17:48:33.631Z","3.0.0":"2025-07-08T16:13:05.920Z","3.0.1":"2025-07-08T16:31:33.909Z","3.1.0":"2026-04-28T12:44:41.585Z"},"bugs":{"url":"https://github.com/CodeWithSachin/uusid/issues"},"author":{"name":"Sachin Singh"},"license":"ISC","homepage":"https://github.com/CodeWithSachin/uusid#readme","keywords":["uuid","uusid","unique","identifier","random","time-based","collision-resistant","hybrid","secure","id","generator","typescript","encrypted","hierarchical","prefixed","base32","url-safe","compact","performance","batch","validation","analysis","metrics","content-based","deterministic","worker-pool","high-volume"],"repository":{"type":"git","url":"git+https://github.com/CodeWithSachin/uusid.git"},"description":"Ultra Unique Secure ID generator with multiple formats, encryption, hierarchical IDs, and advanced features for modern applications","maintainers":[{"name":"code_with_sachin","email":"sachinnnsingh0510@gmail.com"}],"readme":"# UUSID — Ultra Unique Secure ID\n\n[![NPM Version](https://img.shields.io/npm/v/@code_with_sachin/uusid.svg)](https://www.npmjs.com/package/@code_with_sachin/uusid)\n[![License](https://img.shields.io/npm/l/@code_with_sachin/uusid.svg)](LICENSE)\n[![Node.js Version](https://img.shields.io/node/v/@code_with_sachin/uusid.svg)](https://nodejs.org)\n\nA modern UUID-shaped ID generator for **Node.js and the browser**, with multiple output formats, AES encryption, deterministic content-based IDs, hierarchical IDs, and zero runtime dependencies.\n\n```js\nimport { uusid } from '@code_with_sachin/uusid/browser';   // React / Angular / Next client / Vite\n// or\nconst { uusid } = require('@code_with_sachin/uusid');       // Node, plain CommonJS\n\nuusid(); // → \"550e8400-e29b-41d4-a716-446655440000\"\n```\n\n---\n\n## Why UUSID\n\n- **One library, two runtimes.** A Node entry that uses `node:crypto` and a browser entry that uses Web Crypto. Bundlers route automatically.\n- **Drop-in UUID v1 layout.** 36-char canonical format — works anywhere a UUID does.\n- **Batteries included.** Prefixes, encryption, validation, batch analysis, hierarchical IDs, content-based IDs, metrics, and a CLI.\n- **Zero dependencies.** Tiny install, no transitive surprises.\n- **TypeScript first.** Full `.d.ts` for both server and browser entries.\n\n---\n\n## Install\n\n```bash\nnpm install @code_with_sachin/uusid\n# or\npnpm add @code_with_sachin/uusid\n# or\nyarn add @code_with_sachin/uusid\n```\n\n---\n\n## Server vs. Browser\n\nSince v3.1.0 the package ships **two explicit subpath entries** plus a backwards-compatible root that points at the server build. The `package.json` `exports` map keeps them isolated, so SSR and CSR code in the same project never cross-contaminate.\n\n| Import | Runtime | Module format | Crypto |\n| --- | --- | --- | --- |\n| `@code_with_sachin/uusid` (root) | Node ≥ 14 | CJS | `node:crypto` |\n| `@code_with_sachin/uusid/server` | Node ≥ 14 | CJS | `node:crypto` |\n| `@code_with_sachin/uusid/browser` | All evergreen browsers, Node ≥ 18 | ESM | Web Crypto (`globalThis.crypto`) |\n\n```js\n// React / Angular / Next.js client component / Vite / Svelte / Solid\nimport { uusid, validate } from '@code_with_sachin/uusid/browser';\n\n// Next.js Route Handler / Server Component / Express / plain Node\nimport { uusid } from '@code_with_sachin/uusid/server';\n// equivalent to:\nconst { uusid } = require('@code_with_sachin/uusid');\n```\n\n### What's different on the browser entry\n\n- `fromContent`, `encrypt`, `decrypt`, and `EncryptedGenerator.generate()` are **`async`** (Web Crypto's `subtle.digest` / `subtle.encrypt` / `subtle.decrypt` are Promise-based). Server keeps the synchronous signatures.\n- `WorkerPool` and `createWorkerPool` are **not exported** in the browser. Use the server entry for very high-volume generation, or run the browser entry inside a Web Worker yourself.\n- `getMetrics()` and `healthCheck()` omit the `memoryUsage` field — there is no `process.memoryUsage` in browsers.\n- The browser entry uses **AES-256-GCM** for `encrypt` / `decrypt`. The server entry uses **AES-256-CBC**. **Encrypted IDs are not portable across the two entries** — encrypt and decrypt with the same one.\n\n---\n\n## Framework recipes\n\n### React + Vite\n\n```jsx\n// src/UserCard.jsx\nimport { uusid } from '@code_with_sachin/uusid/browser';\n\nexport function UserCard({ name }) {\n  const [id] = useState(() => uusid());\n  return <div data-id={id}>{name}</div>;\n}\n```\n\n### Next.js (App Router)\n\n```ts\n// app/api/users/route.ts — server, sync\nimport { uusid } from '@code_with_sachin/uusid/server';\nexport async function POST(req: Request) {\n  const id = uusid();\n  return Response.json({ id });\n}\n```\n\n```tsx\n// app/components/Button.tsx — client component\n'use client';\nimport { uusid } from '@code_with_sachin/uusid/browser';\nexport default function Button() {\n  return <button data-trace={uusid()}>Click</button>;\n}\n```\n\n### Angular\n\n```ts\n// src/app/id.service.ts\nimport { Injectable } from '@angular/core';\nimport { uusid, fromContent } from '@code_with_sachin/uusid/browser';\n\n@Injectable({ providedIn: 'root' })\nexport class IdService {\n  next() { return uusid(); }\n  forContent(content: string) { return fromContent(content); }   // async\n}\n```\n\n### Express\n\n```js\nconst express = require('express');\nconst { uusid } = require('@code_with_sachin/uusid');   // bare = server\nconst app = express();\napp.use((req, _res, next) => { req.requestId = uusid(); next(); });\n```\n\n---\n\n## API reference\n\n### Top-level functions\n\n| Export | Server | Browser | Returns |\n| --- | --- | --- | --- |\n| `uusid(options?)` | sync | sync | `string` |\n| `uusidBatch(count, options?)` | sync | sync | `string[]` |\n| `validate(id, options?)` | sync | sync | `ValidationResult` |\n| `extractTimestamp(id)` | sync | sync | `number` (ms) |\n| `isInTimeRange(id, start, end)` | sync | sync | `boolean` |\n| `analyze(idArray)` | sync | sync | `AnalysisResult` |\n| `getMetrics()` | sync | sync | `Metrics` |\n| `healthCheck()` | async | async | `Promise<HealthCheck>` |\n| `base32()` | sync | sync | `string` (26 chars) |\n| `urlSafe()` | sync | sync | `string` (32 chars, lowercase) |\n| `compact()` | sync | sync | `string` (32 chars) |\n| `hierarchical(options?)` | sync | sync | `string` (dotted) |\n| `fromContent(content, options?)` | **sync** | **async** | `string` / `Promise<string>` |\n\n### Classes\n\n| Export | Notes |\n| --- | --- |\n| `UUSIDGenerator` | Core class. All instance methods mirror the top-level functions. |\n| `PrefixedGenerator(prefix, options?)` | Auto-prefixes every ID. Uses `_` as the separator. |\n| `EncryptedGenerator({ secretKey, ... })` | `generate()` returns an encrypted ID. **Async on browser.** |\n| `WorkerPool({ workers, batchSize })` | **Server only.** Multi-instance batch generation. |\n\n### Factory helpers\n\n`createGenerator`, `createPrefixedGenerator`, `createEncryptedGenerator`, `createWorkerPool` — thin wrappers that return new class instances.\n\n---\n\n## ID formats\n\n```js\nimport {\n  uusid, base32, urlSafe, compact, hierarchical\n} from '@code_with_sachin/uusid/browser';\n\nuusid();          // \"550e8400-e29b-41d4-a716-446655440000\"  (36 chars, canonical)\ncompact();        // \"550e8400e29b41d4a716446655440000\"      (32 chars, no separators)\nurlSafe();        // \"550e8400e29b41d4a716446655440000\"      (lowercased compact)\nbase32();         // \"KRSXG5CTMZRW6Z3JN5XGK4TLAA\"            (26 chars)\nhierarchical();   // \"550e8400e2.9b41d4a716.446655440000\"     (3 dotted levels)\nhierarchical({ parent: 'org.team' });\n                  // \"org.team.550e8400e2\"                    (child of a parent)\n```\n\n> Output values are illustrative — your IDs will differ.\n\n---\n\n## Generators\n\n### Default\n\n```js\nimport { createGenerator } from '@code_with_sachin/uusid/server';\n\nconst gen = createGenerator({\n  prefix: 'order',\n  separator: '_',\n  validAfter:  '2025-01-01',\n  validBefore: '2026-12-31',\n});\n\ngen.generate();            // \"order_550e8400_e29b_41d4_a716_446655440000\"\ngen.generateBatch(10);     // string[]\ngen.generateSortedBatch(10); // chronologically sorted\n```\n\n### Prefixed\n\n```js\nimport { createPrefixedGenerator } from '@code_with_sachin/uusid/server';\n\nconst users = createPrefixedGenerator('user');\nusers.generate();          // \"user_550e8400_e29b_41d4_a716_446655440000\"\n```\n\n> `PrefixedGenerator` always uses `_` as the separator. Use `createGenerator({ prefix, separator })` if you need a different one.\n\n### Encrypted\n\n```js\n// Server — sync\nimport { createEncryptedGenerator } from '@code_with_sachin/uusid/server';\nconst sec = createEncryptedGenerator({ secretKey: process.env.SECRET });\nconst ct = sec.generate();              // \"ivHex:cipherTextHex\"  (AES-256-CBC)\nconst pt = sec.decrypt(ct);             // recovered uusid\n\n// Browser — async, AES-256-GCM\nimport { createEncryptedGenerator } from '@code_with_sachin/uusid/browser';\nconst sec = createEncryptedGenerator({ secretKey: 'k'.repeat(32) });\nconst ct = await sec.generate();\nconst pt = await sec.decrypt(ct);\n```\n\n### Content-based (deterministic)\n\nSame content → same ID. Useful as a stable derived key.\n\n```js\nimport { fromContent } from '@code_with_sachin/uusid/server';   // sync\nfromContent('user@example.com');                                 // \"8c12...-...-...-...-...\"\nfromContent('user@example.com', { namespace: 'users', algorithm: 'sha256' });\n```\n\n```js\nimport { fromContent } from '@code_with_sachin/uusid/browser';  // async\nawait fromContent('user@example.com');\nawait fromContent('user@example.com', { namespace: 'users', algorithm: 'SHA-256' });\n```\n\n> Note: server uses Node's algorithm names (`'sha256'`); browser uses Web Crypto names (`'SHA-256'`).\n\n### Worker pool (server only)\n\n```js\nconst { createWorkerPool } = require('@code_with_sachin/uusid');\nconst pool = createWorkerPool({ workers: 8, batchSize: 1_000 });\nconst ids = await pool.generateBatch(50_000);\n```\n\n---\n\n## Validation, analysis, metrics\n\n```js\nimport { validate, analyze, extractTimestamp, isInTimeRange,\n         getMetrics, healthCheck, uusid } from '@code_with_sachin/uusid';\n\nconst id = uusid();\n\nvalidate(id);\n// { valid: true, isValid: true, version: 'uusid', entropy: 3.7 }\n\nextractTimestamp(id);                                  // 1735689600000 (ms since epoch)\nisInTimeRange(id, '2025-01-01', '2026-01-01');         // true / false\n\nanalyze([uusid(), uusid(), 'not-an-id']);\n// {\n//   total: 3, totalIds: 3,\n//   valid: 2, invalid: 1, duplicates: 0, uniqueIds: 3,\n//   timeRange: { earliest: Date, latest: Date },\n//   formats: { standard: 2, prefixed: 0, custom: 0 },\n//   errors: ['Invalid ID not-an-id: Invalid format']\n// }\n\ngetMetrics();\n// { totalGenerated, uptime, averageRate, currentRate, peakRate,\n//   collisions, memoryUsage }      // memoryUsage is server-only\n\nawait healthCheck();\n// { healthy: true, checks: { validation, uniqueness, performance },\n//   metrics: { generationTime, rate }, timestamp }\n```\n\n---\n\n## Hierarchical IDs\n\n```js\nimport { hierarchical, createGenerator } from '@code_with_sachin/uusid';\n\nconst root = hierarchical();                       // \"aaaaaaaa.bbbbbbbb.ccccccccdddd\"\nconst child = hierarchical({ parent: root });      // \"<root>.eeeeeeeeff\"\n\nconst gen = createGenerator();\ngen.parseHierarchy(child);\n// { depth: 1, parts: [...], parent: <root>, root: <first 3 parts>, leaf: 'eeeeeeeeff' }\n```\n\n---\n\n## CLI\n\n```bash\nnpm install -g @code_with_sachin/uusid\n```\n\n```bash\n# Generate\nuusid generate --count 10 --format base32\nuusid gen -c 5 -f url-safe --prefix API\n\n# Validate / inspect\nuusid validate 550e8400-e29b-41d4-a716-446655440000\nuusid analyze ids.txt\n\n# Diagnostics\nuusid benchmark --iterations 100000\nuusid health\nuusid metrics\n```\n\n---\n\n## TypeScript\n\nTypes ship with the package. Both subpaths have their own `.d.ts`, so the async surface differences on `/browser` are reflected in your editor.\n\n```ts\nimport { uusid, UUSIDGenerator, ValidationResult } from '@code_with_sachin/uusid/server';\n\nconst gen: UUSIDGenerator = new UUSIDGenerator({ prefix: 'usr', separator: '-' });\nconst id: string = uusid();\nconst v: ValidationResult = gen.validate(id);\n```\n\n```ts\nimport { fromContent } from '@code_with_sachin/uusid/browser';\nconst id: string = await fromContent('hello');   // Promise<string> on /browser\n```\n\n---\n\n## Performance\n\nMeasured locally with `npm run benchmark` on Node 24 / Apple Silicon. Numbers are indicative.\n\n| Operation | Throughput | Notes |\n| --- | --- | --- |\n| `uusid()` (default generator) | ~6,000–60,000 ops/sec | Single-thread, includes timestamp + clock-seq logic |\n| `WorkerPool.generateBatch()` | 60,000+ ops/sec | Multi-instance, server only |\n| `validate()` | 10M+ ops/sec | Pure regex + math |\n| `fromContent()` (server, SHA-256) | 750k+ ops/sec | One hash per call |\n| `EncryptedGenerator.generate()` (server, AES-CBC) | 50k+ ops/sec | Includes encryption |\n\nMemory: ~50 bytes per ID retained, no internal queues, no leaks observed across 500k generations.\nCollision resistance: zero collisions across 500k generations in test suite.\n\n---\n\n## Migration\n\n### From `uuid`\n\n```js\n// Before\nconst { v4: uuidv4 } = require('uuid');\nconst id = uuidv4();\n\n// After\nconst { uusid } = require('@code_with_sachin/uusid');\nconst id = uusid();\n```\n\n### From `crypto.randomBytes`\n\n```js\n// Before\nconst id = require('crypto').randomBytes(16).toString('hex');\n\n// After — same shape, plus prefixing/encryption/etc when you need them\nconst { compact } = require('@code_with_sachin/uusid');\nconst id = compact();\n```\n\n### From v3.0.x → v3.1.0\n\nNo breaking changes. Existing `require('@code_with_sachin/uusid')` and `import` from the bare path keep working unchanged. The new `/server` and `/browser` subpaths are additive.\n\n---\n\n## Development\n\n```bash\nnpm test            # 19 server-side tests\nnpm run test:browser # 20 browser-entry tests (uses globalThis.crypto)\nnpm run benchmark   # performance numbers\nnpm run example     # walkthrough of every feature\n```\n\n---\n\n## Roadmap\n\n- [x] Browser compatibility (v3.1.0)\n- [x] Subpath imports (`/server`, `/browser`)\n- [ ] AES-256-GCM on the server entry (cross-runtime encrypted ID interop)\n- [ ] Web Worker port of `WorkerPool`\n- [ ] Pluggable RNG hooks\n- [ ] Optional URL-safe Base64 format\n\n---\n\n## Contributing\n\nIssues and pull requests are welcome at <https://github.com/CodeWithSachin/uusid>. Please run `npm test && npm run test:browser` before submitting.\n\n## License\n\nISC — see [LICENSE](LICENSE).\n\n## Related\n\n- [`uuid`](https://www.npmjs.com/package/uuid) — RFC-compliant UUID v1/v4/v5\n- [`nanoid`](https://www.npmjs.com/package/nanoid) — short URL-safe IDs\n- [`cuid2`](https://www.npmjs.com/package/@paralleldrive/cuid2) — collision-resistant IDs\n\n---\n\nMade by [Sachin Singh](https://github.com/CodeWithSachin). If this saves you time, a star on GitHub is appreciated.\n","readmeFilename":"README.md"}