using tokens now

This commit is contained in:
Anish Lakhwara 2022-06-18 18:44:29 +10:00
parent 15b952865f
commit afa54c2e5a
3 changed files with 18 additions and 19 deletions

View file

@ -1 +0,0 @@
/nix/store/g78hiahkl0j6wi51mb6vvp94f7b8lc6v-source

View file

@ -1648,3 +1648,4 @@ export TMP="$NIX_BUILD_TOP"
export TMPDIR="$NIX_BUILD_TOP"
export TEMP="$NIX_BUILD_TOP"
export TEMPDIR="$NIX_BUILD_TOP"
eval "$shellHook"

View file

@ -33,7 +33,7 @@
(clojure.string/replace "+" "-"))]
(str header "." payload "." signature))))
(let [token (generate-token (System/getenv secret-token))
(let [token (generate-token (System/getenv "token"))
data (-> (curl/get "http://links.mossnet.lan/api/v1/links?searchtags=music" {:headers {"Authorization" (str "Bearer " token)}})
(:body)
(json/parse-string true))
@ -41,13 +41,12 @@
filtered-data (mapv (filter (fn [x] (contains? "bandcamp" (get x :url)))) data)]
filtered-data)
(comment
(println "somestring")
(.getBytes (str {"iat" (sh "date" "-u" "+%s")}))
(def signature (-> (Mac/getInstance "HmacSHA256")
(.init (SecretKeySpec. (.getBytes "test secret") "HmacSHA256"))
(.doFinal (.getBytes (str "header.payload" ) "UTF-8"))))
(.doFinal (.getBytes (str "header.payload") "UTF-8"))))
(def sig
(let [algo "HmacSHA256"
mac (Mac/getInstance algo)]