-
Notifications
You must be signed in to change notification settings - Fork 160
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 APNs with .p8 key #166
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
protected function generateJwt() { | ||
$key = openssl_pkey_get_private('file://'.$this->config['key']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to not access the file system here to avoid any complications at runtime for the following reasons:
- Directory structure can look different in other projects
- Certificates should be placed in Laravel's
/storage
folder and read from there usingstorage_path()
helper
Suggestion: Could you move the openssl_pkey_get_private
method into the config.php
file and access it from the storage path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just following the folder structure that exists nowadays.
There is the iosCertificates folder right there, I didn't place the .p8 file into the folder because it wasn't technically a certificate, but there would be no problem placing it "by default" inside a new folder. This route can be set in the config anyway, in case another project has a different structure.
@@ -26,4 +26,10 @@ | |||
'passFile' => __DIR__ . '/iosCertificates/yourKey.pem', //Optional | |||
'dry_run' => true, | |||
], | |||
'apnp8' => [ | |||
'key' => __DIR__ . '/apns-key.p8', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
openssl_pkey_get_private(storage_path('/apns-key.p8'))
Allow use of APNs keys (that doesn't expire) instead of certificates.
I added a new service, so it doesn't contain any breaking changes with the actual APN version with certificates.
All the user has to do is use the new service 'apnp8' and update the config needed for it.