{"id":15018136,"url":"https://github.com/probot/get-private-key","last_synced_at":"2025-07-06T10:41:07.063Z","repository":{"id":37066846,"uuid":"313787282","full_name":"probot/get-private-key","owner":"probot","description":"🛠️ Get private key from a path, environment variables, or a `*.pem` file in the current working directory","archived":false,"fork":false,"pushed_at":"2025-02-22T02:59:58.000Z","size":1052,"stargazers_count":10,"open_issues_count":7,"forks_count":16,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-22T14:59:15.014Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/probot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2020-11-18T01:18:39.000Z","updated_at":"2024-11-02T10:03:49.000Z","dependencies_parsed_at":"2024-06-05T00:47:07.253Z","dependency_job_id":"66700841-e7ea-4036-b0cb-07d1205d15c9","html_url":"https://github.com/probot/get-private-key","commit_stats":{"total_commits":82,"total_committers":8,"mean_commits":10.25,"dds":"0.46341463414634143","last_synced_commit":"2f53ba2b0566f42b8fbd2936c8ea2dc594db5c3c"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/probot%2Fget-private-key","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/probot%2Fget-private-key/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/probot%2Fget-private-key/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/probot%2Fget-private-key/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/probot","download_url":"https://codeload.github.com/probot/get-private-key/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246423731,"owners_count":20774820,"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":[],"created_at":"2024-09-24T19:51:29.837Z","updated_at":"2025-03-31T06:08:10.152Z","avatar_url":"https://github.com/probot.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @probot/get-private-key\n\n\u003e Get private key from a file path, environment variables, or a `*.pem` file in the current working directory\n\n[![@latest](https://img.shields.io/npm/v/@probot/get-private-key.svg)](https://www.npmjs.com/package/@probot/get-private-key)\n[![Build Status](https://github.com/probot/get-private-key/workflows/Test/badge.svg)](https://github.com/probot/get-private-key/actions?query=workflow%3ATest)\n\nFinds a private key through various user-(un)specified methods. Order of precedence:\n\n1. Explicit file path option\n2. `PRIVATE_KEY` environment variable or explicit `env.PRIVATE_KEY` option. The private key can optionally be base64 encoded.\n3. `PRIVATE_KEY_PATH` environment variable or explicit `env.PRIVATE_KEY_PATH` option\n4. Any file w/ `.pem` extension in current working dir\n\nSupports both PKCS1 (i.e `-----BEGIN RSA PRIVATE KEY-----`) and PKCS8 (i.e `-----BEGIN PRIVATE KEY-----`).\n\n## Usage\n\n\u003ctable\u003e\n\u003ctbody valign=top align=left\u003e\n\u003ctr\u003e\u003cth\u003e\nBrowsers\n\u003c/th\u003e\u003ctd width=100%\u003e\n\n`@probot/get-private-key` is not compatible with browser usage\n\n\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003cth\u003e\nNode\n\u003c/th\u003e\u003ctd\u003e\n\nInstall with \u003ccode\u003enpm install @probot/get-private-key\u003c/code\u003e\n\n```js\nimport { Probot } from \"probot\";\nimport { getPrivateKey } from \"@probot/get-private-key\";\n```\n\n\u003e [!IMPORTANT]\n\u003e As we use [conditional exports](https://nodejs.org/api/packages.html#conditional-exports), you will need to adapt your `tsconfig.json` by setting `\"moduleResolution\": \"node16\", \"module\": \"node16\"`.\n\u003e\n\u003e See the TypeScript docs on [package.json \"exports\"](https://www.typescriptlang.org/docs/handbook/modules/reference.html#packagejson-exports).\u003cbr\u003e\n\u003e See this [helpful guide on transitioning to ESM](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) from [@sindresorhus](https://github.com/sindresorhus)\n\n\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n```js\nconst probot = new Probot({\n  appId: 123,\n  privateKey: getPrivateKey(),\n});\n```\n\n## Options\n\n\u003ctable\u003e\n  \u003cthead align=left\u003e\n    \u003ctr\u003e\n      \u003cth\u003e\n        name\n      \u003c/th\u003e\n      \u003cth\u003e\n        type\n      \u003c/th\u003e\n      \u003cth width=100%\u003e\n        description\n      \u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody align=left valign=top\u003e\n    \u003ctr\u003e\n      \u003cth\u003e\n        \u003ccode\u003eoptions.filepath\u003c/code\u003e\n      \u003c/th\u003e\n      \u003ctd\u003e\n        \u003ccode\u003estring\u003ccode\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n\nPass a path to a `*.pem` file. A relative path will be resolved to the current working directory (which you can set with the `cwd` option)\n\n```js\nconst privateKey = getPrivateKey({\n  filepath: \"private-key.pem\",\n});\n```\n\n\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e\n        \u003ccode\u003eoptions.cwd\u003c/code\u003e\n      \u003c/th\u003e\n      \u003ctd\u003e\n        \u003ccode\u003estring\u003ccode\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n\nDefaults to `process.cwd()`. Used to resolve the `filepath` option and used as folder to find `*.pem` files.\n\n```js\nconst privateKey = getPrivateKey({\n  cwd: \"/app/current\",\n});\n```\n\n\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003cth\u003e\n        \u003ccode\u003eoptions.env\u003c/code\u003e\n      \u003c/th\u003e\n      \u003ctd\u003e\n        \u003ccode\u003eobject\u003ccode\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n\nDefaults to `process.env`. Pass `env.PRIVATE_KEY` or `env.PRIVATE_KEY_PATH` to workaround reading environment variables\n\n```js\nconst privateKey = getPrivateKey({\n  env: {\n    PRIVATE_KEY: \"-----BEGIN RSA PRIVATE KEY-----\\n...\",\n  },\n});\n```\n\n\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n## LICENSE\n\n[ISC](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprobot%2Fget-private-key","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprobot%2Fget-private-key","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprobot%2Fget-private-key/lists"}