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

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

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

  "Convert octets to String."
  ([data]
   (bytes->str data "UTF-8"))
  ([^bytes data, ^String encoding]
   (String. data encoding)))

(defn bytes->hex
  "Convert a byte array to hex
  encoded string."
  [^bytes data]
  (Hex/encodeHexString data))

(defn hex->bytes
