Class: Authkeeper::Providers::Telegram
- Inherits:
-
Object
- Object
- Authkeeper::Providers::Telegram
- Defined in:
- app/services/authkeeper/providers/telegram.rb
Constant Summary collapse
- REQUIRED_FIELDS =
%i[id hash].freeze
- HASH_FIELDS =
%i[auth_date first_name id last_name photo_url username].freeze
- SECONDS_IN_DAY =
86_400
Instance Method Summary collapse
Instance Method Details
#call(params: {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/services/authkeeper/providers/telegram.rb', line 13 def call(params: {}) return { errors: ['Required field is missing'] } unless required_fields_valid?(params) return { errors: ['Signature mismatch'] } unless signature_valid?(params) return { errors: ['Session expired'] } if session_expired?(params) { result: { uid: params[:id].to_s, provider: 'telegram', login: params[:username] } } end |