mob1
parent
7713afdb38
commit
d270dfcbd0
@ -1,21 +1,17 @@
|
||||
(ns dda.c4k-common.base64
|
||||
(:import (java.util Base64))
|
||||
(:require
|
||||
[orchestra.core :refer [defn-spec]]
|
||||
[orchestra.spec.test :as st]
|
||||
[clojure.spec.alpha :as s]))
|
||||
[orchestra.core :refer [defn-spec]]))
|
||||
|
||||
|
||||
(defn-spec encode string?
|
||||
[string string?]
|
||||
[input string?]
|
||||
(.encodeToString
|
||||
(Base64/getEncoder)
|
||||
(.getBytes string "UTF-8")))
|
||||
(.getBytes input "UTF-8")))
|
||||
|
||||
(defn-spec decode string?
|
||||
[string string?]
|
||||
[input string?]
|
||||
(String.
|
||||
(.decode (Base64/getDecoder) string)
|
||||
(.decode (Base64/getDecoder) input)
|
||||
"UTF-8"))
|
||||
|
||||
(st/instrument)
|
@ -1,11 +1,13 @@
|
||||
(ns dda.c4k-common.base64
|
||||
(:require
|
||||
["js-base64" :as b64]))
|
||||
["js-base64" :as b64]
|
||||
[orchestra.core :refer-macros [defn-spec]]))
|
||||
|
||||
(defn encode
|
||||
[string]
|
||||
(.encode b64/Base64 string))
|
||||
|
||||
(defn decode
|
||||
[string]
|
||||
(.decode b64/Base64 string))
|
||||
(defn-spec encode string?
|
||||
[input string?]
|
||||
(.encode b64/Base64 input))
|
||||
|
||||
(defn-spec decode string?
|
||||
[input string?]
|
||||
(.decode b64/Base64 input))
|
||||
|
Loading…
Reference in New Issue