Skip to Content
AZMARA PLATFORM
Packages

@azmr/legal

Legal documents as data, with a drift check that keeps them honest against the code that uses them.

View as Markdown for coding assistants, or see llms.txt.

Installation

pnpm add @azmr/legal

Why

A privacy policy goes stale the moment the code starts using a new service. @azmr/legal keeps the policy as data in one place, so every site renders the same text, and gives each site a test that fails when the policy and the code disagree.

Checking a site against the policy

import { findPolicyDrift } from "@azmr/legal";
import { azmaraPrivacyPolicy } from "@azmr/legal/azmara";

const problems = findPolicyDrift({
  document: azmaraPrivacyPolicy,
  site: "app",
  dependencies: pkg.dependencies,
  envExample: readFileSync(".env.local.example", "utf8"),
  serviceDependencies: ["@supabase/supabase-js", "stripe", "resend"],
  trackerPattern: /posthog|sentry|mixpanel/i,
});
expect(problems).toEqual([]);

It reports these kinds of drift:

  • a provider the policy names whose package, env var or host is gone;
  • a service the code uses that no processor covers;
  • a tracking package the policy's cookie statement rules out;
  • a host the site's source contacts that the policy doesn't name.

Services called by URL

Some services have no package, only a fetch to their API. Give a processor evidence.host (a domain such as open-meteo.com, which also covers api.open-meteo.com) and pass the site's source files as sources. The check then fails if the source stops contacting that host.

Pass allowedHosts too, and it also fails on any host in the source that is neither a processor nor on that list. List the site's own domain and hosts that are only links or schema namespaces, so that a new service called by URL has to be named in the policy before the test passes.

findPolicyDrift({
  // ...
  sources: { "src/weather.ts": readFileSync("src/weather.ts", "utf8") },
  allowedHosts: ["azmara.io", "schema.org"],
});

A host is only found when it is written as a full http(s):// URL in the source. An address built up from pieces at runtime is invisible to it.

Documents

@azmr/legal/azmara holds Azmara's own privacy policy. It is a draft for review, not legal advice.