{"_id":"@buddhilive/dsh-util-crypto","name":"@buddhilive/dsh-util-crypto","dist-tags":{"alpha":"0.1.2-alpha.3","latest":"0.1.2-alpha.3"},"versions":{"0.1.2-alpha.3":{"name":"@buddhilive/dsh-util-crypto","description":"Zero-dependency browser-safe UUID and byte-encoding helpers","version":"0.1.2-alpha.3","publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/Buddhilive/buddhi-ai-harness.git","directory":"packages/util/crypto"},"type":"module","main":"lib/index.js","types":"lib/types/index.d.ts","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@buddhilive/dsh-invariants":"^0.1.2-alpha.3","@deepseek-ai/cordis":"^4.0.2"},"devDependencies":{"@buddhilive/dsh-invariants":"^0.1.2-alpha.3","@deepseek-ai/cordis":"^4.0.2"},"_id":"@buddhilive/dsh-util-crypto@0.1.2-alpha.3","bugs":{"url":"https://github.com/Buddhilive/buddhi-ai-harness/issues"},"homepage":"https://github.com/Buddhilive/buddhi-ai-harness#readme","_integrity":"sha512-feYVaFTcVG6RI3rtq2LAYtns/x/DWh6jDu7BENafj66Q4UDrGJkN+8znPzR3u2Ob14wZ68rA955h3rfU1gh2fg==","_resolved":"C:\\DevDojo\\Buddhi\\buddhi-ai-harness\\dist\\npm\\buddhilive-dsh-util-crypto-0.1.2-alpha.3.tgz","_from":"file:C:/DevDojo/Buddhi/buddhi-ai-harness/dist/npm/buddhilive-dsh-util-crypto-0.1.2-alpha.3.tgz","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-feYVaFTcVG6RI3rtq2LAYtns/x/DWh6jDu7BENafj66Q4UDrGJkN+8znPzR3u2Ob14wZ68rA955h3rfU1gh2fg==","shasum":"4f0ea854ce334a56f71b06983eb320757a355730","tarball":"https://registry.npmjs.org/@buddhilive/dsh-util-crypto/-/dsh-util-crypto-0.1.2-alpha.3.tgz","fileCount":9,"unpackedSize":11372,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIA9E7EFZ97sN7Nscey9MDL8MyJX88sFy86+uGh8yevnBAiEAmK5L/mKaTjUSmFtMHN949pg0LUJlf4JaIwZsNmzY/xQ="}]},"_npmUser":{"name":"buddhilive","email":"visitbudkavin@gmail.com"},"directories":{},"maintainers":[{"name":"buddhilive","email":"visitbudkavin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dsh-util-crypto_0.1.2-alpha.3_1788164925205_0.3930855400821287"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-31T08:28:45.054Z","0.1.2-alpha.3":"2026-08-31T08:28:45.340Z","modified":"2026-08-31T08:28:45.558Z"},"maintainers":[{"name":"buddhilive","email":"visitbudkavin@gmail.com"}],"description":"Zero-dependency browser-safe UUID and byte-encoding helpers","homepage":"https://github.com/Buddhilive/buddhi-ai-harness#readme","repository":{"type":"git","url":"git+https://github.com/Buddhilive/buddhi-ai-harness.git","directory":"packages/util/crypto"},"bugs":{"url":"https://github.com/Buddhilive/buddhi-ai-harness/issues"},"license":"MIT","readme":"---\ndescription: \"面向替换仅安全上下文可用的 crypto.randomUUID 调用的维护者，说明跨运行时 UUID 生成。\"\nkind: \"package-library\"\n---\n\n# dsh-util-crypto\n\n[English](README.md) | 中文\n\n## 概述\n\n零依赖、可在浏览器使用的 UUID 与字节编码辅助函数。UUID 铸造基于 `crypto.getRandomValues`——所有发布上下文都提供的那个随机原语。`crypto.randomUUID` 是安全上下文限定的 Web API：经普通 HTTP 在局域网地址上提供的页面或 worker（浏览器预览部署）根本没有这个方法，必须在那里运行的代码不能调它。全仓 `no-restricted-properties` lint 规则把 `crypto.randomUUID` 的调用者指到这里；只跑在 Node 的代码从 `node:crypto` 导入 `randomUUID` 维持原样。\n\n## 目录\n\n- [使用本包](#use-this-package)\n- [API](#api)\n- [Model Experience](#model-experience)\n- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)\n- [开发备注](#dev-note)\n\n-----\n\n<a id=\"use-this-package\"></a>\n## 使用本包\n\n它是**库，不是服务也不是插件**：无 `ctx`、不注册任何东西、不持有状态。\n\n-----\n\n<a id=\"api\"></a>\n## API\n\n```ts\nimport { bytesToBase64, randomUUID, type Uuid } from '@buddhilive/dsh-util-crypto'\n```\n\n| 导出 | 角色 |\n|---|---|\n| `bytesToBase64(data)` | 以有界分片把字节数组编码为标准 base64。 |\n| `randomUUID()` | 随机 RFC 9562 v4 UUID 字符串，由 `crypto.getRandomValues` 铸造。可原位替换 `crypto.randomUUID()`。 |\n| `Uuid` | 五段式 UUID 字符串类型，与 `crypto.randomUUID` 声明的返回形状一致。 |\n\n<a id=\"model-experience\"></a>\n## Model Experience\n\n间接地，经由用它铸造请求、会话与附件标识符的消费方，这些标识符均不作为语义内容进入提示词。\n\n#### KV Cache effect\n\n无直接失效；铸造标识符的消费方自行负责其请求变化。\n\n## Known Limitations and Deferred Work\n\n<a id=\"known-limitations-and-deferred-work\"></a>\n\n- **仅 v4**——不提供其他 UUID 版本、命名空间或解析；需要更多能力的消费方应引入真正的 UUID 依赖。\n- **唯一性是概率性的**——122 位随机，与 `crypto.randomUUID` 同级保证；此处不做碰撞检测。\n\n\n<a id=\"dev-note\"></a>\n### 开发备注\n\n<details>\n<summary>维护者工作上下文——点击展开</summary>\n\n无。\n\n</details>\n","readmeFilename":"README.zh.md","_rev":"1-9eb141121d4189b4c0524b41af46c053"}