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

kveil-web

v0.3.1

Published

防 AI 密钥窃取工具 - Web/React 运行时库

Downloads

45

Readme

kveil-web

Kveil Web/React 运行时库 - 防 AI 密钥窃取工具

⚠️ 迁移指南 (v0.2.0 -> v0.3.0)

BREAKING CHANGE: 默认配置目录已从 .kveil 重命名为 .kvbin

请手动重命名项目中的目录:

mv .kveil .kvbin

安装

npm install kveil-web

使用

1. 配置 bin 文件

.kvbin/secrets.bin 文件拷贝到项目的 public/ 目录:

cp .kvbin/secrets.bin public/.kvbin/secrets.bin

2. 初始化

import { Kveil } from 'kveil-web';

await Kveil.init('/.kvbin/secrets.bin');

3. 获取密钥

const apiKey = Kveil.get('mi_api_key');

4. 检查必需密钥

Kveil.checkRequiredKeys(['mi_api_key', 'stripe_key']);

React Hooks 示例

import { useEffect, useState } from 'react';
import { Kveil } from 'kveil-web';

function useApiKey(name: string): string | null {
  const [key, setKey] = useState<string | null>(null);

  useEffect(() => {
    if (Kveil.isInitialized()) {
      setKey(Kveil.get(name));
    }
  }, [name]);

  return key;
}

function MyApp() {
  const apiKey = useApiKey('mi_api_key');

  if (!apiKey) {
    return <div>加载中...</div>;
  }

  return <div>API Key: {apiKey}</div>;
}

API

Kveil.init(binUrl?: string)

初始化 Kveil,加载并解密 bin 文件中的密钥。

  • binUrl - bin 文件的 URL,默认为 /.kvbin/secrets.bin

Kveil.get(key: string): string

获取指定密钥的明文值。

Kveil.getKeys(): string[]

获取所有已配置的密钥名列表。

Kveil.checkRequiredKeys(keys: string[]): void

检查必需的密钥是否都存在,缺失则抛出异常。

Kveil.isInitialized(): boolean

检查 Kveil 是否已初始化。

CLI 工具

使用前需要先运行 CLI 工具初始化并添加密钥:

# 安装 CLI
npm install -g kveil

# 初始化
kveil init

# 添加密钥
kveil add mi_api_key "sk-1234567890abcdef"

# 查看密钥列表
kveil list

# 查看密钥信息
kveil show -l

# 密钥管理
kveil remove mi_api_key
kveil reset mi_api_key "new-sk-0987654321fedcba"
kveil rekey --key "ABCDEFGHIJ123456"

完整文档

https://github.com/yourusername/kveil

许可证

MIT