@elizaos/plugin-tee 2.0.0-beta.1 → 2.0.3-beta.3

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 (41) hide show
  1. package/README.md +46 -104
  2. package/package.json +15 -3
  3. package/registry-entry.json +53 -0
  4. package/dist/index.js +0 -31460
  5. package/dist/index.js.map +0 -204
  6. package/dist/node/index.d.ts +0 -9
  7. package/dist/node/index.d.ts.map +0 -1
  8. package/dist/node/index.js +0 -34
  9. package/dist/node/providers/base.d.ts +0 -8
  10. package/dist/node/providers/base.d.ts.map +0 -1
  11. package/dist/node/providers/base.js +0 -4
  12. package/dist/node/providers/deriveKey.d.ts +0 -24
  13. package/dist/node/providers/deriveKey.d.ts.map +0 -1
  14. package/dist/node/providers/deriveKey.js +0 -148
  15. package/dist/node/providers/index.d.ts +0 -4
  16. package/dist/node/providers/index.d.ts.map +0 -1
  17. package/dist/node/providers/index.js +0 -3
  18. package/dist/node/providers/remoteAttestation.d.ts +0 -10
  19. package/dist/node/providers/remoteAttestation.d.ts.map +0 -1
  20. package/dist/node/providers/remoteAttestation.js +0 -78
  21. package/dist/node/services/index.d.ts +0 -2
  22. package/dist/node/services/index.d.ts.map +0 -1
  23. package/dist/node/services/index.js +0 -1
  24. package/dist/node/services/tee.d.ts +0 -24
  25. package/dist/node/services/tee.d.ts.map +0 -1
  26. package/dist/node/services/tee.js +0 -42
  27. package/dist/node/types/index.d.ts +0 -58
  28. package/dist/node/types/index.d.ts.map +0 -1
  29. package/dist/node/types/index.js +0 -35
  30. package/dist/node/utils/index.d.ts +0 -9
  31. package/dist/node/utils/index.d.ts.map +0 -1
  32. package/dist/node/utils/index.js +0 -61
  33. package/dist/node/vendors/index.d.ts +0 -5
  34. package/dist/node/vendors/index.d.ts.map +0 -1
  35. package/dist/node/vendors/index.js +0 -14
  36. package/dist/node/vendors/phala.d.ts +0 -10
  37. package/dist/node/vendors/phala.d.ts.map +0 -1
  38. package/dist/node/vendors/phala.js +0 -17
  39. package/dist/node/vendors/types.d.ts +0 -13
  40. package/dist/node/vendors/types.d.ts.map +0 -1
  41. 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, providing secure key management and remote attestation capabilities.
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
- ## Features
5
+ ## What it does
6
6
 
7
- - 🔐 **Remote Attestation** - Generate verifiable proofs that your agent is running in a secure TEE
8
- - 🔑 **Key Derivation** - Securely derive Ed25519 (Solana) and ECDSA (EVM) keypairs within the TEE
9
- - 🛡️ **Vendor Support** - Extensible vendor system (currently supports Phala Network)
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 Start
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
- // Or use the service directly
26
- const service = await TEEService.start(runtime);
27
- const solanaKeys = await service.deriveEd25519Keypair(
28
- "salt",
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
- - **LOCAL**: Development mode using simulator at `localhost:8090`
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
- ### Actions
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
- | Action | Description |
55
- | -------------------- | --------------------------------------------------------------------- |
56
- | `REMOTE_ATTESTATION` | Generate and upload a remote attestation quote to prove TEE execution |
35
+ ### TEE modes
57
36
 
58
- ### Providers
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
- | Provider | Description |
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
- ### Services
45
+ ## Providers registered
66
46
 
67
- | Service | Description |
68
- | ------------ | ---------------------------------------------- |
69
- | `TEEService` | Main service for key derivation and management |
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
- ## API Reference
52
+ Both providers are dynamic and gated to `secrets` / `agent_internal` contexts.
72
53
 
73
- ### TEEService
54
+ ## TEEService API
74
55
 
75
56
  ```typescript
76
57
  class TEEService {
77
- // Derive Ed25519 keypair for Solana
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
- ### Remote Attestation
60
+ // Derive Ed25519 keypair (Solana)
61
+ deriveEd25519Keypair(path: string, subject: string, agentId: UUID):
62
+ Promise<{ keypair: Keypair; attestation: RemoteAttestationQuote }>;
100
63
 
101
- ```typescript
102
- class PhalaRemoteAttestationProvider {
103
- // Generate attestation quote
104
- async generateAttestation(
105
- reportData: string,
106
- hashAlgorithm?: TdxQuoteHashAlgorithm,
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
- ## Directory Structure
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.0-beta.1",
3
+ "version": "2.0.3-beta.3",
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,16 +29,23 @@
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": [
41
+ "registry-entry.json",
30
42
  "dist",
31
43
  "README.md",
32
44
  "LICENSE"
33
45
  ],
34
46
  "sideEffects": false,
35
47
  "dependencies": {
36
- "@elizaos/core": "2.0.0-beta.1",
48
+ "@elizaos/core": "2.0.3-beta.3",
37
49
  "@phala/dstack-sdk": "^0.5.7",
38
50
  "@solana/web3.js": "1.98.4",
39
51
  "viem": "^2.48.8"
@@ -62,7 +74,7 @@
62
74
  "publishConfig": {
63
75
  "access": "public"
64
76
  },
65
- "gitHead": "646c632924826e2b75c2304a75ee56959fe4a460",
77
+ "gitHead": "f54b0f4eaed317d59fa7dbcdce20f4cdb0734420",
66
78
  "agentConfig": {
67
79
  "pluginType": "elizaos:plugin:1.0.0",
68
80
  "pluginParameters": {
@@ -0,0 +1,53 @@
1
+ {
2
+ "id": "tee",
3
+ "name": "Tee",
4
+ "description": "A plugin for secure key derivation and remote attestation within Trusted Execution Environments (TEE).",
5
+ "npmName": "@elizaos/plugin-tee",
6
+ "version": "2.0.0-beta.0",
7
+ "source": "bundled",
8
+ "tags": ["crypto", "tee"],
9
+ "config": {
10
+ "TEE_MODE": {
11
+ "type": "string",
12
+ "required": true,
13
+ "sensitive": false,
14
+ "label": "Mode",
15
+ "help": "Determines the Trusted Execution Environment operation mode (LOCAL, DOCKER, PRODUCTION) and is referenced in error handling to validate provided modes.",
16
+ "advanced": false
17
+ },
18
+ "TEE_VENDOR": {
19
+ "type": "string",
20
+ "required": false,
21
+ "sensitive": false,
22
+ "default": "PHALA",
23
+ "label": "Vendor",
24
+ "help": "Specifies which Trusted Execution Environment vendor to initialize (defaults to PHALA).",
25
+ "advanced": false
26
+ },
27
+ "WALLET_SECRET_SALT": {
28
+ "type": "secret",
29
+ "required": true,
30
+ "sensitive": true,
31
+ "default": "secret_salt",
32
+ "label": "Secret Salt",
33
+ "help": "Secret salt used to deterministically derive Solana and EVM keypairs inside the TEE.",
34
+ "advanced": false
35
+ }
36
+ },
37
+ "render": {
38
+ "visible": true,
39
+ "pinTo": [],
40
+ "style": "card",
41
+ "icon": "LockKeyhole",
42
+ "group": "feature-other",
43
+ "groupOrder": 12,
44
+ "actions": ["enable", "configure"]
45
+ },
46
+ "resources": {
47
+ "homepage": "https://github.com/elizaos-plugins/plugin-tee#readme",
48
+ "repository": "https://github.com/elizaos-plugins/plugin-tee"
49
+ },
50
+ "dependsOn": [],
51
+ "kind": "plugin",
52
+ "subtype": "other"
53
+ }