             [net.cgrand.enlive-html :as html]
             [salava.core.util :as u]
             [salava.core.http :as http]
+            [salava.core.helper :refer [dump]]
             [schema.core :as s])
   (:import (ar.com.hjg.pngj PngReader)
            (java.io StringReader)))

                                                  :ctime now
                                                  :mtime now}]
                   ;; list of evidences
                   (coll? (:evidence assertion)) (mapv #({:id nil
                                                            :user_badge_id nil
                                                            :url (:id %)
                                                            :narrative (:narrative %)
                                                            :name (:name %)
                                                            :description (:description %)
                                                            :genre (:genre %)
                                                            :audience (:audience %)
                                                            :ctime now
                                                            :mtime now}) (:evidence assertion))
                   :else [])

        badge  (if (map? (:badge assertion)) (:badge assertion) (http/json-get (:badge assertion)))

(defmethod verify-assertion :v2.0 [url asr]
  (let [kind (get-in asr [:verify :type] (get-in asr [:verification :type]))]
    (when (and (not (nil? url)) (or (= kind "hosted") (= kind "HostedBadge")))
      (if (and (not= (:id asr) url) (not (string/includes? url (:id asr))))
        (throw (IllegalArgumentException. "invalid assertion, verify url mismatch")))
      (if (map? (:badge asr))
        (if (not= (domain (get-in asr [:badge :id])) (domain (:id asr)))
