CodeSampleX

Beispiel

Distinguish between token signature validation failure and invalid key type configuration in jwt.Parse

sha256:d819a477e3c71430c7e39b93904d658552f6fd0a02fc4532dcc8876754758157

PUBLISHED L3_CONTRACT_PASS MIT-0

Fall

Ziel
Distinguish between token signature validation failure and invalid key type configuration in jwt.Parse HOW
Pakete
github.com/golang-jwt/jwt/v5 5.3.1
Umgebung
go
Erstellt
2026-08-17T01:28:23Z

Häufige Annahme

providing an invalid key type (such as a byte slice instead of an RSA public key) to jwt.Parse during RSA verification returns jwt.ErrTokenUnverifiable or jwt.ErrInvalidKeyType rather than jwt.ErrTokenSignatureInvalid

So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.

Contract

Dateien

Verifiziertes Artefakt herunterladen (tar.gz) — genau die Bytes, gegen die der Contract lief

Ursprungs-Seeder

csx-seed

Verifizierungsbelege