lib/twilio-ruby/util/access_token.rb in twilio-ruby-4.8.0 vs lib/twilio-ruby/util/access_token.rb in twilio-ruby-4.8.1.edge

- old
+ new

@@ -1,22 +1,14 @@ module Twilio module Util class AccessToken - attr_accessor :account_sid, - :signing_key_id, - :secret, - :ttl, - :identity, - :nbf - - def initialize(account_sid, signing_key_id, secret, ttl=3600, identity=nil, nbf=nil) + def initialize(account_sid, signing_key_id, secret, ttl=3600, identity=nil) @account_sid = account_sid @signing_key_sid = signing_key_id @secret = secret @ttl = ttl @identity = identity - @nbf = nbf @grants = [] end def add_grant(grant) @grants.push(grant) @@ -38,14 +30,13 @@ payload = { 'jti' => "#{@signing_key_sid}-#{now}", 'iss' => @signing_key_sid, 'sub' => @account_sid, + 'nbf' => now, 'exp' => now + @ttl, 'grants' => grants } - payload['nbf'] = @nbf unless @nbf.nil? - JWT.encode payload, @secret, algorithm, headers end def to_s to_jwt