{"id":19166917,"url":"https://github.com/thomaschaplin/image-to-totp","last_synced_at":"2025-05-07T13:36:31.758Z","repository":{"id":38426516,"uuid":"309682784","full_name":"thomaschaplin/image-to-totp","owner":"thomaschaplin","description":"🔐 Convert QR images to TOTP codes","archived":false,"fork":false,"pushed_at":"2023-07-19T00:14:44.000Z","size":831,"stargazers_count":10,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-01T09:02:07.329Z","etag":null,"topics":["2fa","2fa-codes","2factor","qrcode","totp"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/thomaschaplin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["thomaschaplin"]}},"created_at":"2020-11-03T12:41:12.000Z","updated_at":"2022-06-08T04:35:41.000Z","dependencies_parsed_at":"2024-06-21T15:33:49.305Z","dependency_job_id":"2e0dfc39-ea4b-4372-a760-875fb735d085","html_url":"https://github.com/thomaschaplin/image-to-totp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomaschaplin%2Fimage-to-totp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomaschaplin%2Fimage-to-totp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomaschaplin%2Fimage-to-totp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomaschaplin%2Fimage-to-totp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomaschaplin","download_url":"https://codeload.github.com/thomaschaplin/image-to-totp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252888002,"owners_count":21819942,"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":["2fa","2fa-codes","2factor","qrcode","totp"],"created_at":"2024-11-09T09:34:50.960Z","updated_at":"2025-05-07T13:36:31.740Z","avatar_url":"https://github.com/thomaschaplin.png","language":"TypeScript","funding_links":["https://github.com/sponsors/thomaschaplin"],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"assets/logo.png\" alt=\"logo\" width=\"213\" height=\"213\" /\u003e\n\n# image-to-totp\n\n![](https://img.shields.io/npm/v/@thomaschaplin/image-to-totp?style=plastic)\n![](https://img.shields.io/npm/dw/@thomaschaplin/image-to-totp?style=plastic)\n![](https://img.shields.io/bundlephobia/min/@thomaschaplin/image-to-totp?style=plastic)\n![](https://img.shields.io/github/license/thomaschaplin/image-to-totp?style=plastic)\n\nimage-to-totp is a library to generate totp codes from a QR code image with a single API.\n\n## Usage\n\n```\nnpm install @thomaschaplin/image-to-totp\n```\n\n### Example Usage\n\nFind full example [here](https://github.com/thomaschaplin/image-to-totp/blob/master/examples/src/image-to-totp.ts) but see the below code snippet\n\n\u003cimg src=\"./src/__tests__/fixtures/2fa.png\" alt=\"example-qr-code\" width=\"100\" height=\"100\" /\u003e\n\n```\nsrc/\n  images/\n    example1.png\n    example2.png\n```\n\n```ts\nimport { imageToTotp } from \"@thomaschaplin/image-to-totp\";\nimport * as path from \"path\";\n\nconst example = async (account: string) =\u003e {\n  const projectBaseFolder = path.join(__dirname, \"../\");\n  const imagesFolder = path.join(projectBaseFolder, \"src/images\");\n  const totp = await imageToTotp(`${imagesFolder}/${account}.png`);\n  console.log(`Account: ${account} - ${totp}`);\n};\n\nexample(\"example1\"); // Account: example1 - 034624\nexample(\"example2\"); // Account: example2 - 084841\n```\n\n## Description\n\nThis repository allows you to take a QR code image and turn it into a TOTP code.\n\nThis project uses:\n\n- [jimp](https://github.com/oliver-moran/jimp)\n- [jsqr](https://github.com/cozmo/jsQR)\n- [otpauth](https://github.com/hectorm/otpauth)\n\n## Setup\n\nMake sure you have [Node.js](https://nodejs.org/en/) installed on your machine\n\n### Development\n\n#### Installation\n\n- Clone this repository\n  `git clone git@github.com:thomaschaplin/image-to-totp.git`\n- Change directory `cd image-to-totp`\n- Install the dependencies `npm install`\n- Transpile the code `npm run build` or `npm run watch`\n\n#### Tests\n\n- Run the tests `npm test`\n- Run the tests with coverage `npm run test:coverage`\n- Run the tests with mutation testing `npm run test:mutation`\n\n---\n\nImage by\n\u003ca href=\"https://pixabay.com/users/mohamed_hassan-5229782/?utm_source=link-attribution\u0026amp;utm_medium=referral\u0026amp;utm_campaign=image\u0026amp;utm_content=5661868\"\u003emohamed\nHassan\u003c/a\u003e from\n\u003ca href=\"https://pixabay.com/?utm_source=link-attribution\u0026amp;utm_medium=referral\u0026amp;utm_campaign=image\u0026amp;utm_content=5661868\"\u003ePixabay\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomaschaplin%2Fimage-to-totp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomaschaplin%2Fimage-to-totp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomaschaplin%2Fimage-to-totp/lists"}