MCPcopy Index your code
hub / github.com/screego/server / read

Function read

auth/auth.go:27–46  ·  view source on GitHub ↗
(r io.Reader)

Source from the content-addressed store, hash-verified

25}
26
27func read(r io.Reader) ([]UserPW, error) {
28 reader := csv.NewReader(r)
29 reader.Comma = ':'
30 reader.Comment = '#'
31 reader.TrimLeadingSpace = true
32
33 records, err := reader.ReadAll()
34 if err != nil {
35 return nil, err
36 }
37
38 result := []UserPW{}
39 for _, record := range records {
40 if len(record) != 2 {
41 return nil, errors.New("malformed users file")
42 }
43 result = append(result, UserPW{Name: record[0], Pass: record[1]})
44 }
45 return result, nil
46}
47
48func ReadPasswordsFile(path string, secret []byte, sessionTimeout int) (*Users, error) {
49 users := &Users{

Callers 1

ReadPasswordsFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected