Class: SmartId::Utils::AuthenticationHash
- Inherits:
-
Object
- Object
- SmartId::Utils::AuthenticationHash
- Defined in:
- lib/smart_id/utils/authentication_hash.rb
Instance Attribute Summary collapse
-
#hash_data ⇒ Object
readonly
Returns the value of attribute hash_data.
Instance Method Summary collapse
- #calculate_base64_digest ⇒ Object
- #calculate_digest ⇒ Object
-
#initialize(hash_data = nil) ⇒ AuthenticationHash
constructor
A new instance of AuthenticationHash.
Constructor Details
#initialize(hash_data = nil) ⇒ AuthenticationHash
Returns a new instance of AuthenticationHash.
9 10 11 |
# File 'lib/smart_id/utils/authentication_hash.rb', line 9 def initialize(hash_data = nil) @hash_data = hash_data || random_bytes end |
Instance Attribute Details
#hash_data ⇒ Object (readonly)
Returns the value of attribute hash_data.
7 8 9 |
# File 'lib/smart_id/utils/authentication_hash.rb', line 7 def hash_data @hash_data end |
Instance Method Details
#calculate_base64_digest ⇒ Object
17 18 19 |
# File 'lib/smart_id/utils/authentication_hash.rb', line 17 def calculate_base64_digest Base64.strict_encode64(calculate_digest) end |
#calculate_digest ⇒ Object
13 14 15 |
# File 'lib/smart_id/utils/authentication_hash.rb', line 13 def calculate_digest Digest::SHA256.digest(hash_data) end |