Trusted Execution Environment (TEE) integration plugin for elizaOS - Multi-language support (TypeScript, Python, Rust)
npm install @elizaos/plugin-tee-rootMulti-language Trusted Execution Environment (TEE) integration plugin for elizaOS, providing secure key management and remote attestation capabilities.
This plugin is implemented in three languages for maximum flexibility:
| Language | Package | Registry |
| ---------- | --------------------- | --------- |
| TypeScript | @elizaos/plugin-tee | npm |
| Rust | elizaos-plugin-tee | crates.io |
| Python | elizaos-plugin-tee | PyPI |
All implementations share the same API design and behavior.
- š Remote Attestation - Generate verifiable proofs that your agent is running in a secure TEE
- š Key Derivation - Securely derive Ed25519 (Solana) and ECDSA (EVM) keypairs within the TEE
- š”ļø Vendor Support - Extensible vendor system (currently supports Phala Network)
- ā” Type Safe - Strong typing in all languages (TypeScript, Rust, Python/Pydantic)
- š No Unsafe Code - Rust implementation uses #![deny(unsafe_code)]
``typescript
import { teePlugin, TEEService } from "@elizaos/plugin-tee";
import { AgentRuntime } from "@elizaos/core";
// Register the plugin
const runtime = new AgentRuntime({
plugins: [teePlugin],
});
// Or use the service directly
const service = await TEEService.start(runtime);
const solanaKeys = await service.deriveEd25519Keypair(
"salt",
"solana",
agentId,
);
const evmKeys = await service.deriveEcdsaKeypair("salt", "evm", agentId);
`
`rust
use elizaos_plugin_tee::{TEEService, TeeMode};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let service = TEEService::start(Some("LOCAL"), None)?;
let solana = service.derive_ed25519_keypair("salt", "solana", "agent-id").await?;
println!("Solana: {}", solana.public_key);
let evm = service.derive_ecdsa_keypair("salt", "evm", "agent-id").await?;
println!("EVM: {}", evm.address);
Ok(())
}
`
`python
from elizaos_plugin_tee import TEEService, TeeMode
async def main():
service = await TEEService.start(tee_mode="LOCAL")
solana = await service.derive_ed25519_keypair("salt", "solana", "agent-id")
print(f"Solana: {solana.public_key}")
evm = await service.derive_ecdsa_keypair("salt", "evm", "agent-id")
print(f"EVM: {evm.address}")
await service.stop()
`
| Variable | Description | Required | Default |
| -------------------- | ----------------------------------------------- | -------- | ------- |
| TEE_MODE | Operation mode: LOCAL, DOCKER, PRODUCTION | Yes | - |WALLET_SECRET_SALT
| | Secret salt for deterministic key derivation | Yes | - |TEE_VENDOR
| | TEE vendor to use | No | phala |
- LOCAL: Development mode using simulator at localhost:8090host.docker.internal:8090
- DOCKER: Docker development mode using simulator at
- PRODUCTION: Production mode connecting to real TEE infrastructure
| Action | Description |
| -------------------- | --------------------------------------------------------------------- |
| REMOTE_ATTESTATION | Generate and upload a remote attestation quote to prove TEE execution |
| Provider | Description |
| -------------------------- | ----------------------------------------------- |
| phala-derive-key | Derive Solana and EVM keypairs with attestation |phala-remote-attestation
| | Generate remote attestation quotes |
| Service | Description |
| ------------ | ---------------------------------------------- |
| TEEService | Main service for key derivation and management |
`typescript
class TEEService {
// Derive Ed25519 keypair for Solana
async deriveEd25519Keypair(
path: string,
subject: string,
agentId: UUID,
): Promise<{ keypair: Keypair; attestation: RemoteAttestationQuote }>;
// Derive ECDSA keypair for EVM
async deriveEcdsaKeypair(
path: string,
subject: string,
agentId: UUID,
): Promise<{
keypair: PrivateKeyAccount;
attestation: RemoteAttestationQuote;
}>;
// Derive raw key for custom use cases
async rawDeriveKey(path: string, subject: string): Promise
}
`
`typescript`
class PhalaRemoteAttestationProvider {
// Generate attestation quote
async generateAttestation(
reportData: string,
hashAlgorithm?: TdxQuoteHashAlgorithm,
): Promise
}
``
plugins/plugin-tee/
āāā typescript/ # TypeScript implementation
ā āāā src/
ā ā āāā actions/ # Remote attestation action
ā ā āāā providers/ # Key derivation & attestation providers
ā ā āāā services/ # TEE service
ā ā āāā types/ # Type definitions
ā ā āāā vendors/ # Vendor implementations
ā ā āāā index.ts # Main entry point
ā āāā __tests__/ # Unit tests
āāā rust/ # Rust implementation
ā āāā src/
ā ā āāā actions/ # Remote attestation action
ā ā āāā providers/ # Key derivation & attestation providers
ā ā āāā services/ # TEE service
ā ā āāā types.rs # Type definitions
ā ā āāā lib.rs # Main entry point
ā āāā tests/ # Integration tests
ā āāā Cargo.toml # Crate manifest
āāā python/ # Python implementation
ā āāā elizaos_plugin_tee/
ā ā āāā actions/ # Remote attestation action
ā ā āāā providers/ # Key derivation & attestation providers
ā ā āāā services/ # TEE service
ā ā āāā types.py # Pydantic models
ā ā āāā __init__.py # Main entry point
ā āāā tests/ # Unit tests
ā āāā pyproject.toml # Package manifest
āāā package.json # NPM manifest
āāā README.md # This file
`bashTypeScript
bun run build
$3
`bash
TypeScript
bun run testRust
bun run test:rustPython
bun run test:pythonAll languages
bun run test:all
`$3
`bash
TypeScript
bun run format:checkRust
bun run lint:rustPython
bun run lint:python
``- TypeScript: Node.js 18+ or Bun
- Rust: Rust 1.70+
- Python: Python 3.11+
- TEE Environment: Intel TDX-enabled environment or Phala Cloud for production
MIT