convex.trust.whitelist.cvx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of convex-core Show documentation
Show all versions of convex-core Show documentation
Convex core libraries and common utilities
The newest version!
'convex.trust.whitelist
;; An Minimal scoped actor implementing immutable small whitelists
;; - Scopes are whitelists: sets of addresses considered safe
;; - Because all state is stored in the scope, this actor is super simple!
;;
;; Intention is that whitelist trust monitors can be sepcified simply as follows:
;;
;; (import convex.trust.whitelist :as allow)
;; (set-controller [allow #{#234 #256 #777}])
(import convex.trust :as trust)
(defn check-trusted?
^:callable
[subject action object]
(or (set? *scope*) (fail :ARGUMENT "Scope must be a set"))
(contains-key? *scope* subject))