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

@cinaconnect/keys-server

v0.2.0

Published

Key management server for CinaConnect — key storage, encryption, session management

Readme

Keys Server

CinaConnect 密钥管理服务 — 安全存储和管理用户加密密钥。

架构

┌────────────┐     HTTPS      ┌─────────────┐     PostgreSQL     ┌────────────┐
│   Client   │ ◀────────────▶ │ Keys Server │ ◀───────────────▶ │ PostgreSQL │
│  (SDK/App) │                │             │                    │  Database  │
└────────────┘                └─────────────┘                    └────────────┘
                                   │
                              migrations/
                              (schema mgmt)

Keys Server 提供安全的密钥存储、轮换和检索服务。所有数据在静态和传输中均加密。

技术栈

  • 语言: Rust
  • Web 框架: Actix-web
  • 数据库: PostgreSQL (via SQLx)
  • 加密: ring, zeroize
  • 迁移: SQLx migrations

配置

环境变量

| 变量 | 说明 | 默认值 | 必需 | |------|------|--------|------| | KEYS_SERVER_HOST | 监听地址 | 0.0.0.0 | ✅ | | KEYS_SERVER_PORT | 监听端口 | 3001 | ✅ | | RUST_LOG | 日志级别 | info | | | DATABASE_URL | PostgreSQL 连接字符串 | | ✅ | | DATABASE_MAX_CONNECTIONS | 最大连接数 | 10 | | | MASTER_ENCRYPTION_KEY | 主加密密钥 (HKDF seed) | | ✅ | | KEYS_SHUTDOWN_TIMEOUT_SECS | 优雅关闭超时 | 30 | |

数据库

运行迁移:

sqlx migrate run --database-url "$DATABASE_URL"

API

健康检查

GET /v1/health

存储密钥

POST /v1/keys
Authorization: Bearer <token>
Content-Type: application/json

{
  "key_type": "session" | "signing" | "encryption",
  "public_key": "<hex>",
  "metadata": {}
}

检索密钥

GET /v1/keys/:key_id
Authorization: Bearer <token>

轮换密钥

POST /v1/keys/:key_id/rotate
Authorization: Bearer <token>

撤销密钥

DELETE /v1/keys/:key_id
Authorization: Bearer <token>

指标

GET /v1/metrics

部署

Docker

docker build -t cinaconnect/keys-server:latest .
docker run -p 3001:3001 \
  -e DATABASE_URL=postgres://user:pass@localhost:5432/keys \
  -e MASTER_ENCRYPTION_KEY=<key> \
  cinaconnect/keys-server:latest

Kubernetes

helm install keys-server ./deploy/helm/cinaconnect \
  --set keysServer.replicaCount=2 \
  --set global.imageRegistry=ghcr.io/cinaconnect

安全

  • 所有密钥在存储前通过主密钥加密
  • 使用 HKDF 派生加密密钥
  • 内存中的密钥数据在使用后清零 (zeroize)
  • 数据库连接使用 TLS
  • API 通过 Bearer Token 认证
  • 审计日志记录所有密钥操作