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

@kaadon.com/cfapi

v1.0.0

Published

AES-256-GCM auto-decrypt client for Cloudflare API responses

Readme

@kaadon.com/cfapi

AES-256-GCM 自动解密的 Cloudflare API 客户端,零运行时依赖,支持浏览器和 Node.js 18+。

安装

npm install @kaadon.com/cfapi axios

快速开始

import { CfApi } from '@kaadon.com/cfapi';

const api = await CfApi.create({
  key: '你的64位十六进制密钥',
  baseURL: 'https://your-api.example.com',
  token: 'your-bearer-token',
});

const res = await api.get<{ ip: string; country: string }>('/api/verify');
console.log(res.data); // { ip: '1.2.3.4', country: 'CN' }

API

CfApi.create(options)

异步工厂方法,创建并返回 CfApi 实例。

| 参数 | 类型 | 必填 | 说明 | |------|------|------|------| | key | string | 是 | 256 位密钥的十六进制字符串(64 字符) | | baseURL | string | 是 | API 基础地址 | | token | string | 否 | Bearer Token,自动 SHA-256(token+YYYYMMDD UTC) 后发送 | | axios | AxiosInstance | 否 | 自定义 axios 实例 | | axiosConfig | AxiosRequestConfig | 否 | 传递给 axios.create 的额外配置 |

请求方法

api.get<T>(url, config?)
api.post<T>(url, body?, config?)
api.put<T>(url, body?, config?)
api.delete<T>(url, config?)

所有方法返回 Promise<CfApiResponse<T>>,响应已自动解密。

其他方法

api.setToken('new-token')        // 更新 Token
api.instance                      // 获取内部 axios 实例
api.decrypt<T>('base64字符串')    // 直接解密数据

使用自定义 Axios 实例

import axios from 'axios';
import { CfApi } from '@kaadon.com/cfapi';

const http = axios.create({ baseURL: 'https://api.example.com', timeout: 5000 });
const api = await CfApi.create({ key: '你的密钥', baseURL: '', axios: http });

低级 API

import { decrypt, decryptResponse, isEncryptedResponse } from '@kaadon.com/cfapi';

const data = await decrypt('base64字符串', '64位十六进制密钥');
const result = await decryptResponse(responseBody, '64位十六进制密钥');
if (isEncryptedResponse(body)) { /* ... */ }

环境要求

  • 浏览器: 支持 Web Crypto API(所有现代浏览器)
  • Node.js: >= 18

License

MIT