npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xfcodeai/dsh-util-crypto

v0.1.5-rc.5

Published

Zero-dependency browser-safe UUID and byte-encoding helpers

Readme


description: "面向替换仅安全上下文可用的 crypto.randomUUID 调用的维护者,说明跨运行时 UUID 生成。" kind: "package-library"

dsh-util-crypto

English | 中文

概述

零依赖、可在浏览器使用的 UUID 与字节编码辅助函数。UUID 铸造基于 crypto.getRandomValues——所有发布上下文都提供的那个随机原语。crypto.randomUUID 是安全上下文限定的 Web API:经普通 HTTP 在局域网地址上提供的页面或 worker(浏览器预览部署)根本没有这个方法,必须在那里运行的代码不能调它。全仓 no-restricted-properties lint 规则把 crypto.randomUUID 的调用者指到这里;只跑在 Node 的代码从 node:crypto 导入 randomUUID 维持原样。

目录


使用本包

它是库,不是服务也不是插件:无 ctx、不注册任何东西、不持有状态。


API

import { bytesToBase64, randomUUID, type Uuid } from '@xfcodeai/dsh-util-crypto'

| 导出 | 角色 | |---|---| | bytesToBase64(data) | 以有界分片把字节数组编码为标准 base64。 | | randomUUID() | 随机 RFC 9562 v4 UUID 字符串,由 crypto.getRandomValues 铸造。可原位替换 crypto.randomUUID()。 | | Uuid | 五段式 UUID 字符串类型,与 crypto.randomUUID 声明的返回形状一致。 |

模型体验

间接地,经由用它铸造请求、会话与附件标识符的消费方,这些标识符均不作为语义内容进入提示词。

KV Cache 影响

无直接失效;铸造标识符的消费方自行负责其请求变化。

已知限制与延期工作

  • 仅 v4——不提供其他 UUID 版本、命名空间或解析;需要更多能力的消费方应引入真正的 UUID 依赖。
  • 唯一性是概率性的——122 位随机,与 crypto.randomUUID 同级保证;此处不做碰撞检测。

开发备注

无。

运行时不变式: 不发布伴生入口。这个纯工具不持有事件流或可变运行时数据;其值运算由单元测试覆盖。