{"id":28541720,"url":"https://github.com/agm-dev/keyro","last_synced_at":"2026-06-19T18:31:40.375Z","repository":{"id":35981318,"uuid":"220635039","full_name":"agm-dev/keyro","owner":"agm-dev","description":"Key rotation utility","archived":false,"fork":false,"pushed_at":"2023-01-05T00:44:18.000Z","size":1265,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-19T21:21:42.195Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/agm-dev.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":"2019-11-09T11:53:36.000Z","updated_at":"2019-11-09T12:02:26.000Z","dependencies_parsed_at":"2023-01-16T10:41:34.067Z","dependency_job_id":null,"html_url":"https://github.com/agm-dev/keyro","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/agm-dev/keyro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agm-dev%2Fkeyro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agm-dev%2Fkeyro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agm-dev%2Fkeyro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agm-dev%2Fkeyro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agm-dev","download_url":"https://codeload.github.com/agm-dev/keyro/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agm-dev%2Fkeyro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273567469,"owners_count":25128630,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"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":[],"created_at":"2025-06-09T20:09:43.741Z","updated_at":"2026-06-19T18:31:35.353Z","avatar_url":"https://github.com/agm-dev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keyro - key rotation utility\n\n[![Build Status](https://travis-ci.org/agm-dev/keyro.svg?branch=master)](https://travis-ci.org/agm-dev/keyro)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/6ca1e22946014852a349c0155fa88cc9)](https://www.codacy.com/manual/agm-dev/keyro?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=agm-dev/keyro\u0026amp;utm_campaign=Badge_Grade)\n[![Codacy](https://api.codacy.com/project/badge/coverage/6ca1e22946014852a349c0155fa88cc9)](https://www.codacy.com/app/codacy/node-codacy-coverage)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/agm-dev/keyro)\n![GitHub All Releases](https://img.shields.io/github/downloads/agm-dev/keyro/total)\n![GitHub](https://img.shields.io/github/license/agm-dev/keyro)\n\n## What is this\n\nKeyro is just a simple utility to store an array of values and return the 'next one' on every 'get' access.\n\nI have done it to mitigate the rate limit overload on some services, so a different key is used on every request, but as it is something very generic I guess it can be useful on other situations.\n\n## Requirements\n\nThis is a npm package, and you will need a node version which supports ES6. Anyway, the code is really simple, and could be reduced to drop node dependencies so it can be used also on browsers:\n\n```javascript\nclass Keyro {\n  constructor({ pool = [] } = {}) {\n    if (!Array.isArray(pool)) {\n      throw new Error(\"pool has to be an array\");\n    }\n\n    this.pointer = 0;\n    this.pool = pool;\n  }\n\n  add(key) {\n    this.pool = [...this.pool, key];\n  }\n\n  get() {\n    const value = this.pool[this.pointer];\n    const hasReachTheEnd = this.pointer \u003e= this.pool.length - 1;\n    const nextPointerValue = hasReachTheEnd ? 0 : this.pointer + 1;\n    this.pointer = nextPointerValue;\n    return value;\n  }\n}\n```\n\n## Installation\n\n```bash\nnpm i --save keyro\n```\n\n## Usage\n\n```javascript\nconst Keyro = require(\"keyro\");\n\nconst keysFromConfig = [\n  \"SDF9DF897SFGD98A7SDF\",\n  \"VB8N8SC7G68DF8B76S4D\",\n  \"OOLI4L2L1U5I3HJU5K15\"\n];\n\nconst keyro = new Keyro({ pool: keysFromConfig });\n\nfunction getApiKey() {\n  return keyro.get();\n}\n\nconsole.log(getApiKey()); // \"SDF9DF897SFGD98A7SDF\"\nconsole.log(getApiKey()); // \"VB8N8SC7G68DF8B76S4D\"\nconsole.log(getApiKey()); // \"OOLI4L2L1U5I3HJU5K15\"\nconsole.log(getApiKey()); // \"SDF9DF897SFGD98A7SDF\"\nconsole.log(getApiKey()); // \"VB8N8SC7G68DF8B76S4D\"\nconsole.log(getApiKey()); // \"OOLI4L2L1U5I3HJU5K15\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagm-dev%2Fkeyro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagm-dev%2Fkeyro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagm-dev%2Fkeyro/lists"}