Get private key from a path, environment variables, or a `*.pem` file in the current working directory
npm install @probot/get-private-key> Get private key from a file path, environment variables, or a *.pem file in the current working directory


Finds a private key through various user-(un)specified methods. Order of precedence:
1. Explicit file path option
2. PRIVATE_KEY environment variable or explicit env.PRIVATE_KEY option. The private key can optionally be base64 encoded.
3. PRIVATE_KEY_PATH environment variable or explicit env.PRIVATE_KEY_PATH option
4. Any file w/ .pem extension in current working dir
Supports both PKCS1 (i.e -----BEGIN RSA PRIVATE KEY-----) and PKCS8 (i.e -----BEGIN PRIVATE KEY-----).
Browsers |
|
|---|---|
Node | Install with `` > [!IMPORTANT] |
`js`
const probot = new Probot({
appId: 123,
privateKey: getPrivateKey(),
});
name | type | description |
|---|---|---|
options.filepath | string | Pass a path to a *.pem ` |
options.cwd | string | Defaults to process.cwd() ` |
options.env | object | Defaults to process.env ` |