looksLikeJWT is a cheap pre-filter: a compact JWS is three base64url segments separated by dots and (for our RS256 tokens) starts with the "eyJ" header. Avoids running full verification on API keys / opaque OAuth tokens.
(s string)
| 189 | // separated by dots and (for our RS256 tokens) starts with the "eyJ" header. |
| 190 | // Avoids running full verification on API keys / opaque OAuth tokens. |
| 191 | func looksLikeJWT(s string) bool { |
| 192 | return strings.HasPrefix(s, "eyJ") && strings.Count(s, ".") == 2 |
| 193 | } |
no test coverage detected