Socket
Book a DemoInstallSign in
Socket

@cerbos/lite

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cerbos/lite

Client library for interacting with WebAssembly Cerbos policy bundles from server-side Node.js and browser-based applications

latest
Source
npmnpm
Version
0.5.0-beta
Version published
Maintainers
2
Created
Source

@cerbos/lite

npm

Client library for interacting with WebAssembly Cerbos policy bundles from server-side Node.js and browser-based applications.

Prerequisites

  • Node.js 18+

Installation

$ npm install @cerbos/lite

Example usage

import { Lite } from "@cerbos/lite";

const cerbos = new Lite(fetch("/policies.wasm"));

await cerbos.isAllowed({
  principal: {
    id: "user@example.com",
    roles: ["USER"],
    attr: { tier: "PREMIUM" },
  },
  resource: {
    kind: "document",
    id: "1",
    attr: { owner: "user@example.com" },
  },
  action: "view",
}); // => true

For more details, see the Lite class documentation.

Further reading

Get help

FAQs

Package last updated on 02 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts