@orangecheck/agent-core 1.0.1 → 1.1.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.
@@ -187,6 +187,21 @@ function isNegative(v: Vector): v is NegativeVector {
187
187
  return 'negative' in v && v.negative === true;
188
188
  }
189
189
 
190
+ // v1.2 federation-principal vectors (v18–v26) are exercised by federation.test.ts
191
+ // against verifyFederationDelegation / verifyFederationRevocation. They use a
192
+ // `federation:<descriptor_id>` principal that the v1 single-address path here
193
+ // intentionally rejects, so skip them in the generic v1 loops. (v26 — the
194
+ // single-address baseline — stays: its principal.alg is "bip322".)
195
+ function isFederation(v: Vector): boolean {
196
+ const d = v as unknown as {
197
+ kind?: string;
198
+ expected?: { envelope?: { principal?: { alg?: string }; signer?: { alg?: string } } };
199
+ };
200
+ if (d.kind === 'federation-descriptor') return true;
201
+ const env = d.expected?.envelope;
202
+ return env?.principal?.alg === 'federation' || env?.signer?.alg === 'federation';
203
+ }
204
+
190
205
  async function loadVectors(): Promise<{ name: string; data: Vector }[]> {
191
206
  try {
192
207
  const files = await readdir(VECTORS_DIR);
@@ -217,6 +232,7 @@ describe('oc-agent-protocol test vectors', () => {
217
232
  const subdelegationEnvelopes = new Map<string, SubdelegationEnvelope>();
218
233
  for (const { data } of vectors) {
219
234
  if (isNegative(data)) continue;
235
+ if (isFederation(data)) continue;
220
236
  if ((data as { private_scope?: unknown }).private_scope) continue;
221
237
  if (data.kind === 'delegation') {
222
238
  delegationEnvelopes.set(data.expected.id, data.expected.envelope);
@@ -227,6 +243,7 @@ describe('oc-agent-protocol test vectors', () => {
227
243
 
228
244
  for (const { name, data } of vectors) {
229
245
  if (isNegative(data)) continue;
246
+ if (isFederation(data)) continue;
230
247
  if ((data as { private_scope?: unknown }).private_scope) continue;
231
248
  it(`${name} — canonical message reconstructs byte-identical`, () => {
232
249
  const msg = reconstructCanonical(data);
package/src/types.ts CHANGED
@@ -254,7 +254,13 @@ export type AgentErrorCode =
254
254
  | 'E_SCOPES_BOTH_PROVIDED'
255
255
  | 'E_SCOPES_NEITHER_PROVIDED'
256
256
  | 'E_SCOPES_UNREADABLE'
257
- | 'E_BAD_LOCK_ENVELOPE';
257
+ | 'E_BAD_LOCK_ENVELOPE'
258
+ // v1.2 federation principal (FEDERATION.md §3.3)
259
+ | 'E_BAD_FEDERATION_DESCRIPTOR'
260
+ | 'E_THRESHOLD_MISMATCH'
261
+ | 'E_THRESHOLD_NOT_MET'
262
+ | 'E_UNKNOWN_GUARDIAN'
263
+ | 'E_DUPLICATE_GUARDIAN';
258
264
 
259
265
  export interface VerifyOk<T> {
260
266
  ok: true;