Skip to content

Conversation

@ASacanell
Copy link

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.

}

protected function generateJwt() {
$key = openssl_pkey_get_private('file://'.$this->config['key']);
Copy link
Collaborator

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 using storage_path() helper

Suggestion: Could you move the openssl_pkey_get_private method into the config.php file and access it from the storage path?

Copy link
Author

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.

'dry_run' => true,
],
'apnp8' => [
'key' => __DIR__ . '/apns-key.p8',
Copy link
Collaborator

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'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants