@agenticprimitives/agent-resolution 0.0.0-alpha.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.
Files changed (92) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +319 -0
  3. package/dist/admission.d.ts +14 -0
  4. package/dist/admission.d.ts.map +1 -0
  5. package/dist/admission.js +137 -0
  6. package/dist/admission.js.map +1 -0
  7. package/dist/authority-ref.d.ts +38 -0
  8. package/dist/authority-ref.d.ts.map +1 -0
  9. package/dist/authority-ref.js +69 -0
  10. package/dist/authority-ref.js.map +1 -0
  11. package/dist/canonicalization.d.ts +16 -0
  12. package/dist/canonicalization.d.ts.map +1 -0
  13. package/dist/canonicalization.js +39 -0
  14. package/dist/canonicalization.js.map +1 -0
  15. package/dist/codec.d.ts +15 -0
  16. package/dist/codec.d.ts.map +1 -0
  17. package/dist/codec.js +34 -0
  18. package/dist/codec.js.map +1 -0
  19. package/dist/compose.d.ts +79 -0
  20. package/dist/compose.d.ts.map +1 -0
  21. package/dist/compose.js +235 -0
  22. package/dist/compose.js.map +1 -0
  23. package/dist/endpoint-control.d.ts +87 -0
  24. package/dist/endpoint-control.d.ts.map +1 -0
  25. package/dist/endpoint-control.js +174 -0
  26. package/dist/endpoint-control.js.map +1 -0
  27. package/dist/errors.d.ts +33 -0
  28. package/dist/errors.d.ts.map +1 -0
  29. package/dist/errors.js +71 -0
  30. package/dist/errors.js.map +1 -0
  31. package/dist/freshness.d.ts +43 -0
  32. package/dist/freshness.d.ts.map +1 -0
  33. package/dist/freshness.js +100 -0
  34. package/dist/freshness.js.map +1 -0
  35. package/dist/grant-index.d.ts +21 -0
  36. package/dist/grant-index.d.ts.map +1 -0
  37. package/dist/grant-index.js +0 -0
  38. package/dist/grant-index.js.map +1 -0
  39. package/dist/grants.d.ts +100 -0
  40. package/dist/grants.d.ts.map +1 -0
  41. package/dist/grants.js +99 -0
  42. package/dist/grants.js.map +1 -0
  43. package/dist/index.d.ts +44 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +63 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/invitation.d.ts +43 -0
  48. package/dist/invitation.d.ts.map +1 -0
  49. package/dist/invitation.js +76 -0
  50. package/dist/invitation.js.map +1 -0
  51. package/dist/peer-attestation.d.ts +61 -0
  52. package/dist/peer-attestation.d.ts.map +1 -0
  53. package/dist/peer-attestation.js +128 -0
  54. package/dist/peer-attestation.js.map +1 -0
  55. package/dist/peer-gate.d.ts +73 -0
  56. package/dist/peer-gate.d.ts.map +1 -0
  57. package/dist/peer-gate.js +108 -0
  58. package/dist/peer-gate.js.map +1 -0
  59. package/dist/policy.d.ts +53 -0
  60. package/dist/policy.d.ts.map +1 -0
  61. package/dist/policy.js +73 -0
  62. package/dist/policy.js.map +1 -0
  63. package/dist/ports.d.ts +59 -0
  64. package/dist/ports.d.ts.map +1 -0
  65. package/dist/ports.js +10 -0
  66. package/dist/ports.js.map +1 -0
  67. package/dist/projection.d.ts +74 -0
  68. package/dist/projection.d.ts.map +1 -0
  69. package/dist/projection.js +134 -0
  70. package/dist/projection.js.map +1 -0
  71. package/dist/proof.d.ts +76 -0
  72. package/dist/proof.d.ts.map +1 -0
  73. package/dist/proof.js +207 -0
  74. package/dist/proof.js.map +1 -0
  75. package/dist/publication.d.ts +123 -0
  76. package/dist/publication.d.ts.map +1 -0
  77. package/dist/publication.js +32 -0
  78. package/dist/publication.js.map +1 -0
  79. package/dist/records.d.ts +168 -0
  80. package/dist/records.d.ts.map +1 -0
  81. package/dist/records.js +83 -0
  82. package/dist/records.js.map +1 -0
  83. package/dist/references.d.ts +61 -0
  84. package/dist/references.d.ts.map +1 -0
  85. package/dist/references.js +7 -0
  86. package/dist/references.js.map +1 -0
  87. package/dist/results.d.ts +89 -0
  88. package/dist/results.d.ts.map +1 -0
  89. package/dist/results.js +37 -0
  90. package/dist/results.js.map +1 -0
  91. package/package.json +57 -0
  92. package/spec.md +78 -0
package/dist/grants.js ADDED
@@ -0,0 +1,99 @@
1
+ // PrivateResolutionGrant — a capability to DISCOVER, never a capability to USE (spec 338 §4).
2
+ //
3
+ // Answers: "May this party discover how to reach this agent?"
4
+ // Never answers: "May this party use this agent?"
5
+ //
6
+ // The distinction is the whole point of ADR-0056. Service use still requires the full chain:
7
+ // delegation ∩ entitlement ∩ tool/action policy ∩ exact invocation proof ∩ revocation ∩ audit.
8
+ //
9
+ // Grant ids are HIGH-ENTROPY OPAQUE capabilities, never a hash of a human-readable name. A 256-bit
10
+ // random id has no guessable pre-image, so no salt and no password-hardening KDF is involved; the
11
+ // "private name + salt" design is rejected in ADR-0056 §Decision 4.
12
+ /** The one action every resolution grant must carry. Additional actions never widen it into use authority. */
13
+ export const RESOLVE_ACTION = 'agent.resolve';
14
+ /** The body a `subjectProof` signature commits to. Binds nonce, audience and target together so a
15
+ * captured presentation cannot be replayed at another resolver or for another target. */
16
+ export function presentationBody(p, targetAgent) {
17
+ return {
18
+ grantId: p.grantId,
19
+ challengeNonce: p.challengeNonce,
20
+ audience: p.audience,
21
+ requestedProjection: p.requestedProjection,
22
+ timestamp: p.timestamp,
23
+ targetAgent,
24
+ };
25
+ }
26
+ /**
27
+ * The canonical body the ISSUER signs when minting a grant (spec 338 §4).
28
+ *
29
+ * WHY THIS EXISTS: without it, a resolver indexing a grant can only check that whoever POSTed it held
30
+ * an operator token — which authenticates the STORE OPERATOR, not the grant. Signing this body lets a
31
+ * resolver verify that the party who claims to have issued discovery rights over `targetAgent`
32
+ * actually did, and lets an auditor re-derive it later.
33
+ *
34
+ * Excludes `proof` (it is the signature) and `grantId` is INCLUDED — a signature that did not commit
35
+ * to the id would let an operator re-file the same authorization under a different, longer-lived id.
36
+ */
37
+ export function grantBody(g) {
38
+ return {
39
+ specVersion: g.specVersion,
40
+ grantId: g.grantId,
41
+ issuer: g.issuer,
42
+ targetAgent: g.targetAgent,
43
+ subject: g.subject,
44
+ mode: g.mode,
45
+ actions: [...g.actions],
46
+ projection: g.projection,
47
+ constraints: g.constraints,
48
+ statusRef: g.statusRef,
49
+ issuedAt: g.issuedAt,
50
+ authorityRef: g.authorityRef,
51
+ };
52
+ }
53
+ /** The maximum lifetime a `bearer-bootstrap` grant may carry (spec 338 §13 SHACL). */
54
+ export const BEARER_BOOTSTRAP_MAX_LIFETIME_MS = 15 * 60 * 1000;
55
+ /**
56
+ * Static shape validation — the invariants that hold regardless of runtime state. Revocation,
57
+ * budget, and proof-of-possession are runtime checks and live in the resolver (see `ports.ts`).
58
+ */
59
+ export function validateGrantShape(g) {
60
+ const out = [];
61
+ if (g.actions[0] !== RESOLVE_ACTION) {
62
+ out.push({ field: 'actions', message: `actions MUST begin with "${RESOLVE_ACTION}"` });
63
+ }
64
+ if ((g.mode === 'subject-bound' || g.mode === 'pairwise') && !g.subject) {
65
+ out.push({ field: 'subject', message: `mode "${g.mode}" requires a subject to bind to` });
66
+ }
67
+ if (g.mode === 'bearer-bootstrap' && g.subject) {
68
+ out.push({ field: 'subject', message: 'mode "bearer-bootstrap" has no subject; exchange it for a subject-bound grant instead' });
69
+ }
70
+ if (g.mode === 'subject-bound' || g.mode === 'pairwise') {
71
+ if (!g.constraints.requireProofOfPossession) {
72
+ out.push({
73
+ field: 'constraints.requireProofOfPossession',
74
+ message: `mode "${g.mode}" MUST require proof of possession, else a copied grant is usable by anyone`,
75
+ });
76
+ }
77
+ }
78
+ const notBefore = Date.parse(g.constraints.notBefore);
79
+ const expiresAt = Date.parse(g.constraints.expiresAt);
80
+ if (Number.isNaN(notBefore) || Number.isNaN(expiresAt)) {
81
+ out.push({ field: 'constraints', message: 'notBefore and expiresAt MUST be parseable ISO-8601 timestamps' });
82
+ }
83
+ else {
84
+ if (expiresAt <= notBefore) {
85
+ out.push({ field: 'constraints.expiresAt', message: 'expiresAt MUST be after notBefore' });
86
+ }
87
+ if (g.mode === 'bearer-bootstrap' && expiresAt - notBefore > BEARER_BOOTSTRAP_MAX_LIFETIME_MS) {
88
+ out.push({
89
+ field: 'constraints.expiresAt',
90
+ message: `bearer-bootstrap lifetime MUST NOT exceed ${BEARER_BOOTSTRAP_MAX_LIFETIME_MS}ms`,
91
+ });
92
+ }
93
+ }
94
+ if (!g.constraints.audience) {
95
+ out.push({ field: 'constraints.audience', message: 'audience is required — an unbound grant is accepted by any resolver (confused deputy)' });
96
+ }
97
+ return out;
98
+ }
99
+ //# sourceMappingURL=grants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grants.js","sourceRoot":"","sources":["../src/grants.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,EAAE;AACF,sEAAsE;AACtE,oDAAoD;AACpD,EAAE;AACF,6FAA6F;AAC7F,iGAAiG;AACjG,EAAE;AACF,mGAAmG;AACnG,kGAAkG;AAClG,oEAAoE;AAiBpE,8GAA8G;AAC9G,MAAM,CAAC,MAAM,cAAc,GAAG,eAAwB,CAAC;AAuEvD;0FAC0F;AAC1F,MAAM,UAAU,gBAAgB,CAC9B,CAAgC,EAChC,WAA6B;IAE7B,OAAO;QACL,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,cAAc,EAAE,CAAC,CAAC,cAAc;QAChC,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,mBAAmB,EAAE,CAAC,CAAC,mBAAmB;QAC1C,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,WAAW;KACZ,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,SAAS,CAAC,CAA0C;IAClE,OAAO;QACL,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;QACvB,UAAU,EAAE,CAAC,CAAC,UAAU;Q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AAE,SAAS,CAAC,CAAC,IAAI,6EAA6E;aACtG,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IACtD,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,+DAA+D,EAAE,CAAC,CAAC;IAC/G,CAAC;SAAM,CAAC;QACN,IAAI,SAAS,IAAI,SAAS,EAAE,CAAC;YAC3B,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,IAAI,CAAC,CAAC,IAAI,KAAK,kBAAkB,IAAI,SAAS,GAAG,SAAS,GAAG,gCAAgC,EAAE,CAAC;YAC9F,GAAG,CAAC,IAAI,CAAC;gBACP,KAAK,EAAE,uBAAuB;gBAC9B,OAAO,EAAE,6CAA6C,gCAAgC,IAAI;aAC3F,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;QAC5B,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,OAAO,EAAE,uFAAuF,EAAE,CAAC,CAAC;IAChJ,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,44 @@
1
+ export declare const PACKAGE_NAME: "@agenticprimitives/agent-resolution";
2
+ export declare const PACKAGE_STATUS: "w2-vault-records-and-conformance";
3
+ export declare const SPEC_REF: "specs/338-private-agent-resolution-and-service-publication.md";
4
+ export { digestOf, signingDigest, timingSafeEqual } from './canonicalization.js';
5
+ export type { Sha256 } from './canonicalization.js';
6
+ export { AgentResolutionError, failure, toWireCode } from './errors.js';
7
+ export type { ResolutionErrorCode, ResolutionWireCode, ResolutionFailure } from './errors.js';
8
+ export { allowsDirectorySearch, allowsUnauthenticatedResolution, discoveryPolicyFromPreset, validateDiscoveryPolicy, } from './policy.js';
9
+ export type { AgentDiscoveryPolicyV1, AgentDiscoveryPreset, AgentInboundPosture, AgentListingPosture, AgentNamingPosture, AgentResolutionPosture, DiscoveryPolicyViolation, } from './policy.js';
10
+ export { publicationBody } from './publication.js';
11
+ export type { AgentServicePublicationV1, EndpointControlProofV1, PublicationBody, PublicationProofV1, PublicationStatus, ServiceSurfacePublicationV1, ServiceSurfaceProtocol, SurfaceExposure, TransportKeyBindingV1, } from './publication.js';
12
+ export { verifyPublication } from './proof.js';
13
+ export type { Erc1271Verifier, PublicationAuthorityCheck, VerifyPublicationOptions, VerifyPublicationResult, } from './proof.js';
14
+ export { endpointChallengeDigest, normalizeEndpointUri, verifyEndpointControl } from './endpoint-control.js';
15
+ export type { EndpointChallengeBody, EndpointControlAssurance, EndpointControlEvidenceV1, EndpointControlResult, EndpointEvidenceResolver, ObservedControlEvidenceV1, SignedChallengeEvidenceV1, VerifyEndpointControlOptions, } from './endpoint-control.js';
16
+ export { DELEGATION_AUTHORITY_SCHEME, SELF_AUTHORITY_REF, authorityRefMatches, delegationAuthorityRef, parseAuthorityRef, } from './authority-ref.js';
17
+ export type { AuthorityRefKind } from './authority-ref.js';
18
+ export { checkResolvedPeer, peerAuthenticatedFrom } from './peer-gate.js';
19
+ export { peerAttestationBody, peerAttestationDigest, verifyPeerAttestation } from './peer-attestation.js';
20
+ export type { PeerAttestationV1, PeerAttestationFailureCode, VerifyPeerAttestationInput, VerifyPeerAttestationResult, } from './peer-attestation.js';
21
+ export type { PeerGateCode, PeerGateFailure, PeerGateResult, ResolvedPeerPolicy } from './peer-gate.js';
22
+ export { advanceContinuity, checkFreshness } from './freshness.js';
23
+ export type { ChannelContinuityState, FreshnessInput, ResolutionFreshnessV1 } from './freshness.js';
24
+ export { BEARER_BOOTSTRAP_MAX_LIFETIME_MS, RESOLVE_ACTION, grantBody, presentationBody, validateGrantShape, } from './grants.js';
25
+ export type { GrantShapeViolation, PrivateResolutionGrantV1, ResolutionGrantConstraints, ResolutionGrantMode, ResolutionGrantPresentationV1, ResolutionProjectionPolicy, } from './grants.js';
26
+ export { invitationBody, validateInvitationShape } from './invitation.js';
27
+ export type { AgentConnectionInvitationV1, InvitationShapeViolation } from './invitation.js';
28
+ export { admitGrantPresentation } from './admission.js';
29
+ export type { AdmitGrantOptions } from './admission.js';
30
+ export type { AgentResolutionMethod, AgentResolutionReference, AgentResolutionReferenceKind, ResolutionContextV1, UnverifiedResolutionBundleV1, } from './references.js';
31
+ export type { AgentResolutionProvider, GrantAdmissionResult, ResolutionGrantStore, ResolverDependencies, SubjectProofVerifier, } from './ports.js';
32
+ export { assuranceOf, createComposedResolver } from './compose.js';
33
+ export type { ComposedResolutionResult, ComposedResolverOptions, ContinuityStore } from './compose.js';
34
+ export { PROJECTION_PRECEDES_SIGNING, channelIdFor, findOverDisclosure, projectSurfaces, selectPresignedPublication, } from './projection.js';
35
+ export type { ProjectionProfile, SurfaceProjectionContext, SurfaceProjectionResult } from './projection.js';
36
+ export { decodePublication, decodeReceipt, encodePublication, encodeReceipt } from './codec.js';
37
+ export type { JsonAgentResolutionReceiptV1, JsonAgentServicePublicationV1 } from './codec.js';
38
+ export { MIN_INDEX_SECRET_BYTES, deriveGrantDigest, deriveReceiptGrantDigest, grantDigestMatches, } from './grant-index.js';
39
+ export type { GrantDigestPurpose } from './grant-index.js';
40
+ export { NEVER_PUBLIC_FIELDS, OWNER_VAULT_RESOURCES, RESOLVER_VAULT_RESOURCES, findNeverPublicFields, } from './records.js';
41
+ export type { ChallengeNonceRecordV1, DiscoveryPolicyRecordV1, EndpointControlEvidenceRecordV1, GrantIndexRecordV1, GrantRecordV1, GrantStatus, GrantStatusRecordV1, InvitationRecordV1, NeverPublicField, OwnerVaultResource, PairwiseAliasRecordV1, PublicationContinuityRecordV1, PublicationRecordV1, ResolutionRecordClassification, ResolverVaultResource, UseCounterRecordV1, } from './records.js';
42
+ export { FAIL_HARD_RESOLUTION_ACTIONS, isFailHardResolutionAction, meetsAssurance } from './results.js';
43
+ export type { AgentResolutionReceiptV1, FailHardResolutionAction, ResolutionAssurance, ResolutionEvidenceV1, VerifiedAgentResolutionV1, } from './results.js';
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,YAAY,EAAG,qCAA8C,CAAC;AAC3E,eAAO,MAAM,cAAc,EAAG,kCAA2C,CAAC;AAC1E,eAAO,MAAM,QAAQ,EAAG,+DAAwE,CAAC;AAGjG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACjF,YAAY,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxE,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG9F,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,YAAY,EACV,yBAAyB,EACzB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,iBAAi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AmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,6BAA6B,EAC7B,mBAAmB,EACnB,8BAA8B,EAC9B,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACxG,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ // @agenticprimitives/agent-resolution — provider-neutral agent resolution primitives.
2
+ //
3
+ // Spec 338 · ADR-0056. The one rule that governs every export here:
4
+ //
5
+ // A resolution grant answers "may this party DISCOVER how to reach this agent?"
6
+ // It NEVER answers "may this party USE this agent?"
7
+ //
8
+ // Service use still requires the full chain, re-run at the origin:
9
+ // delegation ∩ entitlement ∩ tool/action policy ∩ exact invocation proof ∩ revocation ∩ audit.
10
+ //
11
+ // Pure Ring-0 leaf: no transport, no storage, no network, no clock, no authorization decision.
12
+ // Signature verification, authority checks, storage, and clocks are all INJECTED (see `ports.ts`).
13
+ export const PACKAGE_NAME = '@agenticprimitives/agent-resolution';
14
+ export const PACKAGE_STATUS = 'w2-vault-records-and-conformance';
15
+ export const SPEC_REF = 'specs/338-private-agent-resolution-and-service-publication.md';
16
+ // ─── Canonicalization + digests ──────────────────────────────────────────────
17
+ export { digestOf, signingDigest, timingSafeEqual } from './canonicalization.js';
18
+ // ─── Error taxonomy (precise local codes → uniform wire codes) ───────────────
19
+ export { AgentResolutionError, failure, toWireCode } from './errors.js';
20
+ // ─── Discovery policy — four independent dimensions ──────────────────────────
21
+ export { allowsDirectorySearch, allowsUnauthenticatedResolution, discoveryPolicyFromPreset, validateDiscoveryPolicy, } from './policy.js';
22
+ // ─── Service publication — the signed, sequenced, expiring operational object ─
23
+ export { publicationBody } from './publication.js';
24
+ // ─── Publication verification ────────────────────────────────────────────────
25
+ export { verifyPublication } from './proof.js';
26
+ // ─── Endpoint control (claim ≠ control) ──────────────────────────────────────
27
+ export { endpointChallengeDigest, normalizeEndpointUri, verifyEndpointControl } from './endpoint-control.js';
28
+ // ─── Publication authority (dntls-comparison §17 P3) ─────────────────────────
29
+ // An `authorityRef` COMMITS to a delegation; it is not a pointer into a vault. The bespoke
30
+ // `PublicationAuthorityRecordV1` this package used to define was a delegation under another name, so
31
+ // it was deleted rather than maintained beside the real one. Verification lives in
32
+ // `@agenticprimitives/delegation.authorizeMethodDelegation`; only the format lives here, so the
33
+ // browser-side verifier stays a leaf.
34
+ export { DELEGATION_AUTHORITY_SCHEME, SELF_AUTHORITY_REF, authorityRefMatches, delegationAuthorityRef, parseAuthorityRef, } from './authority-ref.js';
35
+ // ─── The post-resolve peer gate (AR-L7) ──────────────────────────────────────
36
+ // resolve → dial → prove the peer IS the resolved agent → else do not send the task.
37
+ // The repo had the parts (VerifiedPeerContextV1, isChannelBoundPeer, createPeerAuthenticator, the
38
+ // 'peer-authenticated' rung) and nothing that REFUSED work when they said no.
39
+ export { checkResolvedPeer, peerAuthenticatedFrom } from './peer-gate.js';
40
+ // The PRODUCER: after resolve, make the responding agent sign OUR nonce. Direction is the reverse of
41
+ // edge-runtime's inbound peer auth — here the agent proves itself to the client.
42
+ export { peerAttestationBody, peerAttestationDigest, verifyPeerAttestation } from './peer-attestation.js';
43
+ // ─── Freshness, rollback, equivocation, continuity ───────────────────────────
44
+ export { advanceContinuity, checkFreshness } from './freshness.js';
45
+ // ─── Private resolution grants ───────────────────────────────────────────────
46
+ export { BEARER_BOOTSTRAP_MAX_LIFETIME_MS, RESOLVE_ACTION, grantBody, presentationBody, validateGrantShape, } from './grants.js';
47
+ // ─── Connection invitations (bootstrap) ──────────────────────────────────────
48
+ export { invitationBody, validateInvitationShape } from './invitation.js';
49
+ // ─── Grant admission ─────────────────────────────────────────────────────────
50
+ export { admitGrantPresentation } from './admission.js';
51
+ // ─── Composed resolution (many methods, ONE verification path) ───────────────
52
+ export { assuranceOf, createComposedResolver } from './compose.js';
53
+ // ─── Projection ──────────────────────────────────────────────────────────────
54
+ export { PROJECTION_PRECEDES_SIGNING, channelIdFor, findOverDisclosure, projectSurfaces, selectPresignedPublication, } from './projection.js';
55
+ // ─── JSON codecs (bigint-safe) ───────────────────────────────────────────────
56
+ export { decodePublication, decodeReceipt, encodePublication, encodeReceipt } from './codec.js';
57
+ // ─── Keyed grant index (no raw bearer secret at rest) ────────────────────────
58
+ export { MIN_INDEX_SECRET_BYTES, deriveGrantDigest, deriveReceiptGrantDigest, grantDigestMatches, } from './grant-index.js';
59
+ // ─── Vault record contracts ──────────────────────────────────────────────────
60
+ export { NEVER_PUBLIC_FIELDS, OWNER_VAULT_RESOURCES, RESOLVER_VAULT_RESOURCES, findNeverPublicFields, } from './records.js';
61
+ // ─── Verified result + privacy-minimized receipt ─────────────────────────────
62
+ export { FAIL_HARD_RESOLUTION_ACTIONS, isFailHardResolutionAction, meetsAssurance } from './results.js';
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,kFAAkF;AAClF,sDAAsD;AACtD,EAAE;AACF,mEAAmE;AACnE,iGAAiG;AACjG,EAAE;AACF,+FAA+F;AAC/F,mGAAmG;AAEnG,MAAM,CAAC,MAAM,YAAY,GAAG,qCAA8C,CAAC;AAC3E,MAAM,CAAC,MAAM,cAAc,GAAG,kCAA2C,CAAC;AAC1E,MAAM,CAAC,MAAM,QAAQ,GAAG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MAAM,iBAAiB,CAAC;AAG1E,gFAAgF;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAmBxD,gFAAgF;AAChF,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAGnE,gFAAgF;AAChF,OAAO,EACL,2BAA2B,EAC3B,YAAY,EACZ,kBAAkB,EAClB,eAAe,EACf,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AAGzB,gFAAgF;AAChF,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhG,gFAAgF;AAChF,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,gFAAgF;AAChF,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAoBtB,gFAAgF;AAChF,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,43 @@
1
+ import type { CanonicalAgentId } from '@agenticprimitives/types';
2
+ import type { Sha256 } from './canonicalization.js';
3
+ import type { PrivateResolutionGrantV1 } from './grants.js';
4
+ import type { AgentServicePublicationV1 } from './publication.js';
5
+ export interface AgentConnectionInvitationV1 {
6
+ specVersion: 'ap.agent-connection-invitation/1';
7
+ invitationId: string;
8
+ issuer: CanonicalAgentId;
9
+ targetAgent: CanonicalAgentId;
10
+ /** Absent only for an invitation intended to bootstrap a party with no Smart Agent yet. */
11
+ recipient?: CanonicalAgentId;
12
+ display?: {
13
+ /** A PRIVATE label. Never projected publicly, never correlated across counterparties. */
14
+ label?: string;
15
+ purpose?: string;
16
+ };
17
+ resolution: {
18
+ method: 'private-grant';
19
+ /** Where to present the grant — an org/vault rendezvous service, not the target's own endpoint. */
20
+ rendezvous: string;
21
+ grant: PrivateResolutionGrantV1;
22
+ };
23
+ /** Lets the recipient connect before ever contacting the resolver. Omit for refresh-only invitations. */
24
+ initialPublication?: AgentServicePublicationV1;
25
+ /** What the recipient MUST verify independently — the anti-substitution anchor. */
26
+ expectedBindings: {
27
+ targetAgentId: CanonicalAgentId;
28
+ publicationDigest?: Sha256;
29
+ endpointProofRequired: boolean;
30
+ };
31
+ issuedAt: string;
32
+ expiresAt: string;
33
+ proof: unknown;
34
+ }
35
+ /** The invitation body a proof commits to. */
36
+ export declare function invitationBody(i: Omit<AgentConnectionInvitationV1, 'proof'>): Record<string, unknown>;
37
+ export interface InvitationShapeViolation {
38
+ field: string;
39
+ message: string;
40
+ }
41
+ /** Static coherence checks between the invitation and the grant it carries. */
42
+ export declare function validateInvitationShape(i: AgentConnectionInvitationV1): InvitationShapeViolation[];
43
+ //# sourceMappingURL=invitation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invitation.d.ts","sourceRoot":"","sources":["../src/invitation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,WAAW,2BAA2B;IAC1C,WAAW,EAAE,kCAAkC,CAAC;IAEhD,YAAY,EAAE,MAAM,CAAC;IAErB,MAAM,EAAE,gBAAgB,CAAC;IACzB,WAAW,EAAE,gBAAgB,CAAC;IAC9B,2FAA2F;IAC3F,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B,OAAO,CAAC,EAAE;QACR,yFAAyF;QACzF,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF,UAAU,EAAE;QACV,MAAM,EAAE,eAAe,CAAC;QACxB,mGAAmG;QACnG,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,wBAAwB,CAAC;KACjC,CAAC;IAEF,yGAAyG;IACzG,kBAAkB,CAAC,EAAE,yBAAyB,CAAC;IAE/C,mFAAmF;IACnF,gBAAgB,EAAE;QAChB,aAAa,EAAE,gBAAgB,CAAC;QAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,qBAAqB,EAAE,OAAO,CAAC;KAChC,CAAC;IAEF,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,8CAA8C;AAC9C,wBAAgB,cAAc,CAC5B,CAAC,EAAE,IAAI,CAAC,2BAA2B,EAAE,OAAO,CAAC,GAC5C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAczB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+EAA+E;AAC/E,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,2BAA2B,GAAG,wBAAwB,EAAE,CAiDlG"}
@@ -0,0 +1,76 @@
1
+ // AgentConnectionInvitation — the bootstrap object (spec 338 §5).
2
+ //
3
+ // It answers the obvious objection: if the agent's endpoint is private, how does a partner reach the
4
+ // resolver in the first place? By carrying BOTH an initial connection result AND a refresh path:
5
+ //
6
+ // initial signed Publication → connect immediately, resolver-independent
7
+ // + private resolution grant → refresh forever
8
+ // + rendezvous locator → where to refresh
9
+ // + expected bindings → what the recipient must independently verify
10
+ //
11
+ // This is why we do not "just send an endpoint": the partner never needs a new invitation when the
12
+ // endpoint, transport key, region, or provider changes.
13
+ /** The invitation body a proof commits to. */
14
+ export function invitationBody(i) {
15
+ return {
16
+ specVersion: i.specVersion,
17
+ invitationId: i.invitationId,
18
+ issuer: i.issuer,
19
+ targetAgent: i.targetAgent,
20
+ recipient: i.recipient,
21
+ display: i.display,
22
+ resolution: i.resolution,
23
+ initialPublicationDigest: i.initialPublication?.digest,
24
+ expectedBindings: i.expectedBindings,
25
+ issuedAt: i.issuedAt,
26
+ expiresAt: i.expiresAt,
27
+ };
28
+ }
29
+ /** Static coherence checks between the invitation and the grant it carries. */
30
+ export function validateInvitationShape(i) {
31
+ const out = [];
32
+ const g = i.resolution.grant;
33
+ if (g.targetAgent !== i.targetAgent) {
34
+ out.push({
35
+ field: 'resolution.grant.targetAgent',
36
+ message: 'grant target MUST equal the invitation target — otherwise the invitation resolves a different agent than it names',
37
+ });
38
+ }
39
+ if (i.expectedBindings.targetAgentId !== i.targetAgent) {
40
+ out.push({
41
+ field: 'expectedBindings.targetAgentId',
42
+ message: 'expected binding target MUST equal the invitation target',
43
+ });
44
+ }
45
+ if (i.recipient && g.subject && g.subject !== i.recipient) {
46
+ out.push({
47
+ field: 'resolution.grant.subject',
48
+ message: 'grant subject MUST equal the invitation recipient',
49
+ });
50
+ }
51
+ if (i.initialPublication) {
52
+ if (i.initialPublication.agentId !== i.targetAgent) {
53
+ out.push({
54
+ field: 'initialPublication.agentId',
55
+ message: 'initial publication MUST describe the invitation target',
56
+ });
57
+ }
58
+ if (i.expectedBindings.publicationDigest &&
59
+ i.expectedBindings.publicationDigest !== i.initialPublication.digest) {
60
+ out.push({
61
+ field: 'expectedBindings.publicationDigest',
62
+ message: 'expected publication digest MUST match the carried initial publication',
63
+ });
64
+ }
65
+ }
66
+ const issued = Date.parse(i.issuedAt);
67
+ const expires = Date.parse(i.expiresAt);
68
+ if (Number.isNaN(issued) || Number.isNaN(expires)) {
69
+ out.push({ field: 'expiresAt', message: 'issuedAt and expiresAt MUST be parseable ISO-8601 timestamps' });
70
+ }
71
+ else if (expires <= issued) {
72
+ out.push({ field: 'expiresAt', message: 'expiresAt MUST be after issuedAt' });
73
+ }
74
+ return out;
75
+ }
76
+ //# sourceMappingURL=invitation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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kCAAkC,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,61 @@
1
+ import type { CanonicalAgentId, VerifiedPeerContextV1 } from '@agenticprimitives/types';
2
+ import type { Erc1271Verifier } from './proof.js';
3
+ /** What the responding agent signs. Every field is bound so none of them can be varied after signing. */
4
+ export interface PeerAttestationV1 {
5
+ specVersion: 'ap.peer-attestation/1';
6
+ /** The agent claiming to be at this endpoint. */
7
+ agentId: CanonicalAgentId;
8
+ /** The CLIENT's nonce. Single-use, client-generated — a server-chosen value proves nothing. */
9
+ nonce: string;
10
+ /** The endpoint origin this attestation is for. Stops it being replayed for another endpoint. */
11
+ audience: string;
12
+ issuedAt: string;
13
+ expiresAt: string;
14
+ /** Signature over `peerAttestationDigest`, by `agentId`'s own key. */
15
+ proof: `0x${string}`;
16
+ }
17
+ /**
18
+ * The canonical body the signature covers.
19
+ *
20
+ * `proof` is excluded (it is the output). Everything else is in, so an attestation cannot be re-aimed
21
+ * at a different agent, endpoint, nonce, or lifetime without invalidating it.
22
+ */
23
+ export declare function peerAttestationBody(a: Omit<PeerAttestationV1, 'proof'>): Record<string, unknown>;
24
+ /** The digest the responding agent signs and the client recomputes. */
25
+ export declare function peerAttestationDigest(a: Omit<PeerAttestationV1, 'proof'>): Promise<`0x${string}`>;
26
+ export type PeerAttestationFailureCode = 'attestation_malformed' | 'attestation_nonce_mismatch' | 'attestation_audience_mismatch' | 'attestation_expired' | 'attestation_signature_invalid';
27
+ export interface VerifyPeerAttestationInput {
28
+ attestation: unknown;
29
+ /** The nonce THIS client generated for THIS dial. Never one echoed back from the response. */
30
+ expectedNonce: string;
31
+ /** The endpoint origin we dialled. */
32
+ expectedAudience: string;
33
+ verifier: Erc1271Verifier;
34
+ now: Date;
35
+ /**
36
+ * A channel binding, when the transport can supply one.
37
+ *
38
+ * Omit on any baseline HTTPS path — workerd exposes no TLS exporter (RFC 9266), so there is nothing
39
+ * honest to put here, and inventing one would make `isChannelBoundPeer` lie.
40
+ */
41
+ channelBinding?: VerifiedPeerContextV1['channelBinding'];
42
+ }
43
+ export type VerifyPeerAttestationResult = {
44
+ ok: true;
45
+ peer: VerifiedPeerContextV1;
46
+ } | {
47
+ ok: false;
48
+ code: PeerAttestationFailureCode;
49
+ detail: string;
50
+ };
51
+ /**
52
+ * Verify an attestation and produce the peer context the gate consumes.
53
+ *
54
+ * Checks the nonce and audience BEFORE the signature: those are free, and an attestation for another
55
+ * dial should not cost a chain read. Never throws — every failure is a code the caller keeps local.
56
+ *
57
+ * The returned context reports `strength: 'agent'` ONLY because the signature verified against the
58
+ * claimed agent's own key. It carries a `channelBinding` only if the caller had one to supply.
59
+ */
60
+ export declare function verifyPeerAttestation(input: VerifyPeerAttestationInput): Promise<VerifyPeerAttestationResult>;
61
+ //# sourceMappingURL=peer-attestation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peer-attestation.d.ts","sourceRoot":"","sources":["../src/peer-attestation.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAExF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,yGAAyG;AACzG,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,uBAAuB,CAAC;IACrC,iDAAiD;IACjD,OAAO,EAAE,gBAAgB,CAAC;IAC1B,+FAA+F;IAC/F,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAShG;AAED,uEAAuE;AACvE,wBAAsB,qBAAqB,CACzC,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAClC,OAAO,CAAC,KAAK,MAAM,EAAE,CAAC,CAExB;AAED,MAAM,MAAM,0BAA0B,GAClC,uBAAuB,GACvB,4BAA4B,GAC5B,+BAA+B,GAC/B,qBAAqB,GACrB,+BAA+B,CAAC;AAEpC,MAAM,WAAW,0BAA0B;IACzC,WAAW,EAAE,OAAO,CAAC;IACrB,8FAA8F;IAC9F,aAAa,EAAE,MAAM,CAAC;IACtB,sCAAsC;IACtC,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,eAAe,CAAC;IAC1B,GAAG,EAAE,IAAI,CAAC;IACV;;;;;OAKG;IACH,cAAc,CAAC,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;CAC1D;AAED,MAAM,MAAM,2BAA2B,GACnC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAA;CAAE,GACzC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,0BAA0B,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAqBpE;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,2BAA2B,CAAC,CAyDtC"}
@@ -0,0 +1,128 @@
1
+ // Peer attestation — the PRODUCER half of the post-resolve gate (spec 338 §6; AR-L7 item 2).
2
+ //
3
+ // `checkResolvedPeer` consumes a `VerifiedPeerContextV1`. Nothing in the repo produced one for this
4
+ // direction, which is why the gate had no input and the assurance rung stayed unreachable.
5
+ //
6
+ // DIRECTION MATTERS, AND IT IS THE OPPOSITE OF THE USUAL ONE. `edge-runtime`'s `createPeerAuthenticator`
7
+ // verifies an INBOUND caller — a client proving itself to a server. This gate needs the reverse: after
8
+ // I resolve agent B and dial it, *B* must prove to *me* that it is B. So the client issues the nonce
9
+ // and the responding agent signs it.
10
+ //
11
+ // WHAT THIS CLOSES. A verified publication proves B signed "my endpoint is this URI". It says nothing
12
+ // about who answers there now. An attestation is B, live, on this request, saying "it is me" — with
13
+ // the client's own nonce in it, so a captured attestation cannot be replayed.
14
+ //
15
+ // WHAT IT DOES NOT CLOSE, and the type refuses to pretend otherwise: an active relay. Without a
16
+ // channel binding, a party terminating TLS for the host can forward the challenge to the real B, take
17
+ // its signature, and pass it back. The produced context therefore carries NO `channelBinding` unless
18
+ // the transport supplied one, and `checkResolvedPeer` refuses it by default for exactly that reason.
19
+ //
20
+ // A NOTE ON WHO CAN DO THIS AT ALL. Attesting requires the responding host to hold (or reach) the
21
+ // agent's signing key. A host serving an agent it does not custody cannot prove AGENT identity — only
22
+ // host identity. That is not a gap in this design; it is why `PeerAuthStrength` separates `host` from
23
+ // `agent`, and a host in that position should report `host` and be refused by the gate rather than
24
+ // claim something it cannot back.
25
+ import { digestOf, signingDigest } from './canonicalization.js';
26
+ /**
27
+ * The canonical body the signature covers.
28
+ *
29
+ * `proof` is excluded (it is the output). Everything else is in, so an attestation cannot be re-aimed
30
+ * at a different agent, endpoint, nonce, or lifetime without invalidating it.
31
+ */
32
+ export function peerAttestationBody(a) {
33
+ return {
34
+ specVersion: a.specVersion,
35
+ agentId: a.agentId,
36
+ nonce: a.nonce,
37
+ audience: a.audience,
38
+ issuedAt: a.issuedAt,
39
+ expiresAt: a.expiresAt,
40
+ };
41
+ }
42
+ /** The digest the responding agent signs and the client recomputes. */
43
+ export async function peerAttestationDigest(a) {
44
+ return signingDigest(await digestOf(peerAttestationBody(a)));
45
+ }
46
+ function isAttestation(v) {
47
+ if (!v || typeof v !== 'object')
48
+ return false;
49
+ const a = v;
50
+ return (a.specVersion === 'ap.peer-attestation/1' &&
51
+ typeof a.agentId === 'string' &&
52
+ typeof a.nonce === 'string' &&
53
+ typeof a.audience === 'string' &&
54
+ typeof a.issuedAt === 'string' &&
55
+ typeof a.expiresAt === 'string' &&
56
+ typeof a.proof === 'string');
57
+ }
58
+ const addressOf = (id) => {
59
+ const last = id.split(':').pop() ?? '';
60
+ return /^0x[0-9a-fA-F]{40}$/.test(last) ? last.toLowerCase() : null;
61
+ };
62
+ /**
63
+ * Verify an attestation and produce the peer context the gate consumes.
64
+ *
65
+ * Checks the nonce and audience BEFORE the signature: those are free, and an attestation for another
66
+ * dial should not cost a chain read. Never throws — every failure is a code the caller keeps local.
67
+ *
68
+ * The returned context reports `strength: 'agent'` ONLY because the signature verified against the
69
+ * claimed agent's own key. It carries a `channelBinding` only if the caller had one to supply.
70
+ */
71
+ export async function verifyPeerAttestation(input) {
72
+ const fail = (code, detail) => ({
73
+ ok: false,
74
+ code,
75
+ detail,
76
+ });
77
+ if (!isAttestation(input.attestation))
78
+ return fail('attestation_malformed', 'not a peer attestation');
79
+ const a = input.attestation;
80
+ // OUR nonce, compared against what came back. This is the only thing making the attestation about
81
+ // THIS dial rather than one captured earlier.
82
+ if (a.nonce !== input.expectedNonce) {
83
+ return fail('attestation_nonce_mismatch', 'attestation does not echo the nonce we issued');
84
+ }
85
+ if (a.audience !== input.expectedAudience) {
86
+ return fail('attestation_audience_mismatch', 'attestation was made for a different endpoint');
87
+ }
88
+ const expiresAt = Date.parse(a.expiresAt);
89
+ const issuedAt = Date.parse(a.issuedAt);
90
+ if (Number.isNaN(expiresAt) || Number.isNaN(issuedAt)) {
91
+ return fail('attestation_malformed', 'unparseable timestamps');
92
+ }
93
+ if (expiresAt <= input.now.getTime())
94
+ return fail('attestation_expired', 'attestation has expired');
95
+ const signer = addressOf(a.agentId);
96
+ if (!signer)
97
+ return fail('attestation_malformed', 'agentId is not a CAIP-10 address');
98
+ let valid = false;
99
+ try {
100
+ const { proof, ...body } = a;
101
+ valid = await input.verifier.verifyHash({
102
+ address: signer,
103
+ hash: await peerAttestationDigest(body),
104
+ signature: proof,
105
+ });
106
+ }
107
+ catch {
108
+ // A verifier that threw did not verify (ADR-0013).
109
+ valid = false;
110
+ }
111
+ if (!valid)
112
+ return fail('attestation_signature_invalid', 'signature did not verify against the claimed agent');
113
+ return {
114
+ ok: true,
115
+ peer: {
116
+ specVersion: 'ap.verified-peer-context/1',
117
+ method: 'ap-signed-challenge',
118
+ // Earned: the claimed agent's own key signed our nonce. NOT relay-resistant — see the header.
119
+ strength: 'agent',
120
+ canonicalAgentId: a.agentId,
121
+ peer: { scheme: 'caip10', id: a.agentId },
122
+ channelBinding: input.channelBinding,
123
+ observedAt: input.now.toISOString(),
124
+ expiresAt: a.expiresAt,
125
+ },
126
+ };
127
+ }
128
+ //# sourceMappingURL=peer-attestation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peer-attestation.js","sourceRoot":"","sources":["../src/peer-attestation.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,EAAE;AACF,oGAAoG;AACpG,2FAA2F;AAC3F,EAAE;AACF,yGAAyG;AACzG,uGAAuG;AACvG,qGAAqG;AACrG,qCAAqC;AACrC,EAAE;AACF,sGAAsG;AACtG,oGAAoG;AACpG,8EAA8E;AAC9E,EAAE;AACF,gGAAgG;AAChG,sGAAsG;AACtG,qGAAqG;AACrG,qGAAqG;AACrG,EAAE;AACF,kGAAkG;AAClG,sGAAsG;AACtG,sGAAsG;AACtG,mGAAmG;AACnG,kCAAkC;AAGlC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAkBhE;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAmC;IACrE,OAAO;QACL,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,SAAS,EAAE,CAAC,CAAC,SAAS;KACvB,CAAC;AACJ,CAAC;AAED,uEAAuE;AACvE,MAAM,CAAC,KAAK,UAAU,q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