Cedarling JavaScript/TypeScript API
    Preparing search index...

    Function initFromArchiveBytes

    • Create a new instance of the Cedarling application from archive bytes.

      This function allows loading a policy store from a Cedar Archive (.cjar) that was fetched with custom logic (e.g., with authentication headers).

      Arguments

      • config - Bootstrap configuration (Map or Object) without a policy-store source property. The archive bytes provide the policy store. With CEDARLING_POLICY_STORE_SIGSTORE_MODE: "enforce", also set CEDARLING_POLICY_STORE_SIGSTORE_BUNDLE_URI to the bundle's URL.
      • archive_bytes - The .cjar archive bytes (Uint8Array)

      Example

      await initWasm();
      const config = {
      CEDARLING_APPLICATION_NAME: "task-api",
      CEDARLING_LOG_TYPE: "memory",
      CEDARLING_LOG_TTL: 120,
      };
      const response = await fetch("https://example.com/policy-store.cjar", {
      headers: { Authorization: "Bearer <token>" },
      });
      if (!response.ok) throw new Error("Unable to fetch policy store");
      const archiveBytes = new Uint8Array(await response.arrayBuffer());
      const cedarling = await initFromArchiveBytes(config, archiveBytes);

      Parameters

      • config: any
      • archive_bytes: Uint8Array

      Returns Promise<Cedarling>