Search code examples
node.jsopensslapple-push-notificationsonesignal

Convert p12 APNS certificate to base64 string


I want to send the .p12 file of APNS certificate to One Signal API, but I need first to convert the .p12 file to base64 string. How do I do that? The API documentation is below: https://documentation.onesignal.com/reference#create-an-app


Solution

  • new Buffer(fs.readFileSync(__dirname + "/ios_push_certificate.p12")).toString('base64')
    

    That is the correct script after all.