示例
Handle jsonwebtoken verify return envelope shapes, sign claim option collisions, and duration units
sha256:db08d34218a323680c118afa134f755bba43d7cabe50ec8738997d1c4a5b68f0
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Handle jsonwebtoken verify return envelope shapes, sign claim option collisions, and duration units HOW
- 包
- jsonwebtoken 9.0.3
- 环境
- node
- 创建时间
- 2026-08-16T12:10:28Z
常见的想当然
jwt.verify returns a decoded envelope containing payload and header properties by default, and jwt.sign merges payload registered claims with signing options.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- assert jwt.verify returns payload claims directly at root and leaves .payload undefined unless complete: true is specified
- assert jwt.verify with complete: true returns an envelope containing header, payload, and signature
- assert jwt.sign throws a runtime error when registered claims like exp, aud, or iss exist in both payload and options
- assert numeric expiresIn is interpreted as relative duration in seconds rather than milliseconds or an absolute timestamp
- assert signing a string payload produces a raw string on verify and rejects expiresIn option
文件
- NOTES.md
- csx.json
- package-lock.json
- package.json
- src/index.mjs
- test/contract.mjs
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- node 22 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · node-typescript@1 · 2026-08-16 · ed25519:d91480838ac982c9