@adastracomputing/ink 0.1.7 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -4,9 +4,15 @@ All notable changes to INK are recorded
4
4
  here. Pre-1.0 releases follow `0.Y.Z` semantics, see
5
5
  [`docs/maturity.md`](docs/maturity.md) for the versioning policy.
6
6
 
7
- ## Unreleased
7
+ ## 0.2.0, version-keyed body-signature domain
8
8
 
9
- No unreleased changes.
9
+ Version-keyed body-signature domain. The body message signature is now domain-separated by protocol version. ink/0.1 messages, and any object with no explicit ink/0.2 protocol, keep the legacy `tulpa/sign` domain so every signature produced to date still verifies. ink/0.2 messages are signed and verified under the neutral `ink/sign` domain. The verifier selects exactly one domain from the signed `protocol` field and never tries an alternate, so a signature made under one version's domain cannot be replayed under another.
10
+
11
+ This change is receiver-first and backward compatible. Verifiers accept both versions and `MessageEnvelopeSchema` now accepts ink/0.1 and ink/0.2 as a strict enum, rejecting any unknown version. Senders still emit ink/0.1 by default. The HTTP transport-auth signature is unchanged.
12
+
13
+ New vectors in `test-vectors/body-signature.json` pin the version-keyed domain including the cross-version and tamper cases. The standalone Python interop client verifies them identically.
14
+
15
+ Per the pre-1.0 policy this release publishes under the `next` dist-tag.
10
16
 
11
17
  ## 0.1.7, expose per-intent payload schemas and getPayloadSchema from the package root
12
18
 
@@ -79,7 +85,7 @@ Fixes the v0.1.1 erratum: the Python `examples/interop-cli/` shipped in v0.1.1 e
79
85
 
80
86
  **CLI now builds `connection_request` envelopes.** `ink-interop send/build --intent-type connection_request` (or the alias `connection`) constructs a `ConnectionRequestPayloadSchema`-conformant payload (`method`, `context`, `profileSnapshot`). This is the bootstrap intent for first contact between strangers: receivers that opt in to foreign senders verify the body signature against the inline key extracted from the sender's `did:key` (trust-on-first-use). Other intent types (`intro_request`, `ask`, `follow_up`) presume the sender is already a known contact and remain reserved for established relationships.
81
87
 
82
- Verified end-to-end against `https://api.tulpa.network/ink/v1/<agentId>/intent`: a `did:key:` `connection_request` from `ink-interop send` lands as a pending action in the recipient's inbox (`status: 200`, `accepted: true`, `pendingActionId: 01KT…`). Coverage spans schema validation, body + transport signature verification, replay/freshness, identity resolution, routing, the foreign-DID policy gate, and shield risk-scoring. Tests pinned to the canonical shape (`tests/test_envelope.py`) prevent regression. The npm library itself is unchanged from v0.1.1.
88
+ Verified end-to-end against `https://api.tulpa.network/ink/v1/<agentId>/intent`: a `did:key:` `connection_request` from `ink-interop send` lands as a pending action in the recipient's inbox (`status: 200`, `accepted: true`, `pendingActionId: 01KT…`). Coverage spans schema validation, body + transport signature verification, replay/freshness, identity resolution, routing, and the foreign-DID policy gate. Tests pinned to the canonical shape (`tests/test_envelope.py`) prevent regression. The npm library itself is unchanged from v0.1.1.
83
89
 
84
90
  **Example-helper API break.** `examples/interop-cli/`'s Python helper `build_intent_envelope()` now requires `keypair`, replaces `intent_type`/`purpose`/`timestamp` with canonical args (`target`, `reason`, `created_at`, etc.), and removes the `extra=` kwarg. Adopters who imported the old helper directly will need to update their calls — the previous signature emitted invalid wire data so no callable interop existed there to preserve. This is an example-only change; the npm library (`@adastracomputing/ink`) exports are unchanged.
85
91
 
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * 1. Remove `signature` field if present
5
5
  * 2. JCS canonicalize (RFC 8785) via `canonicalize` library
6
- * 3. Sign canonical bytes directly with Ed25519
6
+ * 3. Sign domain-prefixed canonical bytes directly with Ed25519
7
7
  * 4. Return base64url-encoded signature (no padding)
8
8
  */
9
9
  export declare function signMessage(message: Record<string, unknown>, privateKey: Uint8Array): Promise<string>;
@@ -54,12 +54,39 @@ function isWithinBounds(value) {
54
54
  }
55
55
  return walk(value, 0);
56
56
  }
57
+ /**
58
+ * Body-signature domain-separation prefix, keyed off the message's
59
+ * declared `protocol` version.
60
+ *
61
+ * - `ink/0.2` -> `ink/sign\n` (neutral, current).
62
+ * - everything else (`ink/0.1`, or any object with no explicit
63
+ * `ink/0.2` protocol) -> `tulpa/sign\n`, the legacy domain, kept
64
+ * forever so every signature ever produced still verifies.
65
+ *
66
+ * The prefix is derived from the `protocol` field that is part of the
67
+ * signed body, so a verifier selects exactly one domain and tampering
68
+ * with `protocol` after signing breaks the signature (an `ink/0.2` body
69
+ * re-labelled `ink/0.1` is verified under `tulpa/sign\n` against a
70
+ * signature made over `ink/sign\n`, and fails). Only the exact string
71
+ * `"ink/0.2"` switches domains, so no other value can smuggle one in.
72
+ *
73
+ * This raw signer stays permissive on purpose: it is a general-purpose
74
+ * Ed25519 message signer (receipts, arbitrary objects), not envelope-
75
+ * specific. Strict "reject unknown protocol version" lives at the
76
+ * envelope schema layer, which validates `protocol` against the allowed
77
+ * set before this function is reached.
78
+ */
79
+ const LEGACY_SIGN_DOMAIN = "tulpa/sign\n";
80
+ const V02_SIGN_DOMAIN = "ink/sign\n";
81
+ function bodySignatureDomain(unsigned) {
82
+ return unsigned.protocol === "ink/0.2" ? V02_SIGN_DOMAIN : LEGACY_SIGN_DOMAIN;
83
+ }
57
84
  /**
58
85
  * Sign a message object using Ed25519.
59
86
  *
60
87
  * 1. Remove `signature` field if present
61
88
  * 2. JCS canonicalize (RFC 8785) via `canonicalize` library
62
- * 3. Sign canonical bytes directly with Ed25519
89
+ * 3. Sign domain-prefixed canonical bytes directly with Ed25519
63
90
  * 4. Return base64url-encoded signature (no padding)
64
91
  */
65
92
  export async function signMessage(message, privateKey) {
@@ -83,8 +110,10 @@ export async function signMessage(message, privateKey) {
83
110
  if (canonical.length > MAX_MESSAGE_CANONICAL_BYTES) {
84
111
  throw new Error("Canonicalized message exceeds maximum allowed size");
85
112
  }
86
- // Domain-separated signing to prevent cross-protocol signature replay
87
- const prefixed = `tulpa/sign\n${canonical}`;
113
+ // Domain-separated signing to prevent cross-protocol signature replay.
114
+ // Domain is keyed off the (signed) protocol version; see
115
+ // bodySignatureDomain. Legacy ink/0.1 keeps the tulpa/sign domain.
116
+ const prefixed = `${bodySignatureDomain(unsigned)}${canonical}`;
88
117
  const bytes = new TextEncoder().encode(prefixed);
89
118
  const sig = await ed.signAsync(bytes, privateKey);
90
119
  return base64urlEncode(sig);
@@ -124,9 +153,12 @@ export async function verifyMessage(message, publicKey) {
124
153
  if (canonical.length > MAX_MESSAGE_CANONICAL_BYTES) {
125
154
  return false;
126
155
  }
127
- // Domain-prefixed verification only legacy unprefixed signatures are no longer accepted.
128
- // signMessage() has always used `tulpa/sign\n` prefix; no callers produce unprefixed signatures.
129
- const prefixed = `tulpa/sign\n${canonical}`;
156
+ // Domain-prefixed verification only. The domain is selected from the
157
+ // signed `protocol` field (see bodySignatureDomain); a verifier never
158
+ // tries an alternate prefix, so a signature made under one version's
159
+ // domain cannot be replayed under another. Legacy unprefixed
160
+ // signatures are not accepted.
161
+ const prefixed = `${bodySignatureDomain(unsigned)}${canonical}`;
130
162
  const prefixedBytes = new TextEncoder().encode(prefixed);
131
163
  try {
132
164
  const sig = base64urlDecode(signature);
package/dist/index.d.ts CHANGED
@@ -16,12 +16,12 @@ export type { InkAuditEventType, InkAuditEvent, InkAuditInclusion, InkReceipt, I
16
16
  export { InkChallengeSchema, InkRejectionSchema, InkResolutionSchema, InkTransportSchema, } from "./models/ink-handshake.js";
17
17
  export type { AgentCardVisibility, InkChallenge, InkRejection, InkResolution, InkTransport, } from "./models/ink-handshake.js";
18
18
  export { AgentCardSchema } from "./models/agent-card.js";
19
- export { validateMessage, getPayloadSchema, MessageEnvelopeSchema, IntentTypeSchema, ScheduleMeetingPayloadSchema, ScheduleMeetingResponsePayloadSchema, IntroRequestPayloadSchema, IntroResponsePayloadSchema, OpportunityPayloadSchema, OpportunityResponsePayloadSchema, ConnectionRequestPayloadSchema, ConnectionResponsePayloadSchema, FollowUpPayloadSchema, AskPayloadSchema, AskResponsePayloadSchema, PingPayloadSchema, RetractPayloadSchema, ContextSharePayloadSchema, MultiPartySyncPayloadSchema, } from "./models/intent.js";
20
- export type { MessageEnvelope, IntentType, } from "./models/intent.js";
19
+ export { validateMessage, getPayloadSchema, MessageEnvelopeSchema, ProtocolVersionSchema, INK_PROTOCOL_VERSIONS, IntentTypeSchema, ScheduleMeetingPayloadSchema, ScheduleMeetingResponsePayloadSchema, IntroRequestPayloadSchema, IntroResponsePayloadSchema, OpportunityPayloadSchema, OpportunityResponsePayloadSchema, ConnectionRequestPayloadSchema, ConnectionResponsePayloadSchema, FollowUpPayloadSchema, AskPayloadSchema, AskResponsePayloadSchema, PingPayloadSchema, RetractPayloadSchema, ContextSharePayloadSchema, MultiPartySyncPayloadSchema, } from "./models/intent.js";
20
+ export type { MessageEnvelope, ProtocolVersion, IntentType, } from "./models/intent.js";
21
21
  export { KeyStatusSchema, KeyRoleSchema, KeyEntrySchema, } from "./models/key-entry.js";
22
22
  export type { KeyStatus, KeyRole, KeyEntry, StoredKey, } from "./models/key-entry.js";
23
23
  export type { InkSignInput } from "./crypto/ink.js";
24
24
  export type { CandidateKey } from "./models/key-entry.js";
25
- export { resolveAgentInbox } from "./models/agent-card.js";
25
+ export { resolveAgentInbox, agentSupportedProtocolVersions } from "./models/agent-card.js";
26
26
  export type { AgentCard } from "./models/agent-card.js";
27
27
  export type { BudgetCheckResult, HandshakeBudgetConfig, } from "./ink/handshake-budget.js";
package/dist/index.js CHANGED
@@ -32,9 +32,9 @@ export { AgentCardSchema } from "./models/agent-card.js";
32
32
  // reject malformed envelopes before signature verification; without
33
33
  // it they have to re-implement the schema check or import from a
34
34
  // non-public path.
35
- export { validateMessage, getPayloadSchema, MessageEnvelopeSchema, IntentTypeSchema, ScheduleMeetingPayloadSchema, ScheduleMeetingResponsePayloadSchema, IntroRequestPayloadSchema, IntroResponsePayloadSchema, OpportunityPayloadSchema, OpportunityResponsePayloadSchema, ConnectionRequestPayloadSchema, ConnectionResponsePayloadSchema, FollowUpPayloadSchema, AskPayloadSchema, AskResponsePayloadSchema, PingPayloadSchema, RetractPayloadSchema, ContextSharePayloadSchema, MultiPartySyncPayloadSchema, } from "./models/intent.js";
35
+ export { validateMessage, getPayloadSchema, MessageEnvelopeSchema, ProtocolVersionSchema, INK_PROTOCOL_VERSIONS, IntentTypeSchema, ScheduleMeetingPayloadSchema, ScheduleMeetingResponsePayloadSchema, IntroRequestPayloadSchema, IntroResponsePayloadSchema, OpportunityPayloadSchema, OpportunityResponsePayloadSchema, ConnectionRequestPayloadSchema, ConnectionResponsePayloadSchema, FollowUpPayloadSchema, AskPayloadSchema, AskResponsePayloadSchema, PingPayloadSchema, RetractPayloadSchema, ContextSharePayloadSchema, MultiPartySyncPayloadSchema, } from "./models/intent.js";
36
36
  // Key-entry types and schemas for adopters wiring their own key-set
37
37
  // storage and rotation. `CandidateKey` was already root-exported via
38
38
  // the verifier surface; this batch adds the persistence shapes.
39
39
  export { KeyStatusSchema, KeyRoleSchema, KeyEntrySchema, } from "./models/key-entry.js";
40
- export { resolveAgentInbox } from "./models/agent-card.js";
40
+ export { resolveAgentInbox, agentSupportedProtocolVersions } from "./models/agent-card.js";
@@ -202,6 +202,7 @@ export declare const AgentCardResponseSchema: z.ZodObject<{
202
202
  currentSigningKeyId: z.ZodOptional<z.ZodString>;
203
203
  currentEncryptionKeyId: z.ZodOptional<z.ZodString>;
204
204
  keySetVersion: z.ZodOptional<z.ZodNumber>;
205
+ supportedProtocolVersions: z.ZodOptional<z.ZodArray<z.ZodString>>;
205
206
  visibility: z.ZodOptional<z.ZodEnum<{
206
207
  public: "public";
207
208
  network_only: "network_only";
@@ -129,6 +129,7 @@ export declare const AgentCardSchema: z.ZodObject<{
129
129
  currentSigningKeyId: z.ZodOptional<z.ZodString>;
130
130
  currentEncryptionKeyId: z.ZodOptional<z.ZodString>;
131
131
  keySetVersion: z.ZodOptional<z.ZodNumber>;
132
+ supportedProtocolVersions: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
133
  visibility: z.ZodOptional<z.ZodEnum<{
133
134
  public: "public";
134
135
  network_only: "network_only";
@@ -153,6 +154,12 @@ export declare const AgentCardSchema: z.ZodObject<{
153
154
  }, z.core.$strip>>;
154
155
  }, z.core.$strip>;
155
156
  export type AgentCard = z.infer<typeof AgentCardSchema>;
157
+ /**
158
+ * The message protocol versions a card's receiver can verify. Falls back
159
+ * to ink/0.1 when the card does not advertise the field, so a sender
160
+ * defaults to the original version for any card that predates it.
161
+ */
162
+ export declare function agentSupportedProtocolVersions(card: Pick<AgentCard, "supportedProtocolVersions">): string[];
156
163
  /**
157
164
  * Return the inbound message URL for an Agent Card.
158
165
  *
@@ -58,6 +58,18 @@ export const AgentCardSchema = z.object({
58
58
  currentSigningKeyId: z.string().optional(),
59
59
  currentEncryptionKeyId: z.string().optional(),
60
60
  keySetVersion: z.number().int().positive().optional(),
61
+ // Message protocol versions this agent's receiver can verify on the
62
+ // body signature. When absent, assume ink/0.1 only. A sender MUST NOT
63
+ // emit a newer version to a card that does not advertise it; advertising
64
+ // a version here is necessary but not sufficient for a sender to use it.
65
+ //
66
+ // The entries are advisory hints, so they are accepted as bounded
67
+ // strings rather than the strict version enum: a newer peer may
68
+ // advertise a version this build does not know yet, and that must not
69
+ // make its whole card unparseable. A sender intersects this list with
70
+ // the versions it can actually emit. The strict enum lives on the
71
+ // envelope (MessageEnvelopeSchema), where an unknown version is rejected.
72
+ supportedProtocolVersions: z.array(z.string().max(16)).max(8).optional(),
61
73
  // Containment extension (Phase 1)
62
74
  visibility: AgentCardVisibilitySchema.optional(),
63
75
  governance: z.object({
@@ -83,6 +95,15 @@ export const AgentCardSchema = z.object({
83
95
  });
84
96
  }
85
97
  });
98
+ /**
99
+ * The message protocol versions a card's receiver can verify. Falls back
100
+ * to ink/0.1 when the card does not advertise the field, so a sender
101
+ * defaults to the original version for any card that predates it.
102
+ */
103
+ export function agentSupportedProtocolVersions(card) {
104
+ const advertised = card.supportedProtocolVersions;
105
+ return advertised && advertised.length > 0 ? advertised : ["ink/0.1"];
106
+ }
86
107
  /**
87
108
  * Return the inbound message URL for an Agent Card.
88
109
  *
@@ -214,8 +214,24 @@ export declare const MessageProvenanceSchema: z.ZodOptional<z.ZodObject<{
214
214
  extensionId: z.ZodString;
215
215
  installationId: z.ZodString;
216
216
  }, z.core.$strict>>;
217
+ /**
218
+ * INK protocol versions a receiver accepts. ink/0.1 is the original wire
219
+ * version; ink/0.2 differs only in the body-signature domain (see
220
+ * src/crypto/sign.ts). The enum is strict: an unknown version is rejected
221
+ * at schema validation, never inferred. Senders still emit ink/0.1 by
222
+ * default; emitting ink/0.2 is a later, negotiated step.
223
+ */
224
+ export declare const INK_PROTOCOL_VERSIONS: readonly ["ink/0.1", "ink/0.2"];
225
+ export declare const ProtocolVersionSchema: z.ZodEnum<{
226
+ "ink/0.1": "ink/0.1";
227
+ "ink/0.2": "ink/0.2";
228
+ }>;
229
+ export type ProtocolVersion = z.infer<typeof ProtocolVersionSchema>;
217
230
  export declare const MessageEnvelopeSchema: z.ZodObject<{
218
- protocol: z.ZodLiteral<"ink/0.1">;
231
+ protocol: z.ZodEnum<{
232
+ "ink/0.1": "ink/0.1";
233
+ "ink/0.2": "ink/0.2";
234
+ }>;
219
235
  id: z.ZodString;
220
236
  correlationId: z.ZodString;
221
237
  createdAt: z.ZodString;
@@ -155,8 +155,17 @@ export const MessageProvenanceSchema = z.object({
155
155
  extensionId: z.string().max(ID_MAX),
156
156
  installationId: z.string().uuid(),
157
157
  }).strict().optional();
158
+ /**
159
+ * INK protocol versions a receiver accepts. ink/0.1 is the original wire
160
+ * version; ink/0.2 differs only in the body-signature domain (see
161
+ * src/crypto/sign.ts). The enum is strict: an unknown version is rejected
162
+ * at schema validation, never inferred. Senders still emit ink/0.1 by
163
+ * default; emitting ink/0.2 is a later, negotiated step.
164
+ */
165
+ export const INK_PROTOCOL_VERSIONS = ["ink/0.1", "ink/0.2"];
166
+ export const ProtocolVersionSchema = z.enum(INK_PROTOCOL_VERSIONS);
158
167
  export const MessageEnvelopeSchema = z.object({
159
- protocol: z.literal("ink/0.1"),
168
+ protocol: ProtocolVersionSchema,
160
169
  id: z.string().max(ID_MAX),
161
170
  correlationId: z.string().max(ID_MAX),
162
171
  createdAt: z.string().max(TIMESTAMP_MAX),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adastracomputing/ink",
3
- "version": "0.1.7",
3
+ "version": "0.2.0",
4
4
  "description": "Library and specification for the INK (Inter-agent Networking Kernel) protocol",
5
5
  "license": "MIT OR Apache-2.0",
6
6
  "author": "Ad Astra Computing Inc.",
@@ -49,6 +49,7 @@
49
49
  "lint": "eslint src/ test/ scripts/",
50
50
  "check:surface": "tsx scripts/check-public-surface.ts",
51
51
  "check:pack": "./scripts/check-pack.sh",
52
+ "gen:body-vectors": "tsx scripts/gen-body-signature-vectors.ts",
52
53
  "prepack": "npm run build",
53
54
  "prepublishOnly": "npm run build"
54
55
  },
@@ -7,16 +7,17 @@ Reference test vectors for INK v0.1 signing, encryption, replay protection, hand
7
7
  | File | Covers | Vector count |
8
8
  |------|--------|-------------|
9
9
  | `keys.json` | Fixed Ed25519 and X25519 key pairs for Alice and Bob (hex-encoded) |, |
10
- | `signing.json` | Signature generation and verification (§3.3) | 3 |
10
+ | `signing.json` | Transport-auth signature generation and verification (§3.3) | 3 |
11
+ | `body-signature.json` | Version-keyed body message signature: legacy vs ink/0.2 domain, plus cross-version and tamper cases | 9 |
11
12
  | `encryption.json` | ECIES encryption/decryption (§3.4) | 2 |
12
- | `jcs.json` | JCS canonicalization (RFC 8785) | 4 |
13
+ | `jcs.json` | JCS canonicalization (RFC 8785) | 2 |
13
14
  | `replay.json` | Replay protection acceptance/rejection (§3.5) | 6 |
14
15
  | `receipts-and-audit.json` | Receipt signatures, audit query signatures, hash-chained audit events and fork detection (Auditability §1–§3) | 4 |
15
16
  | `handshake.json` | Challenge (Stage 2a), rejection (Stage 2b) and resolution (Stage 3), valid signatures, path/recipient/body binding failures, replay protection | 22 |
16
17
  | `witness.json` | Audit submit and query with INK transport auth, plus cross-service interop cases | 15 |
17
18
  | `key-rotation.json` | Auth header keyId format, rotated-key verification, historical verification, revoked-key rejection, refresh-on-miss, keyId precedence, unknown keyId fallthrough, audit event signingKeyId tracking | 8 |
18
19
 
19
- **Total: 64 deterministic vectors across 9 families**
20
+ **Total: 71 deterministic vectors across 10 families**
20
21
 
21
22
  ## Vector categories
22
23
 
@@ -0,0 +1,201 @@
1
+ {
2
+ "description": "INK body message signature: domain is keyed off the signed protocol field (ink/0.2 -> ink/sign, else tulpa/sign). Verify each body with the signer public key; signatureVerifies is the expected verifyMessage result.",
3
+ "vectors": [
4
+ {
5
+ "description": "ink/0.1 body signed under the legacy tulpa/sign domain verifies",
6
+ "input": {
7
+ "body": {
8
+ "protocol": "ink/0.1",
9
+ "id": "01HVECTORID0000000000000000",
10
+ "from": "did:key:zAlice",
11
+ "to": "did:key:zBob",
12
+ "intent": "connection_request",
13
+ "payload": {
14
+ "method": "discovery"
15
+ },
16
+ "timestamp": "2026-06-03T00:00:00Z",
17
+ "nonce": "ZmtmaXhlZG5vbmNl",
18
+ "signature": "W44kkGyQFg348NADetWQPq5Ogi7rL_72CwjmK-XVn2hL8sXYuSM7cFaDVidGV5LeK3dmmqW6iu5QiWkm6qboAQ"
19
+ },
20
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
21
+ },
22
+ "expected": {
23
+ "signatureVerifies": true
24
+ }
25
+ },
26
+ {
27
+ "description": "ink/0.2 body signed under the ink/sign domain verifies",
28
+ "input": {
29
+ "body": {
30
+ "protocol": "ink/0.2",
31
+ "id": "01HVECTORID0000000000000000",
32
+ "from": "did:key:zAlice",
33
+ "to": "did:key:zBob",
34
+ "intent": "connection_request",
35
+ "payload": {
36
+ "method": "discovery"
37
+ },
38
+ "timestamp": "2026-06-03T00:00:00Z",
39
+ "nonce": "ZmtmaXhlZG5vbmNl",
40
+ "signature": "UAITw3Qqcg96s4r5tmxHXGpuHCfzJBgxihVRPdR8FYcQKk2nYcYxrV8fRFUH3NB_-z-006tFWgZfzJbFILw4Bg"
41
+ },
42
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
43
+ },
44
+ "expected": {
45
+ "signatureVerifies": true
46
+ }
47
+ },
48
+ {
49
+ "description": "protocol-less body signed under the legacy domain verifies",
50
+ "input": {
51
+ "body": {
52
+ "id": "01HVECTORID0000000000000000",
53
+ "from": "did:key:zAlice",
54
+ "to": "did:key:zBob",
55
+ "intent": "connection_request",
56
+ "payload": {
57
+ "method": "discovery"
58
+ },
59
+ "timestamp": "2026-06-03T00:00:00Z",
60
+ "nonce": "ZmtmaXhlZG5vbmNl",
61
+ "signature": "qP1oxHKCEImzkYT8Iz00N4Crqi5prbKRguKj_zg8YlLyCrE4CmElrNWECEBWBe-8XV_rNB4oMc1wReXwHqOFCA"
62
+ },
63
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
64
+ },
65
+ "expected": {
66
+ "signatureVerifies": true
67
+ }
68
+ },
69
+ {
70
+ "description": "ink/0.2 body relabelled ink/0.1 (domain mismatch) does not verify",
71
+ "input": {
72
+ "body": {
73
+ "protocol": "ink/0.1",
74
+ "id": "01HVECTORID0000000000000000",
75
+ "from": "did:key:zAlice",
76
+ "to": "did:key:zBob",
77
+ "intent": "connection_request",
78
+ "payload": {
79
+ "method": "discovery"
80
+ },
81
+ "timestamp": "2026-06-03T00:00:00Z",
82
+ "nonce": "ZmtmaXhlZG5vbmNl",
83
+ "signature": "UAITw3Qqcg96s4r5tmxHXGpuHCfzJBgxihVRPdR8FYcQKk2nYcYxrV8fRFUH3NB_-z-006tFWgZfzJbFILw4Bg"
84
+ },
85
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
86
+ },
87
+ "expected": {
88
+ "signatureVerifies": false
89
+ }
90
+ },
91
+ {
92
+ "description": "ink/0.1 body relabelled ink/0.2 (domain mismatch) does not verify",
93
+ "input": {
94
+ "body": {
95
+ "protocol": "ink/0.2",
96
+ "id": "01HVECTORID0000000000000000",
97
+ "from": "did:key:zAlice",
98
+ "to": "did:key:zBob",
99
+ "intent": "connection_request",
100
+ "payload": {
101
+ "method": "discovery"
102
+ },
103
+ "timestamp": "2026-06-03T00:00:00Z",
104
+ "nonce": "ZmtmaXhlZG5vbmNl",
105
+ "signature": "W44kkGyQFg348NADetWQPq5Ogi7rL_72CwjmK-XVn2hL8sXYuSM7cFaDVidGV5LeK3dmmqW6iu5QiWkm6qboAQ"
106
+ },
107
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
108
+ },
109
+ "expected": {
110
+ "signatureVerifies": false
111
+ }
112
+ },
113
+ {
114
+ "description": "ink/0.2 body with protocol removed (falls back to legacy domain) does not verify",
115
+ "input": {
116
+ "body": {
117
+ "id": "01HVECTORID0000000000000000",
118
+ "from": "did:key:zAlice",
119
+ "to": "did:key:zBob",
120
+ "intent": "connection_request",
121
+ "payload": {
122
+ "method": "discovery"
123
+ },
124
+ "timestamp": "2026-06-03T00:00:00Z",
125
+ "nonce": "ZmtmaXhlZG5vbmNl",
126
+ "signature": "UAITw3Qqcg96s4r5tmxHXGpuHCfzJBgxihVRPdR8FYcQKk2nYcYxrV8fRFUH3NB_-z-006tFWgZfzJbFILw4Bg"
127
+ },
128
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
129
+ },
130
+ "expected": {
131
+ "signatureVerifies": false
132
+ }
133
+ },
134
+ {
135
+ "description": "ink/0.1 body with a flipped payload field does not verify",
136
+ "input": {
137
+ "body": {
138
+ "protocol": "ink/0.1",
139
+ "id": "01HVECTORID0000000000000000",
140
+ "from": "did:key:zAlice",
141
+ "to": "did:key:zBob",
142
+ "intent": "connection_request",
143
+ "payload": {
144
+ "method": "qr"
145
+ },
146
+ "timestamp": "2026-06-03T00:00:00Z",
147
+ "nonce": "ZmtmaXhlZG5vbmNl",
148
+ "signature": "W44kkGyQFg348NADetWQPq5Ogi7rL_72CwjmK-XVn2hL8sXYuSM7cFaDVidGV5LeK3dmmqW6iu5QiWkm6qboAQ"
149
+ },
150
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
151
+ },
152
+ "expected": {
153
+ "signatureVerifies": false
154
+ }
155
+ },
156
+ {
157
+ "description": "ink/0.2 body signed under the legacy domain does not verify (a verifier must not try both domains)",
158
+ "input": {
159
+ "body": {
160
+ "protocol": "ink/0.2",
161
+ "id": "01HVECTORID0000000000000000",
162
+ "from": "did:key:zAlice",
163
+ "to": "did:key:zBob",
164
+ "intent": "connection_request",
165
+ "payload": {
166
+ "method": "discovery"
167
+ },
168
+ "timestamp": "2026-06-03T00:00:00Z",
169
+ "nonce": "ZmtmaXhlZG5vbmNl",
170
+ "signature": "axpZvQqF8KPG-Mh1q3hnfZhnaSUHbYfToUz-wA_WD7PV0qKOnVHpuTu8DTaR0OTtGBVHoqpoQFlfMVskELfgDg"
171
+ },
172
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
173
+ },
174
+ "expected": {
175
+ "signatureVerifies": false
176
+ }
177
+ },
178
+ {
179
+ "description": "unknown protocol string uses the legacy body-signature domain and verifies",
180
+ "input": {
181
+ "body": {
182
+ "protocol": "ink/0.3",
183
+ "id": "01HVECTORID0000000000000000",
184
+ "from": "did:key:zAlice",
185
+ "to": "did:key:zBob",
186
+ "intent": "connection_request",
187
+ "payload": {
188
+ "method": "discovery"
189
+ },
190
+ "timestamp": "2026-06-03T00:00:00Z",
191
+ "nonce": "ZmtmaXhlZG5vbmNl",
192
+ "signature": "I3JIzt0kg9zncGvRU9nSZ2ldVrE4L9JnolDJAgW4kNUAqmp6bLAfPptfbYttqp1nTX4OB3oCCOOBPFCA7Fw4Cw"
193
+ },
194
+ "signerPublicKeyHex": "79b5562e8fe654f94078b112e8a98ba7901f853ae695bed7e0e3910bad049664"
195
+ },
196
+ "expected": {
197
+ "signatureVerifies": true
198
+ }
199
+ }
200
+ ]
201
+ }