use base64 encoded private key for apns

This commit is contained in:
2025-02-11 11:46:46 -08:00
parent 9af48be746
commit ebcd35b85d
2 changed files with 7 additions and 15 deletions

View File

@@ -52,9 +52,10 @@ export class NotificationService {
const keyId = process.env.APNS_KEY_ID;
const teamId = process.env.APNS_TEAM_ID;
const privateKeyPath = process.env.APNS_KEY_PATH;
if (!privateKeyPath) return;
const privateKey = fs.readFileSync(privateKeyPath);
const privateKeyBase64 = process.env.APNS_PRIVATE_KEY;
if (!privateKeyBase64) return;
const privateKey = Buffer.from(privateKeyBase64, 'base64').toString('utf-8');
const tokenHeader = {
alg: "ES256",