MCPcopy Index your code
hub / github.com/dnote/dnote / GetRandomStr

Function GetRandomStr

pkg/server/crypt/crypt.go:38–45  ·  view source on GitHub ↗

GetRandomStr generates a cryptographically secure pseudorandom numbers of the given size in byte

(numBytes int)

Source from the content-addressed store, hash-verified

36// GetRandomStr generates a cryptographically secure pseudorandom numbers of the
37// given size in byte
38func GetRandomStr(numBytes int) (string, error) {
39 b, err := getRandomBytes(numBytes)
40 if err != nil {
41 return "", errors.Wrap(err, "generating random bits")
42 }
43
44 return base64.StdEncoding.EncodeToString(b), nil
45}

Callers 1

CreateSessionMethod · 0.92

Calls 1

getRandomBytesFunction · 0.85

Tested by

no test coverage detected