 
 (defn revoke-cap
   "Revokes a capability."
-  [cap {store :store kdf :kdf}]
+  [cap {:keys [store kdf]}]
   (let [{index :index} (crypto/derive kdf cap)
         chan (delete! store index)]
     (async/into {} chan)))


(defn execute-cap
  "Executes a capability."
  [cap {store :store kdf :kdf scheme :scheme}]
  (let [{index :index cap-key :cap-key} (crypto/derive kdf cap)
        blob (<!! (retrieve store index))
        encoded-plan (crypto/decrypt scheme cap-key blob)
        plan (spy (nippy/thaw encoded-plan))


(defn create-cap
  "Creates a capability."
  [plan {:keys [store kdf scheme]}]
  (let [error (spy (check-plan plan))]
    (if (nil? error)
      (let [cap (crypto/make-cap)
            {:keys [index cap-key]} (crypto/derive kdf cap)
            encoded-plan (nippy/freeze plan)
            blob (crypto/encrypt scheme cap-key encoded-plan)
            ch (create! store index blob)]
