{"id":13456556,"url":"https://github.com/arkerone/api-key-auth","last_synced_at":"2026-05-15T13:13:52.875Z","repository":{"id":51332807,"uuid":"128675786","full_name":"arkerone/api-key-auth","owner":"arkerone","description":"Express/Restify middleware to authenticate HTTP requests based on api key and signature.","archived":false,"fork":false,"pushed_at":"2023-02-13T16:31:48.000Z","size":64,"stargazers_count":49,"open_issues_count":5,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-02T14:33:26.731Z","etag":null,"topics":["api","authentication","express","expressjs","javascript","middleware","nodejs","restify","restifyjs","security"],"latest_commit_sha":null,"homepage":"","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/arkerone.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}},"created_at":"2018-04-08T19:42:53.000Z","updated_at":"2024-10-28T13:47:05.000Z","dependencies_parsed_at":"2024-01-13T17:48:25.982Z","dependency_job_id":"d0c9dea9-de7b-4065-a1c4-441022c31958","html_url":"https://github.com/arkerone/api-key-auth","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":0.06060606060606055,"last_synced_commit":"93ed511079c4d2fbfebd923a3f71baf10a44e305"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/arkerone/api-key-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkerone%2Fapi-key-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkerone%2Fapi-key-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkerone%2Fapi-key-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkerone%2Fapi-key-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arkerone","download_url":"https://codeload.github.com/arkerone/api-key-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arkerone%2Fapi-key-auth/sbom","scorecard":{"id":207251,"data":{"date":"2025-08-11","repo":{"name":"github.com/arkerone/api-key-auth","commit":"93ed511079c4d2fbfebd923a3f71baf10a44e305"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/27 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":"Maintained","score":0,"reason":"0 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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":"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":"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"}},{"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T00:03:38.213Z","repository_id":51332807,"created_at":"2025-08-17T00:03:38.213Z","updated_at":"2025-08-17T00:03:38.213Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33067699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["api","authentication","express","expressjs","javascript","middleware","nodejs","restify","restifyjs","security"],"created_at":"2024-07-31T08:01:24.016Z","updated_at":"2026-05-15T13:13:52.854Z","avatar_url":"https://github.com/arkerone.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# api-key-auth\n\nExpress/Restify middleware to authenticate HTTP requests based on api key and signature.\n\n[![npm version](https://badge.fury.io/js/api-key-auth.svg)](https://badge.fury.io/js/api-key-auth)\n[![codebeat badge](https://codebeat.co/badges/8b9de4e3-0841-4a91-85fd-5a26f58901c3)](https://codebeat.co/projects/github-com-arkerone-api-key-auth-master)\n[![Build Status](https://travis-ci.org/arkerone/api-key-auth.svg?branch=master)](https://travis-ci.org/arkerone/api-key-auth)\n[![codecov](https://codecov.io/gh/arkerone/api-key-auth/branch/master/graph/badge.svg)](https://codecov.io/gh/arkerone/api-key-auth)\n[![Greenkeeper badge](https://badges.greenkeeper.io/arkerone/api-key-auth.svg)](https://greenkeeper.io/)\n\n## Installation\n\n```\n$ npm install --save api-key-auth\n```\n\n## Usage\n\nThis middleware authenticates callers using an api key and the signature of the request. If the api key and the signature are valid, `req.credentials` will be set with the calling application information.\n\n### Example\n\nThis basic usage example should help you get started :\n\n```javascript\nconst express = require('express');\nconst apiKeyAuth = require('api-key-auth');\n\nconst app = express();\n\n// Create the collection of api keys\nconst apiKeys = new Map();\napiKeys.set('123456789', {\n  id: 1,\n  name: 'app1',\n  secret: 'secret1'\n});\napiKeys.set('987654321', {\n  id: 2,\n  name: 'app2',\n  secret: 'secret2'\n});\n\n// Your function to get the secret associated to the key id\nfunction getSecret(keyId, done) {\n  if (!apiKeys.has(keyId)) {\n    return done(new Error('Unknown api key'));\n  }\n  const clientApp = apiKeys.get(keyId);\n  done(null, clientApp.secret, {\n    id: clientApp.id,\n    name: clientApp.name\n  });\n}\n\napp.use(apiKeyAuth({ getSecret }));\n\napp.get('/protected', (req, res) =\u003e {\n  res.send(`Hello ${req.credentials.name}`);\n});\n\napp.listen(8080);\n```\n\n## API\n\n### apiKeyAuth(options)\n\nCreate an api key based authentication middleware function using the given `options` :\n\n|       Name        |      Type       |     Default     | Description                                     |\n| :---------------: | :-------------: | :-------------: | :---------------------------------------------- |\n|    `getSecret`    |   `Function`    |       `-`       | Invoked to retrieve the secret from the `keyId` |\n| `requestProperty` |    `String`     | `'credentials'` | The request property to attach the information  |\n| `requestLifetime` | `Number | null` |      `300`      | The lifetime of a request in seconds            |\n\n#### options.getSecret (REQUIRED)\n\nA function with signature `function(keyId, done)` to be invoked to retrieve the secret from the `keyId`.\n\n- `keyId` (`String`) - The api key used to retrieve the secret.\n- `done` (`Function`) - A function with signature `function(err, secret, credentials)` to be invoked when the secret is retrieved.\n\n  - `err` (`Error`) - The error that occurred.\n  - `secret` (`String`) - The secret to use to verify the signature.\n  - `credentials` (`Object`) - `req.credentials` will be set with this object.\n\n#### options.requestProperty (OPTIONAL)\n\nBy default, you can attach information about the client application on `req.credentials` but can be configured with the `requestProperty` option.\n\n#### options.requestLifetime (OPTIONAL)\n\nThe lifetime of a request in second, by default is set to 300 seconds, set it to null to disable it. This options is used if HTTP header \"date\" is used to create the signature.\n\n## HTTP signature scheme\n\nLook [\"HTTP signature scheme\"](signature.md) to sign a HTTP request.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright (c) 2018 Axel SHAÏTA \u003cmailto:shaita.axel@gmail.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkerone%2Fapi-key-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farkerone%2Fapi-key-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farkerone%2Fapi-key-auth/lists"}