Class: Lorkhan::ProviderToken
- Inherits:
-
Object
- Object
- Lorkhan::ProviderToken
- Defined in:
- lib/lorkhan/provider_token.rb
Overview
Wrapper for creating the authentication token for communicating with Apple’s servers.
See the “Provider Authentication Tokens” from Apple’s “Local and Remote Notification Programming Guide” developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingwithAPNs.html#//apple_ref/doc/uid/TP40008194-CH11-SW1
Constant Summary collapse
- ALGORITHM =
'ES256'.freeze
Instance Method Summary collapse
- #encode ⇒ Object
-
#initialize(key_id:, team_id:, secret:) ⇒ ProviderToken
constructor
Create a new token.
Constructor Details
#initialize(key_id:, team_id:, secret:) ⇒ ProviderToken
Create a new token
key_id: An alphanumeric string obtained from the developer portal. team_id: The team id for your developer account. Obtained from the developer portal. secret: The content of the Authentication Token key file obtained from the developer portal.
21 22 23 24 25 |
# File 'lib/lorkhan/provider_token.rb', line 21 def initialize(key_id:, team_id:, secret:) @key_id = key_id @team_id = team_id @secret = secret end |
Instance Method Details
#encode ⇒ Object
27 28 29 |
# File 'lib/lorkhan/provider_token.rb', line 27 def encode JWT.encode(payload, p_key, ALGORITHM, headers) end |