@agenticprimitives/agent-resolution 0.0.0-alpha.20 → 0.0.0-alpha.22
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 +15 -9
- package/dist/compose.d.ts +58 -7
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +116 -62
- package/dist/compose.js.map +1 -1
- package/dist/endpoint-control.d.ts +120 -13
- package/dist/endpoint-control.d.ts.map +1 -1
- package/dist/endpoint-control.js +215 -51
- package/dist/endpoint-control.js.map +1 -1
- package/dist/errors.d.ts +16 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +6 -0
- package/dist/errors.js.map +1 -1
- package/dist/freshness.d.ts +79 -5
- package/dist/freshness.d.ts.map +1 -1
- package/dist/freshness.js +149 -35
- package/dist/freshness.js.map +1 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/projection.d.ts +17 -3
- package/dist/projection.d.ts.map +1 -1
- package/dist/projection.js +20 -2
- package/dist/projection.js.map +1 -1
- package/dist/proof.d.ts +120 -18
- package/dist/proof.d.ts.map +1 -1
- package/dist/proof.js +279 -73
- package/dist/proof.js.map +1 -1
- package/dist/publication.d.ts +62 -6
- package/dist/publication.d.ts.map +1 -1
- package/dist/publication.js +28 -1
- package/dist/publication.js.map +1 -1
- package/dist/records.d.ts +3 -0
- package/dist/records.d.ts.map +1 -1
- package/dist/records.js.map +1 -1
- package/package.json +3 -3
- package/spec.md +5 -2
package/dist/freshness.d.ts
CHANGED
|
@@ -1,23 +1,73 @@
|
|
|
1
|
+
import type { CanonicalAgentId } from '@agenticprimitives/types';
|
|
1
2
|
import type { Sha256 } from './canonicalization.js';
|
|
2
3
|
import { type ResolutionFailure } from './errors.js';
|
|
3
|
-
/**
|
|
4
|
+
/** Statuses that withdraw a publication. Each is a sequenced publication that advances the floor. */
|
|
5
|
+
export type TombstoneStatus = 'suspended' | 'revoked' | 'compromised';
|
|
6
|
+
export declare function isTombstoneStatus(status: string): status is TombstoneStatus;
|
|
7
|
+
/** A key epoch is a non-negative safe integer. Anything else is malformed, never "epoch 0". */
|
|
8
|
+
export declare function isKeyEpoch(v: unknown): v is number;
|
|
9
|
+
/**
|
|
10
|
+
* What a verifier accepted on ONE channel of ONE agent — the channel it is entitled to read. Absent
|
|
11
|
+
* ⇒ first contact on that channel. Keyed by (`agentId`, `channelId`) where `channelId` is the
|
|
12
|
+
* verifier's EXPECTED channel, never a publication's own claim.
|
|
13
|
+
*/
|
|
4
14
|
export interface ChannelContinuityState {
|
|
15
|
+
agentId: CanonicalAgentId;
|
|
16
|
+
/** The channel the verifier expects (public, or the one its grant establishes). */
|
|
5
17
|
channelId: string;
|
|
18
|
+
/** The floor: the highest sequence accepted (or tombstoned) on this channel. */
|
|
6
19
|
latestAcceptedSequence: bigint;
|
|
7
20
|
latestAcceptedDigest: Sha256;
|
|
21
|
+
/** The key epoch the floor publication carried. */
|
|
22
|
+
latestAcceptedKeyEpoch: number;
|
|
23
|
+
/** Set when the floor publication is a tombstone. Terminal for everything at or below it. */
|
|
24
|
+
tombstone?: {
|
|
25
|
+
status: TombstoneStatus;
|
|
26
|
+
sequence: bigint;
|
|
27
|
+
digest: Sha256;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* What a verifier knows about ONE AGENT across every channel it reads. Deliberately tiny: the
|
|
32
|
+
* key-epoch floor and the publishers a `compromised` tombstone retired. No sequence lives here.
|
|
33
|
+
*/
|
|
34
|
+
export interface AgentKeyEpochState {
|
|
35
|
+
agentId: CanonicalAgentId;
|
|
36
|
+
/** The floor: the highest `keyEpoch` seen from an authentic publication or tombstone, any channel. */
|
|
37
|
+
keyEpoch: number;
|
|
38
|
+
/**
|
|
39
|
+
* Delegated publishers named by a `compromised` tombstone. Refused at every sequence, on every
|
|
40
|
+
* channel, forever. (A SELF-published tombstone lists nobody: the Smart Agent's address is its
|
|
41
|
+
* identity and its credentials rotate under it — the epoch, not the address, retires the old range.)
|
|
42
|
+
*/
|
|
43
|
+
compromisedPublishers?: readonly CanonicalAgentId[];
|
|
44
|
+
}
|
|
45
|
+
/** The pair a verifier persists after an authentic publication: the channel floor + the agent floor. */
|
|
46
|
+
export interface PublicationContinuity {
|
|
47
|
+
channel: ChannelContinuityState;
|
|
48
|
+
agent: AgentKeyEpochState;
|
|
8
49
|
}
|
|
9
50
|
export interface FreshnessInput {
|
|
51
|
+
/** The agent the publication describes. */
|
|
52
|
+
agentId: CanonicalAgentId;
|
|
53
|
+
/** The channel the VERIFIER expects. The caller has already matched the publication to it. */
|
|
10
54
|
channelId: string;
|
|
11
55
|
sequence: bigint;
|
|
12
56
|
previousDigest?: Sha256;
|
|
13
57
|
digest: Sha256;
|
|
58
|
+
/** The publication's agent-wide key epoch. */
|
|
59
|
+
keyEpoch: number;
|
|
14
60
|
issuedAt: string;
|
|
15
61
|
notBefore?: string;
|
|
16
62
|
expiresAt: string;
|
|
63
|
+
/** Who signed it — checked against `agent.compromisedPublishers`. */
|
|
64
|
+
publishedBy?: CanonicalAgentId;
|
|
17
65
|
/** ISO-8601, injected. */
|
|
18
66
|
now: string;
|
|
19
|
-
/** Prior state for this channel, if the
|
|
67
|
+
/** Prior state for this (agent, expected channel), if the verifier has read the channel before. */
|
|
20
68
|
known?: ChannelContinuityState;
|
|
69
|
+
/** Prior state for this AGENT — possibly learned on a different channel. */
|
|
70
|
+
agent?: AgentKeyEpochState;
|
|
21
71
|
/** Require `previousDigest` to chain to the known digest. Default true when `known` is supplied. */
|
|
22
72
|
requireContinuity?: boolean;
|
|
23
73
|
}
|
|
@@ -31,13 +81,37 @@ export interface ResolutionFreshnessV1 {
|
|
|
31
81
|
remainingMs: number;
|
|
32
82
|
/** True when a differing digest was seen at the same sequence — publisher equivocation. */
|
|
33
83
|
conflict: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* True when the CONTINUITY checks passed against what is known (no rollback on the channel, no
|
|
86
|
+
* equivocation, chain intact, key epoch at or above the agent floor, publisher not tombstoned) —
|
|
87
|
+
* independent of the validity window. This, not `fresh`, is what decides whether an authentic
|
|
88
|
+
* tombstone may move the floors.
|
|
89
|
+
*/
|
|
90
|
+
sequenceOk: boolean;
|
|
34
91
|
failures: readonly ResolutionFailure[];
|
|
35
92
|
}
|
|
36
93
|
export declare function checkFreshness(input: FreshnessInput): ResolutionFreshnessV1;
|
|
37
|
-
/**
|
|
38
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Advance a verifier's continuity after a publication was AUTHENTICATED (format, digest, agent,
|
|
96
|
+
* EXPECTED channel, signature, publisher authority, continuity checks). Returns BOTH records to
|
|
97
|
+
* persist. Fail-closed: neither floor regresses, a compromised publisher is never forgotten, and
|
|
98
|
+
* state for another agent or channel is a thrown programming error — never silently adopted.
|
|
99
|
+
*
|
|
100
|
+
* `accepted.channelId` is the channel the VERIFIER expected. A tombstone moves the channel floor
|
|
101
|
+
* exactly like an active publication does; a `compromised` one also retires its delegated publisher
|
|
102
|
+
* and — if the publisher failed to raise the epoch as the format requires — raises the agent floor
|
|
103
|
+
* past the epoch this channel last accepted, so "compromised" always retires the old epoch.
|
|
104
|
+
*/
|
|
105
|
+
export declare function advanceContinuity(known: {
|
|
106
|
+
channel?: ChannelContinuityState;
|
|
107
|
+
agent?: AgentKeyEpochState;
|
|
108
|
+
} | undefined, accepted: {
|
|
109
|
+
agentId: CanonicalAgentId;
|
|
39
110
|
channelId: string;
|
|
40
111
|
sequence: bigint;
|
|
41
112
|
digest: Sha256;
|
|
42
|
-
|
|
113
|
+
keyEpoch: number;
|
|
114
|
+
status?: string;
|
|
115
|
+
publishedBy?: CanonicalAgentId;
|
|
116
|
+
}): PublicationContinuity;
|
|
43
117
|
//# sourceMappingURL=freshness.d.ts.map
|
package/dist/freshness.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freshness.d.ts","sourceRoot":"","sources":["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O,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC,GACA,qBAAqB,CAiDvB"}
|
package/dist/freshness.js
CHANGED
|
@@ -2,53 +2,98 @@
|
|
|
2
2
|
//
|
|
3
3
|
// The rule this file exists to enforce:
|
|
4
4
|
// A content hash proves the publication was NOT MODIFIED. It does not prove it is CURRENT.
|
|
5
|
+
// Sequence + expiry + status + key epoch prove current.
|
|
6
|
+
//
|
|
7
|
+
// THE PROPERTY, OVER THE WHOLE OBJECT (spec 445 / NAME-3 — the hybrid):
|
|
8
|
+
//
|
|
9
|
+
// TWO floors, two keys, and neither key is taken from the object under verification.
|
|
10
|
+
//
|
|
11
|
+
// 1. CHANNEL floor, keyed by (agent, the channel THE VERIFIER EXPECTS). `sequence` is an
|
|
12
|
+
// independent counter per channel; the floor is the highest sequence this verifier accepted on
|
|
13
|
+
// the channel it is entitled to read. The caller has already refused a publication whose
|
|
14
|
+
// `channelId` differs from that expectation (`publication_channel_mismatch`), so the object
|
|
15
|
+
// cannot choose "first contact" by naming another channel — which is how the rollback
|
|
16
|
+
// re-entered.
|
|
17
|
+
// 2. AGENT KEY-EPOCH floor, keyed by the agent. `keyEpoch` is the same small integer on every
|
|
18
|
+
// channel and moves only on a key rotation or a `compromised` / `revoked`-with-rotation
|
|
19
|
+
// tombstone. The highest epoch seen from an AUTHENTIC publication or tombstone on ANY channel
|
|
20
|
+
// this verifier reads is the floor for EVERY channel: a publication under an older epoch is
|
|
21
|
+
// refused wherever it is presented, including a channel the verifier has never read before.
|
|
22
|
+
//
|
|
23
|
+
// A tombstone (`suspended` / `revoked` / `compromised`) is itself a sequenced publication: it moves
|
|
24
|
+
// the channel floor, and nothing at or below it is accepted again on that channel. A `compromised`
|
|
25
|
+
// tombstone additionally carries the NEW epoch — retiring everything under the old one on every
|
|
26
|
+
// channel — and retires the delegated publisher that signed it at every sequence.
|
|
27
|
+
//
|
|
28
|
+
// WHY NOT ONE PER-AGENT SEQUENCE: it closes the same rollback, but puts a running counter that
|
|
29
|
+
// advances with every publication to anyone into every counterparty's hands (see `keyEpoch` in
|
|
30
|
+
// `publication.ts` for what each design reveals).
|
|
5
31
|
//
|
|
6
|
-
// Currency is three independent things — the publication is inside its own validity window, it is
|
|
7
|
-
// not a rollback to an older sequence, and it continues the chain the client already knows.
|
|
8
32
|
// Equivocation (two valid signatures at the same sequence) is reported rather than merely rejected,
|
|
9
33
|
// because it is evidence of publisher-key compromise, not a transient error.
|
|
10
|
-
import { failure } from './errors.js';
|
|
34
|
+
import { AgentResolutionError, failure } from './errors.js';
|
|
35
|
+
export function isTombstoneStatus(status) {
|
|
36
|
+
return status === 'suspended' || status === 'revoked' || status === 'compromised';
|
|
37
|
+
}
|
|
38
|
+
/** A key epoch is a non-negative safe integer. Anything else is malformed, never "epoch 0". */
|
|
39
|
+
export function isKeyEpoch(v) {
|
|
40
|
+
return typeof v === 'number' && Number.isSafeInteger(v) && v >= 0;
|
|
41
|
+
}
|
|
11
42
|
export function checkFreshness(input) {
|
|
12
43
|
const failures = [];
|
|
44
|
+
const seqFailures = [];
|
|
13
45
|
const now = Date.parse(input.now);
|
|
14
46
|
const expiresAt = Date.parse(input.expiresAt);
|
|
15
47
|
const notBefore = input.notBefore ? Date.parse(input.notBefore) : Date.parse(input.issuedAt);
|
|
16
48
|
let conflict = false;
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
fresh: false,
|
|
21
|
-
sequence: input.sequence,
|
|
22
|
-
issuedAt: input.issuedAt,
|
|
23
|
-
expiresAt: input.expiresAt,
|
|
24
|
-
remainingMs: 0,
|
|
25
|
-
conflict: false,
|
|
26
|
-
failures,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
if (now < notBefore) {
|
|
30
|
-
failures.push(failure('publication_not_yet_valid', 'publication is not yet valid', { notBefore: input.notBefore }));
|
|
49
|
+
if (typeof input.sequence !== 'bigint' || input.sequence < 0n) {
|
|
50
|
+
seqFailures.push(failure('malformed', 'sequence MUST be a non-negative bigint'));
|
|
31
51
|
}
|
|
32
|
-
if (
|
|
33
|
-
|
|
52
|
+
if (!isKeyEpoch(input.keyEpoch)) {
|
|
53
|
+
seqFailures.push(failure('malformed', 'keyEpoch MUST be a non-negative safe integer'));
|
|
34
54
|
}
|
|
35
|
-
|
|
36
|
-
|
|
55
|
+
const wellFormed = seqFailures.length === 0;
|
|
56
|
+
// ── Agent floor: key epoch + retired publishers. Applies on EVERY channel, incl. first contact.
|
|
57
|
+
const agent = input.agent;
|
|
58
|
+
if (agent && wellFormed) {
|
|
59
|
+
if (agent.agentId !== input.agentId) {
|
|
60
|
+
seqFailures.push(failure('publication_continuity_broken', 'known key-epoch state is for a different agent', {
|
|
61
|
+
expected: input.agentId,
|
|
62
|
+
got: agent.agentId,
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
if (input.publishedBy && (agent.compromisedPublishers ?? []).includes(input.publishedBy)) {
|
|
67
|
+
seqFailures.push(failure('publication_publisher_tombstoned', 'publisher was named by a compromised tombstone for this agent', {
|
|
68
|
+
publishedBy: input.publishedBy,
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
if (input.keyEpoch < agent.keyEpoch) {
|
|
72
|
+
// Signed under a key set the agent has since rotated out or declared compromised. Refused
|
|
73
|
+
// on whichever channel it is presented — the channel's own sequence cannot see this.
|
|
74
|
+
seqFailures.push(failure('publication_key_epoch_retired', 'publication key epoch is older than the highest seen for this agent', {
|
|
75
|
+
keyEpoch: input.keyEpoch,
|
|
76
|
+
floor: agent.keyEpoch,
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
37
80
|
}
|
|
81
|
+
// ── Channel floor: sequence, equivocation, chain.
|
|
38
82
|
const known = input.known;
|
|
39
|
-
if (known) {
|
|
40
|
-
if (known.channelId !== input.channelId) {
|
|
41
|
-
|
|
42
|
-
expected: input.channelId
|
|
43
|
-
got: known.channelId
|
|
83
|
+
if (known && wellFormed) {
|
|
84
|
+
if (known.agentId !== input.agentId || known.channelId !== input.channelId) {
|
|
85
|
+
seqFailures.push(failure('publication_continuity_broken', 'known continuity state is for a different agent or channel', {
|
|
86
|
+
expected: `${input.agentId} / ${input.channelId}`,
|
|
87
|
+
got: `${known.agentId} / ${known.channelId}`,
|
|
44
88
|
}));
|
|
45
89
|
}
|
|
46
90
|
else if (input.sequence < known.latestAcceptedSequence) {
|
|
47
91
|
// Rollback: an attacker replaying an older, still-signed publication to steer a client at a
|
|
48
92
|
// decommissioned or compromised endpoint.
|
|
49
|
-
|
|
93
|
+
seqFailures.push(failure('publication_sequence_rollback', 'publication sequence is older than the latest accepted on this channel', {
|
|
50
94
|
sequence: input.sequence.toString(10),
|
|
51
95
|
latestAccepted: known.latestAcceptedSequence.toString(10),
|
|
96
|
+
tombstoned: known.tombstone?.status,
|
|
52
97
|
}));
|
|
53
98
|
}
|
|
54
99
|
else if (input.sequence === known.latestAcceptedSequence) {
|
|
@@ -56,7 +101,7 @@ export function checkFreshness(input) {
|
|
|
56
101
|
// Equivocation: two validly signed publications at the same sequence. Both digests are kept
|
|
57
102
|
// as evidence by the caller; this is a compromise signal, not a retryable error.
|
|
58
103
|
conflict = true;
|
|
59
|
-
|
|
104
|
+
seqFailures.push(failure('publication_equivocation', 'a different publication was already accepted at this sequence', {
|
|
60
105
|
sequence: input.sequence.toString(10),
|
|
61
106
|
knownDigest: known.latestAcceptedDigest,
|
|
62
107
|
offeredDigest: input.digest,
|
|
@@ -69,13 +114,34 @@ export function checkFreshness(input) {
|
|
|
69
114
|
// publications) is legitimate and is not a continuity break.
|
|
70
115
|
const isDirectSuccessor = input.sequence === known.latestAcceptedSequence + 1n;
|
|
71
116
|
if (requireContinuity && isDirectSuccessor && input.previousDigest !== known.latestAcceptedDigest) {
|
|
72
|
-
|
|
117
|
+
seqFailures.push(failure('publication_continuity_broken', 'previousDigest does not chain to the last accepted publication', {
|
|
73
118
|
expected: known.latestAcceptedDigest,
|
|
74
119
|
got: input.previousDigest,
|
|
75
120
|
}));
|
|
76
121
|
}
|
|
77
122
|
}
|
|
78
123
|
}
|
|
124
|
+
if (Number.isNaN(now) || Number.isNaN(expiresAt) || Number.isNaN(notBefore)) {
|
|
125
|
+
// An unparseable window cannot be shown to be current — never a pass.
|
|
126
|
+
failures.push(failure('malformed', 'now / notBefore / expiresAt MUST be parseable ISO-8601 timestamps'));
|
|
127
|
+
return {
|
|
128
|
+
fresh: false,
|
|
129
|
+
sequence: input.sequence,
|
|
130
|
+
issuedAt: input.issuedAt,
|
|
131
|
+
expiresAt: input.expiresAt,
|
|
132
|
+
remainingMs: 0,
|
|
133
|
+
conflict,
|
|
134
|
+
sequenceOk: seqFailures.length === 0,
|
|
135
|
+
failures: [...failures, ...seqFailures],
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (now < notBefore) {
|
|
139
|
+
failures.push(failure('publication_not_yet_valid', 'publication is not yet valid', { notBefore: input.notBefore }));
|
|
140
|
+
}
|
|
141
|
+
if (now >= expiresAt) {
|
|
142
|
+
failures.push(failure('publication_expired', 'publication has expired', { expiresAt: input.expiresAt }));
|
|
143
|
+
}
|
|
144
|
+
failures.push(...seqFailures);
|
|
79
145
|
return {
|
|
80
146
|
fresh: failures.length === 0,
|
|
81
147
|
sequence: input.sequence,
|
|
@@ -83,18 +149,66 @@ export function checkFreshness(input) {
|
|
|
83
149
|
expiresAt: input.expiresAt,
|
|
84
150
|
remainingMs: expiresAt - now,
|
|
85
151
|
conflict,
|
|
152
|
+
sequenceOk: seqFailures.length === 0,
|
|
86
153
|
failures,
|
|
87
154
|
};
|
|
88
155
|
}
|
|
89
|
-
/**
|
|
156
|
+
/**
|
|
157
|
+
* Advance a verifier's continuity after a publication was AUTHENTICATED (format, digest, agent,
|
|
158
|
+
* EXPECTED channel, signature, publisher authority, continuity checks). Returns BOTH records to
|
|
159
|
+
* persist. Fail-closed: neither floor regresses, a compromised publisher is never forgotten, and
|
|
160
|
+
* state for another agent or channel is a thrown programming error — never silently adopted.
|
|
161
|
+
*
|
|
162
|
+
* `accepted.channelId` is the channel the VERIFIER expected. A tombstone moves the channel floor
|
|
163
|
+
* exactly like an active publication does; a `compromised` one also retires its delegated publisher
|
|
164
|
+
* and — if the publisher failed to raise the epoch as the format requires — raises the agent floor
|
|
165
|
+
* past the epoch this channel last accepted, so "compromised" always retires the old epoch.
|
|
166
|
+
*/
|
|
90
167
|
export function advanceContinuity(known, accepted) {
|
|
91
|
-
|
|
92
|
-
|
|
168
|
+
const kc = known?.channel;
|
|
169
|
+
const ka = known?.agent;
|
|
170
|
+
if (!isKeyEpoch(accepted.keyEpoch)) {
|
|
171
|
+
throw new AgentResolutionError('malformed', 'agent-resolution: keyEpoch must be a non-negative safe integer');
|
|
172
|
+
}
|
|
173
|
+
if (kc && (kc.agentId !== accepted.agentId || kc.channelId !== accepted.channelId)) {
|
|
174
|
+
throw new AgentResolutionError('publication_continuity_broken', 'agent-resolution: channel continuity state is for a different agent or channel');
|
|
175
|
+
}
|
|
176
|
+
if (ka && ka.agentId !== accepted.agentId) {
|
|
177
|
+
throw new AgentResolutionError('publication_continuity_broken', 'agent-resolution: key-epoch state is for a different agent');
|
|
93
178
|
}
|
|
179
|
+
// ── Agent floor.
|
|
180
|
+
const compromised = new Set(ka?.compromisedPublishers ?? []);
|
|
181
|
+
let keyEpoch = Math.max(ka?.keyEpoch ?? 0, accepted.keyEpoch);
|
|
182
|
+
if (accepted.status === 'compromised') {
|
|
183
|
+
if (accepted.publishedBy && accepted.publishedBy !== accepted.agentId)
|
|
184
|
+
compromised.add(accepted.publishedBy);
|
|
185
|
+
// A NEW compromised tombstone must carry a higher epoch than what this channel accepted before
|
|
186
|
+
// it. If it does not, the old epoch is retired anyway.
|
|
187
|
+
if (kc && accepted.sequence > kc.latestAcceptedSequence && accepted.keyEpoch <= kc.latestAcceptedKeyEpoch) {
|
|
188
|
+
keyEpoch = Math.max(keyEpoch, kc.latestAcceptedKeyEpoch + 1);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const agent = {
|
|
192
|
+
agentId: accepted.agentId,
|
|
193
|
+
keyEpoch,
|
|
194
|
+
...(compromised.size > 0 ? { compromisedPublishers: [...compromised] } : {}),
|
|
195
|
+
};
|
|
196
|
+
// ── Channel floor.
|
|
197
|
+
if (kc && kc.latestAcceptedSequence >= accepted.sequence)
|
|
198
|
+
return { channel: kc, agent };
|
|
199
|
+
const tombstone = accepted.status !== undefined && isTombstoneStatus(accepted.status)
|
|
200
|
+
? { status: accepted.status, sequence: accepted.sequence, digest: accepted.digest }
|
|
201
|
+
: undefined;
|
|
94
202
|
return {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
203
|
+
channel: {
|
|
204
|
+
agentId: accepted.agentId,
|
|
205
|
+
channelId: accepted.channelId,
|
|
206
|
+
latestAcceptedSequence: accepted.sequence,
|
|
207
|
+
latestAcceptedDigest: accepted.digest,
|
|
208
|
+
latestAcceptedKeyEpoch: accepted.keyEpoch,
|
|
209
|
+
...(tombstone ? { tombstone } : {}),
|
|
210
|
+
},
|
|
211
|
+
agent,
|
|
98
212
|
};
|
|
99
213
|
}
|
|
100
214
|
//# sourceMappingURL=freshness.js.map
|
package/dist/freshness.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"freshness.js","sourceRoot":"","sources":["../src/freshness.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,wCAAwC;AACxC,6FAA6F;AAC7F,EAAE;AACF,kGAAkG;AAClG,
|
|
1
|
+
{"version":3,"file":"freshness.js","sourceRoot":"","sources":["../src/freshness.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,EAAE;AACF,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CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7E,CAAC;IAEF,oBAAoB;IACpB,IAAI,EAAE,IAAI,EAAE,CAAC,sBAAsB,IAAI,QAAQ,CAAC,QAAQ;QAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;IAExF,MAAM,SAAS,GACb,QAAQ,CAAC,MAAM,KAAK,SAAS,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC;QACjE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE;QACnF,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO;QACL,OAAO,EAAE;YACP,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,SAAS,EAAE,QAAQ,CAAC,SAAS;YAC7B,sBAAsB,EAAE,QAAQ,CAAC,QAAQ;YACzC,oBAAoB,EAAE,QAAQ,CAAC,MAAM;YACrC,sBAAsB,EAAE,QAAQ,CAAC,QAAQ;YACzC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpC;QACD,KAAK;KACN,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,20 +7,21 @@ export { AgentResolutionError, failure, toWireCode } from './errors.js';
|
|
|
7
7
|
export type { ResolutionErrorCode, ResolutionWireCode, ResolutionFailure } from './errors.js';
|
|
8
8
|
export { allowsDirectorySearch, allowsUnauthenticatedResolution, discoveryPolicyFromPreset, validateDiscoveryPolicy, } from './policy.js';
|
|
9
9
|
export type { AgentDiscoveryPolicyV1, AgentDiscoveryPreset, AgentInboundPosture, AgentListingPosture, AgentNamingPosture, AgentResolutionPosture, DiscoveryPolicyViolation, } from './policy.js';
|
|
10
|
-
export { publicationBody } from './publication.js';
|
|
10
|
+
export { PUBLICATION_FORMAT, RETIRED_PUBLICATION_FORMATS, keyEpochAfter, publicationBody } from './publication.js';
|
|
11
|
+
export type { KeyEpochEvent } from './publication.js';
|
|
11
12
|
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';
|
|
13
|
+
export { inspectPublicationIntegrity, selfPublishedOnly, verifyPublication } from './proof.js';
|
|
14
|
+
export type { Erc1271Verifier, PublicationAuthorityCheck, PublicationContinuityInput, PublicationIntegrityReport, PublicationVerdict, VerifyPublicationOptions, VerifyPublicationResult, } from './proof.js';
|
|
15
|
+
export { ENDPOINT_CONTROL_CHALLENGE_TYPE, endpointChallengeDigest, endpointControlChallengeDigest, establishEndpointControl, isEndpointControl, normalizeEndpointUri, verifyEndpointAssertion, verifyEndpointControl, } from './endpoint-control.js';
|
|
16
|
+
export type { EndpointAssertionResult, EndpointChallengeBody, EndpointControlAssurance, EndpointControlChallengeV1, EndpointControlResponseV1, EndpointDialPort, EndpointNonceLedger, EstablishEndpointControlOptions, EstablishEndpointControlResult, EndpointControlEvidenceV1, EndpointControlResult, EndpointEvidenceResolver, ObservedControlEvidenceV1, SignedChallengeEvidenceV1, VerifyEndpointControlOptions, } from './endpoint-control.js';
|
|
16
17
|
export { DELEGATION_AUTHORITY_SCHEME, SELF_AUTHORITY_REF, authorityRefMatches, delegationAuthorityRef, parseAuthorityRef, } from './authority-ref.js';
|
|
17
18
|
export type { AuthorityRefKind } from './authority-ref.js';
|
|
18
19
|
export { checkResolvedPeer, peerAuthenticatedFrom } from './peer-gate.js';
|
|
19
20
|
export { peerAttestationBody, peerAttestationDigest, verifyPeerAttestation } from './peer-attestation.js';
|
|
20
21
|
export type { PeerAttestationV1, PeerAttestationFailureCode, VerifyPeerAttestationInput, VerifyPeerAttestationResult, } from './peer-attestation.js';
|
|
21
22
|
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';
|
|
23
|
+
export { advanceContinuity, checkFreshness, isKeyEpoch, isTombstoneStatus } from './freshness.js';
|
|
24
|
+
export type { AgentKeyEpochState, ChannelContinuityState, FreshnessInput, PublicationContinuity, ResolutionFreshnessV1, TombstoneStatus, } from './freshness.js';
|
|
24
25
|
export { BEARER_BOOTSTRAP_MAX_LIFETIME_MS, RESOLVE_ACTION, grantBody, presentationBody, validateGrantShape, } from './grants.js';
|
|
25
26
|
export type { GrantShapeViolation, PrivateResolutionGrantV1, ResolutionGrantConstraints, ResolutionGrantMode, ResolutionGrantPresentationV1, ResolutionProjectionPolicy, } from './grants.js';
|
|
26
27
|
export { invitationBody, validateInvitationShape } from './invitation.js';
|
|
@@ -31,7 +32,7 @@ export type { AgentResolutionMethod, AgentResolutionReference, AgentResolutionRe
|
|
|
31
32
|
export type { AgentResolutionProvider, GrantAdmissionResult, ResolutionGrantStore, ResolverDependencies, SubjectProofVerifier, } from './ports.js';
|
|
32
33
|
export { assuranceOf, createComposedResolver } from './compose.js';
|
|
33
34
|
export type { ComposedResolutionResult, ComposedResolverOptions, ContinuityStore } from './compose.js';
|
|
34
|
-
export { PROJECTION_PRECEDES_SIGNING, channelIdFor, findOverDisclosure, projectSurfaces, selectPresignedPublication, } from './projection.js';
|
|
35
|
+
export { PROJECTION_PRECEDES_SIGNING, channelIdFor, expectedChannelForGrant, publicChannelFor, findOverDisclosure, projectSurfaces, selectPresignedPublication, } from './projection.js';
|
|
35
36
|
export type { ProjectionProfile, SurfaceProjectionContext, SurfaceProjectionResult } from './projection.js';
|
|
36
37
|
export { decodePublication, decodeReceipt, encodePublication, encodeReceipt } from './codec.js';
|
|
37
38
|
export type { JsonAgentResolutionReceiptV1, JsonAgentServicePublicationV1 } from './codec.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,eAAO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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;AAGtB,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,WAAW,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7K,YAAY,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,11 +20,11 @@ export { AgentResolutionError, failure, toWireCode } from './errors.js';
|
|
|
20
20
|
// ─── Discovery policy — four independent dimensions ──────────────────────────
|
|
21
21
|
export { allowsDirectorySearch, allowsUnauthenticatedResolution, discoveryPolicyFromPreset, validateDiscoveryPolicy, } from './policy.js';
|
|
22
22
|
// ─── Service publication — the signed, sequenced, expiring operational object ─
|
|
23
|
-
export { publicationBody } from './publication.js';
|
|
23
|
+
export { PUBLICATION_FORMAT, RETIRED_PUBLICATION_FORMATS, keyEpochAfter, publicationBody } from './publication.js';
|
|
24
24
|
// ─── Publication verification ────────────────────────────────────────────────
|
|
25
|
-
export { verifyPublication } from './proof.js';
|
|
25
|
+
export { inspectPublicationIntegrity, selfPublishedOnly, verifyPublication } from './proof.js';
|
|
26
26
|
// ─── Endpoint control (claim ≠ control) ──────────────────────────────────────
|
|
27
|
-
export { endpointChallengeDigest, normalizeEndpointUri, verifyEndpointControl } from './endpoint-control.js';
|
|
27
|
+
export { ENDPOINT_CONTROL_CHALLENGE_TYPE, endpointChallengeDigest, endpointControlChallengeDigest, establishEndpointControl, isEndpointControl, normalizeEndpointUri, verifyEndpointAssertion, verifyEndpointControl, } from './endpoint-control.js';
|
|
28
28
|
// ─── Publication authority (dntls-comparison §17 P3) ─────────────────────────
|
|
29
29
|
// An `authorityRef` COMMITS to a delegation; it is not a pointer into a vault. The bespoke
|
|
30
30
|
// `PublicationAuthorityRecordV1` this package used to define was a delegation under another name, so
|
|
@@ -41,7 +41,7 @@ export { checkResolvedPeer, peerAuthenticatedFrom } from './peer-gate.js';
|
|
|
41
41
|
// edge-runtime's inbound peer auth — here the agent proves itself to the client.
|
|
42
42
|
export { peerAttestationBody, peerAttestationDigest, verifyPeerAttestation } from './peer-attestation.js';
|
|
43
43
|
// ─── Freshness, rollback, equivocation, continuity ───────────────────────────
|
|
44
|
-
export { advanceContinuity, checkFreshness } from './freshness.js';
|
|
44
|
+
export { advanceContinuity, checkFreshness, isKeyEpoch, isTombstoneStatus } from './freshness.js';
|
|
45
45
|
// ─── Private resolution grants ───────────────────────────────────────────────
|
|
46
46
|
export { BEARER_BOOTSTRAP_MAX_LIFETIME_MS, RESOLVE_ACTION, grantBody, presentationBody, validateGrantShape, } from './grants.js';
|
|
47
47
|
// ─── Connection invitations (bootstrap) ──────────────────────────────────────
|
|
@@ -51,7 +51,7 @@ export { admitGrantPresentation } from './admission.js';
|
|
|
51
51
|
// ─── Composed resolution (many methods, ONE verification path) ───────────────
|
|
52
52
|
export { assuranceOf, createComposedResolver } from './compose.js';
|
|
53
53
|
// ─── Projection ──────────────────────────────────────────────────────────────
|
|
54
|
-
export { PROJECTION_PRECEDES_SIGNING, channelIdFor, findOverDisclosure, projectSurfaces, selectPresignedPublication, } from './projection.js';
|
|
54
|
+
export { PROJECTION_PRECEDES_SIGNING, channelIdFor, expectedChannelForGrant, publicChannelFor, findOverDisclosure, projectSurfaces, selectPresignedPublication, } from './projection.js';
|
|
55
55
|
// ─── JSON codecs (bigint-safe) ───────────────────────────────────────────────
|
|
56
56
|
export { decodePublication, decodeReceipt, encodePublication, encodeReceipt } from './codec.js';
|
|
57
57
|
// ─── Keyed grant index (no raw bearer secret at rest) ────────────────────────
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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,+DAAwE,CAAC;AAEjG,gFAAgF;AAChF,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGjF,gFAAgF;AAChF,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGxE,gFAAgF;AAChF,OAAO,EACL,qBAAqB,EACrB,+BAA+B,EAC/B,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AAWrB,iFAAiF;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,kFAAkF;AAClF,s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AAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CanonicalAgentId } from '@agenticprimitives/types';
|
|
2
|
-
import type { ResolutionProjectionPolicy } from './grants.js';
|
|
2
|
+
import type { PrivateResolutionGrantV1, ResolutionProjectionPolicy } from './grants.js';
|
|
3
3
|
import type { ServiceSurfacePublicationV1 } from './publication.js';
|
|
4
4
|
/** Named projection profiles. `internal` and `pairwise` are never public-facing. */
|
|
5
5
|
export type ProjectionProfile = 'public' | 'authenticated' | 'partner' | 'internal' | 'pairwise';
|
|
@@ -56,10 +56,24 @@ export declare function selectPresignedPublication<T extends {
|
|
|
56
56
|
status: string;
|
|
57
57
|
}>(publications: readonly T[], channelId: string): T | null;
|
|
58
58
|
/**
|
|
59
|
-
* The channel id for an (agent, audience) pair.
|
|
60
|
-
*
|
|
59
|
+
* The channel id for an (agent, audience) pair. Per-counterparty channels each carry an independent
|
|
60
|
+
* sequence, so no counterparty's sequence moves with another's activity.
|
|
61
|
+
*
|
|
62
|
+
* NOTE (spec 445 STEP 0): this id embeds the agent's and the counterparty's canonical ids in the
|
|
63
|
+
* clear. It is a routing key both sides can derive, not a pseudonym.
|
|
61
64
|
*/
|
|
62
65
|
export declare function channelIdFor(agentId: string, projectionProfile: string, counterparty?: string): string;
|
|
66
|
+
/** The channel an anonymous / public verifier is entitled to read. */
|
|
67
|
+
export declare function publicChannelFor(agentId: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* The channel a GRANT HOLDER is entitled to read — the only source of a private verifier's
|
|
70
|
+
* `expectedChannelId` (NAME-3). Derived from the signed grant the verifier holds: target agent,
|
|
71
|
+
* projection profile, and — for a recipient-bound grant (`subject-bound` / `pairwise`) — the grant's
|
|
72
|
+
* subject. Never from the publication a resolver served: that object's `channelId` is the claim
|
|
73
|
+
* under test. A publication naming another counterparty's channel therefore fails here even when it
|
|
74
|
+
* was handed over under this verifier's own grant.
|
|
75
|
+
*/
|
|
76
|
+
export declare function expectedChannelForGrant(grant: Pick<PrivateResolutionGrantV1, 'targetAgent' | 'subject' | 'projection'>): string;
|
|
63
77
|
/**
|
|
64
78
|
* Verify that a SERVED projection did not over-disclose relative to what the grant permitted.
|
|
65
79
|
*
|
package/dist/projection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../src/projection.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,KAAK,EAAE,2BAA2B,EAAmB,MAAM,kBAAkB,CAAC;AAErF,oFAAoF;AACpF,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,eAAe,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEjG,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,iBAAiB,CAAC;CACtC;AAkBD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,EAAG,IAAa,CAAC;AAEzD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACjD,2GAA2G;IAC3G,OAAO,EAAE,SAAS;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,iBAAiB,EAAE,SAAS,2BAA2B,EAAE,EACzD,OAAO,EAAE,wBAAwB,EACjC,MAAM,CAAC,EAAE,0BAA0B,GAClC,uBAAuB,CAoCzB;AAOD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,CAAC,SAAS;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EACjE,YAAY,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAOzD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAItG;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,wBAAwB,EAAE,aAAa,GAAG,SAAS,GAAG,YAAY,CAAC,GAAG,MAAM,CAE/H;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,2BAA2B,EAAE,EAC9C,OAAO,EAAE,wBAAwB,EACjC,MAAM,CAAC,EAAE,0BAA0B,GAClC,SAAS;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,CAoBlD"}
|
package/dist/projection.js
CHANGED
|
@@ -97,14 +97,32 @@ export function selectPresignedPublication(publications, channelId) {
|
|
|
97
97
|
return candidates[0] ?? null;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
|
-
* The channel id for an (agent, audience) pair.
|
|
101
|
-
*
|
|
100
|
+
* The channel id for an (agent, audience) pair. Per-counterparty channels each carry an independent
|
|
101
|
+
* sequence, so no counterparty's sequence moves with another's activity.
|
|
102
|
+
*
|
|
103
|
+
* NOTE (spec 445 STEP 0): this id embeds the agent's and the counterparty's canonical ids in the
|
|
104
|
+
* clear. It is a routing key both sides can derive, not a pseudonym.
|
|
102
105
|
*/
|
|
103
106
|
export function channelIdFor(agentId, projectionProfile, counterparty) {
|
|
104
107
|
return counterparty
|
|
105
108
|
? `${agentId}:${projectionProfile}:${counterparty}`
|
|
106
109
|
: `${agentId}:${projectionProfile}`;
|
|
107
110
|
}
|
|
111
|
+
/** The channel an anonymous / public verifier is entitled to read. */
|
|
112
|
+
export function publicChannelFor(agentId) {
|
|
113
|
+
return channelIdFor(agentId, 'public');
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The channel a GRANT HOLDER is entitled to read — the only source of a private verifier's
|
|
117
|
+
* `expectedChannelId` (NAME-3). Derived from the signed grant the verifier holds: target agent,
|
|
118
|
+
* projection profile, and — for a recipient-bound grant (`subject-bound` / `pairwise`) — the grant's
|
|
119
|
+
* subject. Never from the publication a resolver served: that object's `channelId` is the claim
|
|
120
|
+
* under test. A publication naming another counterparty's channel therefore fails here even when it
|
|
121
|
+
* was handed over under this verifier's own grant.
|
|
122
|
+
*/
|
|
123
|
+
export function expectedChannelForGrant(grant) {
|
|
124
|
+
return channelIdFor(grant.targetAgent, grant.projection.profile, grant.subject);
|
|
125
|
+
}
|
|
108
126
|
/**
|
|
109
127
|
* Verify that a SERVED projection did not over-disclose relative to what the grant permitted.
|
|
110
128
|
*
|