 (defn bytes->base64
   "Encode a bytes array to base64
 and return utf8 string."
-  [#^bytes data]
+  [^bytes data]
   (Base64/encodeBase64URLSafeString data))
 
 (defn bytes->bbase64
   "Encode a bytes array to base64 and
 return bytearray."
-  [#^bytes data]
+  [^bytes data]
   (Base64/encodeBase64URLSafe data))
 
 (defn base64->bytes
   "Decode from base64 to bytes."
-  [s]
+  [^String s]
   (Base64/decodeBase64 s))
 
 (defn str->base64

  [^String s]
  (String. (base64->bytes s) "UTF8"))

(defn str->sefebase64
  "Given a string, convert it to completely
urlsafe base64 version."
  [^String s]
  (-> (str->base64 s)
      (str/replace #"\s" "")
      (str/replace "=" "")
      (str/replace "+" "-")

      (str/replace "_" "/")
      (base64->str)))

(defn safebase64->bytes
  "Given urlsafe base64 string decode it to bytes."
  [^String s]
  (-> (case (mod (count s) 4)
        2 (str s "==")
        3 (str s "=")
        s)
      (str/replace "-" "+")
      (str/replace "_" "/")
      (base64->bytes)))

(defprotocol ByteArray
  "Facility for convert input parameters
to bytes array with default implementation
