Skip to content

Commit 206ced7

Browse files
committed
fix(add): trim private key head and foot
1 parent 4969f10 commit 206ced7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/apple-gen-secret.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ async function signJWT(sub, iss, kid, privateKeyPath, exp) {
5959
toBase64Url(encoder.encode(JSON.stringify(payload))),
6060
]
6161

62-
const privateKey = fs.readFileSync(path.resolve(privateKeyPath), "utf8")
62+
const privateKey = fs
63+
.readFileSync(path.resolve(privateKeyPath), "utf8")
64+
.replace(/-----BEGIN PRIVATE KEY-----|\n|-----END PRIVATE KEY-----/g, "")
6365

6466
const signature = await sign(parts.join("."), privateKey)
6567

0 commit comments

Comments
 (0)