d262f734f0
* mobile: wire notification registration and listener
* implement backend components for push notifications
* refactor: agentic comment cleanup
* docs: use proper module name for particle processor
* set required env variables for push notifications
* bump version
* fix: always upsert push token on mobile start
* Revert "fix: always upsert push token on mobile start"
This reverts commit 90ff18a788.
* send push notifications regardless of online status
31 lines
534 B
Go
31 lines
534 B
Go
package utils
|
|
|
|
import (
|
|
"math/rand"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
charset = "abcdefghijklmnopqrstuvwxyz0123456789"
|
|
charsetNumbers = "0123456789"
|
|
)
|
|
|
|
func RandomString(length int) string {
|
|
sb := strings.Builder{}
|
|
sb.Grow(length)
|
|
for i := 0; i < length; i++ {
|
|
sb.WriteByte(charset[rand.Intn(len(charset))])
|
|
}
|
|
return sb.String()
|
|
}
|
|
|
|
func RandomStringNumbers(length int) string {
|
|
sb := strings.Builder{}
|
|
sb.Grow(length)
|
|
for range length {
|
|
sb.WriteByte(charsetNumbers[rand.Intn(len(charsetNumbers))])
|
|
}
|
|
|
|
return sb.String()
|
|
}
|