Add self-service photo and pronunciation upload with archiving and change log

This commit is contained in:
Ian Gulliver
2026-08-16 08:01:34 -07:00
parent 272ce380bb
commit 54a5b4615f
12 changed files with 645 additions and 34 deletions
+27
View File
@@ -0,0 +1,27 @@
// Command cookie prints a signed session cookie for local api testing.
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"flag"
"fmt"
"log"
"os"
"time"
)
func main() {
email := flag.String("email", "", "session email address")
flag.Parse()
key := os.Getenv("SESSION_KEY")
if key == "" || *email == "" {
log.Fatal("[ERROR] SESSION_KEY and -email are required")
}
payload := fmt.Sprintf("%s|%d", *email, time.Now().Add(24*time.Hour).Unix())
mac := hmac.New(sha256.New, []byte(key))
mac.Write([]byte(payload))
fmt.Println(base64.RawURLEncoding.EncodeToString([]byte(payload)) + "." +
base64.RawURLEncoding.EncodeToString(mac.Sum(nil)))
}