/* * Copyright (C) 2024 Jonni Liljamo * * This file is licensed under AGPL-3.0-or-later, see NOTICE and LICENSE for * more information. */ package util import "math/rand" const charsAPIKey = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" // GenAPIKey returns a 48 char string. func GenAPIKey() string { // NOTE: "Good enough" b := make([]byte, 48) for i := range b { b[i] = charsAPIKey[rand.Int63()%int64(len(charsAPIKey))] } return string(b) }