gr2m / gr2m/universal-github-app-jwt

Throw helpful error if `privateKey` is set to only the first line, e.g. `-----BEGIN RSA PRIVATE KEY-----`

Open
#71 7 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
34
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Follow up to https://github.com/octokit/auth-app.js/issues/465#issuecomment-1564998327, reported by @reza-ebrahimi

The first line might be `-----BEGIN PRIVATE KEY-----` or `-----BEGIN RSA PRIVATE KEY-----`, maybe we will support other variations in future. But they all have the format `-----BEGIN * KEY-----`

I would suggest we add a check like

```js
if (/-----BEGIN * KEY-----/.test(privateKey?.trim()) {
throw new Error("privateKey only contains the first line. Try replacing line breaks with \n")
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.