{"id":16831333,"url":"https://github.com/jonfriesen/otp","last_synced_at":"2025-04-11T04:12:27.145Z","repository":{"id":57503716,"uuid":"111128406","full_name":"jonfriesen/otp","owner":"jonfriesen","description":"A Go implementation of RFC 4226 HOTP: An HMAC-Based One-Time Password Algorithm and RFC 6238: TOTP: Time-Based One-Time Password Algorithm","archived":false,"fork":false,"pushed_at":"2023-11-09T20:41:18.000Z","size":362,"stargazers_count":9,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-11T04:12:20.422Z","etag":null,"topics":["2-factor","2fa","hacktoberfest","hmac-sha1","hotp","otp","password-algorithm","rfc-4226","rfc-6238","totp"],"latest_commit_sha":null,"homepage":"","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/jonfriesen.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":"2017-11-17T16:54:25.000Z","updated_at":"2024-02-06T18:54:39.000Z","dependencies_parsed_at":"2025-02-18T17:33:29.611Z","dependency_job_id":"07a608c4-087c-418b-8119-281c8955309b","html_url":"https://github.com/jonfriesen/otp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonfriesen%2Fotp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonfriesen%2Fotp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonfriesen%2Fotp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonfriesen%2Fotp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonfriesen","download_url":"https://codeload.github.com/jonfriesen/otp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339225,"owners_count":21087215,"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":["2-factor","2fa","hacktoberfest","hmac-sha1","hotp","otp","password-algorithm","rfc-4226","rfc-6238","totp"],"created_at":"2024-10-13T11:43:13.930Z","updated_at":"2025-04-11T04:12:27.097Z","avatar_url":"https://github.com/jonfriesen.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![OneTimePasswords](media/otp_logo.png)\n\n![Build Status](https://github.com/jonfriesen/otp/workflows/build/badge.svg)\n\nThis package is an implementation of [RFC 4226: HOTP: An HMAC-Based One-Time Password Algorithm](https://tools.ietf.org/html/rfc4226) and [RFC 6238: TOTP: Time-Based One-Time Password Algorithm](https://tools.ietf.org/html/rfc6238) with slight deviations from the RFC based on the algorithmic reference implementation and tested using the RFC test values to ensure comaptibility with other HOTP and TOTP systems. \n\n## Installation\n\nClone this repository into your Go src directory or pull it automatically with:\n\n```\n$ go get github.com/jonfriesen/otp\n```\n\n## Usage\n```\nimport \"github.com/jonfriesen/otp\"\n...\n// To generate and checking a Time base OTP\ntotpToken := NewTOTP(\"secret\", Time, 8, 30, 2, sha1.New)\ntotp := totpToken.Generate()\nisValid := totp == totpToken.Check(\"12345678\")\n...\n// To generate and checking a HMAC OTP \nhotpToken := NewHOTP(\"secret\", 0, 6, 5, sha1.New)\nhotp := hotpToken.Generate()\nisValid := hotp == hotpToken.Check(\"123456\")\n```\n\n## Considerations and Variations from RFC\n### Checksum\nThe checksum option is not included in this implementation as I feel most real world implementations don't use it or account for it. \n\n### Truncation Offset\nThe truncation offset is intended to give the entire hash digest the opportunity to contribute to the truncated portion of the hash. Removing this section does not make the algorithm more or less secure.\n\n## Motivation\nThe OTP package was created to offer a simple, close implementation of RFC 4226 and RFC 6238 for easy consumption in Go.\n\n## Contributions\nPull Requests are welcome, please include tests covering your contributions. \n\n\n\u003csub\u003e[MIT License Copyright (c) 2022 Jonathan Friesen](./LICENSE)\u003c/sub\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonfriesen%2Fotp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonfriesen%2Fotp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonfriesen%2Fotp/lists"}