diff --git a/lib/fernet/generator.rb b/lib/fernet/generator.rb index e80badd..a60f5ea 100644 --- a/lib/fernet/generator.rb +++ b/lib/fernet/generator.rb @@ -5,7 +5,6 @@ module Fernet class Generator - attr_reader :secret attr_accessor :data def initialize(secret) @@ -20,5 +19,12 @@ def generate Base64.urlsafe_encode64(JSON.dump(data.merge(signature: mac))) end + def inspect + "#" + end + alias to_s inspect + + private + attr_reader :secret end end diff --git a/lib/fernet/verifier.rb b/lib/fernet/verifier.rb index 58c2a95..03f7bcb 100644 --- a/lib/fernet/verifier.rb +++ b/lib/fernet/verifier.rb @@ -6,11 +6,11 @@ module Fernet class Verifier - attr_reader :secret, :token, :data + attr_reader :token, :data attr_writer :seconds_valid def initialize(secret) - @secret = secret + @secret = secret end def verify_token(token) @@ -22,7 +22,13 @@ def verify_token(token) signatures_match? && token_recent_enough? && custom_verification end - private + def inspect + "#" + end + alias to_s inspect + + private + attr_reader :secret def deconstruct @data = JSON.parse(Base64.decode64(token))