Cerbos JavaScript SDK
    Preparing search index...

    Module @cerbos/embedded-client - v0.4.0

    @cerbos/embedded-client

    npm

    Client library for interacting with embedded Cerbos policy decision points (PDPs) from server-side Node.js and browser-based applications. Policy bundles are loaded from Cerbos Hub and executed by a WebAssembly module (@cerbos/embedded-server).

    $ npm install @cerbos/embedded-client
    

    With Vite:

    import { fileURLToPath } from "node:url";
    import { Embedded } from "@cerbos/embedded-client";
    import wasm from "@cerbos/embedded-server/server.wasm?init";

    const cerbos = new Embedded({
    policies: { ruleId: "B5LU9EVYN1MD" },
    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 Embedded class documentation.

    This package is ESM-only, but may be required from CommonJS modules in Node.js versions 20.19.5+, 22.15+, and 24+.

    Enumerations

    SchemaEnforcement

    Classes

    Embedded
    PolicyLoader

    Interfaces

    Options
    PolicyLoaderOptions

    Type aliases

    DecodedJWTPayload
    DecodeJWTPayload
    PolicySource
    WasmInstantiate
    WasmSource