{"id":21038668,"url":"https://github.com/degree9/covenant","last_synced_at":"2025-08-11T19:15:37.935Z","repository":{"id":88498060,"uuid":"114848067","full_name":"degree9/covenant","owner":"degree9","description":"Access Control and Data Validation for Clojure(Script) written in Clojure Spec.","archived":false,"fork":false,"pushed_at":"2018-11-10T06:17:05.000Z","size":56,"stargazers_count":7,"open_issues_count":8,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-09T16:57:45.998Z","etag":null,"topics":["abac","access-control","acl","clojure","clojurescript","covenant","data-validation","rbac"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/degree9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-12-20T05:49:11.000Z","updated_at":"2020-10-06T13:38:24.000Z","dependencies_parsed_at":"2024-01-23T21:34:49.380Z","dependency_job_id":null,"html_url":"https://github.com/degree9/covenant","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degree9%2Fcovenant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degree9%2Fcovenant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degree9%2Fcovenant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/degree9%2Fcovenant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/degree9","download_url":"https://codeload.github.com/degree9/covenant/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225361715,"owners_count":17462294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abac","access-control","acl","clojure","clojurescript","covenant","data-validation","rbac"],"created_at":"2024-11-19T13:34:04.160Z","updated_at":"2024-11-19T13:34:04.844Z","avatar_url":"https://github.com/degree9.png","language":"Clojure","funding_links":["https://www.patreon.com/degree9"],"categories":[],"sub_categories":[],"readme":"# Covenant\n\n[![Clojars Project](https://img.shields.io/clojars/v/degree9/covenant.svg)](https://clojars.org/degree9/covenant)\n[![Dependencies Status](https://versions.deps.co/degree9/covenant/status.svg)](https://versions.deps.co/degree9/covenant)\n[![Downloads](https://versions.deps.co/degree9/covenant/downloads.svg)](https://versions.deps.co/degree9/covenant)\n[![CircleCI](https://circleci.com/gh/degree9/covenant/tree/master.svg?style=shield)](https://circleci.com/gh/degree9/covenant/tree/master)\n\u003c!-- [![Medium](https://img.shields.io/badge/medium-read-blue.svg)](https://medium.com/degree9/boot-covenant-e1453826b732) --\u003e\n\nAccess Control and Data Validation for Clojure(Script) written in Clojure Spec.\n\n\u003e A covenant, is a solemn promise to engage in or refrain from a specified action. - [Wikipedia](https://en.wikipedia.org/wiki/Covenant_(law))\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://degree9.io\" align=\"center\"\u003e\n    \u003cimg width=\"135\" src=\"http://degree9.io/images/degree9.png\"\u003e\n  \u003c/a\u003e\n  \u003cbr\u003e\n  \u003cb\u003eCovenant is developed and maintained by Degree9\u003c/b\u003e\n\u003c/p\u003e\n\n---\n\nCovenant is divided into a few namespaces:\n- `covenant.core` ICovenant protocol and public api.\n- `covenant.schema` type/value based data comparison on top of clojure.spec.\n- `covenant.acl` provides covenants around Access Control List's (ACL).\n- `covenant.rbac` provides covenants around Role Based Access Control (RBAC).\n- `covenant.abac` provides covenants around Attribute Based Access Control (ABAC).\n\n## Usage ##\n\n### `ICovenant` Protocol\n\nCovenant exposes a protocol that closely matches cljs native spec.\n\n```clojure\n(defprotocol ICovenant\n  \"Provides an abstraction for validating data using clojure.spec based on a covenant.\"\n  (assert   [covenant data] \"See clojure.spec/assert.\")\n  (conform  [covenant data] \"See clojure.spec/conform.\")\n  (explain  [covenant data] \"See clojure.spec/explain.\")\n  (problems [covenant data] \"See clojure.spec/explain-data.\")\n  (validate [covenant data] \"See clojure.spec/valid?.\")\n  (spec     [covenant]      \"Returns related spec for `covenant`.\"))\n```\n\nThe `spec` function will return a spec based on the passed data.\n\nA simple example is that `(covenant.core/spec nil)` will return\n`:covenant.core/nil` which is preregistered with spec as\n`(clojure.spec.alpha/def :covenant.core/nil nil?)`.\n\nScalar primitives simply return a spec/predicate based on their data type while\ncollections also compare their contents.\n\n### RBAC\n\n`covenant.rbac` provides validation fns that are \"loose\" for collections.\n\nIf some values in the passed collection (deep) matches the passed covenant then\n`covenant.core/validate` returns `true` after `covenant.rbac` has been required.\n\n```clojure\n(require 'covenant.rbac)\n(covenant.core/validate {:roles [:admin :editor]} {:roles [:admin]}) ; true\n(covenant.core/validate {:roles [:admin :editor]} {:roles [:admin :editor]}) ; true\n(covenant.core/validate {:roles [:admin :editor]} {:roles [:editor]}) ; true\n(covenant.core/validate {:roles [:admin :editor]} {:roles []}) ; false\n(covenant.core/validate {:roles [:admin :editor]} {:roles [:foo]}) ; false\n```\n\n### Examples\n\n`(:require covenant.core :as covenant)`\n\nFor more examples check out the test suite.\n\nA vanilla spec + scalar primitive will pass `covenant/explain`.\n\n```clojure\n(covenant/explain :covenant.core/number 1)\n; =\u003e\n;Success!\n```\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.patreon.com/degree9\" align=\"center\"\u003e\n    \u003cimg src=\"https://c5.patreon.com/external/logo/become_a_patron_button@2x.png\" width=\"160\" alt=\"Patreon\"\u003e\n  \u003c/a\u003e\n  \u003cbr\u003e\n  \u003cb\u003eSupport this and other open-source projects on Patreon!\u003c/b\u003e\n\u003c/p\u003e\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegree9%2Fcovenant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdegree9%2Fcovenant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdegree9%2Fcovenant/lists"}