From 908f028322f90c8ae8d9ea3d38c77d253560eaa4 Mon Sep 17 00:00:00 2001 From: Luka Vandervelden Date: Fri, 28 Jun 2019 18:20:34 +0200 Subject: [PATCH] Update to new crystal-jwt APIs. --- src/authd.cr | 3 +-- src/main.cr | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/authd.cr b/src/authd.cr index 8d91f3f..ece20ed 100644 --- a/src/authd.cr +++ b/src/authd.cr @@ -119,7 +119,7 @@ module AuthD end def decode_token(token) - user, meta = JWT.decode token, @key, "HS256" + user, meta = JWT.decode token, @key, JWT::Algorithm::HS256 user = AuthD::User.from_json user.to_json @@ -135,7 +135,6 @@ module AuthD response = read - pp! response.type payload = String.new response.payload case ResponseTypes.new response.type.to_i when ResponseTypes::Ok diff --git a/src/main.cr b/src/main.cr index 31a4546..62639ce 100644 --- a/src/main.cr +++ b/src/main.cr @@ -58,7 +58,6 @@ IPC::Service.new "auth" do |event| when IPC::Event::Message message = event.message payload = message.payload - pp message case RequestTypes.new message.type.to_i when RequestTypes::GetToken @@ -79,7 +78,7 @@ IPC::Service.new "auth" do |event| end client.send ResponseTypes::Ok.value.to_u8, - JWT.encode user.to_h, authd_jwt_key, "HS256" + JWT.encode user.to_h, authd_jwt_key, JWT::Algorithm::HS256 when RequestTypes::AddUser begin request = AddUserRequest.from_json String.new payload