class ApnsGatling::Token

Attributes

auth_key_id[R]
ecdsa_key[R]
team_id[R]

Public Class Methods

new(team_id, auth_key_id, ecdsa_key) click to toggle source
# File lib/apns_gatling/jwt_token.rb, line 7
def initialize(team_id, auth_key_id, ecdsa_key)
  @team_id = team_id
  @auth_key_id = auth_key_id
  @ecdsa_key = ecdsa_key
end

Public Instance Methods

new_token() click to toggle source
# File lib/apns_gatling/jwt_token.rb, line 13
def new_token
  payload = {iss: @team_id, iat: Time.now.to_i}
  header = {kid: @auth_key_id}
  JWT.encode payload, @ecdsa_key, 'ES256', header
end