{"id":19112721,"url":"https://github.com/russellsteadman/basic32","last_synced_at":"2025-02-22T11:34:29.140Z","repository":{"id":57189294,"uuid":"324810479","full_name":"russellsteadman/basic32","owner":"russellsteadman","description":"OTP codes (One-time passcodes) made shorter","archived":false,"fork":false,"pushed_at":"2021-07-02T22:10:18.000Z","size":125,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T11:55:52.016Z","etag":null,"topics":["2fa","base32","hotp","one-time-password","otp","tfa","totp","two-factor-authentication"],"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/russellsteadman.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}},"created_at":"2020-12-27T17:12:47.000Z","updated_at":"2023-03-17T12:32:26.000Z","dependencies_parsed_at":"2022-09-15T21:22:11.481Z","dependency_job_id":null,"html_url":"https://github.com/russellsteadman/basic32","commit_stats":null,"previous_names":["teamtofu/basic32"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russellsteadman%2Fbasic32","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russellsteadman%2Fbasic32/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russellsteadman%2Fbasic32/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/russellsteadman%2Fbasic32/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/russellsteadman","download_url":"https://codeload.github.com/russellsteadman/basic32/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240170074,"owners_count":19759141,"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","base32","hotp","one-time-password","otp","tfa","totp","two-factor-authentication"],"created_at":"2024-11-09T04:33:55.665Z","updated_at":"2025-02-22T11:34:29.108Z","avatar_url":"https://github.com/russellsteadman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Basic32\n\nBasic32 encodes and decodes OTP (One-time passcode) tokens to and from a standard length Base32 string, effectively making them shorter.\n\n## Why?\n\nBasic32 decreases the number of characters needed for a OTP code, making the code easier for users to remember.\n\n| Regular TOTP | Encoded TOTP |\n| ------------ | ------------ |\n| 6 digits     | 4 chars      |\n| 7 digits     | 5 chars      |\n| 8 digits     | 6 chars      |\n| 9 digits     | 6 chars      |\n\n## Installation\n\n```sh\nnpm i basic32\n```\n\n```javascript\nimport Basic32 from 'basic32';\n```\n\n## Usage\n\n```javascript\nimport Basic32 from 'basic32';\n\n/* Initialize the encoder */\nconst basic = new Basic32(/* Number of digits in OTP code, default: 6 */);\n\n/* Encode a number or string */\nbasic.encode(123456); // -\u003e \"3WX0\"\nbasic.encode('123456'); // -\u003e \"3WX0\"\n\n/* Decode a string */\nbasic.decode('3WX0'); // -\u003e \"123456\"\n\n/* Decode a string, but zero is switched with letter o */\nbasic.decode('3WXO'); // -\u003e \"123456\"\n\n/* Decode the wrong number of characters */\nbasic.decode('3WX0A'); // -\u003e new Error(\"Code should be 4 alphanumeric characters\")\n\n/* Decode an already decoded string */\nbasic.decode('123456'); // -\u003e \"123456\"\n```\n\n## Character Corrections\n\nThe following character transposition errors are automatically fixed.\n\n| User Writes | Interpreted |\n| ----------- | ----------- |\n| (Letter) O  | (Number) 0  |\n| (Letter) I  | (Number) 1  |\n| (Letter) L  | (Number) 1  |\n| (Letter) B  | (Number) 8  |\n\n## License\n\nMIT \u0026copy; 2021 [Russell Steadman](https://github.com/russellsteadman). See LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussellsteadman%2Fbasic32","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frussellsteadman%2Fbasic32","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frussellsteadman%2Fbasic32/lists"}