Bundle
dsh-jwt
DSH plugin: decode and inspect JWT tokens (debug only, no signature verification).
- Source
- ZhijiangTang
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 2 days ago
Readme
# dsh-jwt
DeepSeek Harness(DSH)插件:JWT 解码查看工具。把 JWT 拆成 header / payload / 签名三段,base64url 解码 header 与 payload,并解读 `exp` / `iat` / `nbf` 时间声明(UTC 与本地时间、剩余/过期状态)。
## ⚠️ 不验签!不要据此做安全决策
`jwt_decode` **只解码、不验签**:它不校验签名是否有效、密钥是否匹配,也不校验 `iss` / `aud` 等声明。
> **请勿依据本工具的输出做任何安全决策**(身份认证、授权、信任来源等)。
> 需要可信的 JWT 校验时,请使用具备密钥校验能力的库,并完整验证签名、`iss` / `aud`、过期时间等全部声明。
## 安装
```sh
dsh plugin --profile <你的 profile> add file:./plugins/dsh-jwt
```
(发布到 npm 后可用 `dsh plugin --profile <profile> add dsh-jwt`)
## 使用
注册工具 `jwt_decode`,参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| `token` | string | 是 | 要解码的 JWT(`header.payload[.signature]`) |
## 输出字段
| 字段 | 类型 | 说明 |
|---|---|---|
| `ok` | boolean | 是否成功解析(header 与 payload 均为合法 JSON) |
| `parts` | integer | 按 `.` 切分得到的段数(2 或 3) |
| `header` | object / null | 解码后的 JOSE header |
| `payload` | object / null | 解码后的 payload(claims) |
| `signaturePresent` | boolean | 是否存在签名段(仅存在性,不校验) |
| `issuedAt` | object? | `iat` 声明:`{ value(秒), iso(UTC), local(本地) }` |
| `notBefore` | object? | `nbf` 声明:`{ value, iso, local, active }` |
| `expiresAt` | object? | `exp` 声明:`{ value, iso, local, expired, remainingSeconds }` |
| `expired` | boolean? | 是否已过期(依据 `exp`) |
| `remainingSeconds` | number? | 距过期的剩余秒数(已过期时为负) |
| `errors` | string[] | 解码/解析过程中的错误或提示(含失败阶段:header/payload 解码或 JSON 解析) |
时间声明支持秒与毫秒时间戳:数值 `> 1e12` 时自动按毫秒识别并换算。解析失败时工具**不抛异常**,返回 `ok: false` 及 `errors` 说明失败阶段。
## License
MIT
Install
dsh plugin --profile web add github:ZhijiangTang/dsh-jwt#1bfd7c75e2b7902533e370d6ff634b92d82988e7
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-jwt from the hub