MCPcopy Create free account
hub / github.com/Preloading/TwitterAPIBridge / Base64URLEncode

Function Base64URLEncode

cryption/authcrypt.go:117–125  ·  view source on GitHub ↗

Base64URLEncode encodes the given string using base64 and returns the result as a URL-safe string

(input string)

Source from the content-addressed store, hash-verified

115
116// Base64URLEncode encodes the given string using base64 and returns the result as a URL-safe string
117func Base64URLEncode(input string) string {
118 base64 := base64.StdEncoding.EncodeToString([]byte(input))
119
120 base64 = strings.ReplaceAll(base64, "+", "-")
121 base64 = strings.ReplaceAll(base64, "/", "_")
122 base64 = strings.ReplaceAll(base64, "=", "") // remove padding
123
124 return base64
125}
126
127// Base64URLDecode decodes the given URL-safe string using base64 and returns the result as a string
128func Base64URLDecode(input string) (string, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected