Base64URLEncode encodes the given string using base64 and returns the result as a URL-safe string
(input string)
| 115 | |
| 116 | // Base64URLEncode encodes the given string using base64 and returns the result as a URL-safe string |
| 117 | func 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 |
| 128 | func Base64URLDecode(input string) (string, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected