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

@hxa-rn/react-native-quick-crypto

v1.1.0-beta.1

Published

A fast implementation of Node's `crypto` module written in C/C++ JSI

Readme

本项目基于 react-native-quick-crypto开发。如果在使用过程中有任何问题,欢迎在AtomGit提交Issue,会及时跟进。

项目介绍

@hxa-rn/react-native-quick-crypto 是 react-native-quick-crypto 的鸿蒙(OpenHarmony / HarmonyOS)适配包,基于 Nitro Modules 与预编译 OpenSSL,在 RN 鸿蒙运行时提供接近 Node.js crypto 的能力。当前版本:1.1.0-beta.1。

集成指南

npm install @hxa-rn/react-native-quick-crypto

业务代码仍按上游包名导入(package.json 中 harmony.alias 为 react-native-quick-crypto):

import crypto from 'react-native-quick-crypto';

鸿蒙工程侧通过 autolinking 引入 HAR(示例见 example / example_auto 的 oh-package.json5)。

Demo 编译(Windows 注意)

在 example 或 example_auto 中编译鸿蒙工程前,请按下列顺序执行:

# 1) 安装 JS 依赖(含 @react-native-oh/react-native-harmony / harmony-cli)
cd example_auto
npm install

# 2) 安装 ohpm 依赖
cd harmony
ohpm install --all --registry https://ohpm.openharmony.cn/ohpm/

# 3) 打包 JS bundle(会自动先执行 ohpm:materialize)
cd ..
npm run dev

# 4) DevEco:Sync and Refresh → Run
#    Sync 会再次 ohpm install 并重建 Junction;工程已在 hvigorfile.ts 启动时自动 materialize,一般无需再手跑脚本

说明:

  • 根因:ohpm install / DevEco「同步并刷新」会把 oh_modules/@rnoh/... 建成 Junction,指向 oh_modules/.ohpm/@pkg@<超长哈希>/...。ninja 解析真实路径后超过 Windows 260 字符限制。
  • 为何 npm run dev 后又失败:dev 只打 JS bundle;随后 DevEco Sync 会重新装 ohpm 依赖,把刚才落地的短目录又改回长路径 Junction,所以 Run 原生编译再次报 260。
  • 自动修复:harmony/hvigorfile.ts 加载时会调用 materialize-ohpm.js(仅 Windows):把 Junction 落成短目录;若 entry/.cxx 里仍缓存着 .ohpm 超长绝对路径会自动清掉,避免「目录已短但 ninja 仍报 260」。
  • 手动命令(排查或脚本失败时):
npm run ohpm:materialize

然后重新 DevEco Run(不要只用增量;清过 .cxx 后首次原生编译会稍慢)。

  • 改用例 JS:只需 npm run dev 更新 bundle,不必为改文件而重复 materialize。

使用说明

import { install } from 'react-native-quick-crypto';

// 可选:将 global.crypto / global.Buffer 安装为 QuickCrypto 实现
install();

import crypto from 'react-native-quick-crypto';

const hash = crypto.createHash('sha256').update('hello').digest('hex');
const bytes = crypto.randomBytes(16);

更完整场景见 example_auto 中的自动化用例页。

接口文档

公开能力与上游 react-native-quick-crypto 对齐,主要包括:

| 模块 | 说明 | |------|------| | createHash / createHmac | 摘要与 HMAC | | createCipheriv / createDecipheriv | 对称加解密 | | randomBytes / randomFill 等 | 随机数 | | pbkdf2 / scrypt / hkdf | 密钥派生 | | generateKeyPair / 各类 KeyObject | 非对称密钥 | | subtle | WebCrypto 子集 | | install() | 注入 global.crypto / global.Buffer |

具体类型定义见包内 dist/typescript。

快速验证(运行 Example)

前置条件

| 依赖 | 版本要求 | |------|----------| | Node.js | >= 18 | | DevEco Studio | 5.0+ | | HarmonyOS SDK | API 13+ |

运行步骤

1. 克隆仓库

git clone https://gitcode.com/hxa-rn/react-native-quick-crypto.git
cd react-native-quick-crypto
git checkout br_rnoh0.72

2. 安装仓库开发依赖

npm install --legacy-peer-deps

Example 已改为从 npm 公仓安装 @hxa-rn/[email protected],不再使用本地 file:../xxx.tgz,运行 Example 不必再执行 npm pack。

3. 进入 example 目录,安装依赖

cd example          # 或 example_auto
npm install --legacy-peer-deps

4. 生成 JS Bundle

npm run dev

产物:harmony/entry/src/main/resources/rawfile/bundle.harmony.js

5. 用 DevEco Studio 打开鸿蒙工程

  • 打开 DevEco Studio
  • 选择 example/harmony(或 example_auto/harmony)目录
  • 等待 Sync 完成

6. 编译并运行 HAP

在 DevEco Studio 中点击运行按钮,将 HAP 安装到设备/模拟器。

注意:Example 中已预置插件依赖和 Package 注册,无需手动配置 Link。

约束与限制

兼容性

  • 鸿蒙 SDK:API 13+(与当前 Demo / HAR 配置一致)
  • 上游 RN:react-native-quick-crypto 1.x 能力面
  • React Native / RNOH:RN 0.77.x + @react-native-oh/react-native-harmony 0.77.x(以 Demo package.json 为准)
  • 原生依赖:仓库内 vendored 的 OpenSSL 3.6.0 预编译静态库(aarch64-linux-ohos),见 harmony/quick_crypto/src/main/cpp/third_party/openssl/

权限

  • 无额外系统权限。

Windows 路径

  • Windows:DevEco Sync 会重建 ohpm Junction(超长路径)。工程已在 harmony/hvigorfile.ts 启动时自动 materialize;若仍报 260,手动执行 npm run ohpm:materialize 后再 Run。仅改 JS/TS 时只需 npm run dev。

开源license

本项目基于 MIT 协议,详见 LICENSE 文件。

问题反馈渠道

使用问题请在 AtomGit 提交 Issue。也可在 GitCode 仓库反馈:

https://gitcode.com/hxa-rn/react-native-quick-crypto

https://gitcode.com/hxa-rn/react-native-quick-crypto/issues