MCPcopy Create free account
hub / github.com/rilldata/rill / NewRandom

Function NewRandom

admin/pkg/authtoken/authtoken.go:50–61  ·  view source on GitHub ↗

NewRandom generates a securely random token.

(t Type)

Source from the content-addressed store, hash-verified

48
49// NewRandom generates a securely random token.
50func NewRandom(t Type) *Token {
51 tkn := Token{
52 Type: t,
53 ID: uuid.New(),
54 }
55
56 if _, err := rand.Read(tkn.Secret[:]); err != nil {
57 panic(err)
58 }
59
60 return &tkn
61}
62
63// FromString re-creates a token from it's string representation (acquired by calling String()).
64// The things I do for pretty tokens.

Callers 8

IssueUserAuthTokenMethod · 0.92
IssueServiceAuthTokenMethod · 0.92
IssueMagicAuthTokenMethod · 0.92
TestReciprocityFunction · 0.70
TestManyFunction · 0.70
TestPrefixFunction · 0.70
TestMatchByPrefixFunction · 0.70

Calls

no outgoing calls

Tested by 4

TestReciprocityFunction · 0.56
TestManyFunction · 0.56
TestPrefixFunction · 0.56
TestMatchByPrefixFunction · 0.56