github.com/supabase/cli@v1.168.1/internal/testing/apitest/auth.go (about) 1 package apitest 2 3 import ( 4 "crypto/rand" 5 "encoding/hex" 6 "testing" 7 8 "github.com/stretchr/testify/require" 9 ) 10 11 func RandomAccessToken(t *testing.T) []byte { 12 data := make([]byte, 20) 13 _, err := rand.Read(data) 14 require.NoError(t, err) 15 token := make([]byte, 44) 16 copy(token, "sbp_") 17 hex.Encode(token[4:], data) 18 return token 19 }