十六个 SDK,一个统一规范界面

相同的 SIEM 事件。相同的解析器上限。相同的 IETF 测试向量。相同的环境变量。任选语言;契约一致。

克隆仓库

在 GitLab 浏览
git clone https://gitlab.com/toontoolbox/toonwebtoken.git

后端 SDK(14)

Rust

稳定
implementations/rust/

参考 Rust crate `toonwebtoken` 1.5.0 — MIT/Apache-2.0 双授权。Criterion 基准低于 30 ms。通过 oqs 0.11 实现真实 ML-DSA-65。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/rust
cargo build
Tests
110
Bench
9 (6 解析器 + 3 PQC)

Python

稳定
implementations/python/

参考 SDK,322 项测试。模块涵盖加固 (TWT-A)、配置完整性 (TWT-C)、AuditTrail (TWT-D4)。通过 liboqs 实现真实 ML-DSA-65。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/python
pip install -r requirements.txt
Tests
322
Bench
9 (6 解析器 + 3 PQC)

TypeScript / Node.js

稳定
implementations/javascript/

190 项测试。通过 @noble/post-quantum 实现真实 ML-DSA-65。Jest 测试运行器,perf_hooks 基准框架。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/javascript
npm install
Tests
190
Bench
9 (6 解析器 + 3 PQC)

Go

稳定
implementations/go/

`twt` 包 + 子包 `twt/config`。138 项测试,`-race` 干净。通过 cloudflare/circl 1.6.3 (纯 Go) 实现真实 ML-DSA-65。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/go
go mod download
Tests
138
Bench
9 (6 解析器 + 3 PQC)

Java

稳定
implementations/java/

Maven 项目,JDK 17+。179 项测试。通过 BouncyCastle 1.79 实现真实 ML-DSA-65。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/java
mvn install
Tests
179
Bench
9 (6 解析器 + 3 PQC)

C# / .NET 8

稳定
implementations/csharp/

185 项测试 (166 主 + 22 TwtConfig)。通过 BouncyCastle.NET 2.6.2 实现真实 ML-DSA-65。xUnit 套件。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/csharp
dotnet restore
Tests
185
Bench
9 (6 解析器 + 3 PQC)

C++

稳定
implementations/cpp/

CMake 项目。通过 liboqs 0.15 (C API + RAII) 实现真实 ML-DSA-65。13 个 ctest 套件,基准框架。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/cpp
mkdir build && cd build && cmake .. && make
Tests
13 suites
Bench
7 (4 HS256 + 3 PQC)

Swift

稳定
implementations/swift/

Swift Package Manager 项目。150 项测试。通过 liboqs 0.15 SPM C-shim 实现真实 ML-DSA-65。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/swift
swift build
Tests
150
Bench
7

C

稳定
implementations/c/

Makefile 构建,生成 libtwt.a。约 90 项测试。通过 liboqs 0.15 C API 实现真实 ML-DSA-65。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/c
make
Tests
52
Bench

VB.NET

稳定
implementations/vbnet/

156 项测试。通过 BouncyCastle.NET 2.6.2 实现真实 ML-DSA-65。与 C# SDK 共享 .NET 8 工具链。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/vbnet
dotnet restore
Tests
156
Bench
7 (4 HS256 + 3 PQC)

PHP

稳定
implementations/php/

157 项测试。通过 PHP-FFI 调用 liboqs 0.15 实现真实 ML-DSA-65。Docker CI (php:8.3-cli)。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/php
composer install
Tests
157
Bench
7

Perl

稳定
implementations/perl/

152 项测试。通过 FFI::Platypus 2.0 调用 liboqs 0.15 实现真实 ML-DSA-65。Docker CI。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/perl
cpanm --installdeps .
Tests
152
Bench
7

Fortran

稳定
implementations/fortran/

13 个 ctest 套件。通过 iso_c_binding 调用 liboqs 0.15 实现真实 ML-DSA-65。CMake 构建,Docker CI。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/fortran
mkdir build && cd build && cmake .. && make
Tests
13 suites
Bench
7

Delphi

Beta
implementations/delphi/

静态审查已验证。DUnitX 测试框架。仅限 Windows (RAD Studio)。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/delphi
Tests
静态审查
Bench

前端 SDK (2/2)

React

Beta
implementations/react/

Hooks (`useTWT`、`useAuth`)、`TWTProvider`、`ProtectedRoute`,带自动刷新的 localStorage 持久化。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/react
npm install

Vue 3

Beta
implementations/vue/

Composables (`useTWT`、`useAuth`)、`createTWTPlugin`、导航守卫,带自动刷新的响应式状态。

git clone https://gitlab.com/toontoolbox/toonwebtoken.git
cd toonwebtoken/implementations/vue
npm install

跨 SDK 契约

  • 16 个 SDK 间相同的规范界面 (参见 SDK_REFERENCE.md)。
  • 相同的 SIEM 事件:TWT_HONEYPOT_HIT、TWT_TOKEN_ISSUED、TWT_TOKEN_REVOKED、TWT_CONFIG_CHANGED、CONFIG_YAML_DEPRECATED、TWT_BREACH_DETECTED。
  • 相同的环境变量:TWT_CONFIG_HMAC_KEY、TWT_CONFIG_HMAC、TWT_CONFIG_PATH。
  • 相同的解析器上限:深度 10、共 1 MiB、每个对象 100 个键、键 256 字节、数组 10 000 个元素、每个字符串 64 KiB。
  • 相同的 IETF 测试向量:由 Rust crate 生成,任一兼容 SDK 逐字节重新验证。
  • 全部 16 个 SDK 均为 MIT/Apache-2.0 双授权。