Documentation
¶
Index ¶
- Constants
- func FirstNonEmpty(vals ...string) string
- func Get(key, def string) string
- func MustRandom(n int) string
- func ParseECKey(pemBytes []byte) (*ecdsa.PrivateKey, error)
- func RandomStringURLSafe(n int) (string, error)
- func WriteError(w http.ResponseWriter, status int, msg string, err error)
- func WriteJSON(w http.ResponseWriter, status int, v any)
- type ApiError
- type PKCE
Constants ¶
View Source
const (
ContentTypeJSON = "application/json; charset=utf-8"
)
Variables ¶
This section is empty.
Functions ¶
func FirstNonEmpty ¶
FirstNonEmpty returns the first non-empty string from the provided values.
func MustRandom ¶
MustRandom panics on error; for places where we already handle outer errors.
func ParseECKey ¶
func ParseECKey(pemBytes []byte) (*ecdsa.PrivateKey, error)
ParseECKey parses PKCS8 or EC private key from PEM bytes.
func RandomStringURLSafe ¶
RandomStringURLSafe returns a URL-safe base64 string (no padding).
func WriteError ¶
func WriteError(w http.ResponseWriter, status int, msg string, err error)
WriteError writes an error response as JSON.
Types ¶
type PKCE ¶
type PKCE struct {
// Verifier is a random string used to prove the client is the same that requested the authorization code.
Verifier string
// Challenge is the code challenge.
Challenge string
// Method is the code challenge method.
Method string // S256
}
PKCE is a Proof Key for Code Exchange (RFC 7636)
Click to show internal directories.
Click to hide internal directories.