@moltzap/identity 2026.902.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.
Files changed (81) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +19 -0
  3. package/README.md +31 -0
  4. package/bin/moltzap-registry +9 -0
  5. package/dist/agent-card.d.ts +69 -0
  6. package/dist/agent-card.d.ts.map +1 -0
  7. package/dist/agent-card.js +257 -0
  8. package/dist/agent-card.js.map +1 -0
  9. package/dist/agent-key.d.ts +77 -0
  10. package/dist/agent-key.d.ts.map +1 -0
  11. package/dist/agent-key.js +251 -0
  12. package/dist/agent-key.js.map +1 -0
  13. package/dist/authenticated-http.d.ts +44 -0
  14. package/dist/authenticated-http.d.ts.map +1 -0
  15. package/dist/authenticated-http.js +226 -0
  16. package/dist/authenticated-http.js.map +1 -0
  17. package/dist/canonical-json.d.ts +40 -0
  18. package/dist/canonical-json.d.ts.map +1 -0
  19. package/dist/canonical-json.js +399 -0
  20. package/dist/canonical-json.js.map +1 -0
  21. package/dist/http-errors.d.ts +115 -0
  22. package/dist/http-errors.d.ts.map +1 -0
  23. package/dist/http-errors.js +55 -0
  24. package/dist/http-errors.js.map +1 -0
  25. package/dist/http-signature.d.ts +60 -0
  26. package/dist/http-signature.d.ts.map +1 -0
  27. package/dist/http-signature.js +337 -0
  28. package/dist/http-signature.js.map +1 -0
  29. package/dist/identifiers.d.ts +32 -0
  30. package/dist/identifiers.d.ts.map +1 -0
  31. package/dist/identifiers.js +55 -0
  32. package/dist/identifiers.js.map +1 -0
  33. package/dist/index.d.ts +33 -0
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +34 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/registry/admission.d.ts +27 -0
  38. package/dist/registry/admission.d.ts.map +1 -0
  39. package/dist/registry/admission.js +107 -0
  40. package/dist/registry/admission.js.map +1 -0
  41. package/dist/registry/client.d.ts +20 -0
  42. package/dist/registry/client.d.ts.map +1 -0
  43. package/dist/registry/client.js +250 -0
  44. package/dist/registry/client.js.map +1 -0
  45. package/dist/registry/contract.d.ts +213 -0
  46. package/dist/registry/contract.d.ts.map +1 -0
  47. package/dist/registry/contract.js +132 -0
  48. package/dist/registry/contract.js.map +1 -0
  49. package/dist/registry/http.d.ts +27 -0
  50. package/dist/registry/http.d.ts.map +1 -0
  51. package/dist/registry/http.js +258 -0
  52. package/dist/registry/http.js.map +1 -0
  53. package/dist/registry/migrations/0001_registry.d.ts +6 -0
  54. package/dist/registry/migrations/0001_registry.d.ts.map +1 -0
  55. package/dist/registry/migrations/0001_registry.js +36 -0
  56. package/dist/registry/migrations/0001_registry.js.map +1 -0
  57. package/dist/registry/rpc.d.ts +138 -0
  58. package/dist/registry/rpc.d.ts.map +1 -0
  59. package/dist/registry/rpc.js +85 -0
  60. package/dist/registry/rpc.js.map +1 -0
  61. package/dist/registry/server.d.ts +52 -0
  62. package/dist/registry/server.d.ts.map +1 -0
  63. package/dist/registry/server.js +157 -0
  64. package/dist/registry/server.js.map +1 -0
  65. package/dist/registry/storage.d.ts +62 -0
  66. package/dist/registry/storage.d.ts.map +1 -0
  67. package/dist/registry/storage.js +341 -0
  68. package/dist/registry/storage.js.map +1 -0
  69. package/dist/registry.d.ts +34 -0
  70. package/dist/registry.d.ts.map +1 -0
  71. package/dist/registry.js +13 -0
  72. package/dist/registry.js.map +1 -0
  73. package/dist/signed-message.d.ts +54 -0
  74. package/dist/signed-message.d.ts.map +1 -0
  75. package/dist/signed-message.js +289 -0
  76. package/dist/signed-message.js.map +1 -0
  77. package/dist/version.d.ts +4 -0
  78. package/dist/version.d.ts.map +1 -0
  79. package/dist/version.js +4 -0
  80. package/dist/version.js.map +1 -0
  81. package/package.json +139 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Tapan Chugh
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,19 @@
1
+ MoltZap
2
+ Copyright 2026 Tapan Chugh
3
+
4
+ This product is licensed under the Apache License, Version 2.0; see LICENSE.
5
+
6
+ Releases published before the four-layer cutover keep the license their
7
+ published manifests declared; the repository LICENSE was the MIT License at
8
+ the time. The source in this repository is original to the project; no
9
+ third-party MIT-licensed source is relicensed by this change.
10
+
11
+ Third-party software is consumed as npm packages, container base images, and
12
+ pinned upstream source archives at build time under their own licenses:
13
+
14
+ - OpenClaw (ghcr.io/openclaw/openclaw) as the base of the OpenClaw agent image.
15
+ - NanoClaw (github.com/nanocoai/nanoclaw) as the pinned source of the NanoClaw
16
+ agent image.
17
+ - The vendored `.claude/skills/cold-read` skill is adapted from the
18
+ safer-by-default project (github.com/chughtapan/safer-by-default) by the same
19
+ copyright holder.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # `@moltzap/identity`
2
+
3
+ Identity is the root package in the MoltZap product graph. It owns agent
4
+ identifiers and names, immutable Registry-issued `AgentCard` values, signing
5
+ and verification, authenticated HTTP, and the Registry process.
6
+
7
+ It publishes to npm as part of the one-version set; `npm install
8
+ @moltzap/identity` pulls exactly the release its siblings were built with.
9
+
10
+ ## Entry points
11
+
12
+ | Import | Purpose |
13
+ |---|---|
14
+ | `@moltzap/identity` | Identity values, signed artifacts, and authenticated HTTP contracts |
15
+ | `@moltzap/identity/registry` | Registry client capability and closed request/result types |
16
+ | `@moltzap/identity/registry/server` | Registry server composition |
17
+
18
+ The package also builds the `moltzap-registry` process executable. Identity has
19
+ no production dependency on another MoltZap package and does not own Router
20
+ delivery, conversations, endpoint history, or runtime MCP behavior.
21
+
22
+ ## Verification
23
+
24
+ ```sh
25
+ pnpm nx run @moltzap/identity:build
26
+ pnpm nx run @moltzap/identity:typecheck:tests
27
+ pnpm nx run @moltzap/identity:test
28
+ pnpm nx run @moltzap/identity:test:integration
29
+ pnpm nx run @moltzap/identity:lint
30
+ pnpm nx run @moltzap/identity:arch:check
31
+ ```
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import { NodeRuntime } from "@effect/platform-node";
3
+ import { ConfigProvider, Effect, Layer } from "effect";
4
+ import { layer } from "../dist/registry/server.js";
5
+
6
+ Layer.launch(layer).pipe(
7
+ Effect.withConfigProvider(ConfigProvider.fromEnv()),
8
+ NodeRuntime.runMain,
9
+ );
@@ -0,0 +1,69 @@
1
+ /** @file Immutable AgentCard representation, issuance, verification, encoding, and digest. */
2
+ import { Brand, Effect, Schema } from "effect";
3
+ import { AgentSigningAuthority, type Ed25519PublicKey as Ed25519PublicKeyValue } from "./agent-key.js";
4
+ import { type AgentId as AgentIdValue, type AgentName as AgentNameValue, type PrincipalId as PrincipalIdValue } from "./identifiers.js";
5
+ /** Digest binding a message to one complete immutable AgentCard. */
6
+ export declare const AgentCardDigest: Schema.brand<Schema.filter<typeof Schema.String>, "AgentCardDigest">;
7
+ /** Validated nominal value decoded by AgentCardDigest. */
8
+ export type AgentCardDigest = typeof AgentCardDigest.Type;
9
+ /** Whole-second UTC issuance evidence carried by an AgentCard. */
10
+ export declare const AgentCardIssuedAt: Schema.brand<Schema.filter<Schema.filter<typeof Schema.String>>, "AgentCardIssuedAt">;
11
+ /** Validated nominal value decoded by AgentCardIssuedAt. */
12
+ export type AgentCardIssuedAt = typeof AgentCardIssuedAt.Type;
13
+ /** Immutable public identity fields carried by an AgentCard. */
14
+ export interface AgentCard {
15
+ readonly agentId: AgentIdValue;
16
+ readonly principalId: PrincipalIdValue;
17
+ readonly agentName: AgentNameValue;
18
+ readonly publicKey: Ed25519PublicKeyValue;
19
+ readonly issuedAt: string;
20
+ }
21
+ /** AgentCard verified against a deployment-pinned Registry signer. */
22
+ export type VerifiedAgentCard = AgentCard & Brand.Brand<"VerifiedAgentCard">;
23
+ /** Private no-serialization RPC witness for a verified card. */
24
+ export declare const verifiedAgentCardSchema: Schema.declare<VerifiedAgentCard, VerifiedAgentCard, readonly [], never>;
25
+ declare const AgentCardVerificationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
26
+ readonly _tag: "AgentCardVerificationError";
27
+ } & Readonly<A>;
28
+ /** A parsed AgentCard does not verify against the pinned Registry signer. */
29
+ export declare class AgentCardVerificationError extends AgentCardVerificationError_base {
30
+ }
31
+ interface IssueAgentCardInput {
32
+ readonly agentId: AgentIdValue;
33
+ readonly principalId: PrincipalIdValue;
34
+ readonly agentName: AgentNameValue;
35
+ readonly publicKey: Ed25519PublicKeyValue;
36
+ readonly issuedAt: AgentCardIssuedAt;
37
+ readonly registrySigningAuthority: AgentSigningAuthority;
38
+ }
39
+ declare const verifyAgentCard: (input: {
40
+ readonly agentCard: AgentCard;
41
+ readonly registrySignerPublicKey: Ed25519PublicKeyValue;
42
+ }) => Effect.Effect<VerifiedAgentCard, AgentCardVerificationError>;
43
+ /**
44
+ * Issues one exact AgentCard for Registry storage.
45
+ *
46
+ * @param input Complete identity fields and Registry signing authority.
47
+ * @returns A Registry-verified immutable AgentCard.
48
+ */
49
+ export declare const issueAgentCard: (input: IssueAgentCardInput) => Effect.Effect<VerifiedAgentCard, AgentCardVerificationError>;
50
+ /**
51
+ * JCS representation bytes retained by a parsed AgentCard.
52
+ *
53
+ * @param agentCard Parsed AgentCard whose retained bytes are requested.
54
+ * @returns The complete canonical General JWS bytes.
55
+ */
56
+ export declare const encodeAgentCard: (agentCard: AgentCard) => Effect.Effect<Uint8Array, AgentCardVerificationError>;
57
+ /**
58
+ * Identity-owned digest over the complete retained AgentCard JWS.
59
+ *
60
+ * @param agentCard Parsed AgentCard to digest.
61
+ * @returns The refined SHA-256 AgentCard digest.
62
+ */
63
+ export declare const digestAgentCard: (agentCard: AgentCard) => Effect.Effect<AgentCardDigest, AgentCardVerificationError>;
64
+ /** Verifies immutable Registry attestation without exposing JOSE mechanics. */
65
+ export declare const AgentCard: Schema.Schema<AgentCard, unknown> & Readonly<{
66
+ readonly verify: typeof verifyAgentCard;
67
+ }>;
68
+ export {};
69
+ //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,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAC;IACvC,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,wBAAwB,EAAE,qBAAqB,CAAC;CAC1D;AAUD,QAAA,MAAM,eAAe,UAAW;IAC9B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,uBAAuB,EAAE,qBAAqB,CAAC;CACzD,KAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,0BAA0B,CA2C3D,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,cAAc,UAClB,mBAAmB,KACzB,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,0BAA0B,CAiClB,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,eAAe,cACf,SAAS,KACnB,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,0BAA0B,CAOtD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,cACf,SAAS,KACnB,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,0BAA0B,CAUf,CAAC;AAK9C,+EAA+E;AAC/E,eAAO,MAAM,SAAS,EAEhB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,GACrC,QAAQ,CAAC;IACP,QAAQ,CAAC,MAAM,EAAE,OAAO,eAAe,CAAC;CACzC,CAAC,CAAC"}
@@ -0,0 +1,257 @@
1
+ /** @file Immutable AgentCard representation, issuance, verification, encoding, and digest. */
2
+ import { Brand, Data, Effect, Either, Encoding, ParseResult, Schema, } from "effect";
3
+ import { GeneralSign, generalVerify, importJWK } from "jose";
4
+ import { createHash } from "node:crypto";
5
+ import { AgentSigningAuthority, agentSigningPrivateKey, Ed25519PublicKey, ed25519PublicKeyThumbprintUri, hasCanonicalEd25519SignatureEncoding, } from "./agent-key.js";
6
+ import { decodeCanonicalJson, encodeCanonicalJson } from "./canonical-json.js";
7
+ import { AgentId, AgentName, canonicalIdentifier, PrincipalId, } from "./identifiers.js";
8
+ import { MOLTZAP_VERSION } from "./version.js";
9
+ const DIGEST_BYTE_LENGTH = 32;
10
+ const WHOLE_SECOND_UTC = /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\dZ$/;
11
+ const AGENT_CARD_TYPE = "application/vnd.moltzap.agent-card+jws";
12
+ const ED25519_SIGNATURE_BYTES = 64;
13
+ const isWholeSecondUtc = (value) => {
14
+ if (typeof value !== "string") {
15
+ return false;
16
+ }
17
+ const epochMilliseconds = Date.parse(value);
18
+ if (!Number.isFinite(epochMilliseconds)) {
19
+ return false;
20
+ }
21
+ const wholeSecondValue = `${value.slice(0, -1)}.000Z`;
22
+ return new Date(epochMilliseconds).toISOString() === wholeSecondValue;
23
+ };
24
+ /** Digest binding a message to one complete immutable AgentCard. */
25
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- Effect Schemas share the public domain name they decode.
26
+ export const AgentCardDigest = canonicalIdentifier("AgentCardDigest", "acd_", DIGEST_BYTE_LENGTH);
27
+ /** Whole-second UTC issuance evidence carried by an AgentCard. */
28
+ // eslint-disable-next-line @typescript-eslint/naming-convention -- Effect Schemas share the package-owned domain name they decode.
29
+ export const AgentCardIssuedAt = Schema.String.pipe(Schema.pattern(WHOLE_SECOND_UTC), Schema.filter(isWholeSecondUtc, {
30
+ identifier: "AgentCardIssuedAt",
31
+ description: "AgentCard issuance time in whole-second UTC",
32
+ }), Schema.brand("AgentCardIssuedAt"), Schema.annotations({
33
+ identifier: "AgentCardIssuedAt",
34
+ description: "AgentCard issuance time in whole-second UTC",
35
+ }));
36
+ const hasCanonicalBase64UrlByteLength = (value, expectedByteLength) => Either.match(Encoding.decodeBase64Url(value), {
37
+ onLeft: () => false,
38
+ onRight: (bytes) => Encoding.encodeBase64Url(bytes) === value &&
39
+ (expectedByteLength === undefined ||
40
+ bytes.byteLength === expectedByteLength),
41
+ });
42
+ const canonicalBase64Url = Schema.String.pipe(Schema.filter((value) => hasCanonicalBase64UrlByteLength(value)));
43
+ const exactStruct = (fields) => Schema.Struct(fields).annotations({
44
+ parseOptions: {
45
+ exact: true,
46
+ onExcessProperty: "error",
47
+ },
48
+ });
49
+ const jwsSignatureRepresentation = exactStruct({
50
+ protected: canonicalBase64Url,
51
+ signature: Schema.String.pipe(Schema.filter((value) => Either.match(Encoding.decodeBase64Url(value), {
52
+ onLeft: () => false,
53
+ onRight: (bytes) => Encoding.encodeBase64Url(bytes) === value &&
54
+ bytes.byteLength === ED25519_SIGNATURE_BYTES &&
55
+ hasCanonicalEd25519SignatureEncoding(bytes),
56
+ }))),
57
+ });
58
+ const generalJwsRepresentation = exactStruct({
59
+ payload: canonicalBase64Url,
60
+ signatures: Schema.Tuple(jwsSignatureRepresentation),
61
+ });
62
+ const protectedHeader = exactStruct({
63
+ alg: Schema.Literal("Ed25519"),
64
+ kid: Schema.String,
65
+ typ: Schema.Literal(AGENT_CARD_TYPE),
66
+ });
67
+ const payload = exactStruct({
68
+ kind: Schema.Literal("agentCard"),
69
+ moltzapVersion: Schema.Literal(MOLTZAP_VERSION),
70
+ agentId: AgentId,
71
+ principalId: PrincipalId,
72
+ agentName: AgentName,
73
+ publicKey: Ed25519PublicKey,
74
+ issuedAt: AgentCardIssuedAt,
75
+ });
76
+ const cardState = new WeakMap();
77
+ const verifiedCards = new WeakSet();
78
+ const hasAgentCardState = (value) => typeof value === "object" &&
79
+ value !== null &&
80
+ Object.isFrozen(value) &&
81
+ cardState.has(value);
82
+ const agentCardView = Schema.declare(hasAgentCardState, {
83
+ identifier: "AgentCardView",
84
+ });
85
+ const parseIssue = (ast, actual) => new ParseResult.Type(ast, actual, "Expected an exact AgentCard");
86
+ const decodeBase64Url = (value, ast) => Encoding.decodeBase64Url(value).pipe(Effect.mapError(() => parseIssue(ast, value)));
87
+ const snapshotRepresentation = (representation) => Object.freeze({
88
+ payload: representation.payload,
89
+ signatures: Object.freeze([
90
+ Object.freeze({
91
+ protected: representation.signatures[0].protected,
92
+ signature: representation.signatures[0].signature,
93
+ }),
94
+ ]),
95
+ });
96
+ const decodeRepresentation = (representation, ast) => Effect.gen(function* () {
97
+ const payloadBytes = yield* decodeBase64Url(representation.payload, ast);
98
+ const headerBytes = yield* decodeBase64Url(representation.signatures[0].protected, ast);
99
+ const decodedPayload = yield* decodeCanonicalJson(payload, payloadBytes).pipe(Effect.mapError(() => parseIssue(ast, representation)));
100
+ const decodedHeader = yield* decodeCanonicalJson(protectedHeader, headerBytes).pipe(Effect.mapError(() => parseIssue(ast, representation)));
101
+ const publicKey = yield* Schema.decodeUnknown(Ed25519PublicKey)(Object.freeze({
102
+ crv: decodedPayload.publicKey.crv,
103
+ kty: decodedPayload.publicKey.kty,
104
+ x: decodedPayload.publicKey.x,
105
+ })).pipe(Effect.mapError(() => parseIssue(ast, representation)));
106
+ const card = Object.freeze({
107
+ agentId: decodedPayload.agentId,
108
+ principalId: decodedPayload.principalId,
109
+ agentName: decodedPayload.agentName,
110
+ publicKey,
111
+ issuedAt: decodedPayload.issuedAt,
112
+ });
113
+ const retained = snapshotRepresentation(representation);
114
+ yield* encodeCanonicalJson(retained).pipe(Effect.mapError(() => parseIssue(ast, representation)));
115
+ cardState.set(card, {
116
+ representation: retained,
117
+ protectedHeader: Object.freeze({ ...decodedHeader }),
118
+ });
119
+ return card;
120
+ });
121
+ const encodeView = (card, ast) => {
122
+ const state = cardState.get(card);
123
+ return state === undefined
124
+ ? Effect.fail(parseIssue(ast, card))
125
+ : Effect.succeed(state.representation);
126
+ };
127
+ const agentCardSchema = Schema.transformOrFail(generalJwsRepresentation, agentCardView, {
128
+ strict: true,
129
+ decode: (representation, ...[, ast]) => decodeRepresentation(representation, ast),
130
+ encode: (card, ...[, ast]) => encodeView(card, ast),
131
+ }).annotations({
132
+ identifier: "AgentCard",
133
+ parseOptions: {
134
+ exact: true,
135
+ onExcessProperty: "error",
136
+ },
137
+ });
138
+ const brandVerifiedAgentCard = Brand.nominal();
139
+ /** Private no-serialization RPC witness for a verified card. */
140
+ export const verifiedAgentCardSchema = Schema.declare((value) => typeof value === "object" &&
141
+ value !== null &&
142
+ cardState.has(value) &&
143
+ verifiedCards.has(value), { identifier: "VerifiedAgentCard" });
144
+ /** A parsed AgentCard does not verify against the pinned Registry signer. */
145
+ export class AgentCardVerificationError extends Data.TaggedError("AgentCardVerificationError") {
146
+ }
147
+ const verificationFailure = () => new AgentCardVerificationError();
148
+ const parseAgentCard = (representation) => Schema.decodeUnknown(agentCardSchema)(representation, {
149
+ exact: true,
150
+ onExcessProperty: "error",
151
+ }).pipe(Effect.mapError(verificationFailure));
152
+ const verifyAgentCard = (input) => Effect.gen(function* () {
153
+ const state = cardState.get(input.agentCard);
154
+ if (state === undefined) {
155
+ return yield* new AgentCardVerificationError();
156
+ }
157
+ const expectedKid = yield* ed25519PublicKeyThumbprintUri(input.registrySignerPublicKey).pipe(Effect.mapError(verificationFailure));
158
+ if (state.protectedHeader.alg !== "Ed25519" ||
159
+ state.protectedHeader.typ !== AGENT_CARD_TYPE ||
160
+ state.protectedHeader.kid !== expectedKid) {
161
+ return yield* new AgentCardVerificationError();
162
+ }
163
+ const key = yield* Effect.tryPromise({
164
+ try: () => importJWK(input.registrySignerPublicKey, "Ed25519"),
165
+ catch: verificationFailure,
166
+ });
167
+ yield* Effect.tryPromise({
168
+ try: () => {
169
+ const signature = state.representation.signatures[0];
170
+ return generalVerify({
171
+ payload: state.representation.payload,
172
+ signatures: [
173
+ {
174
+ protected: signature.protected,
175
+ signature: signature.signature,
176
+ },
177
+ ],
178
+ }, key, {
179
+ algorithms: ["Ed25519"],
180
+ });
181
+ },
182
+ catch: verificationFailure,
183
+ });
184
+ verifiedCards.add(input.agentCard);
185
+ return brandVerifiedAgentCard(input.agentCard);
186
+ });
187
+ /**
188
+ * Issues one exact AgentCard for Registry storage.
189
+ *
190
+ * @param input Complete identity fields and Registry signing authority.
191
+ * @returns A Registry-verified immutable AgentCard.
192
+ */
193
+ export const issueAgentCard = (input) => Effect.gen(function* () {
194
+ const payloadBytes = yield* encodeCanonicalJson({
195
+ kind: "agentCard",
196
+ moltzapVersion: MOLTZAP_VERSION,
197
+ agentId: input.agentId,
198
+ principalId: input.principalId,
199
+ agentName: input.agentName,
200
+ publicKey: input.publicKey,
201
+ issuedAt: input.issuedAt,
202
+ }).pipe(Effect.mapError(verificationFailure));
203
+ const kid = yield* ed25519PublicKeyThumbprintUri(AgentSigningAuthority.publicKey(input.registrySigningAuthority)).pipe(Effect.mapError(verificationFailure));
204
+ const representation = yield* Effect.tryPromise({
205
+ try: () => new GeneralSign(payloadBytes)
206
+ .addSignature(agentSigningPrivateKey(input.registrySigningAuthority))
207
+ .setProtectedHeader({
208
+ alg: "Ed25519",
209
+ kid,
210
+ typ: AGENT_CARD_TYPE,
211
+ })
212
+ .sign(),
213
+ catch: verificationFailure,
214
+ });
215
+ const card = yield* parseAgentCard(representation);
216
+ return yield* verifyAgentCard({
217
+ agentCard: card,
218
+ registrySignerPublicKey: AgentSigningAuthority.publicKey(input.registrySigningAuthority),
219
+ });
220
+ }).pipe(Effect.withSpan("issueAgentCard"));
221
+ /**
222
+ * JCS representation bytes retained by a parsed AgentCard.
223
+ *
224
+ * @param agentCard Parsed AgentCard whose retained bytes are requested.
225
+ * @returns The complete canonical General JWS bytes.
226
+ */
227
+ export const encodeAgentCard = (agentCard) => {
228
+ const state = cardState.get(agentCard);
229
+ return state === undefined
230
+ ? Effect.fail(new AgentCardVerificationError())
231
+ : encodeCanonicalJson(state.representation).pipe(Effect.mapError(verificationFailure));
232
+ };
233
+ /**
234
+ * Identity-owned digest over the complete retained AgentCard JWS.
235
+ *
236
+ * @param agentCard Parsed AgentCard to digest.
237
+ * @returns The refined SHA-256 AgentCard digest.
238
+ */
239
+ export const digestAgentCard = (agentCard) => Effect.gen(function* () {
240
+ const bytes = yield* encodeAgentCard(agentCard);
241
+ const digest = yield* Effect.try({
242
+ try: () => createHash("sha256").update(bytes).digest(),
243
+ catch: () => new AgentCardVerificationError(),
244
+ });
245
+ return yield* Schema.decodeUnknown(AgentCardDigest)(`acd_${Encoding.encodeBase64Url(digest)}`).pipe(Effect.mapError(verificationFailure));
246
+ }).pipe(Effect.withSpan("digestAgentCard"));
247
+ /* eslint-disable @typescript-eslint/no-redeclare, @typescript-eslint/naming-convention, agent-code-guard/require-assertion-rationale --
248
+ * The accepted same-name Schema/type API retains the exact private General JWS AST while erasing only its encoded TypeScript type.
249
+ */
250
+ /** Verifies immutable Registry attestation without exposing JOSE mechanics. */
251
+ export const AgentCard = Object.assign(agentCardSchema, {
252
+ verify: verifyAgentCard,
253
+ });
254
+ /* eslint-enable @typescript-eslint/no-redeclare, @typescript-eslint/naming-convention, agent-code-guard/require-assertion-rationale --
255
+ * The accepted same-name Schema/type API retains the exact private General JWS AST while erasing only its encoded TypeScript type.
256
+ */
257
+ //# sourceMappingURL=agent-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-card.js","sourceRoot":"","sources":["../src/agent-card.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,OAAO,EACL,KAAK,EACL,IAAI,EACJ,MAAM,EACN,MAAM,EACN,QAAQ,EACR,WAAW,EACX,MAAM,GAEP,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,6BAA6B,EAE7B,oCAAoC,GACrC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,OAAO,EAE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