@elizaos/plugin-tee 2.0.0-beta.1 → 2.0.3-beta.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.
- package/README.md +46 -104
- package/package.json +14 -3
- package/dist/index.js +0 -31460
- package/dist/index.js.map +0 -204
- package/dist/node/index.d.ts +0 -9
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.js +0 -34
- package/dist/node/providers/base.d.ts +0 -8
- package/dist/node/providers/base.d.ts.map +0 -1
- package/dist/node/providers/base.js +0 -4
- package/dist/node/providers/deriveKey.d.ts +0 -24
- package/dist/node/providers/deriveKey.d.ts.map +0 -1
- package/dist/node/providers/deriveKey.js +0 -148
- package/dist/node/providers/index.d.ts +0 -4
- package/dist/node/providers/index.d.ts.map +0 -1
- package/dist/node/providers/index.js +0 -3
- package/dist/node/providers/remoteAttestation.d.ts +0 -10
- package/dist/node/providers/remoteAttestation.d.ts.map +0 -1
- package/dist/node/providers/remoteAttestation.js +0 -78
- package/dist/node/services/index.d.ts +0 -2
- package/dist/node/services/index.d.ts.map +0 -1
- package/dist/node/services/index.js +0 -1
- package/dist/node/services/tee.d.ts +0 -24
- package/dist/node/services/tee.d.ts.map +0 -1
- package/dist/node/services/tee.js +0 -42
- package/dist/node/types/index.d.ts +0 -58
- package/dist/node/types/index.d.ts.map +0 -1
- package/dist/node/types/index.js +0 -35
- package/dist/node/utils/index.d.ts +0 -9
- package/dist/node/utils/index.d.ts.map +0 -1
- package/dist/node/utils/index.js +0 -61
- package/dist/node/vendors/index.d.ts +0 -5
- package/dist/node/vendors/index.d.ts.map +0 -1
- package/dist/node/vendors/index.js +0 -14
- package/dist/node/vendors/phala.d.ts +0 -10
- package/dist/node/vendors/phala.d.ts.map +0 -1
- package/dist/node/vendors/phala.js +0 -17
- package/dist/node/vendors/types.d.ts +0 -13
- package/dist/node/vendors/types.d.ts.map +0 -1
- package/dist/node/vendors/types.js +0 -3
package/README.md
CHANGED
|
@@ -1,141 +1,83 @@
|
|
|
1
1
|
# @elizaos/plugin-tee
|
|
2
2
|
|
|
3
|
-
Trusted Execution Environment (TEE) integration plugin for elizaOS
|
|
3
|
+
Trusted Execution Environment (TEE) integration plugin for elizaOS. Adds secure key derivation and remote attestation to Eliza agents running inside a TEE.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What it does
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
- ⚡ **Type Safe** - Strong typing with TypeScript
|
|
7
|
+
- **Remote attestation** — generates a verifiable TDX quote proving an agent is executing inside a real TEE (Phala Network / dstack).
|
|
8
|
+
- **Key derivation** — deterministically derives Ed25519 (Solana) and ECDSA (EVM) keypairs from a secret salt inside the TEE, with per-derivation attestation.
|
|
9
|
+
- **TEEService** — a runtime service (`ServiceType.TEE`) that other plugins can call to derive keys without going through providers.
|
|
11
10
|
|
|
12
|
-
## Quick
|
|
13
|
-
|
|
14
|
-
### TypeScript
|
|
11
|
+
## Quick start
|
|
15
12
|
|
|
16
13
|
```typescript
|
|
17
14
|
import { teePlugin, TEEService } from "@elizaos/plugin-tee";
|
|
18
|
-
import { AgentRuntime } from "@elizaos/core";
|
|
19
15
|
|
|
20
|
-
// Register the plugin
|
|
21
16
|
const runtime = new AgentRuntime({
|
|
22
17
|
plugins: [teePlugin],
|
|
18
|
+
// TEE_MODE defaults to LOCAL; set WALLET_SECRET_SALT for key derivation
|
|
23
19
|
});
|
|
24
20
|
|
|
25
|
-
//
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
"solana",
|
|
30
|
-
agentId,
|
|
31
|
-
);
|
|
32
|
-
const evmKeys = await service.deriveEcdsaKeypair("salt", "evm", agentId);
|
|
21
|
+
// Access via service
|
|
22
|
+
const svc = runtime.getService<TEEService>(TEEService.serviceType);
|
|
23
|
+
const { keypair, attestation } = await svc.deriveEd25519Keypair("salt", "solana", agentId);
|
|
24
|
+
const { keypair: evmKeypair } = await svc.deriveEcdsaKeypair("salt", "evm", agentId);
|
|
33
25
|
```
|
|
34
|
-
## Configuration
|
|
35
|
-
|
|
36
|
-
### Environment Variables
|
|
37
|
-
|
|
38
|
-
| Variable | Description | Required | Default |
|
|
39
|
-
| -------------------- | ----------------------------------------------- | -------- | ------- |
|
|
40
|
-
| `TEE_MODE` | Operation mode: `LOCAL`, `DOCKER`, `PRODUCTION` | Yes | - |
|
|
41
|
-
| `WALLET_SECRET_SALT` | Secret salt for deterministic key derivation | Yes | - |
|
|
42
|
-
| `TEE_VENDOR` | TEE vendor to use | No | `phala` |
|
|
43
|
-
|
|
44
|
-
### TEE Modes
|
|
45
26
|
|
|
46
|
-
|
|
47
|
-
- **DOCKER**: Docker development mode using simulator at `host.docker.internal:8090`
|
|
48
|
-
- **PRODUCTION**: Production mode connecting to real TEE infrastructure
|
|
49
|
-
|
|
50
|
-
## Components
|
|
27
|
+
## Configuration
|
|
51
28
|
|
|
52
|
-
|
|
29
|
+
| Variable | Required | Default | Description |
|
|
30
|
+
|----------|----------|---------|-------------|
|
|
31
|
+
| `TEE_MODE` | no | `LOCAL` | Operation mode: `LOCAL`, `DOCKER`, or `PRODUCTION`. `init` defaults to `LOCAL` when unset and throws only on a present-but-invalid value. |
|
|
32
|
+
| `WALLET_SECRET_SALT` | **yes** | — | Secret salt used as the derivation path for all keypairs. Sensitive — treat as a private key. |
|
|
33
|
+
| `TEE_VENDOR` | no | `PHALA` | TEE vendor. Only `PHALA` is supported. |
|
|
53
34
|
|
|
54
|
-
|
|
55
|
-
| -------------------- | --------------------------------------------------------------------- |
|
|
56
|
-
| `REMOTE_ATTESTATION` | Generate and upload a remote attestation quote to prove TEE execution |
|
|
35
|
+
### TEE modes
|
|
57
36
|
|
|
58
|
-
|
|
37
|
+
| Mode | dstack endpoint | Use |
|
|
38
|
+
|------|----------------|-----|
|
|
39
|
+
| `LOCAL` | `http://localhost:8090` | Local simulator |
|
|
40
|
+
| `DOCKER` | `http://host.docker.internal:8090` | Docker simulator |
|
|
41
|
+
| `PRODUCTION` | (TappdClient default) | Real TEE hardware |
|
|
59
42
|
|
|
60
|
-
|
|
61
|
-
| -------------------------- | ----------------------------------------------- |
|
|
62
|
-
| `phala-derive-key` | Derive Solana and EVM keypairs with attestation |
|
|
63
|
-
| `phala-remote-attestation` | Generate remote attestation quotes |
|
|
43
|
+
Run the Phala dstack simulator for `LOCAL`/`DOCKER` development: see [Phala dstack docs](https://github.com/Phala-Network/dstack).
|
|
64
44
|
|
|
65
|
-
|
|
45
|
+
## Providers registered
|
|
66
46
|
|
|
67
|
-
|
|
|
68
|
-
|
|
69
|
-
| `
|
|
47
|
+
| Provider | Description |
|
|
48
|
+
|----------|-------------|
|
|
49
|
+
| `phala-derive-key` | Derives Solana public key and EVM address from `WALLET_SECRET_SALT`; injects `solana_public_key` and `evm_address` into agent context. |
|
|
50
|
+
| `phala-remote-attestation` | Generates a TDX quote over the current message payload; injects `quote` and `timestamp`. |
|
|
70
51
|
|
|
71
|
-
|
|
52
|
+
Both providers are dynamic and gated to `secrets` / `agent_internal` contexts.
|
|
72
53
|
|
|
73
|
-
|
|
54
|
+
## TEEService API
|
|
74
55
|
|
|
75
56
|
```typescript
|
|
76
57
|
class TEEService {
|
|
77
|
-
|
|
78
|
-
async deriveEd25519Keypair(
|
|
79
|
-
path: string,
|
|
80
|
-
subject: string,
|
|
81
|
-
agentId: UUID,
|
|
82
|
-
): Promise<{ keypair: Keypair; attestation: RemoteAttestationQuote }>;
|
|
83
|
-
|
|
84
|
-
// Derive ECDSA keypair for EVM
|
|
85
|
-
async deriveEcdsaKeypair(
|
|
86
|
-
path: string,
|
|
87
|
-
subject: string,
|
|
88
|
-
agentId: UUID,
|
|
89
|
-
): Promise<{
|
|
90
|
-
keypair: PrivateKeyAccount;
|
|
91
|
-
attestation: RemoteAttestationQuote;
|
|
92
|
-
}>;
|
|
93
|
-
|
|
94
|
-
// Derive raw key for custom use cases
|
|
95
|
-
async rawDeriveKey(path: string, subject: string): Promise<DeriveKeyResponse>;
|
|
96
|
-
}
|
|
97
|
-
```
|
|
58
|
+
static serviceType: ServiceType.TEE;
|
|
98
59
|
|
|
99
|
-
|
|
60
|
+
// Derive Ed25519 keypair (Solana)
|
|
61
|
+
deriveEd25519Keypair(path: string, subject: string, agentId: UUID):
|
|
62
|
+
Promise<{ keypair: Keypair; attestation: RemoteAttestationQuote }>;
|
|
100
63
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
): Promise<RemoteAttestationQuote>;
|
|
64
|
+
// Derive ECDSA keypair (EVM)
|
|
65
|
+
deriveEcdsaKeypair(path: string, subject: string, agentId: UUID):
|
|
66
|
+
Promise<{ keypair: PrivateKeyAccount; attestation: RemoteAttestationQuote }>;
|
|
67
|
+
|
|
68
|
+
// Derive raw key bytes
|
|
69
|
+
rawDeriveKey(path: string, subject: string): Promise<DeriveKeyResponse>;
|
|
108
70
|
}
|
|
109
71
|
```
|
|
110
72
|
|
|
111
|
-
##
|
|
73
|
+
## Enabling the plugin
|
|
112
74
|
|
|
113
|
-
|
|
114
|
-
plugins/plugin-tee/
|
|
115
|
-
├── typescript/ # TypeScript implementation
|
|
116
|
-
│ ├── src/
|
|
117
|
-
│ │ ├── actions/ # Remote attestation action
|
|
118
|
-
│ │ ├── providers/ # Key derivation & attestation providers
|
|
119
|
-
│ │ ├── services/ # TEE service
|
|
120
|
-
│ │ ├── types/ # Type definitions
|
|
121
|
-
│ │ ├── vendors/ # Vendor implementations
|
|
122
|
-
│ │ └── index.ts # Main entry point
|
|
123
|
-
│ └── __tests__/ # Unit tests
|
|
124
|
-
├── package.json # NPM manifest
|
|
125
|
-
└── README.md # This file
|
|
126
|
-
```
|
|
75
|
+
Add `@elizaos/plugin-tee` to your agent character's `plugins` array and set the required environment variables. The plugin is opt-in and not auto-loaded.
|
|
127
76
|
|
|
128
77
|
## Development
|
|
129
78
|
|
|
130
|
-
### Building
|
|
131
|
-
|
|
132
79
|
```bash
|
|
133
|
-
bun run build
|
|
134
|
-
bun run test
|
|
80
|
+
bun run --cwd plugins/plugin-tee build # compile
|
|
81
|
+
bun run --cwd plugins/plugin-tee test # run tests
|
|
82
|
+
bun run --cwd plugins/plugin-tee format:check # lint
|
|
135
83
|
```
|
|
136
|
-
|
|
137
|
-
### Linting
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
# TypeScript
|
|
141
|
-
bun run format:check
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-tee",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/node/index.js",
|
|
6
6
|
"module": "dist/node/index.js",
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
"./package.json": "./package.json",
|
|
15
15
|
".": {
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
|
+
"eliza-source": {
|
|
18
|
+
"types": "./src/index.ts",
|
|
19
|
+
"import": "./src/index.ts",
|
|
20
|
+
"default": "./src/index.ts"
|
|
21
|
+
},
|
|
17
22
|
"node": {
|
|
18
23
|
"types": "./dist/node/index.d.ts",
|
|
19
24
|
"import": "./dist/node/index.js",
|
|
@@ -24,6 +29,12 @@
|
|
|
24
29
|
"default": "./dist/node/index.js"
|
|
25
30
|
},
|
|
26
31
|
"default": "./dist/node/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./*.css": "./dist/*.css",
|
|
34
|
+
"./*": {
|
|
35
|
+
"types": "./dist/*.d.ts",
|
|
36
|
+
"import": "./dist/*.js",
|
|
37
|
+
"default": "./dist/*.js"
|
|
27
38
|
}
|
|
28
39
|
},
|
|
29
40
|
"files": [
|
|
@@ -33,7 +44,7 @@
|
|
|
33
44
|
],
|
|
34
45
|
"sideEffects": false,
|
|
35
46
|
"dependencies": {
|
|
36
|
-
"@elizaos/core": "2.0.
|
|
47
|
+
"@elizaos/core": "2.0.3-beta.2",
|
|
37
48
|
"@phala/dstack-sdk": "^0.5.7",
|
|
38
49
|
"@solana/web3.js": "1.98.4",
|
|
39
50
|
"viem": "^2.48.8"
|
|
@@ -62,7 +73,7 @@
|
|
|
62
73
|
"publishConfig": {
|
|
63
74
|
"access": "public"
|
|
64
75
|
},
|
|
65
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "82fe0f44215954c2417328203f5bd6510985c1fc",
|
|
66
77
|
"agentConfig": {
|
|
67
78
|
"pluginType": "elizaos:plugin:1.0.0",
|
|
68
79
|
"pluginParameters": {
|