ajp-protocol 0.2.1 → 0.3.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.
@@ -34,9 +34,18 @@ const resolve = declarationKeyResolver({ fetchText });
34
34
  const ok1 = await resolve(ALICE, { declaration_url: ALICE_URL });
35
35
  t('honest sender resolves offline', ok1.publicKey === alice.publicKey && !!ok1.fingerprint);
36
36
 
37
- // 2. No declaration_url -> refused with a specific code.
38
- try { await resolve(ALICE, {}); t('missing declaration_url refused', false); }
39
- catch (e) { t('missing declaration_url refused', e.code === 'NO_DECLARATION_URL', e.code); }
37
+ // 2. No declaration_url and no standard location -> refused with a specific code.
38
+ try { await resolve('provenance:npm:some-agent', {}); t('no declaration_url and no standard location refused', false); }
39
+ catch (e) { t('no declaration_url and no standard location refused', e.code === 'NO_DECLARATION_URL', e.code); }
40
+
41
+ // 2b. No declaration_url, but the id names a standard location -> that is fetched.
42
+ {
43
+ const std = 'https://raw.githubusercontent.com/alice/research-agent/HEAD/PROVENANCE.yml';
44
+ net.set(std, JSON.stringify(aliceDecl));
45
+ const r = await resolve(ALICE, {});
46
+ t('falls back to the standard location for its id', r.publicKey === alice.publicKey && r.source === std);
47
+ net.delete(std);
48
+ }
40
49
 
41
50
  // 3. Impostor re-hosts Alice's genuine declaration on their own server.
42
51
  const EVIL_URL = 'https://evil.example/copied/PROVENANCE.json';