Skip to content

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

@gr2m

Description

@gr2m

Follow up to octokit/auth-app.js#465 (comment), 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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions