lib/fernet/verifier.rb in fernet-1.5 vs lib/fernet/verifier.rb in fernet-1.6
- old
+ new
@@ -1,6 +1,7 @@
require 'base64'
+require 'yajl'
require 'openssl'
require 'date'
module Fernet
class Verifier
@@ -41,15 +42,15 @@
def deconstruct
parts = @token.split('|')
if decrypt?
encrypted_data, iv, @received_signature = *parts
- @data = Fernet::OkJson.decode(decrypt!(encrypted_data, Base64.urlsafe_decode64(iv)))
+ @data = Yajl::Parser.parse(decrypt!(encrypted_data, Base64.urlsafe_decode64(iv)))
signing_blob = "#{encrypted_data}|#{iv}"
else
encoded_data, @received_signature = *parts
signing_blob = encoded_data
- @data = Fernet::OkJson.decode(Base64.urlsafe_decode64(encoded_data))
+ @data = Yajl::Parser.parse(Base64.urlsafe_decode64(encoded_data))
end
@regenerated_mac = OpenSSL::HMAC.hexdigest('sha256', signing_blob, signing_key)
end
def token_recent_enough?