Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to escape newlines in p8 certs #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

peterferguson
Copy link

When trying to deploy on fly I was facing an issue with the reading of the apns .p8 cert.

I couldn't find a good way to securely store the cert so it could be read in the application so that just leaves an env var.

However when you do the naive thing setting APNS_P8_CERTIFICATE to the .p8 file contents the server will fail with an error initing client.Production()

This pr allows the user to set the env by explicitly escaping the newlines:

If the .p8 cert is

"-----BEGIN PRIVATE KEY-----
flkdflkdf...
-----END PRIVATE KEY-----"

then you can set the env var as follows

APNS_P8_CERTIFICATE="-----BEGIN PRIVATE KEY-----\nflkdflkdf...\n-----END PRIVATE KEY-----"

If I am just missing a better way to do this please let me know 🙏

Copy link
Contributor

@nplasterer nplasterer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a fine fix to me. Just seeing if @zombieobject who is more familiar with iOS has any thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants