@fonoster/identity

中文文档
0.61.0发布于 2026/11/15MITTypeScriptCommonJS构建来源已验证近 30 天下载 8157

Identity service for Fonoster

原始使用文档
文档目录4 节
  1. About Identity
  2. Key Features
  3. Running standalone
  4. Specification

Discord GitHub Twitter Follow

This document is a high-level overview of the Identity module, helpful for maintainers, contributors, and developers who want to understand its architecture and design or contribute to it.

This module is part of the Fonoster project. It does not do much by itself. It is intended to be combined with other modules to create a complete solution. For more information about the project, please visit https://github.com/fonoster/fonoster.

About Identity

The Fonoster Identity Module provides the cornerstone for secure user management, authentication, and authorization within the Fonoster Ecosystem. It is designed with flexibility and scalability to accommodate the diverse and evolving needs of the various Fonoster projects.

Key Features

This module offers comprehensive identity management functionality, including creating, reading, updating, and deleting user and workspace entities. Users may represent individual accounts or service accounts. Workspaces organize users and streamline permission administration; a user can belong to multiple workspaces.

  • Authentication via JSON Web Tokens (JWTs) — username/password, Multi-Factor Authentication (MFA), OAuth2, and token exchange.
  • Authorization via Role-Based Access Control (RBAC) with predefined and custom roles.
  • Resource ownership keyed by accessKeyId (US… for users, WO… for workspaces).

Running standalone

fonoster-identity (or the fonoster/identity image) serves Identity without the telephony stack. It reads identity.json (or .jsonc/.yaml), found via --config <path>, /opt/fonoster/identity.json or ./config/identity.json, and reads no environment variables. Fields sit at the root of the file:

{
  "database": { "url": "postgresql://postgres:postgres@postgres:5432/fnidentity" },
  "encryptionKey": "change-me",
  "issuer": "https://id.acme.com",
  "keys": {
    "privateKeyPath": "/opt/fonoster/keys/private.pem",
    "publicKeyPath": "/opt/fonoster/keys/public.pem"
  },
  "smtp": { "host": "smtp.acme.com", "port": 587, "sender": "[email protected]", "auth": { "user": "ops", "pass": "secret" } },
  "auth": { "methods": ["password"], "signup": "invite" },
  "defaultUser": { "name": "Admin", "email": "[email protected]", "password": "changeme" }
}

npm run db:deploy -- --config <path> applies the migrations using the same file. Every key is described in docs/configuration.md.

Specification

The normative specification for this module — entities and resource ownership, the RBAC model, the id/access/refresh token model, token exchanges, RS256 verification via GetPublicKey, and security practices — lives in OpenSpec and is the source of truth:

➡️ openspec/specs/identity/spec.md

Proposed changes to this capability live under openspec/changes/.

版本与发布记录

@fonoster/identity 共发布 229 个版本,首次发布于 2024/07/23;过去 12 个月发布了 65 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.61.0latest2026/11/15今天
0.60.02026/11/151 天前
0.59.02026/11/141 天前
0.58.02026/11/141 天前
0.57.02026/11/114 天前
0.56.02026/11/114 天前

其他发布通道:next → 0.9.51。

关于 @fonoster/identity 的常见问题

@fonoster/identity 是什么?

Identity service for Fonoster

如何安装 @fonoster/identity?

在项目目录运行 npm install @fonoster/identity,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 fonoster、fonoster-identity,可以用 npx fonoster 直接运行。

@fonoster/identity 支持 TypeScript 吗?

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

@fonoster/identity 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@fonoster/identity 可以商用吗?

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

@fonoster/identity 的下载量有多少?

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

@fonoster/identity 还在维护吗?

最新版本 0.61.0 发布于 2026/11/15(今天);至今共发布 229 个版本,其中过去 12 个月发布了 65 个;首次发布于 2024/07/23。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。