{"id":23131214,"url":"https://github.com/emartech/koa-escher-auth","last_synced_at":"2025-08-17T08:31:09.729Z","repository":{"id":50151995,"uuid":"50427417","full_name":"emartech/koa-escher-auth","owner":"emartech","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-26T09:20:36.000Z","size":483,"stargazers_count":0,"open_issues_count":5,"forks_count":5,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-06-29T06:39:36.345Z","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/emartech.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":"2016-01-26T12:31:09.000Z","updated_at":"2023-01-03T15:15:26.000Z","dependencies_parsed_at":"2023-02-14T15:35:14.130Z","dependency_job_id":null,"html_url":"https://github.com/emartech/koa-escher-auth","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/emartech/koa-escher-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fkoa-escher-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fkoa-escher-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fkoa-escher-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fkoa-escher-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emartech","download_url":"https://codeload.github.com/emartech/koa-escher-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emartech%2Fkoa-escher-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268273650,"owners_count":24223799,"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-08-01T02:00:08.611Z","response_time":67,"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":"2024-12-17T11:12:20.813Z","updated_at":"2025-08-17T08:31:09.457Z","avatar_url":"https://github.com/emartech.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-escher-auth\n[![Dependency Status](https://david-dm.org/emartech/koa-escher-auth.svg)](https://david-dm.org/emartech/koa-escher-auth)\n[![devDependency Status](https://david-dm.org/emartech/koa-escher-auth/dev-status.svg)](https://david-dm.org/emartech/koa-escher-auth#info=devDependencies)\n\nThis koa middleware allows you to restrict access to pages with Escher authentication.\n\n## Usage\n\nThe middlewares will work only in the following order:\n1. A bodyparser defining rawBody on the request (e.g. koa-bodyparser)\n2. Authenticator middleware (lib/koa-authenticator)\n\n```javascript\nconst Koa = require('koa');\nconst bodyParser = require('koa-bodyparser');\nconst escherAuth = require('koa-escher-auth');\n\n\nlet escherConfig = {\n  credentialScope: 'eu/app-id/ems_request',\n  keyPool: JSON.stringify([\n    { 'keyId': 'app-id_suite_v1', 'secret': 'app-id-secret', acceptOnly: 0 }\n  ])\n};\n\nlet app = new Koa();\napp.use(bodyParser());\napp.use(escherAuth.authenticator(escherConfig));\napp.use(function(ctx) {\n  ctx.body = `Hello world, ${ctx.escherAccessKeyId}!`;\n});\n```\nThe access key id used to authenticate the request will be available on the context as `escherAccessKeyId`\n\n### Environment variables\n\nIf you define SUITE_ESCHER_CREDENTIAL_SCOPE and SUITE_ESCHER_KEY_POOL as environment variables\nthe setup becomes even more easier.\n\n```\nSUITE_ESCHER_CREDENTIAL_SCOPE='eu/app-id/ems_request'\nSUITE_ESCHER_KEY_POOL='[{\"keyId\": \"app-id_suite_v1\", \"secret\": \"app-id-secret\", \"acceptOnly\": 0}]'\n```\n\n```javascript\nconst Koa = require('koa');\nconst bodyParser = require('koa-bodyparser');\nconst escherAuth = require('koa-escher-auth');\n\n\nlet app = new Koa();\napp.use(bodyParser());\napp.use(escherAuth.authenticator());\napp.use(function(ctx) {\n  ctx.body = 'Hello world';\n});\n```\n\n### Notes\n\nThe keypool always has to be a valid JSON string.\n\nYou are able to add other middlewares between bodyparser and authenticator if you want.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femartech%2Fkoa-escher-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femartech%2Fkoa-escher-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femartech%2Fkoa-escher-auth/lists"}