mirror of
https://github.com/penpot/penpot.git
synced 2025-05-06 21:15:53 +02:00
🔥 Replace clojure.spec with simple assert on tokens ns
This commit is contained in:
parent
25265cec70
commit
046ef7eb6e
1 changed files with 7 additions and 6 deletions
|
@ -8,18 +8,19 @@
|
||||||
"Tokens generation API."
|
"Tokens generation API."
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
|
[app.common.data.macros :as dm]
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.spec :as us]
|
|
||||||
[app.common.transit :as t]
|
[app.common.transit :as t]
|
||||||
[app.util.time :as dt]
|
[app.util.time :as dt]
|
||||||
[buddy.sign.jwe :as jwe]
|
[buddy.sign.jwe :as jwe]))
|
||||||
[clojure.spec.alpha :as s]))
|
|
||||||
|
|
||||||
(s/def ::tokens-key bytes?)
|
|
||||||
|
|
||||||
(defn generate
|
(defn generate
|
||||||
[{:keys [tokens-key]} claims]
|
[{:keys [tokens-key]} claims]
|
||||||
(us/assert! ::tokens-key tokens-key)
|
|
||||||
|
(dm/assert!
|
||||||
|
"expexted token-key to be bytes instance"
|
||||||
|
(bytes? tokens-key))
|
||||||
|
|
||||||
(let [payload (-> claims
|
(let [payload (-> claims
|
||||||
(assoc :iat (dt/now))
|
(assoc :iat (dt/now))
|
||||||
(d/without-nils)
|
(d/without-nils)
|
||||||
|
|
Loading…
Add table
Reference in a new issue