2023-02-10 09:51:53 +01:00
|
|
|
require "uuid"
|
|
|
|
require "option_parser"
|
|
|
|
require "openssl"
|
|
|
|
require "colorize"
|
|
|
|
require "jwt"
|
|
|
|
require "grok"
|
2018-09-22 21:42:21 +02:00
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
require "dodb"
|
|
|
|
require "ipc"
|
2023-02-09 17:55:34 +01:00
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
require "baguette-crystal-base"
|
2023-02-09 17:55:34 +01:00
|
|
|
|
2023-06-11 18:59:41 +02:00
|
|
|
# In any message, a user can be referred by its Int32 uid or its login.
|
|
|
|
alias UserID = Int32 | String
|
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
# Allows get configuration from a provided file.
|
|
|
|
# See Baguette::Configuration::Base.get
|
|
|
|
class Baguette::Configuration
|
|
|
|
class Auth < IPC
|
|
|
|
include YAML::Serializable
|
2023-02-09 17:55:34 +01:00
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
property login : String? = nil
|
|
|
|
property pass : String? = nil
|
|
|
|
property shared_key : String = "nico-nico-nii" # Default authd key, as per the specs. :eyes:
|
|
|
|
property shared_key_file : String? = nil
|
2023-02-09 17:55:34 +01:00
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
def initialize
|
2023-02-09 17:55:34 +01:00
|
|
|
end
|
|
|
|
end
|
2020-12-04 00:08:24 +01:00
|
|
|
end
|
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
# Token and user classes.
|
|
|
|
require "./authd/token.cr"
|
|
|
|
require "./authd/user.cr"
|
2020-10-31 00:46:14 +01:00
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
# Requests and responses.
|
|
|
|
require "./authd/exceptions"
|
2023-02-09 17:55:34 +01:00
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
# Requests and responses.
|
|
|
|
require "./network"
|
2020-07-14 17:48:16 +02:00
|
|
|
|
2023-02-10 09:51:53 +01:00
|
|
|
# Functions to request the authd server.
|
|
|
|
require "./authd/client.cr"
|