-self | #10 | nil |
add-trusted-upgrade | (fn [config] (let [root (cond (:root %0) *result* *address*) ] (list do (list def trust #10/-self) (list def upgradable-root %1) (defn change-control ^{:callable true} [controller] (or ((lookup trust trusted?) upgradable-root *caller* :control *address*) (fail :TRUST "Not allowed to update controller")) (cond (nil? *scope*) (def upgradable-root controller) (fail :ARGUMENT "Unexpected non-nil scope"))) (defn upgrade ^{:callable true} [code] (if ((lookup trust trusted?) upgradable-root *caller* :upgrade *address*) (eval code) (fail :TRUST "No access to upgrade capability!")))))) | ["Creates deployable code for an upgradable actor where any arbitrary code can be executed." "An optional configuration map may be provided:" "- `:root`, address that can execute arbitrary code in the actor (defaults to `*address*`)" "Meant to be used wisely."] |
trusted? | (fn ([monitor subject] (recur %0 %1 nil nil)) ([monitor subject action] (recur %0 %1 %2 nil)) ([monitor subject action object] (cond (callable? %0 check-trusted?) (query (call* %0 0 check-trusted? %1 %2 %3)) (address? %0) (= %0 %1) false))) | ["Returns true if `subject` is trusted by `trust-monitor`, false otherwise." "A trust monitor is an (optionally scoped) address, pointing to either:" "- A user account (that can only trust itself)" "- An actor implementing `(check-trusted? subject action object)` which returns true or false." "`action` and `object` are arbitrary values specific to the trust monitor." "`subject` should usually be an address, although this is specific to the trust monitor as well."] |
change-control | (fn [path controller] (do (call* %0 0 change-control %1) :OK)) | ["Sets a controller for an entity (possibly scoped). Controller may be any trust monitor. Typically requires trust from the existing controller, for an action of :control."] |
remove-upgradability! | (fn [actor] (do (call* %0 0 upgrade (do (undef upgrade) (undef upgradable-root))) nil)) | ["Removes upgradability from an actor, previously added using `add-trusted-upgrade`." "Cannot be undone, meant to be used wisely after considering all implications."] |
trust-monitor? | (fn [x] (callable? %0 check-trusted?)) | "Does `x` look like a trust monitor?" |
add-controller | (fn ([] (recur *address*)) ([cont] (list set-controller %0))) | ["Creates deployable code to add a controller to an actor."] |