This package has been deprecated

Author message:

Migrated to @cerbos/embedded

@cerbos/lite
TypeScript icon, indicating that this package has built-in type declarations

0.5.0-beta • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i @cerbos/lite

Weekly Downloads

13

Version

0.5.0-beta

License

Apache-2.0

Unpacked Size

698 kB

Total Files

113

Last publish

Collaborators

  • ahaines
  • alexolivier