8000 jwt/errors.go at v3.2.2 · golang-jwt/jwt · GitHub
[go: up one dir, main page]

Skip to content
< 4939 script type="application/json" data-target="react-app.embeddedData">{"payload":{"allShortcutsEnabled":false,"fileTree":{"":{"items":[{"name":".github","path":".github","contentType":"directory"},{"name":"cmd","path":"cmd","contentType":"directory"},{"name":"request","path":"request","contentType":"directory"},{"name":"test","path":"test","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"MIGRATION_GUIDE.md","path":"MIGRATION_GUIDE.md","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"},{"name":"VERSION_HISTORY.md","path":"VERSION_HISTORY.md","contentType":"file"},{"name":"claims.go","path":"claims.go","contentType":"file"},{"name":"doc.go","path":"doc.go","contentType":"file"},{"name":"ecdsa.go","path":"ecdsa.go","contentType":"file"},{"name":"ecdsa_test.go","path":"ecdsa_test.go","contentType":"file"},{"name":"ecdsa_utils.go","path":"ecdsa_utils.go","contentType":"file"},{"name":"ed25519.go","path":"ed25519.go","contentType":"file"},{"name":"ed25519_test.go","path":"ed25519_test.go","contentType":"file"},{"name":"ed25519_utils.go","path":"ed25519_utils.go","contentType":"file"},{"name":"errors.go","path":"errors.go","contentType":"file"},{"name":"example_test.go","path":"example_test.go","contentType":"file"},{"name":"hmac.go","path":"hmac.go","contentType":"file"},{"name":"hmac_example_test.go","path":"hmac_example_test.go","contentType":"file"},{"name":"hmac_test.go","path":"hmac_test.go","contentType":"file"},{"name":"http_example_test.go","path":"http_example_test.go","contentType":"file"},{"name":"map_claims.go","path":"map_claims.go","contentType":"file"},{"name":"map_claims_test.go","path":"map_claims_test.go","contentType":"file"},{"name":"none.go","path":"none.go","contentType":"file"},{"name":"none_test.go","path":"none_test.go","contentType":"file"},{"name":"parser.go","path":"parser.go","contentType":"file"},{"name":"parser_test.go","path":"parser_test.go","contentType":"file"},{"name":"rsa.go","path":"rsa.go","contentType":"file"},{"name":"rsa_pss.go","path":"rsa_pss.go","contentType":"file"},{"name":"rsa_pss_test.go","path":"rsa_pss_test.go","contentType":"file"},{"name":"rsa_test.go","path":"rsa_test.go","contentType":"file"},{"name":"rsa_utils.go","path":"rsa_utils.go","contentType":"file"},{"name":"signing_method.go","path":"signing_method.go","contentType":"file"},{"name":"token.go","path":"token.go","contentType":"file"}],"totalCount":36}},"fileTreeProcessingTime":10.439537,"foldersToFetch":[],"incompleteFileTree":false,"repo":{"id":368683828,"defaultBranch":"main","name":"jwt","ownerLogin":"golang-jwt","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2021-05-18T22:42:37.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/84194169?v=4","public":true,"private":false,"isOrgOwned":true},"codeLineWrapEnabled":false,"symbolsExpanded":false,"treeExpanded":true,"refInfo":{"name":"v3.2.2","listCacheKey":"v0:1752625463.0","canEdit":false,"refType":"tag","currentOid":"4bbdd8ac624fc7a9ef7aec841c43d99b5fe65a29"},"path":"errors.go","currentUser":null,"blob":{"rawLines":["package jwt","","import (","\t\"errors\"",")","","// Error constants","var (","\tErrInvalidKey = errors.New(\"key is invalid\")","\tErrInvalidKeyType = errors.New(\"key is of invalid type\")","\tErrHashUnavailable = errors.New(\"the requested hash function is unavailable\")",")","","// The errors that might occur when parsing and validating a token","const (","\tValidationErrorMalformed uint32 = 1 \u003c\u003c iota // Token is malformed","\tValidationErrorUnverifiable // Token could not be verified because of signing problems","\tValidationErrorSignatureInvalid // Signature validation failed","","\t// Standard Claim validation errors","\tValidationErrorAudience // AUD validation failed","\tValidationErrorExpired // EXP validation failed","\tValidationErrorIssuedAt // IAT validation failed","\tValidationErrorIssuer // ISS validation failed","\tValidationErrorNotValidYet // NBF validation failed","\tValidationErrorId // JTI validation failed","\tValidationErrorClaimsInvalid // Generic claims validation error",")","","// Helper for constructing a ValidationError with a string error message","func NewValidationError(errorText string, errorFlags uint32) *ValidationError {","\treturn \u0026ValidationError{","\t\ttext: errorText,","\t\tErrors: errorFlags,","\t}","}","","// The error from Parse if token is not valid","type ValidationError struct {","\tInner error // stores the error returned by external dependencies, i.e.: KeyFunc","\tErrors uint32 // bitfield. see ValidationError... constants","\ttext string // errors that do not have a valid error just have text","}","","// Validation error is an error type","func (e ValidationError) Error() string {","\tif e.Inner != nil {","\t\treturn e.Inner.Error()","\t} else if e.text != \"\" {","\t\treturn e.text","\t} else {","\t\treturn \"token is invalid\"","\t}","}","","// No errors","func (e *ValidationError) valid() bool {","\treturn e.Errors == 0","}"],"stylingDirectives":null,"colorizedLines":null,"csv":null,"csvError":null,"dependabotInfo":{"showConfigurationBanner":false,"configFilePath":null,"networkDependabotPath":"/golang-jwt/jwt/network/updates","dismissConfigurationNoticePath":"/settings/dismiss-notice/dependabot_configuration_notice","configurationNoticeDismissed":null},"displayName":"errors.go","displayUrl":"https://github.com/golang-jwt/jwt/blob/v3.2.2/errors.go?raw=true","headerInfo":{"blobSize":"1.8 KB","deleteTooltip":"You must be signed in to make or propose changes","editTooltip":"You must be signed in to make or propose changes","ghDesktopPath":null,"isGitLfs":false,"onBranch":false,"shortPath":"1c93024","siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Fgolang-jwt%2Fjwt%2Fblob%2Fv3.2.2%2Ferrors.go","isCSV":false,"isRichtext":false,"toc":null,"lineInfo":{"truncatedLoc":"59","truncatedSloc":"51"},"mode":"file"},"image":false,"isCodeownersFile":null,"isPlain":false,"isValidLegacyIssueTemplate":false,"issueTemplate":null,"discussionTemplate":null,"language":"Go","languageID":132,"large":false,"planSupportInfo":{"repoIsFork":null,"repoOwnedByCurrentUser":null,"requestFullPath":"/golang-jwt/jwt/blob/v3.2.2/errors.go","showFreeOrgGatedFeatureMessage":null,"showPlanSupportBanner":null,"upgradeDataAttributes":null,"upgradePath":null},"publishBannersInfo":{"dismissActionNoticePath":"/settings/dismiss-notice/publish_action_from_dockerfile","releasePath":"/golang-jwt/jwt/releases/new?marketplace=true","showPublishActionBanner":false},"rawBlobUrl":"https://github.com/golang-jwt/jwt/raw/refs/tags/v3.2.2/errors.go","renderImageOrRaw":false,"richText":null,"renderedFileInfo":null,"shortPath":null,"symbolsEnabled":true,"tabSize":8,"topBannersInfo":{"overridingGlobalFundingFile":false,"globalPreferredFundingPath":null,"showInvalidCitationWarning":false,"citationHelpUrl":"https://docs.github.com/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files","actionsOnboardingTip":null},"truncated":false,"viewable":true,"workflowRedirectUrl":null,"symbols":null},"copilotInfo":null,"copilotAccessAllowed":false,"modelsAccessAllowed":false,"modelsRepoIntegrationEnabled":false,"isMarketplaceEnabled":true,"csrf_tokens":{"/golang-jwt/jwt/branches":{"post":"q0ascXCJS896jO0suCmWIyjBhWbV6WeEj4ccN3QNHfUHgwGRFyRInZzodgK_vBG_BOvibNdnZxc_pQDcqP05jw"},"/repos/preferences":{"post":"wLeTuXHHavPZB1sY-rv-EJJajBYaYhKNIgyMR1-9qQjFiay3_YM50T074TgweuRTwYY33xeFyYOM8o7_1QxH9A"}}},"title":"jwt/errors.go at v3.2.2 · golang-jwt/jwt","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-263cab1760dd.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-d30550df4878.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true}}}
0