Class: Masks::Rails::Device

Inherits:
ApplicationRecord show all
Defined in:
app/models/masks/rails/device.rb

Instance Method Summary collapse

Instance Method Details

#known?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/masks/rails/device.rb', line 18

def known?
  session.device&.known?
end

#reset_versionObject



26
27
28
# File 'app/models/masks/rails/device.rb', line 26

def reset_version
  self.version = SecureRandom.hex
end

#session_keyObject



22
23
24
# File 'app/models/masks/rails/device.rb', line 22

def session_key
  Digest::SHA512.hexdigest([key, version].join("-"))
end