mob1
This commit is contained in:
parent
7713afdb38
commit
d270dfcbd0
3 changed files with 17 additions and 19 deletions
|
@ -1,21 +1,17 @@
|
||||||
(ns dda.c4k-common.base64
|
(ns dda.c4k-common.base64
|
||||||
(:import (java.util Base64))
|
(:import (java.util Base64))
|
||||||
(:require
|
(:require
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]))
|
||||||
[orchestra.spec.test :as st]
|
|
||||||
[clojure.spec.alpha :as s]))
|
|
||||||
|
|
||||||
|
|
||||||
(defn-spec encode string?
|
(defn-spec encode string?
|
||||||
[string string?]
|
[input string?]
|
||||||
(.encodeToString
|
(.encodeToString
|
||||||
(Base64/getEncoder)
|
(Base64/getEncoder)
|
||||||
(.getBytes string "UTF-8")))
|
(.getBytes input "UTF-8")))
|
||||||
|
|
||||||
(defn-spec decode string?
|
(defn-spec decode string?
|
||||||
[string string?]
|
[input string?]
|
||||||
(String.
|
(String.
|
||||||
(.decode (Base64/getDecoder) string)
|
(.decode (Base64/getDecoder) input)
|
||||||
"UTF-8"))
|
"UTF-8"))
|
||||||
|
|
||||||
(st/instrument)
|
|
|
@ -4,11 +4,11 @@
|
||||||
[clj-yaml.core :as yaml]
|
[clj-yaml.core :as yaml]
|
||||||
[clojure.walk]
|
[clojure.walk]
|
||||||
[orchestra.core :refer [defn-spec]]
|
[orchestra.core :refer [defn-spec]]
|
||||||
[orchestra.spec.test :as st]
|
[orchestra.spec.test :as st]))
|
||||||
[clojure.spec.alpha :as s]))
|
|
||||||
|
|
||||||
|
|
||||||
(defn-spec cast-lazy-seq-to-vec map?
|
|
||||||
|
(defn-spec cast-lazy-seq-to-vec vector?
|
||||||
[lazy-seq map?]
|
[lazy-seq map?]
|
||||||
(clojure.walk/postwalk #(if (instance? clojure.lang.LazySeq %)
|
(clojure.walk/postwalk #(if (instance? clojure.lang.LazySeq %)
|
||||||
(into [] %)
|
(into [] %)
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
(ns dda.c4k-common.base64
|
(ns dda.c4k-common.base64
|
||||||
(:require
|
(:require
|
||||||
["js-base64" :as b64]))
|
["js-base64" :as b64]
|
||||||
|
[orchestra.core :refer-macros [defn-spec]]))
|
||||||
|
|
||||||
(defn encode
|
|
||||||
[string]
|
|
||||||
(.encode b64/Base64 string))
|
|
||||||
|
|
||||||
(defn decode
|
(defn-spec encode string?
|
||||||
[string]
|
[input string?]
|
||||||
(.decode b64/Base64 string))
|
(.encode b64/Base64 input))
|
||||||
|
|
||||||
|
(defn-spec decode string?
|
||||||
|
[input string?]
|
||||||
|
(.decode b64/Base64 input))
|
||||||
|
|
Loading…
Reference in a new issue