Implement io.jwt.verify_eddsa builtin (closes #145) - #153
Conversation
Signed-off-by: Muhammad Umer Hammad <umerhammad010@gmail.com>
| type = "string", | ||
| name = "certificate", | ||
| description = | ||
| "PEM encoded certificate, PEM encoded public key, or the JWK key (set) used to verify the signature") |
There was a problem hiding this comment.
_verifyEdDSA reaches getPublicKey → extractPublicKey, which only handles RSAKey and ECKey. An Ed25519 JWK parses to an OctetKeyPair (kty: OKP), so it falls into the else branch and throws "Unsupported JWK key type" — meaning this returns false (or errors in strict mode) for a valid Ed25519 JWK, even though the arg doc here advertises "the JWK key (set)".
This diverges from OPA: its getKeysFromCertOrJWK (v1/topdown/tokens.go) parses JWKs via jwx's jwk.Export, which supports OKP keys, so OPA accepts an Ed25519 JWK for io.jwt.verify_eddsa. For parity, consider adding an OKP branch to extractPublicKey (convert OctetKeyPair → Ed25519 PublicKey) rather than only supporting the PEM path. The added test only covers the PEM cert fixture, so the JWK path is untested for EdDSA.
Signed-off-by: Muhammad Umer Hammad <umerhammad010@gmail.com>
Summary
Implements io.jwt.verify_eddsa as described in #145.
Changes
Testing
Closes #145.