{"id":13827337,"url":"https://github.com/sethvargo/go-password","last_synced_at":"2025-05-14T16:03:06.155Z","repository":{"id":41247979,"uuid":"110257592","full_name":"sethvargo/go-password","owner":"sethvargo","description":"A Golang library for generating high-entropy random passwords similar to 1Password or LastPass.","archived":false,"fork":false,"pushed_at":"2024-07-27T06:44:51.000Z","size":41,"stargazers_count":672,"open_issues_count":0,"forks_count":79,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-04-03T02:08:24.166Z","etag":null,"topics":["golang","password","password-generator"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sethvargo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-10T14:44:52.000Z","updated_at":"2025-04-02T07:33:48.000Z","dependencies_parsed_at":"2024-06-25T01:31:27.878Z","dependency_job_id":"3b68bec5-965f-4e80-b934-31aaecde740e","html_url":"https://github.com/sethvargo/go-password","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethvargo%2Fgo-password","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethvargo%2Fgo-password/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethvargo%2Fgo-password/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethvargo%2Fgo-password/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sethvargo","download_url":"https://codeload.github.com/sethvargo/go-password/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154995,"owners_count":21056542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","password","password-generator"],"created_at":"2024-08-04T09:01:54.296Z","updated_at":"2025-04-10T03:48:53.460Z","avatar_url":"https://github.com/sethvargo.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"## Golang Password Generator\n\n[![GoDoc](https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://pkg.go.dev/github.com/sethvargo/go-password/password)\n[![GitHub Actions](https://img.shields.io/github/workflow/status/sethvargo/go-password/Test?style=flat-square)](https://github.com/sethvargo/go-password/actions?query=workflow%3ATest)\n\nThis library implements generation of random passwords with provided\nrequirements as described by  [AgileBits\n1Password](https://discussions.agilebits.com/discussion/23842/how-random-are-the-generated-passwords)\nin pure Golang. The algorithm is commonly used when generating website\npasswords.\n\nThe library uses crypto/rand for added randomness.\n\nSample example passwords this library may generate:\n\n```text\n0N[k9PhDqmmfaO`p_XHjVv`HTq|zsH4XiH8umjg9JAGJ#\\Qm6lZ,28XF4{X?3sHj\n7@90|0H7!4p\\,c\u003c!32:)0.9N\nUlYuRtgqyWEivlXnLeBpZvIQ\nQ795Im1VR5h363s48oZGaLDa\nwpvbxlsc\n```\n\n\u003e Since these are completely randomized, it's possible that they may generate passwords that don't comply with some custom password policies, such as ones that require both upper case AND lower case letters. If your particular use case needs a mix of casing, then you can either increase the number of characters in the password or check the output and regenerate if it fails a particular constraint, such as requiring both upper and lower case.\n\n## Installation\n\n```sh\n$ go get -u github.com/sethvargo/go-password/password\n```\n\n## Usage\n\n```golang\npackage main\n\nimport (\n  \"log\"\n\n  \"github.com/sethvargo/go-password/password\"\n)\n\nfunc main() {\n  // Generate a password that is 64 characters long with 10 digits, 10 symbols,\n  // allowing upper and lower case letters, disallowing repeat characters.\n  res, err := password.Generate(64, 10, 10, false, false)\n  if err != nil {\n    log.Fatal(err)\n  }\n  log.Printf(res)\n}\n```\n\nSee the [GoDoc](https://godoc.org/github.com/sethvargo/go-password) for more\ninformation.\n\n## Testing\n\nFor testing purposes, instead of accepted a `*password.Generator` struct, accept\na `password.PasswordGenerator` interface:\n\n```go\n// func MyFunc(p *password.Generator)\nfunc MyFunc(p password.PasswordGenerator) {\n  // ...\n}\n```\n\nThen, in tests, use a mocked password generator with stubbed data:\n\n```go\nfunc TestMyFunc(t *testing.T) {\n  gen := password.NewMockGenerator(\"canned-response\", false)\n  MyFunc(gen)\n}\n```\n\nIn this example, the mock generator will always return the value\n\"canned-response\", regardless of the provided parameters.\n\n## License\n\nThis code is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethvargo%2Fgo-password","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsethvargo%2Fgo-password","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethvargo%2Fgo-password/lists"}