@motebit/verify 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Motebit
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,64 @@
1
+ # @motebit/verify
2
+
3
+ Standalone verifier for `motebit.md` agent identity files.
4
+
5
+ Implements the verification algorithm from the [motebit/identity@1.0](https://github.com/hakimlabs/motebit/blob/main/spec/identity-v1.md) specification. Zero monorepo dependencies — only [`@noble/ed25519`](https://github.com/paulmillr/noble-ed25519) for cryptography.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @motebit/verify
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```typescript
16
+ import { verify } from "@motebit/verify";
17
+ import fs from "node:fs";
18
+
19
+ const content = fs.readFileSync("motebit.md", "utf-8");
20
+ const result = await verify(content);
21
+
22
+ if (result.valid) {
23
+ console.log("Verified:", result.identity.motebit_id);
24
+ console.log("Owner:", result.identity.owner_id);
25
+ console.log("Trust:", result.identity.governance.trust_mode);
26
+ } else {
27
+ console.error("Verification failed:", result.error);
28
+ }
29
+ ```
30
+
31
+ ### Parse without verifying
32
+
33
+ ```typescript
34
+ import { parse } from "@motebit/verify";
35
+
36
+ const { frontmatter, signature, rawFrontmatter } = parse(content);
37
+ console.log(frontmatter.motebit_id);
38
+ ```
39
+
40
+ ## API
41
+
42
+ ### `verify(content: string): Promise<VerifyResult>`
43
+
44
+ Verify a `motebit.md` file's Ed25519 signature.
45
+
46
+ Returns `{ valid: true, identity }` on success, or `{ valid: false, identity: null, error }` on failure.
47
+
48
+ ### `parse(content: string): { frontmatter, signature, rawFrontmatter }`
49
+
50
+ Parse a `motebit.md` file into its components. Does not verify the signature.
51
+
52
+ Throws if the file is malformed (missing frontmatter delimiters or signature).
53
+
54
+ ## What is a motebit.md?
55
+
56
+ A `motebit.md` is a human-readable, cryptographically signed agent identity file. It contains YAML frontmatter with identity, governance, privacy, and memory configuration, followed by an Ed25519 signature in an HTML comment.
57
+
58
+ See the [motebit/identity@1.0 specification](https://github.com/hakimlabs/motebit/blob/main/spec/identity-v1.md) for details.
59
+
60
+ ## License
61
+
62
+ MIT — see [LICENSE](./LICENSE).
63
+
64
+ "Motebit" is a trademark. The MIT License grants rights to this software, not to any Motebit trademarks, logos, or branding. You may not use Motebit branding in a way that suggests endorsement or affiliation without written permission.
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @motebit/verify — Standalone verifier for motebit.md agent identity files.
3
+ *
4
+ * Implements the verification algorithm from the motebit/identity@1.0 spec.
5
+ * Zero monorepo dependencies — only @noble/ed25519 for cryptography.
6
+ *
7
+ * Usage:
8
+ * import { verify } from "@motebit/verify";
9
+ * const result = await verify(fs.readFileSync("motebit.md", "utf-8"));
10
+ * if (result.valid) console.log(result.identity.motebit_id);
11
+ */
12
+ export interface MotebitIdentityFile {
13
+ spec: string;
14
+ motebit_id: string;
15
+ created_at: string;
16
+ owner_id: string;
17
+ type?: "personal" | "service" | "collaborative";
18
+ service_name?: string;
19
+ service_description?: string;
20
+ service_url?: string;
21
+ capabilities?: string[];
22
+ terms_url?: string;
23
+ identity: {
24
+ algorithm: "Ed25519";
25
+ public_key: string;
26
+ };
27
+ governance: {
28
+ trust_mode: "full" | "guarded" | "minimal";
29
+ max_risk_auto: string;
30
+ require_approval_above: string;
31
+ deny_above: string;
32
+ operator_mode: boolean;
33
+ };
34
+ privacy: {
35
+ default_sensitivity: string;
36
+ retention_days: Record<string, number>;
37
+ fail_closed: boolean;
38
+ };
39
+ memory: {
40
+ half_life_days: number;
41
+ confidence_threshold: number;
42
+ per_turn_limit: number;
43
+ };
44
+ devices: Array<{
45
+ device_id: string;
46
+ name: string;
47
+ public_key: string;
48
+ registered_at: string;
49
+ }>;
50
+ }
51
+ export interface VerifyResult {
52
+ valid: boolean;
53
+ identity: MotebitIdentityFile | null;
54
+ error?: string;
55
+ }
56
+ /**
57
+ * Parse a motebit.md file into its components.
58
+ * Does not verify the signature — use `verify()` for that.
59
+ */
60
+ export declare function parse(content: string): {
61
+ frontmatter: MotebitIdentityFile;
62
+ signature: string;
63
+ rawFrontmatter: string;
64
+ };
65
+ /**
66
+ * Verify a motebit.md file's Ed25519 signature.
67
+ *
68
+ * Returns `{ valid: true, identity }` if the signature is valid,
69
+ * or `{ valid: false, identity: null, error }` if verification fails.
70
+ *
71
+ * Implements the motebit/identity@1.0 verification algorithm (spec §4.3).
72
+ */
73
+ export declare function verify(content: string): Promise<VerifyResult>;
74
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAcH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,M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wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG;IACtC,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;CACxB,CAqBA;AAED;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAmDnE"}
package/dist/index.js ADDED
@@ -0,0 +1,243 @@
1
+ /**
2
+ * @motebit/verify — Standalone verifier for motebit.md agent identity files.
3
+ *
4
+ * Implements the verification algorithm from the motebit/identity@1.0 spec.
5
+ * Zero monorepo dependencies — only @noble/ed25519 for cryptography.
6
+ *
7
+ * Usage:
8
+ * import { verify } from "@motebit/verify";
9
+ * const result = await verify(fs.readFileSync("motebit.md", "utf-8"));
10
+ * if (result.valid) console.log(result.identity.motebit_id);
11
+ */
12
+ import * as ed from "@noble/ed25519";
13
+ import { sha512 } from "@noble/hashes/sha512";
14
+ // @noble/ed25519 v3 requires explicit SHA-512 binding
15
+ if (!ed.hashes.sha512) {
16
+ ed.hashes.sha512 = (msg) => sha512(msg);
17
+ }
18
+ // ---------------------------------------------------------------------------
19
+ // Minimal YAML parser — handles only the motebit identity schema
20
+ // ---------------------------------------------------------------------------
21
+ function parseYamlValue(raw) {
22
+ const trimmed = raw.trim();
23
+ if (trimmed === "null")
24
+ return null;
25
+ if (trimmed === "true")
26
+ return true;
27
+ if (trimmed === "false")
28
+ return false;
29
+ if (trimmed === "[]")
30
+ return [];
31
+ if (trimmed === "{}")
32
+ return ({});
33
+ if ((trimmed.startsWith('"') && trimmed.endsWith('"')) ||
34
+ (trimmed.startsWith("'") && trimmed.endsWith("'"))) {
35
+ return JSON.parse(trimmed);
36
+ }
37
+ const num = Number(trimmed);
38
+ if (trimmed !== "" && !isNaN(num) && isFinite(num))
39
+ return num;
40
+ return trimmed;
41
+ }
42
+ function parseYaml(text) {
43
+ const lines = text.split("\n");
44
+ const root = {};
45
+ const stack = [{ obj: root, indent: -1 }];
46
+ let currentArray = null;
47
+ let currentArrayIndent = -1;
48
+ for (let i = 0; i < lines.length; i++) {
49
+ const line = lines[i];
50
+ if (line.trim() === "" || line.trim().startsWith("#"))
51
+ continue;
52
+ const lineIndent = line.length - line.trimStart().length;
53
+ const trimmed = line.trimStart();
54
+ if (trimmed.startsWith("- ")) {
55
+ const itemContent = trimmed.slice(2);
56
+ const colonIdx = itemContent.indexOf(": ");
57
+ if (colonIdx !== -1) {
58
+ const obj = {};
59
+ const key = itemContent.slice(0, colonIdx);
60
+ const val = itemContent.slice(colonIdx + 2);
61
+ obj[key] = parseYamlValue(val);
62
+ for (let j = i + 1; j < lines.length; j++) {
63
+ const nextLine = lines[j];
64
+ if (nextLine.trim() === "")
65
+ continue;
66
+ const nextIndent = nextLine.length - nextLine.trimStart().length;
67
+ const nextTrimmed = nextLine.trimStart();
68
+ if (nextIndent > lineIndent && !nextTrimmed.startsWith("- ")) {
69
+ const nextColonIdx = nextTrimmed.indexOf(": ");
70
+ if (nextColonIdx !== -1) {
71
+ const nk = nextTrimmed.slice(0, nextColonIdx);
72
+ const nv = nextTrimmed.slice(nextColonIdx + 2);
73
+ obj[nk] = parseYamlValue(nv);
74
+ i = j;
75
+ }
76
+ }
77
+ else {
78
+ break;
79
+ }
80
+ }
81
+ if (currentArray)
82
+ currentArray.push(obj);
83
+ }
84
+ else {
85
+ if (currentArray)
86
+ currentArray.push(parseYamlValue(itemContent));
87
+ }
88
+ continue;
89
+ }
90
+ const colonIdx = trimmed.indexOf(": ");
91
+ const endsWithColon = trimmed.endsWith(":") && colonIdx === -1;
92
+ if (endsWithColon) {
93
+ const key = trimmed.slice(0, -1);
94
+ if (currentArray && lineIndent <= currentArrayIndent) {
95
+ currentArray = null;
96
+ currentArrayIndent = -1;
97
+ }
98
+ while (stack.length > 1 && stack[stack.length - 1].indent >= lineIndent) {
99
+ stack.pop();
100
+ }
101
+ const parent = stack[stack.length - 1].obj;
102
+ let nextIdx = i + 1;
103
+ while (nextIdx < lines.length && lines[nextIdx].trim() === "")
104
+ nextIdx++;
105
+ if (nextIdx < lines.length && lines[nextIdx].trimStart().startsWith("- ")) {
106
+ const arr = [];
107
+ parent[key] = arr;
108
+ currentArray = arr;
109
+ currentArrayIndent = lineIndent;
110
+ }
111
+ else {
112
+ const nested = {};
113
+ parent[key] = nested;
114
+ stack.push({ obj: nested, indent: lineIndent });
115
+ }
116
+ continue;
117
+ }
118
+ if (colonIdx !== -1) {
119
+ if (currentArray && lineIndent <= currentArrayIndent) {
120
+ currentArray = null;
121
+ currentArrayIndent = -1;
122
+ }
123
+ while (stack.length > 1 && stack[stack.length - 1].indent >= lineIndent) {
124
+ stack.pop();
125
+ }
126
+ const key = trimmed.slice(0, colonIdx);
127
+ const val = trimmed.slice(colonIdx + 2);
128
+ const parent = stack[stack.length - 1].obj;
129
+ parent[key] = parseYamlValue(val);
130
+ }
131
+ }
132
+ return root;
133
+ }
134
+ // ---------------------------------------------------------------------------
135
+ // Encoding helpers
136
+ // ---------------------------------------------------------------------------
137
+ function hexToBytes(hex) {
138
+ const bytes = new Uint8Array(hex.length / 2);
139
+ for (let i = 0; i < hex.length; i += 2) {
140
+ bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);
141
+ }
142
+ return bytes;
143
+ }
144
+ function fromBase64Url(str) {
145
+ const padded = str.replace(/-/g, "+").replace(/_/g, "/");
146
+ const binary = atob(padded);
147
+ const bytes = new Uint8Array(binary.length);
148
+ for (let i = 0; i < binary.length; i++) {
149
+ bytes[i] = binary.charCodeAt(i);
150
+ }
151
+ return bytes;
152
+ }
153
+ // ---------------------------------------------------------------------------
154
+ // Constants
155
+ // ---------------------------------------------------------------------------
156
+ const SIG_PREFIX = "<!-- motebit:sig:Ed25519:";
157
+ const SIG_SUFFIX = " -->";
158
+ // ---------------------------------------------------------------------------
159
+ // Public API
160
+ // ---------------------------------------------------------------------------
161
+ /**
162
+ * Parse a motebit.md file into its components.
163
+ * Does not verify the signature — use `verify()` for that.
164
+ */
165
+ export function parse(content) {
166
+ const firstDash = content.indexOf("---\n");
167
+ if (firstDash === -1)
168
+ throw new Error("Missing frontmatter opening ---");
169
+ const bodyStart = firstDash + 4;
170
+ const secondDash = content.indexOf("\n---", bodyStart);
171
+ if (secondDash === -1)
172
+ throw new Error("Missing frontmatter closing ---");
173
+ const rawFrontmatter = content.slice(bodyStart, secondDash);
174
+ const frontmatter = parseYaml(rawFrontmatter);
175
+ const sigStart = content.indexOf(SIG_PREFIX);
176
+ if (sigStart === -1)
177
+ throw new Error("Missing signature");
178
+ const sigValueStart = sigStart + SIG_PREFIX.length;
179
+ const sigEnd = content.indexOf(SIG_SUFFIX, sigValueStart);
180
+ if (sigEnd === -1)
181
+ throw new Error("Malformed signature");
182
+ const signature = content.slice(sigValueStart, sigEnd);
183
+ return { frontmatter, signature, rawFrontmatter };
184
+ }
185
+ /**
186
+ * Verify a motebit.md file's Ed25519 signature.
187
+ *
188
+ * Returns `{ valid: true, identity }` if the signature is valid,
189
+ * or `{ valid: false, identity: null, error }` if verification fails.
190
+ *
191
+ * Implements the motebit/identity@1.0 verification algorithm (spec §4.3).
192
+ */
193
+ export async function verify(content) {
194
+ let parsed;
195
+ try {
196
+ parsed = parse(content);
197
+ }
198
+ catch (err) {
199
+ const msg = err instanceof Error ? err.message : String(err);
200
+ return { valid: false, identity: null, error: msg };
201
+ }
202
+ // Step 6: Extract and validate public key
203
+ const pubKeyHex = parsed.frontmatter.identity?.public_key;
204
+ if (!pubKeyHex) {
205
+ return { valid: false, identity: null, error: "No public key in frontmatter" };
206
+ }
207
+ let pubKey;
208
+ try {
209
+ pubKey = hexToBytes(pubKeyHex);
210
+ }
211
+ catch {
212
+ return { valid: false, identity: null, error: "Invalid public key hex" };
213
+ }
214
+ if (pubKey.length !== 32) {
215
+ return { valid: false, identity: null, error: "Public key must be 32 bytes" };
216
+ }
217
+ // Step 5: Extract and validate signature
218
+ let sigBytes;
219
+ try {
220
+ sigBytes = fromBase64Url(parsed.signature);
221
+ }
222
+ catch {
223
+ return { valid: false, identity: null, error: "Invalid signature encoding" };
224
+ }
225
+ if (sigBytes.length !== 64) {
226
+ return { valid: false, identity: null, error: "Signature must be 64 bytes" };
227
+ }
228
+ // Steps 7-8: Verify Ed25519 signature over frontmatter bytes
229
+ const frontmatterBytes = new TextEncoder().encode(parsed.rawFrontmatter);
230
+ let valid;
231
+ try {
232
+ valid = await ed.verifyAsync(sigBytes, frontmatterBytes, pubKey);
233
+ }
234
+ catch {
235
+ valid = false;
236
+ }
237
+ return {
238
+ valid,
239
+ identity: valid ? parsed.frontmatter : null,
240
+ error: valid ? undefined : "Signature verification failed",
241
+ };
242
+ }
243
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,sDAAsD;AACtD,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IACtB,EAAE,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,GAAe,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AA2DD,8EAA8E;AAC9E,iEAAiE;AACjE,8EAA8E;AAE9E,SAAS,cAAc,CAAC,GAAW;IACjC,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAC3B,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,OAAO,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,OAAO,KAAK,OAAO;QAAE,OAAO,KAAK,CAAC;IACtC,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAChC,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,CAAC,E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,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;QAC3B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,4BAA4B,EAAE,CAAC;IAC/E,CAAC;IAED,6DAA6D;IAC7D,MAAM,gBAAgB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;IAEzE,IAAI,KAAc,CAAC;IACnB,IAAI,CAAC;QACH,KAAK,GAAG,MAAM,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;IACnE,CAAC;IAAC,MAAM,CAAC;QACP,KAAK,GAAG,KAAK,CAAC;IAChB,CAAC;IAED,OAAO;QACL,KAAK;QACL,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;QAC3C,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,+BAA+B;KAC3D,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@motebit/verify",
3
+ "version": "0.1.0",
4
+ "description": "Verify motebit.md agent identity files — Ed25519 signature verification for the motebit/identity@1.0 spec",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "LICENSE",
17
+ "README.md"
18
+ ],
19
+ "sideEffects": false,
20
+ "license": "MIT",
21
+ "keywords": [
22
+ "motebit",
23
+ "agent",
24
+ "identity",
25
+ "ed25519",
26
+ "verify",
27
+ "signature"
28
+ ],
29
+ "homepage": "https://github.com/hakimlabs/motebit/tree/main/packages/verify#readme",
30
+ "bugs": {
31
+ "url": "https://github.com/hakimlabs/motebit/issues"
32
+ },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/hakimlabs/motebit",
36
+ "directory": "packages/verify"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "dependencies": {
42
+ "@noble/ed25519": "^3.0.0",
43
+ "@noble/hashes": "^1.6.0"
44
+ },
45
+ "devDependencies": {
46
+ "typescript": "^5.6.0",
47
+ "vitest": "^3.0.0"
48
+ },
49
+ "scripts": {
50
+ "build": "tsc -b",
51
+ "test": "vitest run",
52
+ "typecheck": "tsc --noEmit",
53
+ "clean": "rm -rf dist .turbo *.tsbuildinfo"
54
+ }
55
+ }