Class: SmartId::Utils::AuthenticationHash

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_id/utils/authentication_hash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_dataObject (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_digestObject



17
18
19
# File 'lib/smart_id/utils/authentication_hash.rb', line 17

def calculate_base64_digest
  Base64.strict_encode64(calculate_digest)
end

#calculate_digestObject



13
14
15
# File 'lib/smart_id/utils/authentication_hash.rb', line 13

def calculate_digest
  Digest::SHA256.digest(hash_data)
end