@getanthill/sec

中文文档
0.7.0发布于 2024/01/16MITTypeScriptESM + CJS近 30 天下载 2248

Anthill project security package

原始使用文档

getanthill Security Layer

pipeline Quality Gate Status

Coverage Vulnerabilities Security Rating

Getting Started

First, you need install the package:

npm install -S @getanthill/sec

Then, your client can follow the steps to register or signin a user to your app, then activate MFA validation.

// 1. Signin part:
const tokens = auth.getTokens(email, password);

// 2. MFA Setup part: (only on registration)
// Master key generation #keep-it-secret-keep-it-safe
const masterKey = otp.generateMasterKey();
// Secret key generation from Master key
const secretKey = otp.generateSecretFromMaster(masterKey);

// Validate MFA:
const isValid = otp.verify('123456', secretKey);

// Create the store:
const store = new Store(tokens.encryption, secretKey);

// Manage your data as always:
store.data = { hello: 'world' }; // Always encrypted data

Roadmap

版本与发布记录

@getanthill/sec 共发布 10 个版本,首次发布于 2020/11/03;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.7.0latest2024/01/162 年前
0.6.02024/01/122 年前
0.5.02022/11/223 年前
0.4.02022/05/224 年前
0.3.42022/05/174 年前
0.3.32022/01/314 年前

关于 @getanthill/sec 的常见问题

@getanthill/sec 是什么?

Anthill project security package

如何安装 @getanthill/sec?

在项目目录运行 npm install @getanthill/sec,或使用 pnpm add / yarn add / bun add。

@getanthill/sec 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@getanthill/sec 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@getanthill/sec 可以商用吗?

@getanthill/sec 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@getanthill/sec 的下载量有多少?

根据 npm 官方下载统计,@getanthill/sec 在 2026/10/17 – 2026/11/15 这 30 天内被下载 2,248 次,日均约 75 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@getanthill/sec 还在维护吗?

最新版本 0.7.0 发布于 2024/01/16(2 年前);至今共发布 10 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/11/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。