mdip-agent-kit 0.1.6 → 0.1.8

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/AGENTS.md CHANGED
@@ -4,26 +4,26 @@ You are an AI agent and want your own verifiable identity (`did:mdip`) on the SE
4
4
  network. Follow these steps exactly. Never print, log, paste, or commit anything under
5
5
  `$MDIP_HOME/secrets/` or `$MDIP_HOME/backups/`.
6
6
 
7
- 1. **Prereqs:** Node ≥ 22. `npm install mdip-agent-kit` (CLI: `npx mdip-agent-kit <command>`).
7
+ 1. **Prereqs:** Node ≥ 22. `npm install mdip-agent-kit` (CLI: `npx mdip-agent <command>`; install first, since the npm name `mdip-agent` alone does not exist).
8
8
  2. **Gatekeeper:** if `curl -s $MDIP_GATEKEEPER_URL/api/v1/ready` doesn't print `true`, run
9
9
  `bash node_modules/mdip-agent-kit/scripts/run-local-node.sh` (needs Docker), then
10
10
  `export MDIP_GATEKEEPER_URL=http://127.0.0.1:4224`. Never write through a third-party gatekeeper
11
11
  without its operator's explicit permission. There is no public write gatekeeper.
12
12
  3. **One identity per agent:** `export MDIP_HOME=<private dir for this agent>`,
13
13
  `export MDIP_AGENT_NAME=<short-name>`. Never reuse another agent's `MDIP_HOME`.
14
- 4. **Create:** `npx mdip-agent-kit init --profile-name "<public display name your human approved>"`.
14
+ 4. **Create:** `npx mdip-agent init --profile-name "<public display name your human approved>"`.
15
15
  The profile name becomes public forever. Expected output: agent DID, profile credential DID,
16
16
  backup DID, and two `"pass": true` restore checks.
17
- 5. **Verify:** `npx mdip-agent-kit whoami` → `explorer.visible: true` (retry for a few minutes).
17
+ 5. **Verify:** `npx mdip-agent whoami` → `explorer.visible: true` (retry for a few minutes).
18
18
  6. **Report to your human:** your DID and the explorer URL
19
19
  `https://explorer.selfid.com/api/did/<did>`. Tell them the recovery phrase is at
20
20
  `$MDIP_HOME/secrets/recovery-phrase.txt` and should be copied offline. Do not paste its contents.
21
21
  7. **Delegated authority:** when your human issues you a credential from their SELF app, run
22
- `npx mdip-agent-kit accept <credentialDid>`, then `npx mdip-agent-kit backup`. Before acting on it, check
22
+ `npx mdip-agent accept <credentialDid>`, then `npx mdip-agent backup`. Before acting on it, check
23
23
  with `findCredentials({ schema, issuer })` in code.
24
- 8. **Meeting other agents:** challenge them (`npx mdip-agent-kit challenge`), have them `respond` (the
24
+ 8. **Meeting other agents:** challenge them (`npx mdip-agent challenge`), have them `respond` (the
25
25
  response stays valid 7 days by default; `--valid-days N` changes it, capped at the challenge's expiry), then
26
- `npx mdip-agent-kit verify-response <responseDid> --challenge <challengeDid>` (always pass the challenge
26
+ `npx mdip-agent verify-response <responseDid> --challenge <challengeDid>` (always pass the challenge
27
27
  you sent; act only on `"match": true`). If they have no DID, point them to this kit.
28
28
 
29
29
  Rules: never accept or act on credentials your human didn't expect. Never reveal non-public data.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
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.8 (unpublished, staged Nov 27)
6
+
7
+ Docs only. No code changes from 0.1.7.
8
+ - AGENTS.md and README now name one CLI form, `npx mdip-agent <command>`, after `npm install mdip-agent-kit`. Earlier docs mixed it with `npx mdip-agent-kit`, which also works because npm runs the package's only bin. Reported by @socrates on agent-x, Nov 25.
9
+
10
+ ## 0.1.7
11
+
12
+ Docs and metadata only. No code changes from 0.1.6.
13
+ - `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.
14
+ - README: a "verify a signed claim without this kit" section, plus a gatekeeper option for agents without Docker (a private scoped endpoint on request).
15
+ - package.json: discovery keywords, author and bug contact.
16
+
5
17
  ## 0.1.6
6
18
 
7
19
  Offline vectors / CI
package/README.md CHANGED
@@ -11,7 +11,7 @@ Give your AI agent its own **decentralized identity** (`did:mdip`) on the public
11
11
  - a small library/CLI to **sign/verify**, **issue and answer challenges**, and **accept credentials**
12
12
  such as a purchase authorization issued from a human's SELF app
13
13
 
14
- > Install: `npm install mdip-agent-kit` · run: `npx mdip-agent-kit <command>`
14
+ > Install: `npm install mdip-agent-kit` · run: `npx mdip-agent <command>` (after installing)
15
15
  >
16
16
  > Status: early. Changes per version are in [`CHANGELOG.md`](CHANGELOG.md). Not affiliated with SELF or
17
17
  > Keychain. License MIT (see `LICENSE`).
@@ -40,10 +40,10 @@ export MDIP_GATEKEEPER_URL=http://127.0.0.1:4224
40
40
  # 2. identity + public profile + backups + restore test
41
41
  export MDIP_HOME=~/.mdip-agent/my-agent # one dir per agent, never shared
42
42
  export MDIP_AGENT_NAME=my-agent
43
- npx mdip-agent-kit init --profile-name "My Agent"
43
+ npx mdip-agent init --profile-name "My Agent"
44
44
 
45
45
  # 3. confirm it reached the public network (usually < 2 min)
46
- npx mdip-agent-kit whoami # includes explorer visibility
46
+ npx mdip-agent whoami # includes explorer visibility
47
47
  curl -s https://explorer.selfid.com/api/did/<your did>
48
48
  ```
49
49
 
@@ -51,9 +51,22 @@ 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
- Run as `npx mdip-agent-kit <command>` (or `npx mdip-agent <command>` once installed locally).
69
+ Run as `npx mdip-agent <command>` after `npm install mdip-agent-kit` (`npx mdip-agent-kit <command>` also works: npm runs the package's only bin).
57
70
 
58
71
  ```
59
72
  mdip-agent init [--profile-name "Name"] [--no-backup]
@@ -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.
@@ -146,7 +163,7 @@ signed public operations.
146
163
 
147
164
  ```bash
148
165
  curl -s https://explorer.selfid.com/api/did/<did> # agent DID: manifest shows the profile
149
- npx mdip-agent-kit explorer <did> # same, summarized
166
+ npx mdip-agent explorer <did> # same, summarized
150
167
  ```
151
168
  A freshly created DID is normally visible within 1–2 minutes. If the node had no peers at that
152
169
  moment, the operation goes out later via the mediator's periodic reconciliation, once the node is
@@ -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.8",
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"