Class: RosettAi::Licensing::LicenseValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/rosett_ai/licensing/license_validator.rb

Overview

Orchestrates the full license validation flow: load from store -> decode -> verify signature -> check expiry.

Returns a structured result hash. Never raises for expected states (missing license, expired subscription).

Instance Method Summary collapse

Instance Method Details

#validateHash{Symbol => Object}

Runs the full license validation flow.

Returns:

  • (Hash{Symbol => Object})

    result with :valid, :tier, :warnings, :errors keys



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rosett_ai/licensing/license_validator.rb', line 17

def validate
  store = LicenseStore.new
  return community_result unless store.exists?

  raw_key = store.load
  return community_result if raw_key.nil? || raw_key.empty?

  validate_key(raw_key)
rescue RosettAi::LicenseError => e
  error_result(e.message)
end