MCPcopy
hub / github.com/filebrowser/filebrowser / RandomPwd

Function RandomPwd

users/password.go:37–47  ·  view source on GitHub ↗
(passwordLength uint)

Source from the content-addressed store, hash-verified

35}
36
37func RandomPwd(passwordLength uint) (string, error) {
38 randomPasswordBytes := make([]byte, passwordLength)
39 var _, err = rand.Read(randomPasswordBytes)
40 if err != nil {
41 return "", err
42 }
43
44 // This is done purely to make the password human-readable
45 var randomPasswordString = base64.URLEncoding.EncodeToString(randomPasswordBytes)
46 return randomPasswordString, nil
47}

Callers 2

createUserMethod · 0.92
quickSetupFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected