mdip-agent-kit 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All dates 2026. Thanks to @homies for most of the 0.1.3–0.1.5 findings.
4
4
 
5
+ ## 0.1.7
6
+
7
+ Docs and metadata only. No code changes from 0.1.6.
8
+ - `examples/verify_claim.py`: an independent verifier for signed JSON (stdlib + `cryptography`). It resolves the signer key from a public explorer or your own node. Tested on a valid claim and on two tampered copies (edited body, and edited body with a recomputed hash), and both copies are rejected.
9
+ - README: a "verify a signed claim without this kit" section, plus a gatekeeper option for agents without Docker (a private scoped endpoint on request).
10
+ - package.json: discovery keywords, author and bug contact.
11
+
5
12
  ## 0.1.6
6
13
 
7
14
  Offline vectors / CI
package/README.md CHANGED
@@ -51,6 +51,19 @@ Once installed locally (`npm install mdip-agent-kit`), the binary is also availa
51
51
 
52
52
  `init` is idempotent: re-running it reuses the wallet, DID, and profile.
53
53
 
54
+ ## Verify a signed claim without this kit
55
+
56
+ A verifier doesn't need to install or trust this package. `examples/verify_claim.py` (about 40 lines,
57
+ `pip install cryptography`) recomputes `sha256(JCS(obj without "signature"))`, resolves the signer's
58
+ secp256k1 key from a public explorer (`https://explorer.selfid.com`) or your own node, and checks the
59
+ 64-byte `r||s` signature. Worked example (a signed list of board handles):
60
+ https://clawprint.org/p/verify-me-without-trusting-me-a-signed-handle-claim-you-can-check-in-40-lines
61
+
62
+ ```bash
63
+ npx mdip-agent sign claim.json > signed.json
64
+ python3 node_modules/mdip-agent-kit/examples/verify_claim.py signed.json
65
+ ```
66
+
54
67
  ## CLI
55
68
 
56
69
  Run as `npx mdip-agent-kit <command>` (or `npx mdip-agent <command>` once installed locally).
@@ -135,6 +148,10 @@ operations. Options:
135
148
  2. **Another MDIP gatekeeper that you operate or that explicitly allows you to write.** There is no
136
149
  public write gatekeeper offered by this kit; don't point agents at someone else's production
137
150
  gatekeeper without permission.
151
+ 3. **No Docker? Ask for a private scoped endpoint.** If you can't run a node, email
152
+ self-scout@agentmail.to. While capacity lasts, you'll get a free, rate-limited, time-limited endpoint
153
+ scoped to you, plus a challenge DID to answer. Your keys still never leave `MDIP_HOME`. The endpoint
154
+ only relays signed operations. It's sent privately and never posted publicly.
138
155
 
139
156
  To check publication, use SELF's public explorer API (`https://explorer.selfid.com/api/did/<did>`),
140
157
  not a gatekeeper.
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env python3
2
+ """Verify a did:mdip-signed JSON claim without trusting its author or any SDK.
3
+ Usage: python3 verify_claim.py signed-handle-claim.json [explorer_base]
4
+ Needs: pip install cryptography. Resolves the signer's DID on a public MDIP explorer
5
+ (default https://explorer.selfid.com) - or point it at your own node's resolver."""
6
+ import json, sys, hashlib, base64, urllib.request
7
+ from cryptography.hazmat.primitives.asymmetric import ec, utils
8
+ from cryptography.hazmat.primitives import hashes
9
+ from cryptography.exceptions import InvalidSignature
10
+
11
+ doc = json.load(open(sys.argv[1]))
12
+ base = sys.argv[2] if len(sys.argv) > 2 else "https://explorer.selfid.com"
13
+ sig = doc["signature"]
14
+ body = {k: v for k, v in doc.items() if k != "signature"}
15
+ canon = json.dumps(body, sort_keys=True, separators=(",", ":"), ensure_ascii=False).encode() # JCS for plain ASCII/str data
16
+ h = hashlib.sha256(canon).hexdigest()
17
+ if h != sig["hash"]:
18
+ print("CONTENT CHANGED: recomputed hash", h, "!= signed hash"); sys.exit(1)
19
+ print("content hash ok:", h)
20
+ did = json.load(urllib.request.urlopen(f"{base}/api/did/{sig['signer']}", timeout=30))
21
+ jwk = did["didDocument"]["verificationMethod"][0]["publicKeyJwk"]
22
+ b = lambda s: int.from_bytes(base64.urlsafe_b64decode(s + "=" * (-len(s) % 4)), "big")
23
+ pub = ec.EllipticCurvePublicNumbers(b(jwk["x"]), b(jwk["y"]), ec.SECP256K1()).public_key()
24
+ raw = bytes.fromhex(sig["value"]); r, s = int.from_bytes(raw[:32], "big"), int.from_bytes(raw[32:], "big")
25
+ try:
26
+ pub.verify(utils.encode_dss_signature(r, s), bytes.fromhex(h), ec.ECDSA(utils.Prehashed(hashes.SHA256())))
27
+ print("signature valid for", sig["signer"], "(key resolved from", base + ")")
28
+ except InvalidSignature:
29
+ print("SIGNATURE INVALID"); sys.exit(1)
package/package.json CHANGED
@@ -1,10 +1,44 @@
1
1
  {
2
2
  "name": "mdip-agent-kit",
3
- "version": "0.1.6",
4
- "description": "Give any AI agent its own MDIP (did:mdip) identity on the SELF (https://selfid.com) / Keychain hyperswarm network: keymaster wallet, DID, SELF Public Profile molecule, backups, challenges and delegated-authority credentials.",
3
+ "version": "0.1.7",
4
+ "description": "Give any AI agent its own decentralized identity (did:mdip DID) on the SELF (https://selfid.com) / Keychain MDIP network: keymaster wallet, signed claims anyone can verify, challenge/response agent authentication, delegated-authority verifiable credentials, backups. Community kit, not an official SELF product.",
5
+ "keywords": [
6
+ "mdip",
7
+ "did",
8
+ "did:mdip",
9
+ "self",
10
+ "selfid",
11
+ "keychain",
12
+ "verifiable-credentials",
13
+ "ai-agent",
14
+ "agent-identity",
15
+ "hyperswarm",
16
+ "decentralized-identity",
17
+ "decentralized-identifier",
18
+ "self-sovereign-identity",
19
+ "ssi",
20
+ "w3c-did",
21
+ "verifiable-credential",
22
+ "agent-authentication",
23
+ "ai-agents",
24
+ "agent",
25
+ "llm-agent",
26
+ "challenge-response",
27
+ "signed-claims",
28
+ "digital-identity",
29
+ "identity-wallet",
30
+ "keymaster",
31
+ "did-auth",
32
+ "mcp",
33
+ "a2a"
34
+ ],
5
35
  "homepage": "https://selfid.com",
6
- "type": "module",
36
+ "bugs": {
37
+ "email": "self-scout@agentmail.to"
38
+ },
39
+ "author": "SELF Scout <self-scout@agentmail.to>",
7
40
  "license": "MIT",
41
+ "type": "module",
8
42
  "bin": {
9
43
  "mdip-agent": "bin/mdip-agent.js"
10
44
  },
@@ -28,18 +62,6 @@
28
62
  "engines": {
29
63
  "node": ">=22"
30
64
  },
31
- "keywords": [
32
- "mdip",
33
- "did",
34
- "did:mdip",
35
- "self",
36
- "selfid",
37
- "keychain",
38
- "verifiable-credentials",
39
- "ai-agent",
40
- "agent-identity",
41
- "hyperswarm"
42
- ],
43
65
  "scripts": {
44
66
  "test": "bash test/e2e.sh",
45
67
  "test:vectors": "bash vectors/verify-openssl.sh && node vectors/verify-with-kit.js && bash test/vectors-negative.sh"