@agent-shield/custody-crossmint 0.1.1 → 0.1.2

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 (2) hide show
  1. package/README.md +155 -0
  2. package/package.json +16 -9
package/README.md ADDED
@@ -0,0 +1,155 @@
1
+ # @agent-shield/custody-crossmint
2
+
3
+ Crossmint TEE custody adapter for AgentShield — hardware-enclave signing for AI agents. The private key never leaves the Trusted Execution Environment.
4
+
5
+ `@agent-shield/custody-crossmint` wraps Crossmint's Intel TDX-backed wallets into a standard `WalletLike` interface that works with `shield()` and the rest of the AgentShield ecosystem. Your agent gets a signing interface; the private key stays in hardware.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @agent-shield/custody-crossmint @solana/web3.js
11
+ ```
12
+
13
+ Optional peer dependency: `@agent-shield/solana` (for `shield()` integration)
14
+
15
+ ## Quick Start
16
+
17
+ ```typescript
18
+ import { shield } from "@agent-shield/solana";
19
+ import { crossmint } from "@agent-shield/custody-crossmint";
20
+
21
+ // Create a TEE-backed wallet and wrap it with spending controls
22
+ const wallet = shield(
23
+ await crossmint({ apiKey: "sk_production_..." }),
24
+ { maxSpend: "500 USDC/day" }
25
+ );
26
+
27
+ // Use like any other wallet — signing happens in hardware
28
+ await wallet.signTransaction(tx);
29
+ ```
30
+
31
+ ### Zero-Config from Environment
32
+
33
+ ```typescript
34
+ import { shield } from "@agent-shield/solana";
35
+ import { crossmintFromEnv } from "@agent-shield/custody-crossmint";
36
+
37
+ // Reads CROSSMINT_API_KEY from environment
38
+ const wallet = shield(await crossmintFromEnv(), { maxSpend: "500 USDC/day" });
39
+ ```
40
+
41
+ ## API Reference
42
+
43
+ ### `crossmint(config, client?): Promise<CrossmintWallet>`
44
+
45
+ Create a `CrossmintWallet` from explicit configuration. If no `locator` is provided, a new wallet is created via the Crossmint API.
46
+
47
+ ```typescript
48
+ const wallet = await crossmint({ apiKey: "sk_production_..." });
49
+ console.log(wallet.publicKey.toBase58()); // Solana address
50
+ ```
51
+
52
+ ### `crossmintFromEnv(client?): Promise<CrossmintWallet>`
53
+
54
+ Create a `CrossmintWallet` from environment variables. Throws if `CROSSMINT_API_KEY` is not set.
55
+
56
+ ### `CrossmintWallet`
57
+
58
+ Implements `WalletLike` — compatible with `shield()`, Solana Agent Kit, and any code expecting a standard wallet interface.
59
+
60
+ | Property/Method | Description |
61
+ |-----------------|-------------|
62
+ | `publicKey` | Solana `PublicKey` of the TEE-backed wallet |
63
+ | `locator` | Crossmint wallet locator string |
64
+ | `provider` | Always `"crossmint"` |
65
+ | `signTransaction(tx)` | Sign via TEE — serializes tx, sends to Crossmint, returns signed tx |
66
+ | `signAllTransactions(txs)` | Sign multiple transactions sequentially via TEE |
67
+ | `CrossmintWallet.create(config, client?)` | Static factory method |
68
+
69
+ ### `CrossmintRESTClient`
70
+
71
+ Default SDK client that calls Crossmint's REST API directly. Used automatically when no custom client is provided.
72
+
73
+ | Method | Description |
74
+ |--------|-------------|
75
+ | `createWallet(params)` | Create a new wallet via Crossmint API |
76
+ | `getWallet(locator)` | Get an existing wallet's address by locator |
77
+ | `signTransaction(locator, transaction, encoding)` | Sign a serialized transaction |
78
+
79
+ ### Configuration Utilities
80
+
81
+ | Export | Description |
82
+ |--------|-------------|
83
+ | `configFromEnv()` | Parse `CrossmintWalletConfig` from environment variables |
84
+ | `validateConfig(config)` | Validate config, throw on missing/invalid fields |
85
+ | `CROSSMINT_ENV_KEYS` | Environment variable key constants |
86
+
87
+ ## Configuration
88
+
89
+ ### `CrossmintWalletConfig`
90
+
91
+ ```typescript
92
+ interface CrossmintWalletConfig {
93
+ apiKey: string; // Required — Crossmint server-side API key
94
+ locator?: string; // Existing wallet locator (creates new if omitted)
95
+ chain?: string; // Default: "solana"
96
+ signerType?: "api-key" | "evm-keypair"; // Default: "api-key"
97
+ baseUrl?: string; // Default: "https://www.crossmint.com"
98
+ linkedUser?: string; // User identifier for wallet association
99
+ }
100
+ ```
101
+
102
+ ### Environment Variables
103
+
104
+ | Variable | Required | Default | Description |
105
+ |----------|----------|---------|-------------|
106
+ | `CROSSMINT_API_KEY` | Yes | — | Server-side API key (needs `wallets.create` + `wallets:transactions.sign` scopes) |
107
+ | `CROSSMINT_WALLET_LOCATOR` | No | — | Existing wallet locator (creates new wallet if omitted) |
108
+ | `CROSSMINT_SIGNER_TYPE` | No | `api-key` | `"api-key"` (custodial) or `"evm-keypair"` |
109
+ | `CROSSMINT_BASE_URL` | No | `https://www.crossmint.com` | API base URL override |
110
+ | `CROSSMINT_LINKED_USER` | No | — | Linked user for wallet association |
111
+
112
+ ## Integration with shield()
113
+
114
+ ```typescript
115
+ import { shield, ShieldDeniedError } from "@agent-shield/solana";
116
+ import { crossmint } from "@agent-shield/custody-crossmint";
117
+
118
+ const teeWallet = await crossmint({ apiKey: "sk_..." });
119
+ const protectedWallet = shield(teeWallet, {
120
+ maxSpend: ["500 USDC/day", "10 SOL/day"],
121
+ blockUnknownPrograms: true,
122
+ rateLimit: { maxTransactions: 60, windowMs: 3_600_000 },
123
+ });
124
+
125
+ // Two layers of protection:
126
+ // 1. Private key in TEE — agent code never sees it
127
+ // 2. shield() enforces spending caps before signing
128
+ try {
129
+ await protectedWallet.signTransaction(tx);
130
+ } catch (error) {
131
+ if (error instanceof ShieldDeniedError) {
132
+ console.log("Policy blocked:", error.violations[0].suggestion);
133
+ }
134
+ }
135
+ ```
136
+
137
+ ## Related Packages
138
+
139
+ | Package | Description |
140
+ |---------|-------------|
141
+ | [`@agent-shield/solana`](https://www.npmjs.com/package/@agent-shield/solana) | Client-side wallet wrapper (`shield()`) |
142
+ | [`@agent-shield/sdk`](https://www.npmjs.com/package/@agent-shield/sdk) | On-chain vault SDK (Level 3 enforcement) |
143
+ | [`@agent-shield/core`](https://www.npmjs.com/package/@agent-shield/core) | Pure TypeScript policy engine |
144
+ | [`@agent-shield/mcp`](https://www.npmjs.com/package/@agent-shield/mcp) | MCP server for AI tools |
145
+ | [`@agent-shield/plugin-elizaos`](https://www.npmjs.com/package/@agent-shield/plugin-elizaos) | ElizaOS integration (supports Crossmint custody) |
146
+
147
+ ## Support
148
+
149
+ - X/Twitter: [@MightieMags](https://x.com/MightieMags)
150
+ - Telegram: [MightyMags](https://t.me/MightyMags)
151
+ - Issues: [GitHub Issues](https://github.com/Kaleb-Rupe/agentshield/issues)
152
+
153
+ ## License
154
+
155
+ MIT
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "@agent-shield/custody-crossmint",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
+ "author": "Kaleb Rupe (https://x.com/MightieMags)",
5
+ "homepage": "https://github.com/Kaleb-Rupe/agentshield#readme",
6
+ "bugs": {
7
+ "url": "https://github.com/Kaleb-Rupe/agentshield/issues",
8
+ "email": "https://t.me/MightyMags"
9
+ },
4
10
  "description": "Crossmint TEE custody adapter for AgentShield — hardware-enclave signing for AI agents",
5
11
  "main": "dist/index.js",
6
12
  "types": "dist/index.d.ts",
@@ -12,6 +18,12 @@
12
18
  "engines": {
13
19
  "node": ">=18.0.0"
14
20
  },
21
+ "scripts": {
22
+ "build": "tsc",
23
+ "clean": "rm -rf dist",
24
+ "prepublishOnly": "npm run clean && npm run build",
25
+ "test": "TS_NODE_PROJECT=tsconfig.test.json mocha --require ts-node/register tests/**/*.test.ts --timeout 30000"
26
+ },
15
27
  "dependencies": {
16
28
  "@crossmint/wallets-sdk": "^0.2.0",
17
29
  "@solana/web3.js": "^1.95.0"
@@ -25,14 +37,14 @@
25
37
  }
26
38
  },
27
39
  "devDependencies": {
40
+ "@agent-shield/solana": "workspace:*",
28
41
  "@types/chai": "^4.3.11",
29
42
  "@types/mocha": "^10.0.6",
30
43
  "@types/node": "^20.11.0",
31
44
  "chai": "^4.4.1",
32
45
  "mocha": "^10.3.0",
33
46
  "ts-node": "^10.9.2",
34
- "typescript": "^5.3.3",
35
- "@agent-shield/solana": "0.3.0"
47
+ "typescript": "^5.3.3"
36
48
  },
37
49
  "keywords": [
38
50
  "solana",
@@ -48,10 +60,5 @@
48
60
  "type": "git",
49
61
  "url": "https://github.com/Kaleb-Rupe/agentshield",
50
62
  "directory": "sdk/custody/crossmint"
51
- },
52
- "scripts": {
53
- "build": "tsc",
54
- "clean": "rm -rf dist",
55
- "test": "TS_NODE_PROJECT=tsconfig.test.json mocha --require ts-node/register tests/**/*.test.ts --timeout 30000"
56
63
  }
57
- }
64
+ }