@atlasent/sdk 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,6 +27,15 @@ if (!gate.allowed) {
27
27
 
28
28
  That's it. `deployGate()` performs the V1 Deploy Gate sequence against `production.deploy`: `evaluate()` calls `POST /v1-evaluate`, receives a permit when allowed, then `verifyPermit()` calls `POST /v1-verify-permit` before your deployment can run. A clean `deny` is returned as a block result — network / server / auth failures are thrown.
29
29
 
30
+ ## Why two calls? (the mental model)
31
+
32
+ AtlaSent is **authorize-before-execute**, not after-the-fact logging. The two-step pattern is intentional:
33
+
34
+ 1. **`evaluate()`** asks the policy engine: "should this action run?" Returns a decision and, when allowed, a single-use **permit token** — a cryptographic proof that evaluation happened.
35
+ 2. **`verifyPermit()`** consumes the permit server-side *before* the action executes. This is what makes the audit chain tamper-evident: every execution is hash-linked to the evaluation that authorized it, and no permit can be replayed.
36
+
37
+ **You rarely call them separately.** `deployGate()` wraps both steps for deploy workflows. The Python SDK's `protect()` wraps them for arbitrary actions. Use the raw two-step form only when something external — a human approval, a change-window check — needs to happen *between* evaluate and execute (evaluate → wait → verify → run).
38
+
30
39
  ## Simple V1 surface
31
40
 
32
41
  ```ts
package/dist/hono.cjs CHANGED
@@ -1943,6 +1943,48 @@ var AtlaSentClient = class {
1943
1943
  break;
1944
1944
  }
1945
1945
  }
1946
+ // ── License verification (self-hosted / air-gapped) ──────────────────────
1947
+ /**
1948
+ * Retrieve the license status of this self-hosted or air-gapped deployment.
1949
+ *
1950
+ * Calls `GET /v1/license`. Returns the current validity state, expiry,
1951
+ * enabled feature flags, and optional capacity limits for the installed
1952
+ * license key.
1953
+ *
1954
+ * Callers should check `result.status === "active"` before proceeding.
1955
+ * A `"grace"` status means the license has lapsed but a grace window
1956
+ * (`grace_until`) is still open — the deployment continues to function
1957
+ * but the license should be renewed immediately.
1958
+ *
1959
+ * Throws {@link AtlaSentError} on transport / auth failures.
1960
+ */
1961
+ async getLicense() {
1962
+ const { body, rateLimit } = await this.get("/v1/license");
1963
+ return { ...body, rateLimit };
1964
+ }
1965
+ /**
1966
+ * Validate a signed license blob against this deployment's installed
1967
+ * public key.
1968
+ *
1969
+ * Calls `POST /v1/license/verify`. Use this when onboarding a new license
1970
+ * key or rotating an expiring one — submit the blob received from AtlaSent
1971
+ * and check `result.valid` before applying the new license.
1972
+ *
1973
+ * A `valid: false` response is **not** thrown — inspect the returned
1974
+ * object. Only transport / server errors throw {@link AtlaSentError}.
1975
+ *
1976
+ * @param blob — The signed license blob string provided by AtlaSent.
1977
+ */
1978
+ async verifyLicense(blob) {
1979
+ if (!blob || typeof blob !== "string") {
1980
+ throw new AtlaSentError("blob is required", { code: "bad_request" });
1981
+ }
1982
+ const { body, rateLimit } = await this.post(
1983
+ "/v1/license/verify",
1984
+ { blob }
1985
+ );
1986
+ return { ...body, rateLimit };
1987
+ }
1946
1988
  async post(path, body, query) {
1947
1989
  return this.request(path, "POST", body, query);
1948
1990
  }