Cerbos JavaScript SDK
    Preparing search index...

    Options for creating a new Embedded client.

    interface Options {
        decodeJWTPayload?: DecodeJWTPayload;
        defaultPolicyVersion?: string;
        defaultScope?: string;
        globals?: Record<string, Value>;
        headers?: HeadersInit | (() => Awaitable<HeadersInit>);
        lenientScopeSearch?: boolean;
        onDecision?: (entry: DecisionLogEntry) => Awaitable<void>;
        onValidationError?: "throw" | ValidationFailedCallback;
        policies: PolicySource;
        schemaEnforcement?: SchemaEnforcement;
        userAgent?: string;
        wasm: WasmSource;
    }

    Hierarchy

    • Pick<Options, "headers" | "onValidationError" | "userAgent">
      • Options
    Index

    Properties

    decodeJWTPayload?: DecodeJWTPayload

    A function to verify and decode JWTs passed as auxiliary data, returning the JWT payload.

    (throw an error when a JWT is passed)
    
    defaultPolicyVersion?: string

    Default policy version to apply to requests that do not specify one.

    "default"

    defaultScope?: string

    Default scope to apply to requests that do not specify one.

    ""

    globals?: Record<string, Value>

    Global variables to pass environment-specific information to policy conditions.

    {}

    headers?: HeadersInit | (() => Awaitable<HeadersInit>)

    Headers to add to every request to the policy decision point.

    Headers can be included in the policy decision point's audit logs by setting the includeMetadataKeys or excludeMetadataKeys fields in the audit configuration block.

    The User-Agent header is set using Options.userAgent.

    undefined

    lenientScopeSearch?: boolean

    Enable lenient scope search?

    By default, when a request specifies a scope of a.b.c then a policy must exist with that exact scope. If lenient scope search is enabled, then the policy decision point will fall back to trying scopes a.b, a, and "" if a policy with scope a.b.c does not exist.

    false

    onDecision?: (entry: DecisionLogEntry) => Awaitable<void>

    A callback to invoke when a decision is made by the embedded policy decision point server.

    (no-op)
    
    onValidationError?: "throw" | ValidationFailedCallback

    Action to take when input fails schema validation.

    Possible values are

    undefined

    policies: PolicySource

    Source of the policy bundle.

    schemaEnforcement?: SchemaEnforcement

    Schema enforcement level for the embedded policy decision point server.

    SchemaEnforcement.NONE

    userAgent?: string

    Custom user agent to prepend to the built-in value.

    undefined

    Source of the embedded policy decision point server's WebAssembly module (imported from @cerbos/embedded-server/server.wasm). The most appropriate source to use will depend on the target runtime of your application.