MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / GenerateRandomSecret

Function GenerateRandomSecret

base/util.go:119–125  ·  view source on GitHub ↗

GenerateRandomSecret returns a cryptographically-secure 160-bit random number encoded as a hex string.

()

Source from the content-addressed store, hash-verified

117
118// GenerateRandomSecret returns a cryptographically-secure 160-bit random number encoded as a hex string.
119func GenerateRandomSecret() (string, error) {
120 val, err := randCryptoHex(160)
121 if err != nil {
122 return "", fmt.Errorf("RNG failed, can't create password: %w", err)
123 }
124 return val, nil
125}
126
127// GenerateRandomID returns a cryptographically-secure 128-bit random number encoded as a hex string.
128func GenerateRandomID() (string, error) {

Callers 11

RegisterNewUserMethod · 0.92
TestDeleteSessionFunction · 0.92
TestMakeSessionCookieFunction · 0.92
CreateSessionMethod · 0.92
handleOIDCCommonMethod · 0.92
TestSessionFailFunction · 0.92
TestSessionExtensionFunction · 0.92
createNewTokenMethod · 0.92
authHandlerMethod · 0.92

Calls 2

randCryptoHexFunction · 0.85
ErrorfMethod · 0.80

Tested by 7

TestDeleteSessionFunction · 0.74
TestMakeSessionCookieFunction · 0.74
TestSessionFailFunction · 0.74
TestSessionExtensionFunction · 0.74
authHandlerMethod · 0.74