Split config handling and OIDC into separate files
[fbfp.git] / misc.go
blobd36fa859f099a4fb4940704dc32b07bab81558a5
1 package main
3 import (
4 "crypto/rand"
5 "encoding/base64"
6 "log"
9 func e(e error) {
10 if e != nil {
11 log.Fatal(e)
15 // Generate a random url-safe string.
16 // Note that the "len" parameter specifies the number of bytes taken from the
17 // random source divided by three and does NOT represent the length of the
18 // encoded string.
19 func random(len int) string {
20 r := make([]byte, 3*len)
21 rand.Read(r)
22 return base64.RawURLEncoding.EncodeToString(r)