ulid/examples/secure/main.go

24 lines
483 B
Go

package main
import (
"crypto/rand"
"fmt"
"time"
"git.wisellama.rocks/Wisellama/ulid"
)
func main() {
t := time.Now()
// This example uses the crypto/rand entropy. This is thread safe
// and intended to be used for secure features. If you are using
// ULIDs for anything related to security/authentication, then use
// this entropy source.
u, err := ulid.NewULIDString(t, rand.Reader)
if err != nil {
fmt.Printf("error: %v\n", err)
}
fmt.Printf("ULID: %s\n", u)
}