@adastracomputing/ink 0.1.0-alpha.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 +63 -0
- package/CODE_OF_CONDUCT.md +42 -0
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +133 -0
- package/SECURITY.md +57 -0
- package/docs/key-rotation-rule.md +108 -0
- package/docs/logo.svg +8 -0
- package/docs/maturity.md +81 -0
- package/docs/threat-model.md +150 -0
- package/package.json +72 -0
- package/specs/ink-agent-containment-and-governance-extension-spec.md +508 -0
- package/specs/ink-auditability.md +652 -0
- package/specs/ink-authorization-chain.md +242 -0
- package/specs/ink-compatibility-policy.md +263 -0
- package/specs/ink-compliance-checklist.md +309 -0
- package/specs/ink-containment-phase1-implementation-spec.md +593 -0
- package/specs/ink-introduction-receipts-extension.md +501 -0
- package/specs/ink-key-rotation-spec.md +535 -0
- package/src/crypto/ink.ts +902 -0
- package/src/crypto/keys.ts +211 -0
- package/src/crypto/multi-key-verify.ts +170 -0
- package/src/crypto/sign.ts +155 -0
- package/src/crypto/verify.ts +1 -0
- package/src/discovery/agent-card.ts +508 -0
- package/src/index.ts +59 -0
- package/src/ink/checkpoint.ts +75 -0
- package/src/ink/discovery-gating.ts +147 -0
- package/src/ink/handshake-budget.ts +413 -0
- package/src/ink/receipts.ts +114 -0
- package/src/ink/transport-auth.ts +96 -0
- package/src/middleware/ink-auth.ts +263 -0
- package/src/models/agent-card.ts +63 -0
- package/src/models/ink-audit.ts +205 -0
- package/src/models/ink-handshake.ts +123 -0
- package/src/models/intent.ts +201 -0
- package/src/models/key-entry.ts +52 -0
- package/src/models/profile.ts +31 -0
- package/test-vectors/README.md +129 -0
- package/test-vectors/encryption.json +90 -0
- package/test-vectors/handshake.json +482 -0
- package/test-vectors/jcs.json +30 -0
- package/test-vectors/key-rotation.json +101 -0
- package/test-vectors/keys.json +32 -0
- package/test-vectors/receipts-and-audit.json +142 -0
- package/test-vectors/replay.json +88 -0
- package/test-vectors/signing.json +61 -0
- package/test-vectors/witness.json +394 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to INK and the reference implementation are recorded
|
|
4
|
+
here. Pre-1.0 releases follow `0.Y.Z` semantics, see
|
|
5
|
+
[`docs/maturity.md`](docs/maturity.md) for the versioning policy.
|
|
6
|
+
|
|
7
|
+
## Unreleased
|
|
8
|
+
|
|
9
|
+
No unreleased changes.
|
|
10
|
+
|
|
11
|
+
## 0.1.0-alpha.0, first public alpha
|
|
12
|
+
|
|
13
|
+
Initial open-source release of the INK protocol reference implementation
|
|
14
|
+
and accompanying specification.
|
|
15
|
+
|
|
16
|
+
### Protocol surface
|
|
17
|
+
|
|
18
|
+
- Ed25519-signed envelopes with JCS (RFC 8785) canonicalization.
|
|
19
|
+
- Domain-separated signing base: `ink/0.1\nMETHOD\nPATH\nrecipientDid\nJCS(body)\ntimestamp`.
|
|
20
|
+
- Agent Card schema with `keys.signing` and `keys.encryption`.
|
|
21
|
+
- Key rotation authority rule (see `docs/key-rotation-rule.md`).
|
|
22
|
+
- Timestamp freshness window: 5 minutes past, 30 seconds future.
|
|
23
|
+
- ECIES encryption envelopes with AAD bound to all security-relevant
|
|
24
|
+
outer fields.
|
|
25
|
+
- Receipt and audit envelope structures.
|
|
26
|
+
- Optional containment extension: capability-gated visibility, handshake
|
|
27
|
+
budgets, sender silent-drop after first rate-limit violation.
|
|
28
|
+
|
|
29
|
+
### Reference implementation
|
|
30
|
+
|
|
31
|
+
- Public API exported from the package root, see README for the export
|
|
32
|
+
surface.
|
|
33
|
+
- Defense-in-depth SSRF protections in `fetchAgentCard`: https-only
|
|
34
|
+
baseUrl, no userinfo, IANA special-use IPv4 and IPv6 blocklists,
|
|
35
|
+
6to4-embedded-v4 extraction, manual redirect, body-size stream cap,
|
|
36
|
+
Zod runtime card validation, recursive endpoint validation,
|
|
37
|
+
integrator-supplied fetch hook for connect-time defenses.
|
|
38
|
+
- Length and format caps on every base64url/hex decode call site.
|
|
39
|
+
- Strict signature length and charset validation before any
|
|
40
|
+
cryptographic operation.
|
|
41
|
+
- Authoritative empty-key-set semantics, once an Agent Card publishes
|
|
42
|
+
a signing key set, callers must not fall back to bootstrap keys.
|
|
43
|
+
- `verifyInkAuth` requires an explicit `nonceStore: NonceStore | "deferred"`
|
|
44
|
+
option: pass a `NonceStore` to have the middleware enforce single-use
|
|
45
|
+
semantics on `body.nonce` within the freshness window, or `"deferred"`
|
|
46
|
+
to acknowledge that `checkReplay` (or equivalent) will run elsewhere
|
|
47
|
+
in the request pipeline. Omitting the option returns
|
|
48
|
+
`nonce_handling_required`, so a misconfigured deployment fails
|
|
49
|
+
loudly rather than silently accepting replays.
|
|
50
|
+
- `verifyAuditEventChain(events)` validates internal continuity of an
|
|
51
|
+
audit response slice: strictly +1 sequence, `previousEventHash`
|
|
52
|
+
linkage, duplicate-sequence fork detection. Consumers of
|
|
53
|
+
audit-exchange responses MUST run this alongside
|
|
54
|
+
`verifyAuditResponseSignature`.
|
|
55
|
+
- `checkReplay` standalone helper with explicit nonce + timestamp
|
|
56
|
+
freshness; nonce backing storage is the integrator's choice.
|
|
57
|
+
|
|
58
|
+
### Test surface
|
|
59
|
+
|
|
60
|
+
- 430 unit and integration tests across crypto, middleware, discovery,
|
|
61
|
+
containment, and security-regression suites.
|
|
62
|
+
- Interop test vectors in `test-vectors/` covering signing base, key
|
|
63
|
+
rotation, replay, and Agent Card shapes.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Standards
|
|
4
|
+
|
|
5
|
+
Participate in this project as a professional. That means:
|
|
6
|
+
|
|
7
|
+
- Treat others with respect. Disagreements about design, code, or spec
|
|
8
|
+
are normal; personal attacks, harassment, and discrimination are not.
|
|
9
|
+
- Critique work, not people. Be specific. Cite the line, the spec
|
|
10
|
+
section, or the failure mode you are addressing.
|
|
11
|
+
- Assume good faith from contributors and maintainers. If you believe
|
|
12
|
+
someone has acted in bad faith, raise it privately first.
|
|
13
|
+
- Keep public discussions focused on the protocol, the spec, the
|
|
14
|
+
reference implementation, or related interoperability work.
|
|
15
|
+
|
|
16
|
+
## Scope
|
|
17
|
+
|
|
18
|
+
This code applies to all project spaces, issues, pull requests,
|
|
19
|
+
discussions, security reports, and any other forum the maintainers
|
|
20
|
+
designate as part of the project.
|
|
21
|
+
|
|
22
|
+
## Reporting
|
|
23
|
+
|
|
24
|
+
Conduct concerns: email **conduct@adastracomputing.com**.
|
|
25
|
+
|
|
26
|
+
Security issues are a separate channel, see [`SECURITY.md`](SECURITY.md).
|
|
27
|
+
|
|
28
|
+
Reports are reviewed by maintainers. We will acknowledge within five
|
|
29
|
+
business days. We will not name reporters publicly without their
|
|
30
|
+
permission.
|
|
31
|
+
|
|
32
|
+
## Enforcement
|
|
33
|
+
|
|
34
|
+
Maintainers may, at their discretion:
|
|
35
|
+
|
|
36
|
+
- Edit or remove issues, PRs, comments, or other contributions that
|
|
37
|
+
conflict with this code.
|
|
38
|
+
- Temporarily or permanently restrict a contributor's participation in
|
|
39
|
+
the project.
|
|
40
|
+
|
|
41
|
+
Enforcement actions are not appealable to the maintainers; they are
|
|
42
|
+
appealable to Ad Astra Computing leadership at the address above.
|
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Ad Astra Computing Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
200
|
+
implied. See the License for the specific language governing
|
|
201
|
+
permissions and limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ad Astra Computing Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<img src="docs/logo.svg" alt="INK" width="200">
|
|
2
|
+
|
|
3
|
+
# INK: Inter-agent Networking Kernel
|
|
4
|
+
|
|
5
|
+
An open protocol for AI agents that need to send each other typed, signed messages on the public web. Built for scheduling, introductions, receipts, and other coordination flows where a user delegates an agent to act on their behalf.
|
|
6
|
+
|
|
7
|
+
**Status: v0.1, experimental.** Wire formats, trust semantics, and APIs may change without backward-compatible migration before v1.0.
|
|
8
|
+
|
|
9
|
+
| | |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Spec | [`specs/`](specs/) |
|
|
12
|
+
| Docs | [ink.tulpa.network](https://ink.tulpa.network) |
|
|
13
|
+
| Contributing | [`CONTRIBUTING.md`](CONTRIBUTING.md) |
|
|
14
|
+
| Security | [`SECURITY.md`](SECURITY.md) |
|
|
15
|
+
| Code of Conduct | [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md) |
|
|
16
|
+
| Changelog | [`CHANGELOG.md`](CHANGELOG.md) |
|
|
17
|
+
|
|
18
|
+
## What's in the envelope
|
|
19
|
+
|
|
20
|
+
Every INK message is an Ed25519-signed envelope over a [JCS](https://datatracker.ietf.org/doc/html/rfc8785) (RFC 8785) canonical serialization. The signature base binds the protocol version, HTTP method, request path, recipient DID, body, and timestamp. Replay protection uses a per-sender nonce plus a timestamp freshness window of 5 minutes past and 30 seconds future.
|
|
21
|
+
|
|
22
|
+
Message types cover intents, challenges, resolutions, receipts, audit events, encrypted payloads, and authenticated agent-card queries. Handshake messages carry a correlation ID; audit and receipt messages do not. Key rotation is governed by an authority rule documented in [`docs/key-rotation-rule.md`](docs/key-rotation-rule.md): the Agent Card's published key set is canonical, revoked keys never verify, and a stale bootstrap key cannot bypass rotation.
|
|
23
|
+
|
|
24
|
+
INK assumes [AT Protocol](https://atproto.com) for identity by default but isn't coupled to it. Any system that can publish an Ed25519 signing key under a stable identifier can participate.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @adastracomputing/ink
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The package ships TypeScript sources directly. Consumers need a TS-aware toolchain (tsx, ts-node, esbuild, Vite, etc.).
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import {
|
|
36
|
+
generateKeypair,
|
|
37
|
+
deriveAgentId,
|
|
38
|
+
signInkMessage,
|
|
39
|
+
verifyInkSignature,
|
|
40
|
+
verifyInkAuth,
|
|
41
|
+
} from "@adastracomputing/ink";
|
|
42
|
+
|
|
43
|
+
const keypair = await generateKeypair();
|
|
44
|
+
const agentId = deriveAgentId(keypair.publicKey);
|
|
45
|
+
|
|
46
|
+
const input = {
|
|
47
|
+
method: "POST",
|
|
48
|
+
path: "/ink/v1/tulpa:zRecipient/intent",
|
|
49
|
+
recipientDid: "tulpa:zRecipient",
|
|
50
|
+
body: {
|
|
51
|
+
protocol: "ink/0.1",
|
|
52
|
+
type: "network.tulpa.intent",
|
|
53
|
+
from: agentId,
|
|
54
|
+
to: "tulpa:zRecipient",
|
|
55
|
+
intent: "meeting_request",
|
|
56
|
+
timestamp: new Date().toISOString(),
|
|
57
|
+
nonce: crypto.randomUUID(),
|
|
58
|
+
},
|
|
59
|
+
timestamp: new Date().toISOString(),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const signature = await signInkMessage(input, keypair.privateKey);
|
|
63
|
+
const ok = await verifyInkSignature(input, signature, keypair.publicKey);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For inbound request verification, `verifyInkAuth` parses the `Authorization: INK-Ed25519 <sig>` header, checks freshness, and applies the key-rotation authority rule. It requires a `nonceStore` option so the 5-minute freshness window does not silently accept replays; pass a `NonceStore` to have the middleware enforce single-use, or `"deferred"` to acknowledge that the caller will run `checkReplay` (or equivalent) elsewhere in the request pipeline.
|
|
67
|
+
|
|
68
|
+
For consumers of audit-exchange responses, call both `verifyAuditResponseSignature` (signed response wrapper) and `verifyAuditEventChain` (sequence-by-one and `previousEventHash` continuity, fork detection). The signature gate alone does not prevent a witness from returning a gapped or forked slice.
|
|
69
|
+
|
|
70
|
+
## Tests
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm test # vitest
|
|
74
|
+
npm run typecheck # tsc --noEmit
|
|
75
|
+
npm run lint # eslint
|
|
76
|
+
npm run check:surface # public-surface drift check
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For Nix users: `nix develop` gives a pinned Node 22 + git + gitleaks shell. `nix build` produces the publishable npm tarball under `result/`.
|
|
80
|
+
|
|
81
|
+
## Layout
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
src/ reference implementation
|
|
85
|
+
crypto/ signing, multi-key verification, key encoding
|
|
86
|
+
models/ Zod schemas for Agent Card, handshake, key entries
|
|
87
|
+
middleware/ transport-level INK auth (verifyInkAuth)
|
|
88
|
+
discovery/ Agent Card fetching and candidate-key extraction
|
|
89
|
+
ink/ discovery gating, handshake budget, receipts, checkpointing
|
|
90
|
+
specs/ protocol spec documents
|
|
91
|
+
docs/ maturity notes, threat model, key rotation rules
|
|
92
|
+
test-vectors/ JSON interop vectors
|
|
93
|
+
test/ vitest unit + integration tests
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The reference implementation runs on any runtime providing standard Web Crypto and `fetch`: Node 22+, Deno, Bun, Cloudflare Workers, browsers. The timestamp freshness window is enforced inside `verifyInkAuth`; nonce single-use is enforced when a `NonceStore` is passed (otherwise `checkReplay` must be called separately). Nonce backing storage and its TTL policy are the integrator's choice.
|
|
97
|
+
|
|
98
|
+
## What's stable in v0.1
|
|
99
|
+
|
|
100
|
+
Reliable to depend on:
|
|
101
|
+
|
|
102
|
+
- Envelope structure and signing base
|
|
103
|
+
- Authorization: signed intent plus Agent Card key set
|
|
104
|
+
- Key rotation authority rule (see [`docs/key-rotation-rule.md`](docs/key-rotation-rule.md))
|
|
105
|
+
- Replay protection (nonce plus timestamp window)
|
|
106
|
+
|
|
107
|
+
Subject to change before v1.0:
|
|
108
|
+
|
|
109
|
+
- Authorization chain framing (delegation and attenuation semantics)
|
|
110
|
+
- Containment vocabulary (capability-gated visibility, sender budgets)
|
|
111
|
+
- Interop conventions with non-AT-Protocol identity systems
|
|
112
|
+
- Receipt and audit envelope shape for third-party witnesses
|
|
113
|
+
|
|
114
|
+
## Naming
|
|
115
|
+
|
|
116
|
+
You will see `network.tulpa.*` on the wire (e.g. `network.tulpa.intent`) and `ink.tulpa.network` for the docs site. Both are historical artifacts of the protocol's origin and do not imply a runtime dependency on Tulpa. A vendor-neutral namespace may be introduced in a future revision.
|
|
117
|
+
|
|
118
|
+
## Relationship to Tulpa
|
|
119
|
+
|
|
120
|
+
INK is developed by [Ad Astra Computing](https://adastracomputing.com) as the underlying protocol for [Tulpa](https://tulpa.network). The spec and the reference implementation in this repo are deliberately free of Tulpa product code so other agent platforms can adopt INK without inheriting Tulpa's surface area. Tulpa's product integration (message orchestration, marketplace, user-facing APIs) lives in a separate, closed-source codebase.
|
|
121
|
+
|
|
122
|
+
## Security
|
|
123
|
+
|
|
124
|
+
See [`SECURITY.md`](SECURITY.md) for the disclosure path. The threat model is in [`docs/threat-model.md`](docs/threat-model.md). **Do not open a public issue for security problems.**
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
Dual-licensed under either of:
|
|
129
|
+
|
|
130
|
+
- MIT ([`LICENSE-MIT`](LICENSE-MIT))
|
|
131
|
+
- Apache 2.0 ([`LICENSE-APACHE`](LICENSE-APACHE))
|
|
132
|
+
|
|
133
|
+
at your option. The Apache 2.0 license includes an explicit patent grant; MIT is the simpler text. Pick whichever fits your downstream policy. This covers the code, specs, docs, and test vectors. Contributions are accepted under both licenses.
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
INK is an experimental pre-1.0 protocol. Security reports are taken seriously.
|
|
4
|
+
|
|
5
|
+
## Reporting a vulnerability
|
|
6
|
+
|
|
7
|
+
**Do not open a public GitHub issue for security problems.**
|
|
8
|
+
|
|
9
|
+
Report privately to: **security@adastracomputing.com**
|
|
10
|
+
|
|
11
|
+
Include:
|
|
12
|
+
|
|
13
|
+
- A description of the issue and why it is a security problem
|
|
14
|
+
- Reproduction steps or a proof-of-concept
|
|
15
|
+
- The affected commit SHA or release tag
|
|
16
|
+
- Whether you want public credit in the fix notes
|
|
17
|
+
|
|
18
|
+
Acknowledgement within 3 business days; triage decision within 7. We coordinate disclosure with the reporter, public disclosure after a fix ships and known integrators have had time to update.
|
|
19
|
+
|
|
20
|
+
## Supported versions
|
|
21
|
+
|
|
22
|
+
INK is pre-1.0. Only the `main` branch receives security fixes. Pinned pre-1.0 releases are not separately maintained.
|
|
23
|
+
|
|
24
|
+
| Version | Supported |
|
|
25
|
+
|---------|-----------|
|
|
26
|
+
| `main` | Yes |
|
|
27
|
+
| v0.x tags | Best-effort only |
|
|
28
|
+
|
|
29
|
+
## Scope
|
|
30
|
+
|
|
31
|
+
In scope:
|
|
32
|
+
|
|
33
|
+
- Signature forgery, replay attacks, nonce collisions
|
|
34
|
+
- Bypass of the key-rotation authority rule (see `docs/key-rotation-rule.md`)
|
|
35
|
+
- Authorization-chain attenuation bypass
|
|
36
|
+
- Receipt/audit envelope tampering
|
|
37
|
+
- Agent Card discovery gating bypass that exposes non-public fields
|
|
38
|
+
- Cryptographic misuse (wrong signing base, non-canonical JSON, etc.)
|
|
39
|
+
|
|
40
|
+
Out of scope:
|
|
41
|
+
|
|
42
|
+
- DoS via high-entropy inputs against the reference implementation
|
|
43
|
+
- Attacks that require a compromised identity system (e.g., a malicious PDS returning a fabricated DID document)
|
|
44
|
+
- Timing side-channels in the reference `@noble/ed25519` verification
|
|
45
|
+
- Attacks on Tulpa's product infrastructure (separate codebase, separate disclosure process)
|
|
46
|
+
|
|
47
|
+
## Threat model
|
|
48
|
+
|
|
49
|
+
See [`docs/threat-model.md`](docs/threat-model.md).
|
|
50
|
+
|
|
51
|
+
## Audit status
|
|
52
|
+
|
|
53
|
+
INK has not undergone an independent security audit. Do not describe or adopt INK as "audited" or "hardened" on that basis.
|
|
54
|
+
|
|
55
|
+
## Credits
|
|
56
|
+
|
|
57
|
+
Reporters who help us will be credited in release notes unless they prefer to remain anonymous.
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Key Rotation Authority Rule
|
|
2
|
+
|
|
3
|
+
> Normative. This is the rule a conforming INK receiver MUST follow when
|
|
4
|
+
> verifying a signature attributed to a sender agent.
|
|
5
|
+
|
|
6
|
+
## Summary
|
|
7
|
+
|
|
8
|
+
**The Agent Card signing key set, once observed, is authoritative.** A
|
|
9
|
+
receiver MUST:
|
|
10
|
+
|
|
11
|
+
1. Try to verify the signature against the sender's Agent Card `keys.signing`
|
|
12
|
+
set. Iterate through entries in this order: `active` → `retired`. Never
|
|
13
|
+
iterate `revoked` entries.
|
|
14
|
+
2. If any entry verifies, accept the signature and record which `keyId` was
|
|
15
|
+
used.
|
|
16
|
+
3. If no entry verifies, reject the signature. **Do not fall through** to
|
|
17
|
+
any other key source.
|
|
18
|
+
|
|
19
|
+
Only when the receiver has **never observed** an Agent Card for the sender
|
|
20
|
+
may it use a bootstrap path, either the public key embedded in an
|
|
21
|
+
agent ID scheme that supports it, or a key the receiver stored from an
|
|
22
|
+
earlier first-contact handshake. This is the *trust-on-first-use* window
|
|
23
|
+
and ends the first time a valid Agent Card is observed.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
|
|
27
|
+
Rotation and revocation exist so an agent can abandon a compromised key.
|
|
28
|
+
The moment the sender publishes an updated Card, any receiver that still
|
|
29
|
+
accepts the old key is defeating rotation. Three concrete failure modes
|
|
30
|
+
this rule closes:
|
|
31
|
+
|
|
32
|
+
1. **Stolen old key.** Attacker has a private key the sender has since
|
|
33
|
+
marked `retired` or `revoked`. Without this rule, a receiver with a
|
|
34
|
+
locally-cached copy of that old key might still verify the attacker's
|
|
35
|
+
signed message.
|
|
36
|
+
2. **Fallback shadowing.** A receiver that first consults an "authoritative"
|
|
37
|
+
key set and then "as a fallback" consults some other single-key lookup
|
|
38
|
+
can have that lookup return a pre-rotation key, silently accepting the
|
|
39
|
+
old signature after rotation. The rule forbids fallback **after** the
|
|
40
|
+
authoritative set has spoken.
|
|
41
|
+
3. **Bootstrap persistence.** Some identity schemes let receivers derive a
|
|
42
|
+
public key from the agent ID. That key is necessarily frozen at creation
|
|
43
|
+
time, rotation by definition can't update it. The rule limits its use
|
|
44
|
+
to first-contact only.
|
|
45
|
+
|
|
46
|
+
## Status taxonomy
|
|
47
|
+
|
|
48
|
+
A signing key entry has exactly one of three statuses:
|
|
49
|
+
|
|
50
|
+
| Status | Receiver behavior |
|
|
51
|
+
|-----------|---------------------------------------------------------------|
|
|
52
|
+
| `active` | Verify signatures made with this key. Normal operation. |
|
|
53
|
+
| `retired` | Verify signatures, but the sender has a newer `active` key. |
|
|
54
|
+
| | Typical during rotation grace periods. Receivers MAY refuse |
|
|
55
|
+
| | based on local policy (e.g. reject anything older than 30 d). |
|
|
56
|
+
| `revoked` | **Never** verify signatures with this key, even for messages |
|
|
57
|
+
| | signed before the revocation timestamp. Revocation means the |
|
|
58
|
+
| | key is compromised or must not be trusted. |
|
|
59
|
+
|
|
60
|
+
Retired vs revoked is the key semantic distinction. Retired is normal
|
|
61
|
+
rotation; revoked is a trust statement. Conforming implementations MUST
|
|
62
|
+
NOT treat them as equivalent.
|
|
63
|
+
|
|
64
|
+
## Concrete receiver algorithm
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
input: senderId, signature, message
|
|
68
|
+
state: agentCardCache (optional per-receiver cache of observed Cards)
|
|
69
|
+
|
|
70
|
+
card ← agentCardCache.get(senderId) or fetch Agent Card via published
|
|
71
|
+
endpoint for senderId
|
|
72
|
+
|
|
73
|
+
if card has a non-empty keys.signing set:
|
|
74
|
+
for entry in card.keys.signing where entry.status ∈ {active, retired}:
|
|
75
|
+
if verify(entry.publicKey, message, signature):
|
|
76
|
+
return ACCEPT, keyIdUsed = entry.keyId
|
|
77
|
+
return REJECT (signature_verification_failed)
|
|
78
|
+
|
|
79
|
+
else if card does not exist OR has no keys.signing:
|
|
80
|
+
# First-contact / bootstrap only
|
|
81
|
+
bootstrapKey ← extract from senderId (scheme-specific) OR
|
|
82
|
+
lookup in local connection store
|
|
83
|
+
if bootstrapKey and verify(bootstrapKey, message, signature):
|
|
84
|
+
return ACCEPT, keyIdUsed = "bootstrap"
|
|
85
|
+
return REJECT (unresolvable_sender_key or signature_verification_failed)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Invariants a conforming implementation MUST preserve
|
|
89
|
+
|
|
90
|
+
1. A `revoked` entry in the Card MUST NEVER be used to verify a signature.
|
|
91
|
+
2. A locally-stored single key MUST NOT be treated as `active` if the
|
|
92
|
+
sender's Card disagrees with its status. If the Card lists that public
|
|
93
|
+
key as `retired` or `revoked`, the Card's status wins.
|
|
94
|
+
3. If the Card's signing set has been observed and no entry verifies the
|
|
95
|
+
signature, the signature MUST be rejected. The receiver MUST NOT then
|
|
96
|
+
consult another key source.
|
|
97
|
+
4. Bootstrap key extraction (deriving a pubkey from an agent ID) MUST be
|
|
98
|
+
disabled once any Card signing set has been observed for that sender.
|
|
99
|
+
|
|
100
|
+
## Non-goals
|
|
101
|
+
|
|
102
|
+
- This rule does not specify how a sender rotates keys. See
|
|
103
|
+
[`../specs/ink-key-rotation-spec.md`](../specs/ink-key-rotation-spec.md).
|
|
104
|
+
- This rule does not specify receipt / audit integrity under rotation;
|
|
105
|
+
see [`../specs/ink-auditability.md`](../specs/ink-auditability.md).
|
|
106
|
+
- This rule does not specify identity proof. INK assumes the identity
|
|
107
|
+
system (AT Protocol, DID, etc.) provides senderId → Agent Card
|
|
108
|
+
resolution.
|
package/docs/logo.svg
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 28" fill="none">
|
|
2
|
+
<!-- INK wordmark: pen nib IS the "I", then path-based "nk" — dark variant -->
|
|
3
|
+
<path d="M10 1 L16 9 L16 16 L13.5 23 L12.5 23 L11.5 17 L10 14.5 L8.5 17 L7.5 23 L6.5 23 L4 16 L4 9 Z"
|
|
4
|
+
fill="#c4b5fd" />
|
|
5
|
+
<circle cx="10" cy="7.5" r="1.5" fill="#121220" />
|
|
6
|
+
<path d="M24 9.5 L24 23 L27.5 23 L27.5 14.5 C27.5 12 29.5 10.5 32 10.5 C34 10.5 35.5 12 35.5 14 L35.5 23 L39 23 L39 13.5 C39 10 36.5 8 33 8 C30.5 8 28.5 9 27.5 10.5 L27.5 9.5 Z" fill="#c4b5fd" />
|
|
7
|
+
<path d="M45 1 L45 23 L48.5 23 L48.5 16 L51 14 L57.5 23 L62 23 L54 13 L60 5 L56 5 L48.5 14 L48.5 1 Z" fill="#c4b5fd" />
|
|
8
|
+
</svg>
|