Class: Fernet::Verifier
- Inherits:
-
Object
- Object
- Fernet::Verifier
- Defined in:
- lib/fernet/verifier.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#seconds_valid ⇒ Object
writeonly
Sets the attribute seconds_valid.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(secret) ⇒ Verifier
constructor
A new instance of Verifier.
- #verify_token(token) ⇒ Object
Constructor Details
#initialize(secret) ⇒ Verifier
Returns a new instance of Verifier.
12 13 14 |
# File 'lib/fernet/verifier.rb', line 12 def initialize(secret) @secret = secret end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/fernet/verifier.rb', line 9 def data @data end |
#seconds_valid=(value) ⇒ Object (writeonly)
Sets the attribute seconds_valid
10 11 12 |
# File 'lib/fernet/verifier.rb', line 10 def seconds_valid=(value) @seconds_valid = value end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
9 10 11 |
# File 'lib/fernet/verifier.rb', line 9 def secret @secret end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
9 10 11 |
# File 'lib/fernet/verifier.rb', line 9 def token @token end |
Instance Method Details
#verify_token(token) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/fernet/verifier.rb', line 16 def verify_token(token) @token = token deconstruct custom_verification = yield self signatures_match? && token_recent_enough? && custom_verification end |