Git Product home page Git Product logo

zed's Introduction

zed

Container Image License Build Status Mailing List Discord Server Twitter

A command-line client for managing SpiceDB and Authzed.

zed features include:

  • Unix-friendly interface for the v1 Authzed API
  • Context switching that stores credentials securely in your OS keychain
  • An experimental OPA REPL with additional builtins for checking permissions

See CONTRIBUTING.md for instructions on how to contribute and perform common tasks like building the project and running tests.

Getting Started

Follow the Guide

We highly recommend following the Protecting Your First App guide to learn the latest best practice to integrate an application with Authzed.

Installation

zed is currently packaged by Homebrew for both macOS and Linux. Individual releases are also available on the releases page.

brew install authzed/tap/zed

Creating a context

In order to do anything useful, zed first needs a context: a named pair of the endpoint and its accompanying credential.

The zed context subcommand has operations for setting the current, creating, listing, deleting contexts.

zed context set prod grpc.authzed.com:443 tc_zed_my_laptop_deadbeefdeadbeefdeadbeefdeadbeef
zed context set dev localhost:80 testpresharedkey
zed context list

At any point in time, the ZED_ENDPOINT and ZED_TOKEN environment variables can be used to override their respective values in the current context.

Viewing & modifying data

For each type of noun used in SpiceDB, there is a zed subcommand:

  • zed schema
  • zed relationship
  • zed permission

For example, you can read a schema, check permissions, and create or delete relationships:

zed schema read
zed permission check document:firstdoc writer user:emilia
zed relationship create document:firstdoc reader user:beatrice
zed relationship delete document:firstdoc reader user:beatrice

Open Policy Agent (OPA)

Experimentally, zed embeds an instance of OPA that supports additional builtin functions for accessing SpiceDB.

The following functions have been added:

authzed.check("resource:id", "permission", "subject:id", "zedtoken")

It can be found under the zed experiment opa command:

$ zed experiment opa eval 'authzed.check("document:firstdoc", "reader", "user:emilia", "")'
{
  "result": [
    {
      "expressions": [
        {
          "value": true,
          "text": "authzed.check(\"document:firstdoc\", \"reader\", \"user:emilia\", \"\")",
          "location": {
            "row": 1,
            "col": 1
          }
        }
      ]
    }
  ]
}

If you are interested in OPA, please feel free to reach out to provide feedback.

zed's People

Contributors

bracki avatar ecordell avatar jakedt avatar josephschorr avatar jzelinskie avatar njhale avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.