lib/fernet/generator.rb in fernet-0.0.1 vs lib/fernet/generator.rb in fernet-0.0.2
- old
+ new
@@ -3,11 +3,10 @@
require 'openssl'
require 'date'
module Fernet
class Generator
- attr_reader :secret
attr_accessor :data
def initialize(secret)
@secret = secret
end
@@ -18,7 +17,14 @@
mac = OpenSSL::HMAC.hexdigest('sha256', JSON.dump(data), secret)
Base64.urlsafe_encode64(JSON.dump(data.merge(signature: mac)))
end
+ def inspect
+ "#<Fernet::Generator @secret=[masked] @data=#{@data.inspect}>"
+ end
+ alias to_s inspect
+
+ private
+ attr_reader :secret
end
end