{"id":16731241,"url":"https://github.com/rohit-chouhan/auth_totp","last_synced_at":"2026-05-01T09:31:22.880Z","repository":{"id":245682106,"uuid":"818956032","full_name":"rohit-chouhan/auth_totp","owner":"rohit-chouhan","description":"A fast and easy-to-use time-based one-time password (TOTP) authentication package for your Flutter application","archived":false,"fork":false,"pushed_at":"2024-06-24T15:49:54.000Z","size":636,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-26T17:33:53.786Z","etag":null,"topics":["auth","authentication","dart","flutter","otp","totp"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/auth_totp","language":"Dart","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/rohit-chouhan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-06-23T11:06:07.000Z","updated_at":"2025-10-24T17:08:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"4741c9b7-1e02-40b1-9d46-fed84680e9d7","html_url":"https://github.com/rohit-chouhan/auth_totp","commit_stats":null,"previous_names":["rohit-chouhan/auth_otp"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rohit-chouhan/auth_totp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Fauth_totp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Fauth_totp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Fauth_totp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Fauth_totp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohit-chouhan","download_url":"https://codeload.github.com/rohit-chouhan/auth_totp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohit-chouhan%2Fauth_totp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32492087,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["auth","authentication","dart","flutter","otp","totp"],"created_at":"2024-10-12T23:36:23.037Z","updated_at":"2026-05-01T09:31:22.862Z","avatar_url":"https://github.com/rohit-chouhan.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"A fast and easy-to-use time-based one-time password (TOTP) authentication package for your Flutter application. It is compatible with `Google Authenticator`, `1Password`, `LastPass`, `Microsoft Authenticator` and various other authenticator apps.\n\n![Auth TOTP Banner](https://github.com/rohit-chouhan/auth_otp/assets/34239087/f22d91d0-452c-473a-87b7-a26107985df1)\n\n## Get Started\n\n- [🔑 Create Secret Key](#create-secret-key)\n- [✔️ Verify TOTP Code](#verify-totp-code)\n- [🚀 Generate TOTP Code](#generate-totp-code)\n- [📸 Get QR Code to Scan](#get-qr-code-to-scan)\n- [🔐 Tested Authenticator Apps](#tested-authenticator-services)\n- [🔐 Full Example](#full-example)\n- [🐛 Report bugs or issues](#report-bugs-or-issues)\n\n## Create Secret Key\n\n🔑 This method generates a random secret key, which is used to create verify codes from authentication apps.\n\n```dart\nString secret = AuthTOTP.createSecret(\n    length: 16,\n    autoPadding: true,\n    secretKeyStyle: SecretKeyStyle.upperLowerCase\n);\n\n//output :  xHu6 nh7I D8uI s9B1\n```\n\n- `length` : The length of the secret to generate. Must be between 16 and 255, Default is 32.\n- `autoPadding` : If true, it will create a secret with a letter by 4 sections, Default is false.\n- `secretKeyStyle` : SecretKeyStyle is used to set the case of the secret key. Default is upperCase.\n\n  - enum `SecretKeyStyle`\n    - `upperCase` : Secret key will be upper case\n    - `lowerCase` : Secret key will be lower case\n    - `upperLowerCase` : Secret key will be upper and lower both case\n\nThis method accepts a single parameter to specify the length of the secret key. By default, it generates a 32-character secret key. The length limit is between `16` to `255` characters.\n\n## Verify TOTP Code\n\n✔️ This method verifies a Time-based One-Time Password (TOTP) code using the secret key and the TOTP code generated by your `authenticator app`.\n\nUse this method after the user has scanned a QR code or entered the secret key into the authentication app. The same secret key generated by `createSecret` and the TOTP code generated by the `authenticator app` should be passed here to verify.\n\n```dart\nbool checkOTP = AuthTOTP.verifyCode({\n    secretKey: \"secret_key_here\",\n    totpCode: \"totp_code_here_by_user\",\n    interval: 30\n});\n```\n\n- `secretKey`: A secret key generate by createSecret method\n- `totpCode`: The TOTP code entered by the user.\n- `interval`: Time interval in seconds, default is 30\n\nIt will return true if code is correct, otherwise false.\n\n## Generate TOTP Code\n\n🚀 This method generates a TOTP code based on the secret key and the time interval. The time interval is specified in seconds.\n\n```dart\nString generatedTOTPCode = AuthTOTP.generateTOTPCode(\n    secretKey: 'secret_key_here',\n    interval: 30\n);\n```\n\n- `secretKey`: A secret key generate by createSecret method\n- `interval`: Time interval in seconds, ex. 30\n\nAs well as you can use this method to verify TOTP code also.\n\n#### Example Code:-\n\n```dart\nString generatedTOTPCode = AuthTOTP.generateTOTPCode(\n    secretKey: 'secret_key_here',\n    interval: 30\n);\n\nString inputedOTP = \"otp_inputed_by_user\";\n\nif(generatedTOTPCode === inputedOTP){\n    print(\"Verified\")\n} else {\n    print(\"Not Verified\")\n}\n```\n\n## Get QR Code to Scan\n\n📸 This method returns a QR code URL to scan with your authenticator app. It can be used in `Image.Network()`\n\n```dart\nString qrCodeUrl =  AuthTOTP.getQRCodeUrl({\n    appName: \"your app name\"\n    secretKey: \"secret_key_here\",\n    issuer:\"auth_totp\"\n});\n\n//Image.Network(qrCodeUrl);\n```\n\n- `appName`: App name, or any text\n- `secretKey`: A secret key generate by `createSecret` method\n- `issuer`: Issuer name, default is `auth_totp`\n\n## Tested Authenticator Services\n\n🔐\n|Logo | Service Name | Status |\n| ----------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | ------ |\n| \u003cimg width=\"40\" src=\"https://play-lh.googleusercontent.com/NntMALIH4odanPPYSqUOXsX8zy_giiK2olJiqkcxwFIOOspVrhMi9Miv6LYdRnKIg-3R=w480-h960-rw\"/\u003e | Google Authenticator | ✅ |\n| \u003cimg width=\"40\" src=\"https://play-lh.googleusercontent.com/RyPWI5dSfKqMUnuEYqMqQPMLv8AvKehIhut1yIKJU91HWpvtUHPj1rzn_UHwpEqH2a0=w480-h960-rw\"/\u003e | 1Password | ✅ |\n| \u003cimg width=\"40\" src=\"https://play-lh.googleusercontent.com/BPgJq2T40gw219T9wcXPld0urrii1L9WwGZ0xovChB7fy-KFfVlKPE6oT5D7lIeQRecJ=s96-rw\"/\u003e | LastPass | ✅ |\n| \u003cimg width=\"40\" src=\"https://play-lh.googleusercontent.com/_1CV99jklLbXuun-6E7eCPR-sKKeZc602rhw_QHZz-qm7xrPdgWsJVc7NtFkkliI8No=w480-h960-rw\"/\u003e | Microsoft Authenticator | ✅ |\n\nAbsolutely, it works with all authenticator apps. But feel free to contribute if you have tested it with any other authenticator app.\n\n## Full Example\n\n👉 For a complete example, refer to the [Auth TOTP package documentation](https://pub.dev/packages/auth_totp/example).\n\n## Report bugs or issues\n\n🐛 You are welcome to open a _[ticket](https://github.com/rohit-chouhan/auth_totp/issues)_ on github if any 🐞 problems arise. New ideas are always welcome.\n\n\u003e Copyright © 2024 **[Rohit Chouhan](https://rohitchouhan.com)**. Licensed under the _[MIT LICENSE](https://github.com/rohit-chouhan/auth_totp/blob/main/LICENSE)_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit-chouhan%2Fauth_totp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohit-chouhan%2Fauth_totp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohit-chouhan%2Fauth_totp/lists"}