Package Exports
- @probot/get-private-key
- @probot/get-private-key/dist-node/index.js
- @probot/get-private-key/dist-web/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@probot/get-private-key) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@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:
- Explicit file path option
PRIVATE_KEY
environment variable or explicitenv.PRIVATE_KEY
option. The private key can optionally be base64 encoded.PRIVATE_KEY_PATH
environment variable or explicitenv.PRIVATE_KEY_PATH
option- 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-----
).
Usage
Browsers |
|
---|---|
Node |
Install with const { Probot } = require("probot");
const { getPrivateKey } = require("@probot/get-private-key"); |
const probot = new Probot({
appId: 123,
privateKey: getPrivateKey(),
});
Options
name | type | description |
---|---|---|
options.filepath
|
string |
Pass a path to a const privateKey = getPrivateKey({
filepath: "private-key.pem",
}); |
options.cwd
|
string |
Defaults to const privateKey = getPrivateKey({
cwd: "/app/current",
}); |
options.env
|
object |
Defaults to const privateKey = getPrivateKey({
env: {
PRIVATE_KEY: "-----BEGIN RSA PRIVATE KEY-----\n...",
},
}); |