{"id":18446575,"url":"https://github.com/cristalhq/otp","last_synced_at":"2025-04-08T00:31:54.272Z","repository":{"id":57691029,"uuid":"480426793","full_name":"cristalhq/otp","owner":"cristalhq","description":"One time password for Go.","archived":false,"fork":false,"pushed_at":"2024-11-16T08:47:40.000Z","size":49,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-23T03:11:51.648Z","etag":null,"topics":["go","golang","otp","otp-generator","otp-verification","otpauth"],"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/cristalhq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2022-04-11T14:55:14.000Z","updated_at":"2025-03-19T02:53:04.000Z","dependencies_parsed_at":"2022-08-27T18:52:37.761Z","dependency_job_id":"b0c311dd-ed42-4003-af61-b1ef54a20719","html_url":"https://github.com/cristalhq/otp","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fotp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fotp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fotp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fotp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cristalhq","download_url":"https://codeload.github.com/cristalhq/otp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755389,"owners_count":20990616,"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":["go","golang","otp","otp-generator","otp-verification","otpauth"],"created_at":"2024-11-06T07:09:43.446Z","updated_at":"2025-04-08T00:31:53.903Z","avatar_url":"https://github.com/cristalhq.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# otp\n\n[![build-img]][build-url]\n[![pkg-img]][pkg-url]\n[![reportcard-img]][reportcard-url]\n[![coverage-img]][coverage-url]\n[![version-img]][version-url]\n\nOne time password for Go.\n\n## Features\n\n* Simple API.\n* Dependency-free.\n* Clean and tested code.\n* HOTP [RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226).\n* TOTP [RFC 6238](https://datatracker.ietf.org/doc/html/rfc6238).\n\nSee [GUIDE.md](https://github.com/cristalhq/otp/blob/main/GUIDE.md) for more details.\n\n## Install\n\nGo version 1.17+\n\n```\ngo get github.com/cristalhq/otp\n```\n\n## Example\n\n```go\nsecretInBase32 := \"JBSWY3DPEHPK3PXP\"\n\nalgo := otp.AlgorithmSHA1\ndigits := otp.Digits(10)\nissuer := \"cristalhq\"\n\nhotp, err := otp.NewHOTP(algo, digits, issuer)\ncheckErr(err)\n\ncode, err := hotp.GenerateCode(42, secretInBase32)\ncheckErr(err)\n\nfmt.Println(code)\n\nerr = hotp.Validate(code, 42, secretInBase32)\ncheckErr(err)\n\n// Output:\n// 0979090604\n```\n\nAlso see examples: [examples_test.go](https://github.com/cristalhq/otp/blob/main/example_test.go).\n\n## Documentation\n\nSee [these docs][pkg-url].\n\n## License\n\n[MIT License](LICENSE).\n\n[build-img]: https://github.com/cristalhq/otp/workflows/build/badge.svg\n[build-url]: https://github.com/cristalhq/otp/actions\n[pkg-img]: https://pkg.go.dev/badge/cristalhq/otp\n[pkg-url]: https://pkg.go.dev/github.com/cristalhq/otp\n[reportcard-img]: https://goreportcard.com/badge/cristalhq/otp\n[reportcard-url]: https://goreportcard.com/report/cristalhq/otp\n[coverage-img]: https://codecov.io/gh/cristalhq/otp/branch/main/graph/badge.svg\n[coverage-url]: https://codecov.io/gh/cristalhq/otp\n[version-img]: https://img.shields.io/github/v/release/cristalhq/otp\n[version-url]: https://github.com/cristalhq/otp/releases\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Fotp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcristalhq%2Fotp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Fotp/lists"}