Authd adapted to libipc version 0.7.

authc
Karchnu 2020-07-14 17:48:16 +02:00
parent 28c30b110d
commit fc0939a1cd
1 changed files with 17 additions and 13 deletions

View File

@ -169,12 +169,6 @@ class AuthD::Response
end end
end end
class IPC::Context
def send(fd, response : AuthD::Response)
send fd, response.type.to_u8, response.to_json
end
end
class AuthD::Request class AuthD::Request
include JSON::Serializable include JSON::Serializable
@ -369,12 +363,6 @@ class AuthD::Request
end end
end end
class IPC::Context
def send(fd, request : AuthD::Request)
send fd, request.type.to_u8, request.to_json
end
end
module AuthD module AuthD
class Client < IPC::Client class Client < IPC::Client
property key : String property key : String
@ -422,7 +410,7 @@ module AuthD
end end
def send(type : Request::Type, payload) def send(type : Request::Type, payload)
send type.value.to_u8, payload send @server_fd, type.value.to_u8, payload
end end
def decode_token(token) def decode_token(token)
@ -586,3 +574,19 @@ module AuthD
end end
end end
class IPC::Context
def send(fd, response : AuthD::Response)
send fd, response.type.to_u8, response.to_json
end
end
class IPC::Client
def send(request : AuthD::Request)
unless (fd = @server_fd).nil?
send fd, request.type.to_u8, request.to_json
else
raise "Client not connected to the server"
end
end
end