// Copyright 2023 wanderer // SPDX-License-Identifier: AGPL-3.0-only package localbreach import ( "os" "time" "gopkg.in/yaml.v2" ) type BreachDataSchema struct { Name string `yaml:"name" validate:"required,name"` Time time.Time `yaml:"time"` IsVerified bool `yaml:"isVerified"` ContainsPasswords bool `yaml:"containsPasswds"` ContainsHashes bool `yaml:"containsHashes"` HashType string `yaml:"hashType"` HashSalted bool `yaml:"hashSalted"` HashPeppered bool `yaml:"hashPeppered"` ContainsUsernames bool `yaml:"containsUsernames"` ContainsEmails bool `yaml:"containsEmails"` Data any `yaml:"data"` } // Load loads local breach data. func Load(path string) (*BreachDataSchema, error) { b, err := os.ReadFile(path) if err != nil { return nil, err } localBreach, err := loadLocalBreach(b) if err != nil { return nil, err } return localBreach, nil } func loadLocalBreach(b []byte) (*BreachDataSchema, error) { localBreach := new(BreachDataSchema) err := yaml.Unmarshal(b, localBreach) if err != nil { return nil, err } return localBreach, nil }