appleboy / gorush

A push notification server written in Go (Golang).
MIT License
8.06k stars 842 forks source link

Add .p8 support for APNS? #247

Closed reaperdtme closed 7 years ago

reaperdtme commented 7 years ago

Apple has new .p8 certificate. One cert for all applications. Can we get support for this?

appleboy commented 7 years ago

@zaiddag Could you use token-based authentication as an alternative to using provider certificates to connect to APNs or something else?

How do you create certificate with extension .p8?

reaperdtme commented 7 years ago

@appleboy Yes. Yes you can. You can make them in Apple's developer console. It uses JWT.

Here's our fork of Apns2 that uses p8 for Apple auth. https://github.com/unmute/apns2

It looks like Apns2 had the feature ~ 8 months ago but did not release it. It's sitting on the feature-auth-token branch here: https://github.com/sideshow/apns2/tree/feature-auth-token

But, Apns2 is on a block actually: https://github.com/sideshow/apns2/pull/43

Waiting on support for MAX_CONNECTIONS

reaperdtme commented 7 years ago

Looks like Go 1.9 will have the Http2 fix

appleboy commented 7 years ago

@zaiddag maybe we should wait @sideshow merge this https://github.com/sideshow/apns2/pull/43 PR.

sideshow commented 7 years ago

@appleboy @zaiddag re: sideshow/apns2#43 Correct, its still blocked due to support for MAX_CONNECTIONS I am considering merging this anyway and documenting as a known issue, because for most people this will still work well. Its only those who are flooding the connection when it opens that will have an issue

appleboy commented 7 years ago

I will implement this feature this week.

appleboy commented 7 years ago

@kidcosmic Implementation in https://github.com/appleboy/gorush/pull/300

changes from config.yml

ios:
  enabled: false
  key_path: "key.pem"
  password: "" # certificate password, default as empty string.
  production: false
  max_retry: 0 # resend fail notification, default value zero is disabled
+ key_id: "" # KeyID from developer account (Certificates, Identifiers & Profiles -> Keys)
+ team_id: "" # TeamID from developer account (View Account -> Membership)

update key_path as your .p8 file and add Key ID and Team ID from Apple