-
Notifications
You must be signed in to change notification settings - Fork 52
[WIP] Support Provider Authentication Tokens (JWT) #88
base: master
Are you sure you want to change the base?
Conversation
based on these slides https://developer.apple.com/videos/play/wwdc2016/724/ #63
> JWT authentication token is invalid
REFUSED_STREAM > When you connect to APNs without a provider certificate, only one stream is allowed on the connection until you send a push message with valid token.
for work in progress example
I have a signing key, which is a Same token for all apps on a Team. The signing key doesn't expire.
Presumably a JWT library will take care of this, but can also look at https://github.com/gtank/cryptopasta. tokens can be reused but need to be periodically regenerated:
But not too often
403 MissingProviderToken, InvalidProviderToken, ExpiredProviderToken |
Current coverage is 53.68% (diff: 11.11%)@@ master #88 diff @@
==========================================
Files 11 11
Lines 308 326 +18
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 173 175 +2
- Misses 116 132 +16
Partials 19 19
|
For concurrent use, it would be useful to have access to maxConcurrentStreams golang/go#17265 instead of guessing how many workers to use (1, 500, something else).
Blocking when Transport hits max concurrent streams could prevent the error situations, whether in x/net/http2 or Buford. golang/go#13774 Still would be guessing at the optimal number of workers (500?). |
This is blocked on the same thing as apns2: |
golang/go#13774 has been closed, I wonder if this is solvable now? I don't have a lot of the context on the literals of what's required to support JWT here yet, but I do have a fair amount of demand signal for this in my use-case - could you let me know if this is something you might continue work on in the nearish future (or if something is still blocking it)? Otherwise I'll probably work to try to carve out time to get up to speed and implement this in the next few months. Thank you! |
APNS2 maintainer has merged something similar to this: regards |
Sorry for the lack of maintenance and responsiveness on this. The client that was sponsoring this work decided to use Elixir for their project instead, so it hasn't received much attention. Happy to look at a fresh pull request if someone has a chance to fully implement this. |
Related: golang/go#27753 https://go-review.googlesource.com/c/net/+/151857/ "http2: revert Transport's strict interpretation of MAX_CONCURRENT_STREAMS" |
continuing from #66 to solve #63.
Provider Authentication Tokens documentation is now public. https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/APNsProviderAPI.html#//apple_ref/doc/uid/TP40008194-CH101-SW21