From e72f864ee96ff691f4bae0a7cdab2cc8b1c478cd Mon Sep 17 00:00:00 2001 From: "mathieu.brunot" Date: Sun, 17 Feb 2019 19:04:07 +0100 Subject: [PATCH] :bug: Fix secret hash size to match JWT tokens --- backend/src/uxbox/config.clj | 2 +- backend/src/uxbox/util/response.clj | 2 +- backend/src/uxbox/util/token.clj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/uxbox/config.clj b/backend/src/uxbox/config.clj index c49969108d..2e65dfbb1f 100644 --- a/backend/src/uxbox/config.clj +++ b/backend/src/uxbox/config.clj @@ -77,7 +77,7 @@ (when-not secret (ex/raise :code ::missing-secret-key :message "Missing `:secret` key in config.")) - (hash/blake2b-512 secret))) + (hash/blake2b-256 secret))) (defstate secret :start (initialize-secret config)) diff --git a/backend/src/uxbox/util/response.clj b/backend/src/uxbox/util/response.clj index 1ca733bb78..4ecf79dae9 100644 --- a/backend/src/uxbox/util/response.clj +++ b/backend/src/uxbox/util/response.clj @@ -27,7 +27,7 @@ (defn digest [^bytes data] - (-> (hash/blake2b-512 data) + (-> (hash/blake2b-256 data) (b64/encode true) (codecs/bytes->str))) diff --git a/backend/src/uxbox/util/token.clj b/backend/src/uxbox/util/token.clj index 5fb993729f..605c9af1f6 100644 --- a/backend/src/uxbox/util/token.clj +++ b/backend/src/uxbox/util/token.clj @@ -17,7 +17,7 @@ using urlsafe variant of base64." [] (-> (nonce/random-bytes 1024) - (hash/blake2b-512) + (hash/blake2b-256) (b64/encode true) (codecs/bytes->str)))