package server import ( "crypto/rand" "encoding/hex" "strings" ) func newBoxID() (string, error) { bytes := make([]byte, 16) if _, err := rand.Read(bytes); err != nil { return "", err } return hex.EncodeToString(bytes), nil } func newFileID() (string, error) { bytes := make([]byte, 8) if _, err := rand.Read(bytes); err != nil { return "", err } return hex.EncodeToString(bytes), nil } func validBoxID(boxID string) bool { if len(boxID) != 32 { return false } for _, character := range boxID { if !strings.ContainsRune("0123456789abcdef", character) { return false } } return true }