2024-01-12 14:27:55 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
)
|
|
|
|
|
2024-01-13 09:22:40 +03:00
|
|
|
type Credentials struct {
|
2024-01-12 14:29:25 +03:00
|
|
|
Username string `json:"username"`
|
|
|
|
Password string `json:"password"`
|
2024-01-12 14:27:55 +03:00
|
|
|
}
|
|
|
|
|
2024-01-13 09:22:40 +03:00
|
|
|
func parseCredentials(credsString string) ([]Credentials, error) {
|
|
|
|
var creds []Credentials
|
2024-01-12 14:27:55 +03:00
|
|
|
err := json.Unmarshal([]byte(credsString), &creds)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2024-01-13 09:22:40 +03:00
|
|
|
return creds, nil
|
2024-01-12 14:27:55 +03:00
|
|
|
}
|