{"id":21031566,"url":"https://github.com/slaveofcode/entica","last_synced_at":"2025-12-29T10:43:08.425Z","repository":{"id":92794996,"uuid":"299304018","full_name":"slaveofcode/entica","owner":"slaveofcode","description":"Dead simple Golang OTP library for both HOTP and TOTP without any dependency","archived":false,"fork":false,"pushed_at":"2020-10-12T08:58:14.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-20T15:25:57.736Z","etag":null,"topics":[],"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/slaveofcode.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":"2020-09-28T12:37:47.000Z","updated_at":"2020-10-12T08:58:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"738033f7-d1d1-40b9-8bdc-ac3600c0b037","html_url":"https://github.com/slaveofcode/entica","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/slaveofcode%2Fentica","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slaveofcode%2Fentica/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slaveofcode%2Fentica/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slaveofcode%2Fentica/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slaveofcode","download_url":"https://codeload.github.com/slaveofcode/entica/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243472224,"owners_count":20296292,"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":[],"created_at":"2024-11-19T12:29:21.966Z","updated_at":"2025-12-29T10:43:08.388Z","avatar_url":"https://github.com/slaveofcode.png","language":"Go","readme":"# Entica\nDead simple Golang OTP (One Time Password) library for both HOTP and TOTP without any dependency following both official [RFC6238](https://tools.ietf.org/html/rfc6238) and [RFC4226](https://tools.ietf.org/html/rfc4226) rules on the implementation.\n\n## TOTP\nA time-based OTP, using the time for the message validation.\n\n```go\nsecret := entica.RandSecret() // base32 string (A-Z and 2-7) with length of 32 chars\ntotp := entica.NewTOTP(secret) // new default totp (sha1) with 6 digit result\ntotp.Get() // 918399\n\n// or with more specific\n\nsecret := \"IDI5FG3XTZE26AONPVRIVQP4DN2DV54J\"\ntotp := entica.NewTOTPSHA(7, sha512.New, secret)\ntotp.Get() // 9183993\n\ntotp.Compare(\"codeToCheck\") // return valid status\ntotp.At(time.Now().Sub(time.Hour * 3)) // return code at specific time, 3 hours earlier\ntotp.CodeAtUnix(1646373) // return code at specific unix time\n```\n\n## HOTP\nHMAC-Based OTP, using the counter value for the message validation.\n\n```go\nsecret := entica.RandSecret(\"SomeSalt\")\nhotp := entica.HOTP{\n    Hash: entica.Sha1,\n    Digits: 6,\n    Secret: secret,  // 32bit string secret\n    Counter: 1,\n}\n\n// or\n\nhotp := entica.NewDefaultHOTP(secret, counter)\n\nhotp.Check(\"codeToCheck\") // return code at current time\nhotp.CodeAtCounter(10) // return code at specific counter value \nhotp.CurrCounter() // return counter value \n```\n\n## LICENSE\nMIT License\n\nCopyright (c) 2020 Aditya Kresna\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslaveofcode%2Fentica","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslaveofcode%2Fentica","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslaveofcode%2Fentica/lists"}