{"id":42847423,"url":"https://github.com/ghmer/go-tiny-mfa","last_synced_at":"2026-02-08T23:09:07.087Z","repository":{"id":53187372,"uuid":"285413339","full_name":"ghmer/go-tiny-mfa","owner":"ghmer","description":"a tiny-mfa implementation written in go","archived":false,"fork":false,"pushed_at":"2025-02-10T19:14:46.000Z","size":447,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T19:43:28.170Z","etag":null,"topics":["mfa","multifactor","multifactor-authentication","tiny-mfa","tinymfa","totp","totp-generator","totp-tokens"],"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/ghmer.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-08-05T21:58:42.000Z","updated_at":"2025-02-10T19:14:50.000Z","dependencies_parsed_at":"2024-01-24T02:24:52.257Z","dependency_job_id":"77d1cd48-db7f-42cf-8ed4-02b48917558c","html_url":"https://github.com/ghmer/go-tiny-mfa","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/ghmer/go-tiny-mfa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghmer%2Fgo-tiny-mfa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghmer%2Fgo-tiny-mfa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghmer%2Fgo-tiny-mfa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghmer%2Fgo-tiny-mfa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ghmer","download_url":"https://codeload.github.com/ghmer/go-tiny-mfa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ghmer%2Fgo-tiny-mfa/sbom","scorecard":{"id":425760,"data":{"date":"2025-08-11","repo":{"name":"github.com/ghmer/go-tiny-mfa","commit":"6e6df8410bb88e68ab9d261cb1fdb3dffece50ee"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:38: update your workflow using https://app.stepsecurity.io/secureworkflow/ghmer/go-tiny-mfa/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/ghmer/go-tiny-mfa/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:47: update your workflow using https://app.stepsecurity.io/secureworkflow/ghmer/go-tiny-mfa/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:58: update your workflow using https://app.stepsecurity.io/secureworkflow/ghmer/go-tiny-mfa/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/ghmer/go-tiny-mfa/codeql-analysis.yml/master?enable=pin","Info:   0 out of   5 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":10,"reason":"SAST tool detected: CodeQL","details":["Info: SAST configuration detected: CodeQL","Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T02:11:44.590Z","repository_id":53187372,"created_at":"2025-08-19T02:11:44.590Z","updated_at":"2025-08-19T02:11:44.590Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28912196,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T11:55:24.701Z","status":"ssl_error","status_checked_at":"2026-01-30T11:54:13.194Z","response_time":66,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["mfa","multifactor","multifactor-authentication","tiny-mfa","tinymfa","totp","totp-generator","totp-tokens"],"created_at":"2026-01-30T11:59:06.224Z","updated_at":"2026-01-30T11:59:06.772Z","avatar_url":"https://github.com/ghmer.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tiny MFA: A Go package for Time-Based One-Time Password (TOTP) generation and verification\n\n## Table of Contents\n\n- [Tiny MFA: A Go package for Time-Based One-Time Password (TOTP) generation and verification](#tiny-mfa-a-go-package-for-time-based-one-time-password-totp-generation-and-verification)\n  - [Table of Contents](#table-of-contents)\n  - [Overview](#overview)\n  - [Installation](#installation)\n  - [Usage](#usage)\n    - [Generating TOTP Tokens](#generating-totp-tokens)\n    - [Verifying TOTP Tokens](#verifying-totp-tokens)\n    - [Generating QR Codes](#generating-qr-codes)\n    - [Encrypting and Decrypting Data](#encrypting-and-decrypting-data)\n  - [API Documentation](#api-documentation)\n  - [License](#license)\n\n## Overview\n\nThe Tiny MFA package is a Go library for generating and verifying Time-Based One-Time Passwords (TOTP) according to the TOTP algorithm specified in RFC 6238. It also includes functionality for encrypting and decrypting data using AES-256-CBC.\n\n## Installation\n\nTo install the Tiny MFA package, run the following command:\n\n```bash\ngo get github.com/ghmer/go-tiny-mfa\n```\n\n## Usage\n\n### Generating TOTP Tokens\n\nTo generate a TOTP token, you can use the `GenerateValidToken` method of the `TinyMfa` struct. This method takes four arguments: the current Unix timestamp, the secret key, the offset type (either present, future, or past), and the desired token length.\n\n```go\npackage main\n\nimport (\n    \"github.com/ghmer/go-tiny-mfa\"\n)\n\nfunc main() {\n    tinymfa := tinymfa.NewTinyMfa()\n    timeStamp := time.Now().Unix()\n    key := []byte(\"your_secret_key\") // replace with your secret key\n    size := 6 // replace with the totp length\n\n    token, _ := tmfa.GenerateValidToken(timeStamp, \u0026key, tinymfa.Present, size)\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(token)\n}\n```\n\n### Verifying TOTP Tokens\n\nTo verify a TOTP token, you can use the `ValidateToken` method of the `TinyMfa` struct. This method takes five arguments: the submitted token, the secret key, the current Unix timestamp, and the desired token length.\n\n```go\npackage main\n\nimport (\n    \"github.com/ghmer/go-tiny-mfa\"\n)\n\nfunc main() {\n    tinymfa := tinymfa.NewTinyMfa()\n    \n    tokenNow := \"123456\" // replace with the submitted token\n    key := []byte(\"your_secret_key\") // replace with your secret key\n    timeStamp := time.Now().Unix()\n    size := 6 // replace with the totp length\n\n\n    valid, _ := tmfa.ValidateToken(tokenNow, \u0026key, timeStamp, 6)\n    if err != nil {\n        panic(err)\n    }\n\n    fmt.Println(valid)\n}\n```\n\n### Generating QR Codes\n\n```go\n\nfunc main() {\n    var issuer string = \"tinymfa.parzival.link\"\n    var user string = \"demo\"\n    var key string = base32.StdEncoding.EncodeToString(Key)\n    var digits uint8 = 6\n\n    qrcode, err := tmfa.GenerateQrCode(issuer, user, \u0026key, digits)\n    if err != nil {\n        panic(err)\n    }\n    // write png to file\n    os.WriteFile(\"./qrcode1.png\", qrcode, 0644)\n\n    // shorthand for the above\n    tmfa.WriteQrCodeImage(issuer, user, \u0026key, digits, \"./qrcode2.png\")\n}\n```\n\n### Encrypting and Decrypting Data\n\nTo encrypt data using the `TinyMfa` package, you can use the `Encrypt` method. This method takes two arguments: the data to be encrypted and the passphrase used for encryption.\n\n```go\npackage main\n\nimport (\n    \"github.com/ghmer/go-tiny-mfa/utils\"\n)\n\nfunc main() {\n    data := []byte(\"Hello, World!\")\n    passphrase := []byte(\"your_passphrase\")\n    encryptedData, err := util.Encrypt(\u0026data, \u0026passphrase)\n    if err != nil {\n        panic(err)\n    }\n    fmt.Println(encryptedData)\n}\n```\n\nTo decrypt data using the `TinyMfa` package, you can use the `Decrypt` method. This method takes two arguments: the encrypted data and the passphrase used for decryption.\n\n```go\npackage main\n\nimport (\n    \"github.com/ghmer/go-tiny-mfa/utils\"\n)\n\nfunc main() {\n    encryptedData := []byte(\"your_encrypted_data\")\n    passphrase := []byte(\"your_passphrase\")\n    decryptedData, err := util.Decrypt(encryptedData, \u0026passphrase)\n    if err != nil {\n        panic(err)\n    }\n    fmt.Println(decryptedData)\n}\n```\n\n## API Documentation\n\nThe `TinyMfa` package includes the following methods:\n\n* `GenerateValidToken`: Generates a TOTP token for the given timestamp and secret key.\n* `ValidateToken`: Verifies whether the submitted token is valid for the given timestamp and secret key.\n* `Encrypt`: Encrypts data using AES-256-CBC with the given passphrase.\n* `Decrypt`: Decrypts encrypted data using AES-256-CBC with the given passphrase.\n\n## License\n\nThe Tiny MFA package is released under the MIT License. See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghmer%2Fgo-tiny-mfa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fghmer%2Fgo-tiny-mfa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fghmer%2Fgo-tiny-mfa/lists"}