@canton-network/core-wallet-auth

中文文档
2.3.0发布于 2026/11/06Apache-2.0TypeScriptESM + CJS近 30 天下载 35.6万

Provides authentication middleware and user management for the Wallet Gateway

原始使用文档
文档目录6 节
  1. Installation
  2. Interfaces
  3. AuthContext
  4. AuthAware
  5. AuthService
  6. JWT Implementation

Wallet Auth

This workspace contains the authentication logic and interfaces used by the Wallet Gateway. It provides abstractions for authentication services, user identity management, and integration points for different identity providers (IDPs), such as password-based and OAuth2/OIDC-based authentication.

Installation

This package requires NodeJS v16 or higher and can be added to your project using:

npm install @canton-network/core-wallet-auth --save

or

pnpm add @canton-network/core-wallet-auth

Interfaces

This workspace defines several core interfaces for authentication.

AuthContext

Represents the authentication context for a user, including their unique user ID and the associated access token.

AuthAware

Provides a pattern for classes or services that are aware of authentication context. It exposes the current authContext and a method withAuthContext to create a new instance with a specific authentication context. An example the application of this pattern can be seen in the StoreInternal.

AuthService

Defines the contract for authentication services. The verifyToken method takes an access token and returns an AuthContext if the token is valid, or undefined otherwise.

JWT Implementation

For JWT-based authentication, see the JwtAuthService implementation. This service verifies JWT tokens using remote JWK sets and integrates with the Wallet Gateway's network configuration to dynamically resolve the appropriate identity provider for each request.

It is important to note that, since the Wallet Gateway supports multiple identity providers (IDPs), the token issuer (iss) is used as the unique identifier for each IDP. This component therefore collaborates with the Store, which enables lookup of the configured IDP based on the issuer value.

版本与发布记录

@canton-network/core-wallet-auth 共发布 75 个版本,首次发布于 2025/08/29;过去 12 个月发布了 60 个版本。

版本发布日期距今
2.3.0latest2026/11/063 天前
2.2.02026/10/2910 天前
1.12.1-backport.3bugfix2026/10/2613 天前
2.1.02026/10/2317 天前
2.0.02026/10/1624 天前
1.14.02026/10/1227 天前

关于 @canton-network/core-wallet-auth 的常见问题

@canton-network/core-wallet-auth 是什么?

Provides authentication middleware and user management for the Wallet Gateway

如何安装 @canton-network/core-wallet-auth?

在项目目录运行 npm install @canton-network/core-wallet-auth,或使用 pnpm add / yarn add / bun add。

@canton-network/core-wallet-auth 支持 TypeScript 吗?

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

@canton-network/core-wallet-auth 支持 ESM 还是 CommonJS?

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

@canton-network/core-wallet-auth 可以商用吗?

@canton-network/core-wallet-auth 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@canton-network/core-wallet-auth 的下载量有多少?

根据 npm 官方下载统计,@canton-network/core-wallet-auth 在 2026/10/09 – 2026/11/07 这 30 天内被下载 356,062 次,日均约 11,869 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@canton-network/core-wallet-auth 还在维护吗?

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