@orangecheck/agent-core 2.7.0 → 2.7.1

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
@@ -117,7 +117,7 @@ if (!result.ok) throw new Error(result.code + ': ' + result.message);
117
117
  - `verifyAction({ action, delegation, revocations | skipRevocationCheck, verifyBip322, now?, maxSkewMs?, verifyOtsAnchor?, content?, resolveAnchorBlockHeight?, scopeMode? })` — the live check, as of `now` (default: the current time). Every link of the chain must be in force at `now`, a revocation in effect at or before `now` refuses the action (`E_REVOKED`), and `signed_at` must lie within `maxSkewMs` of `now` (default 120 s; else `E_STALE`). The result's `asOf` is `{ basis: 'now', now }`.
118
118
  - `verifyActionAsOfSignedAt({ … })` — an audit of a past action, as of its own `signed_at`. The agent chooses that time, so `asOf.anchored` says whether a verified OTS anchor fixes it. Never use it to decide whether to act now.
119
119
  - `createReplayGuard(maxSkewMs?)` — `firstUse(action, now?)` is true once per action id. It keeps each id until `signed_at + maxSkewMs`, as long as the action could pass `verifyAction`. One process only; across instances keep the same record in a shared store. Replay is the caller's to stop: `verifyAction` keeps no state.
120
- - `verifyRevocation({ envelope, delegation, verifyBip322 })` — the principal may always revoke; `revocation.holders` can only add the agent
120
+ - `verifyRevocation({ envelope, delegation, verifyBip322 })` — the principal and the agent may always revoke; `revocation.holders` is informational
121
121
  - `verifyOtsAnchor(proofB64, blockHeight, blockHash, envelopeId)` — an anchor orders an action against a revocation only when this returns true
122
122
  - `verifyFederationRevocation({ envelope, delegation, verifyBip322 })`
123
123
 
package/dist/index.js CHANGED
@@ -801,11 +801,11 @@ async function verifyRevocation(input) {
801
801
  if (env.delegation_id !== d.id) {
802
802
  return err("E_DELEGATION_MISMATCH", `revocation.delegation_id (${env.delegation_id}) != delegation.id (${d.id})`);
803
803
  }
804
- const holders = d.revocation?.holders ?? ["principal"];
805
- const holderAddrs = /* @__PURE__ */ new Set([d.principal.address]);
806
- if (Array.isArray(holders) && holders.includes("agent")) holderAddrs.add(d.agent.address);
807
- if (!holderAddrs.has(env.signer.address)) {
808
- return err("E_REVOKER_UNAUTHORIZED", `revocation signer ${env.signer.address} not in delegation holders`);
804
+ if (env.signer.address !== d.principal.address && env.signer.address !== d.agent.address) {
805
+ return err(
806
+ "E_REVOKER_UNAUTHORIZED",
807
+ `revocation signer ${env.signer.address} is neither the principal nor the agent`
808
+ );
809
809
  }
810
810
  const canonInput = {
811
811
  address: env.signer.address,
@@ -1188,10 +1188,6 @@ async function verifyRevocationOf(d, rev, input) {
1188
1188
  });
1189
1189
  }
1190
1190
  const v1 = rev;
1191
- const holders = d.revocation?.holders ?? ["principal"];
1192
- if (!Array.isArray(holders) || !holders.includes("agent")) {
1193
- return fail("E_REVOKER_UNAUTHORIZED", "only the federation may revoke this delegation");
1194
- }
1195
1191
  if (v1.kind !== "agent-revocation" || v1.signer?.address !== d.agent.address) {
1196
1192
  return fail("E_REVOKER_UNAUTHORIZED", "a single-address revocation must be signed by the agent");
1197
1193
  }