universal-github-app-jwt
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -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 @@ }); |
{ | ||
"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, | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30537
428