MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / base64URLDecode

Function base64URLDecode

internal/auth/codex/jwt_parser.go:81–91  ·  view source on GitHub ↗

base64URLDecode decodes a Base64 URL-encoded string, adding padding if necessary. JWTs use a URL-safe Base64 alphabet and omit padding, so this function ensures correct decoding by re-adding the padding before decoding.

(data string)

Source from the content-addressed store, hash-verified

79// JWTs use a URL-safe Base64 alphabet and omit padding, so this function ensures
80// correct decoding by re-adding the padding before decoding.
81func base64URLDecode(data string) ([]byte, error) {
82 // Add padding if necessary
83 switch len(data) % 4 {
84 case 2:
85 data += "=="
86 case 3:
87 data += "="
88 }
89
90 return base64.URLEncoding.DecodeString(data)
91}
92
93// GetUserEmail extracts the user's email address from the JWT claims.
94func (c *JWTClaims) GetUserEmail() string {

Callers 1

ParseJWTTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected