https://github.com/s0rg/gosv
golang rule-based string validator
https://github.com/s0rg/gosv
go golang password-safety rules validation-library
Last synced: 4 days ago
JSON representation
golang rule-based string validator
- Host: GitHub
- URL: https://github.com/s0rg/gosv
- Owner: s0rg
- License: mit
- Created: 2021-09-01T15:16:17.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-24T21:46:17.000Z (about 2 years ago)
- Last Synced: 2025-01-18T05:31:04.211Z (9 months ago)
- Topics: go, golang, password-safety, rules, validation-library
- Language: Go
- Homepage:
- Size: 17.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/s0rg/gosv)
[](https://github.com/s0rg/gosv/actions?query=workflow%3Aci)
[](https://goreportcard.com/report/github.com/s0rg/gosv)
[](https://codeclimate.com/github/s0rg/gosv/maintainability)
[](https://codeclimate.com/github/s0rg/gosv/test_coverage)
[](https://github.com/s0rg/gosv/blob/main/LICENSE)# gosv
golang rule-based string validator
# usage
```go
import "github.com/s0rg/gosv"var MyRules = []gosv.Rule{
gosv.MinLen(8),
gosv.MaxLen(64),
gosv.MinLowers(1),
gosv.MinUppers(1),
gosv.MinNumbers(1),
gosv.MaxDuplicates(0.2), // limit duplicates to 20%
gosv.MaxSequencies(0.1), // limit sequencies to 10% (i.e. 'abc', '123')
gosv.MaxEntropyDiff(0.3), // limit entropy diff between ideal and current entropy values
}func MyPasswordValidator(input string) error {
return gosv.Validate(input, MyRules...)
}
```# license
MIT