Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ members = [
"crates/perry-ext-uuid",
"crates/perry-ext-bcrypt",
"crates/perry-ext-argon2",
"crates/perry-ext-jsonwebtoken",
"crates/perry-ext-validator",
"crates/perry-validation",
"crates/perry-perex",
Expand Down Expand Up @@ -482,7 +481,6 @@ perry-ext-nanoid = { path = "crates/perry-ext-nanoid" }
perry-ext-uuid = { path = "crates/perry-ext-uuid" }
perry-ext-bcrypt = { path = "crates/perry-ext-bcrypt" }
perry-ext-argon2 = { path = "crates/perry-ext-argon2" }
perry-ext-jsonwebtoken = { path = "crates/perry-ext-jsonwebtoken" }
perry-ext-validator = { path = "crates/perry-ext-validator" }
perry-validation = { path = "crates/perry-validation" }
perry-perex = { path = "crates/perry-perex" }
Expand Down
17 changes: 17 additions & 0 deletions changelog.d/10687-jsonwebtoken-native-binding-removal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Removed the native `jsonwebtoken` binding (#10683): `verify()` returned
`null` instead of throwing on every forgery case (tampered payload, wrong
secret, `alg:none`, garbage token, tampered signature, expired token), and
`sign(..., { expiresIn: "1h" })` silently dropped the expiry. `import jwt
from "jsonwebtoken"` (no `perry.compilePackages` entry) now compiles the
real npm package from source, matching Node exactly including all six
thrown error names/messages.

Deleted both duplicate hand-written implementations (`crates/perry-ext-jsonwebtoken`
and `crates/perry-stdlib/src/jsonwebtoken.rs`, which independently exported
the same `js_jwt_*` symbols — #10678) plus the dedicated codegen lowering
path in `crates/perry-codegen/src/lower_call/native/jsonwebtoken.rs` that
bypassed the well-known-binding registry entirely. Re-wired `dep:rsa`/
`dep:spki` directly onto perry-stdlib's `crypto` feature, since WebCrypto's
`key_object.rs`/`keys.rs` need them unconditionally and were only reachable
through the now-deleted `bundled-jsonwebtoken` feature by historical
accident.
1 change: 0 additions & 1 deletion crates/perry-api-manifest/src/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ pub const NATIVE_MODULES: &[&str] = &[
"crypto", // (Node builtin) hashing, HMAC, cipher, sign/verify, WebCrypto
"dotenv", // .env file loader
"dotenv/config", // dotenv's auto-load-on-import subpath
"jsonwebtoken", // JWT sign/verify
"nanoid", // compact URL-safe ID generation
"validator", // string validators/sanitizers
"ethers", // Ethereum library (utils/wallet/ABI)
Expand Down
65 changes: 0 additions & 65 deletions crates/perry-api-manifest/src/entries/part_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,71 +1166,6 @@ pub(crate) const API_MANIFEST_PART_1: &[ApiEntry] = &[
}],
TypeSpec::Number,
),
method_sig(
"jsonwebtoken",
"sign",
false,
None,
&[
ParamSpec::Named {
name: "payload",
ty: TypeSpec::Any,
optional: false,
},
ParamSpec::Named {
name: "secret",
ty: TypeSpec::String,
optional: false,
},
ParamSpec::Named {
name: "options",
ty: TypeSpec::Any,
optional: true,
},
// #915: FFI's 4th arg is `kid_ptr: *const StringHeader` — the
// dispatch table padding zeroes it when the user doesn't pass
// it. Surfacing the slot in the manifest keeps the
// #512 arity-drift assertion happy without forcing every
// caller to write a 4th positional arg.
ParamSpec::Named {
name: "kid",
ty: TypeSpec::String,
optional: true,
},
],
TypeSpec::String,
),
method_sig(
"jsonwebtoken",
"verify",
false,
None,
&[
ParamSpec::Named {
name: "token",
ty: TypeSpec::String,
optional: false,
},
ParamSpec::Named {
name: "secret",
ty: TypeSpec::String,
optional: false,
},
],
TypeSpec::Any,
),
method_sig(
"jsonwebtoken",
"decode",
false,
None,
&[ParamSpec::Named {
name: "token",
ty: TypeSpec::String,
optional: false,
}],
TypeSpec::Any,
),
method_sig(
"nodemailer",
"createTransport",
Expand Down
Loading
Loading