class SmartId::Utils::AuthenticationHash

Attributes

hash_data[R]

Public Class Methods

new(hash_data = nil) click to toggle source
# File lib/smart_id/utils/authentication_hash.rb, line 9
def initialize(hash_data = nil)
  @hash_data = hash_data || random_bytes
end

Public Instance Methods

calculate_base64_digest() click to toggle source
# File lib/smart_id/utils/authentication_hash.rb, line 17
def calculate_base64_digest
  Base64.strict_encode64(calculate_digest)
end
calculate_digest() click to toggle source
# File lib/smart_id/utils/authentication_hash.rb, line 13
def calculate_digest
  Digest::SHA256.digest(hash_data)
end

Private Instance Methods

random_bytes() click to toggle source
# File lib/smart_id/utils/authentication_hash.rb, line 23
def random_bytes
  OpenSSL::Random.random_bytes(64)
end