Socket
Socket
Sign inDemoInstall

universal-github-app-jwt

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-github-app-jwt - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

6

index.js

@@ -15,2 +15,6 @@ // @ts-check

}) {
// Private keys are often times configured as environment variables, in which case line breaks are escaped using `\\n`.
// Replace these here for convenience.
const privateKeyWithNewlines = privateKey.replace(/\\n/g, '\n');
// When creating a JSON Web Token, it sets the "issued at time" (iat) to 30s

@@ -30,3 +34,3 @@ // in the past as we have seen people running situations where the GitHub API

const token = await getToken({
privateKey,
privateKey: privateKeyWithNewlines,
payload,

@@ -33,0 +37,0 @@ });

4

package.json
{
"name": "universal-github-app-jwt",
"type": "module",
"version": "2.1.0",
"version": "2.1.1",
"exports": "./index.js",

@@ -44,3 +44,3 @@ "imports": {

"prettier": "^3.0.0",
"tsd": "^0.30.0",
"tsd": "^0.31.0",
"typescript": "^5.0.0"

@@ -47,0 +47,0 @@ },

@@ -104,3 +104,3 @@ # universal-github-app-jwt

<td>
<strong>Required</strong>. Content of the <code>*.pem</code> file you downloaded from the app’s about page. You can generate a new private key if needed. Make sure to preserve the line breaks.
<strong>Required</strong>. Content of the <code>*.pem</code> file you downloaded from the app’s about page. You can generate a new private key if needed. Make sure to preserve the line breaks. If your private key contains escaped newlines (`\\n`), they will be automatically replaced with actual newlines.
</td>

@@ -107,0 +107,0 @@ </tr>

@@ -165,1 +165,16 @@ import test from "ava";

});
test("Replace escaped line breaks with actual linebreaks", async (t) => {
MockDate.set(0);
const result = await githubAppJwt({
id: APP_ID,
privateKey: PRIVATE_KEY_PKCS8.replace(/\n/g, "\\n"),
});
t.deepEqual(result, {
appId: APP_ID,
expiration: 570,
token: BEARER,
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc