@cerbos/grpc
v0.19.0
Published
Client library for interacting with the Cerbos policy decision point service over gRPC from server-side Node.js applications
Downloads
47,555
Readme
@cerbos/grpc
Client library for interacting with the Cerbos policy decision point service over gRPC from server-side Node.js applications.
Prerequisites
- Cerbos 0.16+
- Node.js 18+
Installation
$ npm install @cerbos/grpc
Example usage
import { GRPC } from "@cerbos/grpc";
const cerbos = new GRPC("localhost:3593", { tls: false });
await cerbos.isAllowed({
principal: {
id: "[email protected]",
roles: ["USER"],
attr: { tier: "PREMIUM" },
},
resource: {
kind: "document",
id: "1",
attr: { owner: "[email protected]" },
},
action: "view",
}); // => true
For more details, see the GRPC
class documentation.