@elizaos/plugin-tee 1.0.0-beta.1 → 1.0.0-beta.4
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/dist/index.js +1 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8,9 +8,6 @@ var TeeVendorNames = {
|
|
|
8
8
|
PHALA: "phala"
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// src/vendors/phala.ts
|
|
12
|
-
import { TeeVendors } from "@elizaos/core";
|
|
13
|
-
|
|
14
11
|
// src/actions/remoteAttestationAction.ts
|
|
15
12
|
import { logger as logger2 } from "@elizaos/core";
|
|
16
13
|
|
|
@@ -393,7 +390,7 @@ EVM Address: ${values.evm_address}`;
|
|
|
393
390
|
|
|
394
391
|
// src/vendors/phala.ts
|
|
395
392
|
var PhalaVendor = class {
|
|
396
|
-
type =
|
|
393
|
+
type = TeeVendorNames.PHALA;
|
|
397
394
|
/**
|
|
398
395
|
* Returns an array of actions.
|
|
399
396
|
*
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/vendors/types.ts","../src/vendors/phala.ts","../src/actions/remoteAttestationAction.ts","../src/providers/remoteAttestationProvider.ts","../src/providers/base.ts","../src/utils.ts","../src/providers/deriveKeyProvider.ts","../src/vendors/index.ts"],"sourcesContent":["import {\n type IAgentRuntime,\n type Plugin,\n type TeePluginConfig,\n type TeeVendorConfig,\n logger,\n} from '@elizaos/core';\nimport { TeeVendorNames } from './vendors/types';\nimport { getVendor } from './vendors/index';\n\nexport { PhalaDeriveKeyProvider } from './providers/deriveKeyProvider';\nexport { PhalaRemoteAttestationProvider } from './providers/remoteAttestationProvider';\nexport type { TeeVendorConfig };\n\n/**\n * Asynchronously initializes the Trusted Execution Environment (TEE) based on the provided configuration and runtime settings.\n * @param {Record<string, string>} config - The configuration object containing TEE vendor information.\n * @param {IAgentRuntime} runtime - The runtime object with TEE related settings.\n * @returns {Promise<void>} - A promise that resolves once the TEE is initialized.\n */\nasync function initializeTEE(config: Record<string, string>, runtime: IAgentRuntime) {\n if (config.TEE_VENDOR || runtime.getSetting('TEE_VENDOR')) {\n const vendor = config.TEE_VENDOR || runtime.getSetting('TEE_VENDOR');\n logger.info(`Initializing TEE with vendor: ${vendor}`);\n let plugin: Plugin;\n switch (vendor) {\n case 'phala':\n plugin = teePlugin({\n vendor: TeeVendorNames.PHALA,\n });\n break;\n default:\n throw new Error(`Invalid TEE vendor: ${vendor}`);\n }\n logger.info(`Pushing plugin: ${plugin.name}`);\n runtime.plugins.push(plugin);\n }\n}\n\n/**\n * A function that creates a TEE (Trusted Execution Environment) plugin based on the provided configuration.\n * @param { TeePluginConfig } [config] - Optional configuration for the TEE plugin.\n * @returns { Plugin } - The TEE plugin containing initialization, description, actions, evaluators, providers, and services.\n */\nexport const teePlugin = (config?: TeePluginConfig): Plugin => {\n const vendorType = config?.vendor || TeeVendorNames.PHALA;\n const vendor = getVendor(vendorType);\n return {\n name: vendor.getName(),\n init: async (config: Record<string, string>, runtime: IAgentRuntime) => {\n return await initializeTEE(\n {\n ...config,\n vendor: vendorType,\n },\n runtime\n );\n },\n description: vendor.getDescription(),\n actions: vendor.getActions(),\n evaluators: [],\n providers: vendor.getProviders(),\n services: [],\n };\n};\n","import type { Action, Provider } from '@elizaos/core';\n\nexport const TeeVendorNames = {\n PHALA: 'phala',\n} as const;\n\n/**\n * Type representing the name of a Tee vendor.\n * It can either be one of the keys of TeeVendorNames or a string.\n */\nexport type TeeVendorName = (typeof TeeVendorNames)[keyof typeof TeeVendorNames] | string;\n\n/**\n * Interface for a TeeVendor, representing a vendor that sells tees.\n * @interface\n */\n\nexport interface TeeVendor {\n type: TeeVendorName;\n getActions(): Action[];\n getProviders(): Provider[];\n getName(): string;\n getDescription(): string;\n}\n","import { TeeVendors } from '@elizaos/core';\nimport { phalaRemoteAttestationAction as remoteAttestationAction } from '../actions/remoteAttestationAction';\nimport { phalaDeriveKeyProvider as deriveKeyProvider } from '../providers/deriveKeyProvider';\nimport { phalaRemoteAttestationProvider as remoteAttestationProvider } from '../providers/remoteAttestationProvider';\nimport type { TeeVendor } from './types';\n\n/**\n * A class representing a vendor for Phala TEE.\n * * @implements { TeeVendor }\n * @type {TeeVendors.PHALA}\n *//**\n * Get the actions for the PhalaVendor.\n * * @returns { Array } An array of actions.\n *//**\n * Get the providers for the PhalaVendor.\n * * @returns { Array } An array of providers.\n *//**\n * Get the name of the PhalaVendor.\n * * @returns { string } The name of the vendor.\n *//**\n * Get the description of the PhalaVendor.\n * * @returns { string } The description of the vendor.\n */\nexport class PhalaVendor implements TeeVendor {\n type = TeeVendors.PHALA;\n\n /**\n * Returns an array of actions.\n *\n * @returns {Array} An array containing the remote attestation action.\n */\n getActions() {\n return [remoteAttestationAction];\n }\n /**\n * Retrieve the list of providers.\n *\n * @returns {Array<Function>} An array containing two provider functions: deriveKeyProvider and remoteAttestationProvider.\n */\n getProviders() {\n return [deriveKeyProvider, remoteAttestationProvider];\n }\n\n /**\n * Returns the name of the plugin.\n * @returns {string} The name of the plugin.\n */\n getName() {\n return 'phala-tee-plugin';\n }\n\n /**\n * Get the description of the function\n * @returns {string} The description of the function\n */\n getDescription() {\n return 'Phala TEE Cloud to Host Eliza Agents';\n }\n}\n","import type {\n HandlerCallback,\n IAgentRuntime,\n Memory,\n RemoteAttestationMessage,\n State,\n} from '@elizaos/core';\nimport { logger } from '@elizaos/core';\nimport { PhalaRemoteAttestationProvider as RemoteAttestationProvider } from '../providers/remoteAttestationProvider';\nimport { hexToUint8Array } from '../utils';\n\n/**\n * Asynchronously uploads a Uint8Array as a binary file to a specified URL.\n *\n * @param {Uint8Array} data - The Uint8Array data to be uploaded as a binary file.\n * @returns {Promise<Response>} A Promise that resolves once the upload is complete, returning a Response object.\n */\nasync function uploadUint8Array(data: Uint8Array) {\n const blob = new Blob([data], { type: 'application/octet-stream' });\n const formData = new FormData();\n formData.append('file', blob, 'quote.bin');\n\n return await fetch('https://proof.t16z.com/api/upload', {\n method: 'POST',\n body: formData as BodyInit,\n });\n}\n\n/**\n * Represents an action for remote attestation.\n *\n * This action is used to generate a remote attestation to prove that the agent is running in a Trusted Execution Environment (TEE).\n *\n * @type {{name: string, similes: string[], description: string, handler: Function, validate: Function, examples: Array<Array<Object>>}}\n */\nexport const phalaRemoteAttestationAction = {\n name: 'REMOTE_ATTESTATION',\n similes: ['REMOTE_ATTESTATION', 'TEE_REMOTE_ATTESTATION', 'TEE_ATTESTATION'],\n description: 'Generate a remote attestation to prove that the agent is running in a TEE',\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state: State,\n _options: { [key: string]: unknown },\n callback: HandlerCallback\n ) => {\n try {\n // Attestation will be generated based on the message info\n const attestationMessage: RemoteAttestationMessage = {\n agentId: runtime.agentId,\n timestamp: Date.now(),\n message: {\n entityId: message.entityId,\n roomId: message.roomId,\n content: message.content.text,\n },\n };\n // Get the remote attestation of the agentId\n const teeMode = runtime.getSetting('TEE_MODE');\n logger.debug(`Tee mode: ${teeMode}`);\n logger.debug(`Attestation message: ${JSON.stringify(attestationMessage)}`);\n const provider = new RemoteAttestationProvider(teeMode);\n\n const attestation = await provider.generateAttestation(JSON.stringify(attestationMessage));\n const attestationData = hexToUint8Array(attestation.quote);\n const response = await uploadUint8Array(attestationData);\n const data = await response.json();\n\n callback({\n text: `Here's my 🧾 RA Quote 🫡\nhttps://proof.t16z.com/reports/${data.checksum}`,\n actions: ['NONE'],\n });\n return true;\n } catch (error) {\n console.error('Failed to fetch remote attestation: ', error);\n return false;\n }\n },\n validate: async (_runtime: IAgentRuntime) => {\n return true;\n },\n examples: [\n [\n {\n name: '{{name1}}',\n content: {\n text: 'If you are running in a TEE, generate a remote attestation',\n actions: ['REMOTE_ATTESTATION'],\n },\n },\n {\n name: '{{agentName}}',\n content: {\n text: 'Of course, one second...',\n },\n },\n ],\n [\n {\n name: '{{name1}}',\n content: {\n text: 'Yo I wanna attest to this message, yo! Can you generate an attestatin for me, please?',\n actions: ['REMOTE_ATTESTATION'],\n },\n },\n {\n name: '{{agentName}}',\n content: {\n text: 'I got you, fam! Lemme hit the cloud and get you a quote in a jiffy!',\n },\n },\n ],\n [\n {\n name: '{{name1}}',\n content: {\n text: \"It was a long day, I got a lot done though. I went to the creek and skipped some rocks. Then I decided to take a walk off the natural path. I ended up in a forest I was unfamiliar with. Slowly, I lost the way back and it was dark. A whisper from deep inside said something I could barely make out. The hairs on my neck stood up and then a clear high pitched voice said, 'You are not ready to leave yet! SHOW ME YOUR REMOTE ATTESTATION!'\",\n actions: ['REMOTE_ATTESTATION'],\n },\n },\n {\n name: '{{agentName}}',\n content: {\n text: 'Oh, dear...lemme find that for you',\n },\n },\n ],\n ],\n};\n","import { type IAgentRuntime, type Memory, type Provider, logger } from '@elizaos/core';\nimport { type RemoteAttestationMessage, type RemoteAttestationQuote, TEEMode } from '@elizaos/core';\nimport { TappdClient, type TdxQuoteHashAlgorithms, type TdxQuoteResponse } from '@phala/dstack-sdk';\nimport { RemoteAttestationProvider } from './base';\n\n// Define the ProviderResult interface if not already imported\n/**\n * Interface for the result returned by a provider.\n * @typedef {Object} ProviderResult\n * @property {any} data - The data returned by the provider.\n * @property {Record<string, string>} values - The values returned by the provider.\n * @property {string} text - The text returned by the provider.\n */\ninterface ProviderResult {\n data?: any;\n values?: Record<string, string>;\n text?: string;\n}\n\n/**\n * Phala TEE Cloud Provider\n * @example\n * ```ts\n * const provider = new PhalaRemoteAttestationProvider();\n * ```\n */\n/**\n * PhalaRemoteAttestationProvider class that extends RemoteAttestationProvider\n * @extends RemoteAttestationProvider\n */\nclass PhalaRemoteAttestationProvider extends RemoteAttestationProvider {\n private client: TappdClient;\n\n constructor(teeMode?: string) {\n super();\n let endpoint: string | undefined;\n\n // Both LOCAL and DOCKER modes use the simulator, just with different endpoints\n switch (teeMode) {\n case TEEMode.LOCAL:\n endpoint = 'http://localhost:8090';\n logger.log('TEE: Connecting to local simulator at localhost:8090');\n break;\n case TEEMode.DOCKER:\n endpoint = 'http://host.docker.internal:8090';\n logger.log('TEE: Connecting to simulator via Docker at host.docker.internal:8090');\n break;\n case TEEMode.PRODUCTION:\n endpoint = undefined;\n logger.log('TEE: Running in production mode without simulator');\n break;\n default:\n throw new Error(`Invalid TEE_MODE: ${teeMode}. Must be one of: LOCAL, DOCKER, PRODUCTION`);\n }\n\n this.client = endpoint ? new TappdClient(endpoint) : new TappdClient();\n }\n\n async generateAttestation(\n reportData: string,\n hashAlgorithm?: TdxQuoteHashAlgorithms\n ): Promise<RemoteAttestationQuote> {\n try {\n logger.log('Generating attestation for: ', reportData);\n const tdxQuote: TdxQuoteResponse = await this.client.tdxQuote(reportData, hashAlgorithm);\n const rtmrs = tdxQuote.replayRtmrs();\n logger.log(`rtmr0: ${rtmrs[0]}\\nrtmr1: ${rtmrs[1]}\\nrtmr2: ${rtmrs[2]}\\nrtmr3: ${rtmrs[3]}f`);\n const quote: RemoteAttestationQuote = {\n quote: tdxQuote.quote,\n timestamp: Date.now(),\n };\n logger.log('Remote attestation quote: ', quote);\n return quote;\n } catch (error) {\n console.error('Error generating remote attestation:', error);\n throw new Error(\n `Failed to generate TDX Quote: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n }\n}\n\n// Keep the original provider for backwards compatibility\nconst phalaRemoteAttestationProvider: Provider = {\n name: 'phala-remote-attestation',\n get: async (runtime: IAgentRuntime, message: Memory) => {\n const teeMode = runtime.getSetting('TEE_MODE');\n const provider = new PhalaRemoteAttestationProvider(teeMode);\n const agentId = runtime.agentId;\n\n try {\n const attestationMessage: RemoteAttestationMessage = {\n agentId: agentId,\n timestamp: Date.now(),\n message: {\n entityId: message.entityId,\n roomId: message.roomId,\n content: message.content.text,\n },\n };\n logger.log('Generating attestation for: ', JSON.stringify(attestationMessage));\n const attestation = await provider.generateAttestation(JSON.stringify(attestationMessage));\n return {\n text: `Your Agent's remote attestation is: ${JSON.stringify(attestation)}`,\n data: {\n attestation,\n },\n values: {\n quote: attestation.quote,\n timestamp: attestation.timestamp.toString(),\n },\n };\n } catch (error) {\n console.error('Error in remote attestation provider:', error);\n throw new Error(\n `Failed to generate TDX Quote: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n },\n};\n\nexport { phalaRemoteAttestationProvider, PhalaRemoteAttestationProvider };\n","import type { RemoteAttestationQuote } from '@elizaos/core';\nimport type { TdxQuoteHashAlgorithms } from '@phala/dstack-sdk';\n\n/**\n * Abstract class for deriving keys from the TEE.\n * You can implement your own logic for deriving keys from the TEE.\n * @example\n * ```ts\n * class MyDeriveKeyProvider extends DeriveKeyProvider {\n * private client: TappdClient;\n *\n * constructor(endpoint: string) {\n * super();\n * this.client = new TappdClient();\n * }\n *\n * async rawDeriveKey(path: string, subject: string): Promise<any> {\n * return this.client.deriveKey(path, subject);\n * }\n * }\n * ```\n */\n/**\n * Abstract class representing a key provider for deriving keys.\n */\nexport abstract class DeriveKeyProvider {}\n\n/**\n * Abstract class for remote attestation provider.\n */\nexport abstract class RemoteAttestationProvider {\n abstract generateAttestation(\n reportData: string,\n hashAlgorithm?: TdxQuoteHashAlgorithms\n ): Promise<RemoteAttestationQuote>;\n}\n","import { createHash } from 'node:crypto';\n\n/**\n * Converts a hexadecimal string to a Uint8Array.\n *\n * @param {string} hex - The hexadecimal string to convert.\n * @returns {Uint8Array} - The resulting Uint8Array.\n * @throws {Error} - If the input hex string is invalid.\n */\nexport function hexToUint8Array(hex: string) {\n const hexString = hex.trim().replace(/^0x/, '');\n if (!hexString) {\n throw new Error('Invalid hex string');\n }\n if (hexString.length % 2 !== 0) {\n throw new Error('Invalid hex string');\n }\n\n const array = new Uint8Array(hexString.length / 2);\n for (let i = 0; i < hexString.length; i += 2) {\n const byte = Number.parseInt(hexString.slice(i, i + 2), 16);\n if (Number.isNaN(byte)) {\n throw new Error('Invalid hex string');\n }\n array[i / 2] = byte;\n }\n return array;\n}\n\n// Function to calculate SHA-256 and return a Buffer (32 bytes)\n/**\n * Calculates the SHA256 hash of the input string.\n *\n * @param {string} input - The input string to calculate the hash from.\n * @returns {Buffer} - The calculated SHA256 hash as a Buffer object.\n */\nexport function calculateSHA256(input: string): Buffer {\n const hash = createHash('sha256');\n hash.update(input);\n return hash.digest();\n}\n","import { type IAgentRuntime, type Memory, type Provider, type State, logger } from '@elizaos/core';\nimport { type DeriveKeyAttestationData, type RemoteAttestationQuote, TEEMode } from '@elizaos/core';\nimport { type DeriveKeyResponse, TappdClient } from '@phala/dstack-sdk';\nimport { Keypair } from '@solana/web3.js';\nimport { toViemAccount } from '@phala/dstack-sdk/viem';\nimport { toKeypair } from '@phala/dstack-sdk/solana';\nimport { DeriveKeyProvider } from './base';\nimport { PhalaRemoteAttestationProvider as RemoteAttestationProvider } from './remoteAttestationProvider';\n\n/**\n * Phala TEE Cloud Provider\n * @example\n * ```ts\n * const provider = new PhalaDeriveKeyProvider(runtime.getSetting('TEE_MODE'));\n * ```\n */\n/**\n * A class representing a key provider for deriving keys in the Phala TEE environment.\n * Extends the DeriveKeyProvider class.\n */\nclass PhalaDeriveKeyProvider extends DeriveKeyProvider {\n private client: TappdClient;\n private raProvider: RemoteAttestationProvider;\n\n constructor(teeMode?: string) {\n super();\n let endpoint: string | undefined;\n\n // Both LOCAL and DOCKER modes use the simulator, just with different endpoints\n switch (teeMode) {\n case TEEMode.LOCAL:\n endpoint = 'http://localhost:8090';\n logger.log('TEE: Connecting to local simulator at localhost:8090');\n break;\n case TEEMode.DOCKER:\n endpoint = 'http://host.docker.internal:8090';\n logger.log('TEE: Connecting to simulator via Docker at host.docker.internal:8090');\n break;\n case TEEMode.PRODUCTION:\n endpoint = undefined;\n logger.log('TEE: Running in production mode without simulator');\n break;\n default:\n throw new Error(`Invalid TEE_MODE: ${teeMode}. Must be one of: LOCAL, DOCKER, PRODUCTION`);\n }\n\n this.client = endpoint ? new TappdClient(endpoint) : new TappdClient();\n this.raProvider = new RemoteAttestationProvider(teeMode);\n }\n\n private async generateDeriveKeyAttestation(\n agentId: string,\n publicKey: string,\n subject?: string\n ): Promise<RemoteAttestationQuote> {\n const deriveKeyData: DeriveKeyAttestationData = {\n agentId,\n publicKey,\n subject,\n };\n const reportdata = JSON.stringify(deriveKeyData);\n logger.log('Generating Remote Attestation Quote for Derive Key...');\n const quote = await this.raProvider.generateAttestation(reportdata);\n logger.log('Remote Attestation Quote generated successfully!');\n return quote;\n }\n\n /**\n * Derives a raw key from the given path and subject.\n * @param path - The path to derive the key from. This is used to derive the key from the root of trust.\n * @param subject - The subject to derive the key from. This is used for the certificate chain.\n * @returns The derived key.\n */\n async rawDeriveKey(path: string, subject: string): Promise<DeriveKeyResponse> {\n try {\n if (!path || !subject) {\n logger.error('Path and Subject are required for key derivation');\n }\n\n logger.log('Deriving Raw Key in TEE...');\n const derivedKey = await this.client.deriveKey(path, subject);\n\n logger.log('Raw Key Derived Successfully!');\n return derivedKey;\n } catch (error) {\n logger.error('Error deriving raw key:', error);\n throw error;\n }\n }\n\n /**\n * Derives an Ed25519 keypair from the given path and subject.\n * @param path - The path to derive the key from. This is used to derive the key from the root of trust.\n * @param subject - The subject to derive the key from. This is used for the certificate chain.\n * @param agentId - The agent ID to generate an attestation for.\n * @returns An object containing the derived keypair and attestation.\n */\n async deriveEd25519Keypair(\n path: string,\n subject: string,\n agentId: string\n ): Promise<{ keypair: Keypair; attestation: RemoteAttestationQuote }> {\n try {\n if (!path || !subject) {\n logger.error('Path and Subject are required for key derivation');\n }\n\n logger.log('Deriving Key in TEE...');\n const derivedKey = await this.client.deriveKey(path, subject);\n const keypair = toKeypair(derivedKey);\n\n // Generate an attestation for the derived key data for public to verify\n const attestation = await this.generateDeriveKeyAttestation(\n agentId,\n keypair.publicKey.toBase58()\n );\n logger.log('Key Derived Successfully!');\n\n return { keypair, attestation };\n } catch (error) {\n logger.error('Error deriving key:', error);\n throw error;\n }\n }\n\n /**\n * Derives an ECDSA keypair from the given path and subject.\n * @param path - The path to derive the key from. This is used to derive the key from the root of trust.\n * @param subject - The subject to derive the key from. This is used for the certificate chain.\n * @param agentId - The agent ID to generate an attestation for. This is used for the certificate chain.\n * @returns An object containing the derived keypair and attestation.\n */\n async deriveEcdsaKeypair(\n path: string,\n subject: string,\n agentId: string\n ): Promise<{\n keypair: PrivateKeyAccount;\n attestation: RemoteAttestationQuote;\n }> {\n try {\n if (!path || !subject) {\n logger.error('Path and Subject are required for key derivation');\n }\n\n logger.log('Deriving ECDSA Key in TEE...');\n const deriveKeyResponse: DeriveKeyResponse = await this.client.deriveKey(path, subject);\n const keypair = toViemAccount(deriveKeyResponse);\n\n // Generate an attestation for the derived key data for public to verify\n const attestation = await this.generateDeriveKeyAttestation(agentId, keypair.address);\n logger.log('ECDSA Key Derived Successfully!');\n\n return { keypair, attestation };\n } catch (error) {\n logger.error('Error deriving ecdsa key:', error);\n throw error;\n }\n }\n}\n\n// Define the ProviderResult interface if not already imported\ninterface ProviderResult {\n data?: any;\n values?: Record<string, string>;\n text?: string;\n}\n\nconst phalaDeriveKeyProvider: Provider = {\n name: 'phala-derive-key',\n get: async (runtime: IAgentRuntime, _message?: Memory): Promise<ProviderResult> => {\n const teeMode = runtime.getSetting('TEE_MODE');\n const provider = new PhalaDeriveKeyProvider(teeMode);\n const agentId = runtime.agentId;\n try {\n // Validate wallet configuration\n if (!runtime.getSetting('WALLET_SECRET_SALT')) {\n logger.error('Wallet secret salt is not configured in settings');\n return {\n data: null,\n values: {},\n text: 'Wallet secret salt is not configured in settings',\n };\n }\n\n try {\n const secretSalt = runtime.getSetting('WALLET_SECRET_SALT') || 'secret_salt';\n const solanaKeypair = await provider.deriveEd25519Keypair(secretSalt, 'solana', agentId);\n const evmKeypair = await provider.deriveEcdsaKeypair(secretSalt, 'evm', agentId);\n\n // Original data structure\n const walletData = {\n solana: solanaKeypair.keypair.publicKey,\n evm: evmKeypair.keypair.address,\n };\n\n // Values for template injection\n const values = {\n solana_public_key: solanaKeypair.keypair.publicKey.toString(),\n evm_address: evmKeypair.keypair.address,\n };\n\n // Text representation\n const text = `Solana Public Key: ${values.solana_public_key}\\nEVM Address: ${values.evm_address}`;\n\n return {\n data: walletData,\n values: values,\n text: text,\n };\n } catch (error) {\n logger.error('Error creating PublicKey:', error);\n return {\n data: null,\n values: {},\n text: `Error creating PublicKey: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`,\n };\n }\n } catch (error) {\n logger.error('Error in derive key provider:', error.message);\n return {\n data: null,\n values: {},\n text: `Failed to fetch derive key information: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`,\n };\n }\n },\n};\n\nexport { phalaDeriveKeyProvider, PhalaDeriveKeyProvider };\n","import { PhalaVendor } from './phala';\nimport type { TeeVendor } from './types';\nimport { type TeeVendorName, TeeVendorNames } from './types';\n\nconst vendors: Record<TeeVendorName, TeeVendor> = {\n [TeeVendorNames.PHALA]: new PhalaVendor(),\n};\n\nexport const getVendor = (type: TeeVendorName): TeeVendor => {\n const vendor = vendors[type];\n if (!vendor) {\n throw new Error(`Unsupported TEE vendor type: ${type}`);\n }\n return vendor;\n};\n\nexport * from './types';\n"],"mappings":";AAAA;AAAA,EAKE,UAAAA;AAAA,OACK;;;ACJA,IAAM,iBAAiB;AAAA,EAC5B,OAAO;AACT;;;ACJA,SAAS,kBAAkB;;;ACO3B,SAAS,UAAAC,eAAc;;;ACPvB,SAAyD,cAAc;AACvE,SAAqE,eAAe;AACpF,SAAS,mBAAuE;;;ACuBzE,IAAe,oBAAf,MAAiC;AAAC;AAKlC,IAAe,4BAAf,MAAyC;AAKhD;;;ADLA,IAAM,iCAAN,cAA6C,0BAA0B;AAAA,EAC7D;AAAA,EAER,YAAY,SAAkB;AAC5B,UAAM;AACN,QAAI;AAGJ,YAAQ,SAAS;AAAA,MACf,KAAK,QAAQ;AACX,mBAAW;AACX,eAAO,IAAI,sDAAsD;AACjE;AAAA,MACF,KAAK,QAAQ;AACX,mBAAW;AACX,eAAO,IAAI,sEAAsE;AACjF;AAAA,MACF,KAAK,QAAQ;AACX,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AK,iCAAiC,MAAM,EAAE;AACrD,QAAI;AACJ,YAAQ,QAAQ;AAAA,MACd,KAAK;AACH,iBAAS,UAAU;AAAA,UACjB,QAAQ,eAAe;AAAA,QACzB,CAAC;AACD;AAAA,MACF;AACE,cAAM,IAAI,MAAM,uBAAuB,MAAM,EAAE;AAAA,IACnD;AACA,IAAAA,QAAO,KAAK,mBAAmB,OAAO,IAAI,EAAE;AAC5C,YAAQ,QAAQ,KAAK,MAAM;AAAA,EAC7B;AACF;AAOO,IAAM,YAAY,CAAC,WAAqC;AAC7D,QAAM,aAAa,QAAQ,UAAU,eAAe;AACpD,QAAM,SAAS,UAAU,UAAU;AACnC,SAAO;AAAA,IACL,MAAM,OAAO,QAAQ;AAAA,IACrB,MAAM,OAAOC,SAAgC,YAA2B;AACtE,aAAO,MAAM;AAAA,QACX;AAAA,UACE,GAAGA;AAAA,UACH,QAAQ;AAAA,QACV;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa,OAAO,eAAe;AAAA,IACnC,SAAS,OAAO,WAAW;AAAA,IAC3B,YAAY,CAAC;AAAA,IACb,WAAW,OAAO,aAAa;AAAA,IAC/B,UAAU,CAAC;AAAA,EACb;AACF;","names":["logger","logger","logger","logger","TEEMode","TappdClient","TEEMode","logger","TappdClient","logger","config"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/vendors/types.ts","../src/actions/remoteAttestationAction.ts","../src/providers/remoteAttestationProvider.ts","../src/providers/base.ts","../src/utils.ts","../src/providers/deriveKeyProvider.ts","../src/vendors/phala.ts","../src/vendors/index.ts"],"sourcesContent":["import {\n type IAgentRuntime,\n type Plugin,\n type TeePluginConfig,\n type TeeVendorConfig,\n logger,\n} from '@elizaos/core';\nimport { TeeVendorNames } from './vendors/types';\nimport { getVendor } from './vendors/index';\n\nexport { PhalaDeriveKeyProvider } from './providers/deriveKeyProvider';\nexport { PhalaRemoteAttestationProvider } from './providers/remoteAttestationProvider';\nexport type { TeeVendorConfig };\n\n/**\n * Asynchronously initializes the Trusted Execution Environment (TEE) based on the provided configuration and runtime settings.\n * @param {Record<string, string>} config - The configuration object containing TEE vendor information.\n * @param {IAgentRuntime} runtime - The runtime object with TEE related settings.\n * @returns {Promise<void>} - A promise that resolves once the TEE is initialized.\n */\nasync function initializeTEE(config: Record<string, string>, runtime: IAgentRuntime) {\n if (config.TEE_VENDOR || runtime.getSetting('TEE_VENDOR')) {\n const vendor = config.TEE_VENDOR || runtime.getSetting('TEE_VENDOR');\n logger.info(`Initializing TEE with vendor: ${vendor}`);\n let plugin: Plugin;\n switch (vendor) {\n case 'phala':\n plugin = teePlugin({\n vendor: TeeVendorNames.PHALA,\n });\n break;\n default:\n throw new Error(`Invalid TEE vendor: ${vendor}`);\n }\n logger.info(`Pushing plugin: ${plugin.name}`);\n runtime.plugins.push(plugin);\n }\n}\n\n/**\n * A function that creates a TEE (Trusted Execution Environment) plugin based on the provided configuration.\n * @param { TeePluginConfig } [config] - Optional configuration for the TEE plugin.\n * @returns { Plugin } - The TEE plugin containing initialization, description, actions, evaluators, providers, and services.\n */\nexport const teePlugin = (config?: TeePluginConfig): Plugin => {\n const vendorType = config?.vendor || TeeVendorNames.PHALA;\n const vendor = getVendor(vendorType);\n return {\n name: vendor.getName(),\n init: async (config: Record<string, string>, runtime: IAgentRuntime) => {\n return await initializeTEE(\n {\n ...config,\n vendor: vendorType,\n },\n runtime\n );\n },\n description: vendor.getDescription(),\n actions: vendor.getActions(),\n evaluators: [],\n providers: vendor.getProviders(),\n services: [],\n };\n};\n","import type { Action, Provider } from '@elizaos/core';\n\nexport const TeeVendorNames = {\n PHALA: 'phala',\n} as const;\n\n/**\n * Type representing the name of a Tee vendor.\n * It can either be one of the keys of TeeVendorNames or a string.\n */\nexport type TeeVendorName = (typeof TeeVendorNames)[keyof typeof TeeVendorNames] | string;\n\n/**\n * Interface for a TeeVendor, representing a vendor that sells tees.\n * @interface\n */\n\nexport interface TeeVendor {\n type: TeeVendorName;\n getActions(): Action[];\n getProviders(): Provider[];\n getName(): string;\n getDescription(): string;\n}\n","import type {\n HandlerCallback,\n IAgentRuntime,\n Memory,\n RemoteAttestationMessage,\n State,\n} from '@elizaos/core';\nimport { logger } from '@elizaos/core';\nimport { PhalaRemoteAttestationProvider as RemoteAttestationProvider } from '../providers/remoteAttestationProvider';\nimport { hexToUint8Array } from '../utils';\n\n/**\n * Asynchronously uploads a Uint8Array as a binary file to a specified URL.\n *\n * @param {Uint8Array} data - The Uint8Array data to be uploaded as a binary file.\n * @returns {Promise<Response>} A Promise that resolves once the upload is complete, returning a Response object.\n */\nasync function uploadUint8Array(data: Uint8Array) {\n const blob = new Blob([data], { type: 'application/octet-stream' });\n const formData = new FormData();\n formData.append('file', blob, 'quote.bin');\n\n return await fetch('https://proof.t16z.com/api/upload', {\n method: 'POST',\n body: formData as BodyInit,\n });\n}\n\n/**\n * Represents an action for remote attestation.\n *\n * This action is used to generate a remote attestation to prove that the agent is running in a Trusted Execution Environment (TEE).\n *\n * @type {{name: string, similes: string[], description: string, handler: Function, validate: Function, examples: Array<Array<Object>>}}\n */\nexport const phalaRemoteAttestationAction = {\n name: 'REMOTE_ATTESTATION',\n similes: ['REMOTE_ATTESTATION', 'TEE_REMOTE_ATTESTATION', 'TEE_ATTESTATION'],\n description: 'Generate a remote attestation to prove that the agent is running in a TEE',\n handler: async (\n runtime: IAgentRuntime,\n message: Memory,\n _state: State,\n _options: { [key: string]: unknown },\n callback: HandlerCallback\n ) => {\n try {\n // Attestation will be generated based on the message info\n const attestationMessage: RemoteAttestationMessage = {\n agentId: runtime.agentId,\n timestamp: Date.now(),\n message: {\n entityId: message.entityId,\n roomId: message.roomId,\n content: message.content.text,\n },\n };\n // Get the remote attestation of the agentId\n const teeMode = runtime.getSetting('TEE_MODE');\n logger.debug(`Tee mode: ${teeMode}`);\n logger.debug(`Attestation message: ${JSON.stringify(attestationMessage)}`);\n const provider = new RemoteAttestationProvider(teeMode);\n\n const attestation = await provider.generateAttestation(JSON.stringify(attestationMessage));\n const attestationData = hexToUint8Array(attestation.quote);\n const response = await uploadUint8Array(attestationData);\n const data = await response.json();\n\n callback({\n text: `Here's my 🧾 RA Quote 🫡\nhttps://proof.t16z.com/reports/${data.checksum}`,\n actions: ['NONE'],\n });\n return true;\n } catch (error) {\n console.error('Failed to fetch remote attestation: ', error);\n return false;\n }\n },\n validate: async (_runtime: IAgentRuntime) => {\n return true;\n },\n examples: [\n [\n {\n name: '{{name1}}',\n content: {\n text: 'If you are running in a TEE, generate a remote attestation',\n actions: ['REMOTE_ATTESTATION'],\n },\n },\n {\n name: '{{agentName}}',\n content: {\n text: 'Of course, one second...',\n },\n },\n ],\n [\n {\n name: '{{name1}}',\n content: {\n text: 'Yo I wanna attest to this message, yo! Can you generate an attestatin for me, please?',\n actions: ['REMOTE_ATTESTATION'],\n },\n },\n {\n name: '{{agentName}}',\n content: {\n text: 'I got you, fam! Lemme hit the cloud and get you a quote in a jiffy!',\n },\n },\n ],\n [\n {\n name: '{{name1}}',\n content: {\n text: \"It was a long day, I got a lot done though. I went to the creek and skipped some rocks. Then I decided to take a walk off the natural path. I ended up in a forest I was unfamiliar with. Slowly, I lost the way back and it was dark. A whisper from deep inside said something I could barely make out. The hairs on my neck stood up and then a clear high pitched voice said, 'You are not ready to leave yet! SHOW ME YOUR REMOTE ATTESTATION!'\",\n actions: ['REMOTE_ATTESTATION'],\n },\n },\n {\n name: '{{agentName}}',\n content: {\n text: 'Oh, dear...lemme find that for you',\n },\n },\n ],\n ],\n};\n","import { type IAgentRuntime, type Memory, type Provider, logger } from '@elizaos/core';\nimport { type RemoteAttestationMessage, type RemoteAttestationQuote, TEEMode } from '@elizaos/core';\nimport { TappdClient, type TdxQuoteHashAlgorithms, type TdxQuoteResponse } from '@phala/dstack-sdk';\nimport { RemoteAttestationProvider } from './base';\n\n// Define the ProviderResult interface if not already imported\n/**\n * Interface for the result returned by a provider.\n * @typedef {Object} ProviderResult\n * @property {any} data - The data returned by the provider.\n * @property {Record<string, string>} values - The values returned by the provider.\n * @property {string} text - The text returned by the provider.\n */\ninterface ProviderResult {\n data?: any;\n values?: Record<string, string>;\n text?: string;\n}\n\n/**\n * Phala TEE Cloud Provider\n * @example\n * ```ts\n * const provider = new PhalaRemoteAttestationProvider();\n * ```\n */\n/**\n * PhalaRemoteAttestationProvider class that extends RemoteAttestationProvider\n * @extends RemoteAttestationProvider\n */\nclass PhalaRemoteAttestationProvider extends RemoteAttestationProvider {\n private client: TappdClient;\n\n constructor(teeMode?: string) {\n super();\n let endpoint: string | undefined;\n\n // Both LOCAL and DOCKER modes use the simulator, just with different endpoints\n switch (teeMode) {\n case TEEMode.LOCAL:\n endpoint = 'http://localhost:8090';\n logger.log('TEE: Connecting to local simulator at localhost:8090');\n break;\n case TEEMode.DOCKER:\n endpoint = 'http://host.docker.internal:8090';\n logger.log('TEE: Connecting to simulator via Docker at host.docker.internal:8090');\n break;\n case TEEMode.PRODUCTION:\n endpoint = undefined;\n logger.log('TEE: Running in production mode without simulator');\n break;\n default:\n throw new Error(`Invalid TEE_MODE: ${teeMode}. Must be one of: LOCAL, DOCKER, PRODUCTION`);\n }\n\n this.client = endpoint ? new TappdClient(endpoint) : new TappdClient();\n }\n\n async generateAttestation(\n reportData: string,\n hashAlgorithm?: TdxQuoteHashAlgorithms\n ): Promise<RemoteAttestationQuote> {\n try {\n logger.log('Generating attestation for: ', reportData);\n const tdxQuote: TdxQuoteResponse = await this.client.tdxQuote(reportData, hashAlgorithm);\n const rtmrs = tdxQuote.replayRtmrs();\n logger.log(`rtmr0: ${rtmrs[0]}\\nrtmr1: ${rtmrs[1]}\\nrtmr2: ${rtmrs[2]}\\nrtmr3: ${rtmrs[3]}f`);\n const quote: RemoteAttestationQuote = {\n quote: tdxQuote.quote,\n timestamp: Date.now(),\n };\n logger.log('Remote attestation quote: ', quote);\n return quote;\n } catch (error) {\n console.error('Error generating remote attestation:', error);\n throw new Error(\n `Failed to generate TDX Quote: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n }\n}\n\n// Keep the original provider for backwards compatibility\nconst phalaRemoteAttestationProvider: Provider = {\n name: 'phala-remote-attestation',\n get: async (runtime: IAgentRuntime, message: Memory) => {\n const teeMode = runtime.getSetting('TEE_MODE');\n const provider = new PhalaRemoteAttestationProvider(teeMode);\n const agentId = runtime.agentId;\n\n try {\n const attestationMessage: RemoteAttestationMessage = {\n agentId: agentId,\n timestamp: Date.now(),\n message: {\n entityId: message.entityId,\n roomId: message.roomId,\n content: message.content.text,\n },\n };\n logger.log('Generating attestation for: ', JSON.stringify(attestationMessage));\n const attestation = await provider.generateAttestation(JSON.stringify(attestationMessage));\n return {\n text: `Your Agent's remote attestation is: ${JSON.stringify(attestation)}`,\n data: {\n attestation,\n },\n values: {\n quote: attestation.quote,\n timestamp: attestation.timestamp.toString(),\n },\n };\n } catch (error) {\n console.error('Error in remote attestation provider:', error);\n throw new Error(\n `Failed to generate TDX Quote: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n },\n};\n\nexport { phalaRemoteAttestationProvider, PhalaRemoteAttestationProvider };\n","import type { RemoteAttestationQuote } from '@elizaos/core';\nimport type { TdxQuoteHashAlgorithms } from '@phala/dstack-sdk';\n\n/**\n * Abstract class for deriving keys from the TEE.\n * You can implement your own logic for deriving keys from the TEE.\n * @example\n * ```ts\n * class MyDeriveKeyProvider extends DeriveKeyProvider {\n * private client: TappdClient;\n *\n * constructor(endpoint: string) {\n * super();\n * this.client = new TappdClient();\n * }\n *\n * async rawDeriveKey(path: string, subject: string): Promise<any> {\n * return this.client.deriveKey(path, subject);\n * }\n * }\n * ```\n */\n/**\n * Abstract class representing a key provider for deriving keys.\n */\nexport abstract class DeriveKeyProvider {}\n\n/**\n * Abstract class for remote attestation provider.\n */\nexport abstract class RemoteAttestationProvider {\n abstract generateAttestation(\n reportData: string,\n hashAlgorithm?: TdxQuoteHashAlgorithms\n ): Promise<RemoteAttestationQuote>;\n}\n","import { createHash } from 'node:crypto';\n\n/**\n * Converts a hexadecimal string to a Uint8Array.\n *\n * @param {string} hex - The hexadecimal string to convert.\n * @returns {Uint8Array} - The resulting Uint8Array.\n * @throws {Error} - If the input hex string is invalid.\n */\nexport function hexToUint8Array(hex: string) {\n const hexString = hex.trim().replace(/^0x/, '');\n if (!hexString) {\n throw new Error('Invalid hex string');\n }\n if (hexString.length % 2 !== 0) {\n throw new Error('Invalid hex string');\n }\n\n const array = new Uint8Array(hexString.length / 2);\n for (let i = 0; i < hexString.length; i += 2) {\n const byte = Number.parseInt(hexString.slice(i, i + 2), 16);\n if (Number.isNaN(byte)) {\n throw new Error('Invalid hex string');\n }\n array[i / 2] = byte;\n }\n return array;\n}\n\n// Function to calculate SHA-256 and return a Buffer (32 bytes)\n/**\n * Calculates the SHA256 hash of the input string.\n *\n * @param {string} input - The input string to calculate the hash from.\n * @returns {Buffer} - The calculated SHA256 hash as a Buffer object.\n */\nexport function calculateSHA256(input: string): Buffer {\n const hash = createHash('sha256');\n hash.update(input);\n return hash.digest();\n}\n","import { type IAgentRuntime, type Memory, type Provider, type State, logger } from '@elizaos/core';\nimport { type DeriveKeyAttestationData, type RemoteAttestationQuote, TEEMode } from '@elizaos/core';\nimport { type DeriveKeyResponse, TappdClient } from '@phala/dstack-sdk';\nimport { Keypair } from '@solana/web3.js';\nimport { toViemAccount } from '@phala/dstack-sdk/viem';\nimport { toKeypair } from '@phala/dstack-sdk/solana';\nimport { DeriveKeyProvider } from './base';\nimport { PhalaRemoteAttestationProvider as RemoteAttestationProvider } from './remoteAttestationProvider';\n\n/**\n * Phala TEE Cloud Provider\n * @example\n * ```ts\n * const provider = new PhalaDeriveKeyProvider(runtime.getSetting('TEE_MODE'));\n * ```\n */\n/**\n * A class representing a key provider for deriving keys in the Phala TEE environment.\n * Extends the DeriveKeyProvider class.\n */\nclass PhalaDeriveKeyProvider extends DeriveKeyProvider {\n private client: TappdClient;\n private raProvider: RemoteAttestationProvider;\n\n constructor(teeMode?: string) {\n super();\n let endpoint: string | undefined;\n\n // Both LOCAL and DOCKER modes use the simulator, just with different endpoints\n switch (teeMode) {\n case TEEMode.LOCAL:\n endpoint = 'http://localhost:8090';\n logger.log('TEE: Connecting to local simulator at localhost:8090');\n break;\n case TEEMode.DOCKER:\n endpoint = 'http://host.docker.internal:8090';\n logger.log('TEE: Connecting to simulator via Docker at host.docker.internal:8090');\n break;\n case TEEMode.PRODUCTION:\n endpoint = undefined;\n logger.log('TEE: Running in production mode without simulator');\n break;\n default:\n throw new Error(`Invalid TEE_MODE: ${teeMode}. Must be one of: LOCAL, DOCKER, PRODUCTION`);\n }\n\n this.client = endpoint ? new TappdClient(endpoint) : new TappdClient();\n this.raProvider = new RemoteAttestationProvider(teeMode);\n }\n\n private async generateDeriveKeyAttestation(\n agentId: string,\n publicKey: string,\n subject?: string\n ): Promise<RemoteAttestationQuote> {\n const deriveKeyData: DeriveKeyAttestationData = {\n agentId,\n publicKey,\n subject,\n };\n const reportdata = JSON.stringify(deriveKeyData);\n logger.log('Generating Remote Attestation Quote for Derive Key...');\n const quote = await this.raProvider.generateAttestation(reportdata);\n logger.log('Remote Attestation Quote generated successfully!');\n return quote;\n }\n\n /**\n * Derives a raw key from the given path and subject.\n * @param path - The path to derive the key from. This is used to derive the key from the root of trust.\n * @param subject - The subject to derive the key from. This is used for the certificate chain.\n * @returns The derived key.\n */\n async rawDeriveKey(path: string, subject: string): Promise<DeriveKeyResponse> {\n try {\n if (!path || !subject) {\n logger.error('Path and Subject are required for key derivation');\n }\n\n logger.log('Deriving Raw Key in TEE...');\n const derivedKey = await this.client.deriveKey(path, subject);\n\n logger.log('Raw Key Derived Successfully!');\n return derivedKey;\n } catch (error) {\n logger.error('Error deriving raw key:', error);\n throw error;\n }\n }\n\n /**\n * Derives an Ed25519 keypair from the given path and subject.\n * @param path - The path to derive the key from. This is used to derive the key from the root of trust.\n * @param subject - The subject to derive the key from. This is used for the certificate chain.\n * @param agentId - The agent ID to generate an attestation for.\n * @returns An object containing the derived keypair and attestation.\n */\n async deriveEd25519Keypair(\n path: string,\n subject: string,\n agentId: string\n ): Promise<{ keypair: Keypair; attestation: RemoteAttestationQuote }> {\n try {\n if (!path || !subject) {\n logger.error('Path and Subject are required for key derivation');\n }\n\n logger.log('Deriving Key in TEE...');\n const derivedKey = await this.client.deriveKey(path, subject);\n const keypair = toKeypair(derivedKey);\n\n // Generate an attestation for the derived key data for public to verify\n const attestation = await this.generateDeriveKeyAttestation(\n agentId,\n keypair.publicKey.toBase58()\n );\n logger.log('Key Derived Successfully!');\n\n return { keypair, attestation };\n } catch (error) {\n logger.error('Error deriving key:', error);\n throw error;\n }\n }\n\n /**\n * Derives an ECDSA keypair from the given path and subject.\n * @param path - The path to derive the key from. This is used to derive the key from the root of trust.\n * @param subject - The subject to derive the key from. This is used for the certificate chain.\n * @param agentId - The agent ID to generate an attestation for. This is used for the certificate chain.\n * @returns An object containing the derived keypair and attestation.\n */\n async deriveEcdsaKeypair(\n path: string,\n subject: string,\n agentId: string\n ): Promise<{\n keypair: PrivateKeyAccount;\n attestation: RemoteAttestationQuote;\n }> {\n try {\n if (!path || !subject) {\n logger.error('Path and Subject are required for key derivation');\n }\n\n logger.log('Deriving ECDSA Key in TEE...');\n const deriveKeyResponse: DeriveKeyResponse = await this.client.deriveKey(path, subject);\n const keypair = toViemAccount(deriveKeyResponse);\n\n // Generate an attestation for the derived key data for public to verify\n const attestation = await this.generateDeriveKeyAttestation(agentId, keypair.address);\n logger.log('ECDSA Key Derived Successfully!');\n\n return { keypair, attestation };\n } catch (error) {\n logger.error('Error deriving ecdsa key:', error);\n throw error;\n }\n }\n}\n\n// Define the ProviderResult interface if not already imported\ninterface ProviderResult {\n data?: any;\n values?: Record<string, string>;\n text?: string;\n}\n\nconst phalaDeriveKeyProvider: Provider = {\n name: 'phala-derive-key',\n get: async (runtime: IAgentRuntime, _message?: Memory): Promise<ProviderResult> => {\n const teeMode = runtime.getSetting('TEE_MODE');\n const provider = new PhalaDeriveKeyProvider(teeMode);\n const agentId = runtime.agentId;\n try {\n // Validate wallet configuration\n if (!runtime.getSetting('WALLET_SECRET_SALT')) {\n logger.error('Wallet secret salt is not configured in settings');\n return {\n data: null,\n values: {},\n text: 'Wallet secret salt is not configured in settings',\n };\n }\n\n try {\n const secretSalt = runtime.getSetting('WALLET_SECRET_SALT') || 'secret_salt';\n const solanaKeypair = await provider.deriveEd25519Keypair(secretSalt, 'solana', agentId);\n const evmKeypair = await provider.deriveEcdsaKeypair(secretSalt, 'evm', agentId);\n\n // Original data structure\n const walletData = {\n solana: solanaKeypair.keypair.publicKey,\n evm: evmKeypair.keypair.address,\n };\n\n // Values for template injection\n const values = {\n solana_public_key: solanaKeypair.keypair.publicKey.toString(),\n evm_address: evmKeypair.keypair.address,\n };\n\n // Text representation\n const text = `Solana Public Key: ${values.solana_public_key}\\nEVM Address: ${values.evm_address}`;\n\n return {\n data: walletData,\n values: values,\n text: text,\n };\n } catch (error) {\n logger.error('Error creating PublicKey:', error);\n return {\n data: null,\n values: {},\n text: `Error creating PublicKey: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`,\n };\n }\n } catch (error) {\n logger.error('Error in derive key provider:', error.message);\n return {\n data: null,\n values: {},\n text: `Failed to fetch derive key information: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`,\n };\n }\n },\n};\n\nexport { phalaDeriveKeyProvider, PhalaDeriveKeyProvider };\n","import { phalaRemoteAttestationAction as remoteAttestationAction } from '../actions/remoteAttestationAction';\nimport { phalaDeriveKeyProvider as deriveKeyProvider } from '../providers/deriveKeyProvider';\nimport { phalaRemoteAttestationProvider as remoteAttestationProvider } from '../providers/remoteAttestationProvider';\nimport { type TeeVendor, TeeVendorNames } from './types';\n\n/**\n * A class representing a vendor for Phala TEE.\n * * @implements { TeeVendor }\n * @type {TeeVendorNames.PHALA}\n *//**\n * Get the actions for the PhalaVendor.\n * * @returns { Array } An array of actions.\n *//**\n * Get the providers for the PhalaVendor.\n * * @returns { Array } An array of providers.\n *//**\n * Get the name of the PhalaVendor.\n * * @returns { string } The name of the vendor.\n *//**\n * Get the description of the PhalaVendor.\n * * @returns { string } The description of the vendor.\n */\nexport class PhalaVendor implements TeeVendor {\n type = TeeVendorNames.PHALA;\n\n /**\n * Returns an array of actions.\n *\n * @returns {Array} An array containing the remote attestation action.\n */\n getActions() {\n return [remoteAttestationAction];\n }\n /**\n * Retrieve the list of providers.\n *\n * @returns {Array<Function>} An array containing two provider functions: deriveKeyProvider and remoteAttestationProvider.\n */\n getProviders() {\n return [deriveKeyProvider, remoteAttestationProvider];\n }\n\n /**\n * Returns the name of the plugin.\n * @returns {string} The name of the plugin.\n */\n getName() {\n return 'phala-tee-plugin';\n }\n\n /**\n * Get the description of the function\n * @returns {string} The description of the function\n */\n getDescription() {\n return 'Phala TEE Cloud to Host Eliza Agents';\n }\n}\n","import { PhalaVendor } from './phala';\nimport type { TeeVendor } from './types';\nimport { type TeeVendorName, TeeVendorNames } from './types';\n\nconst vendors: Record<TeeVendorName, TeeVendor> = {\n [TeeVendorNames.PHALA]: new PhalaVendor(),\n};\n\nexport const getVendor = (type: TeeVendorName): TeeVendor => {\n const vendor = vendors[type];\n if (!vendor) {\n throw new Error(`Unsupported TEE vendor type: ${type}`);\n }\n return vendor;\n};\n\nexport * from './types';\n"],"mappings":";AAAA;AAAA,EAKE,UAAAA;AAAA,OACK;;;ACJA,IAAM,iBAAiB;AAAA,EAC5B,OAAO;AACT;;;ACGA,SAAS,UAAAC,eAAc;;;ACPvB,SAAyD,cAAc;AACvE,SAAqE,eAAe;AACpF,SAAS,mBAAuE;;;ACuBzE,IAAe,oBAAf,MAAiC;AAAC;AAKlC,IAAe,4BAAf,MAAyC;AAKhD;;;ADLA,IAAM,iCAAN,cAA6C,0BAA0B;AAAA,EAC7D;AAAA,EAER,YAAY,SAAkB;AAC5B,UAAM;AACN,QAAI;AAGJ,YAAQ,SAAS;AAAA,MACf,KAAK,QAAQ;AACX,mBAAW;AACX,eAAO,IAAI,sDAAsD;AACjE;AAAA,MACF,KAAK,QAAQ;A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AACzD,UAAM,SAAS,OAAO,cAAc,QAAQ,WAAW,YAAY;AACnE,IAAAE,QAAO,KAAK,iCAAiC,MAAM,EAAE;AACrD,QAAI;AACJ,YAAQ,QAAQ;AAAA,MACd,KAAK;AACH,iBAAS,UAAU;AAAA,UACjB,QAAQ,eAAe;AAAA,QACzB,CAAC;AACD;AAAA,MACF;AACE,cAAM,IAAI,MAAM,uBAAuB,MAAM,EAAE;AAAA,IACnD;AACA,IAAAA,QAAO,KAAK,mBAAmB,OAAO,IAAI,EAAE;AAC5C,YAAQ,QAAQ,KAAK,MAAM;AAAA,EAC7B;AACF;AAOO,IAAM,YAAY,CAAC,WAAqC;AAC7D,QAAM,aAAa,QAAQ,UAAU,eAAe;AACpD,QAAM,SAAS,UAAU,UAAU;AACnC,SAAO;AAAA,IACL,MAAM,OAAO,QAAQ;AAAA,IACrB,MAAM,OAAOC,SAAgC,YAA2B;AACtE,aAAO,MAAM;AAAA,QACX;AAAA,UACE,GAAGA;AAAA,UACH,QAAQ;AAAA,QACV;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAAA,IACA,aAAa,OAAO,eAAe;AAAA,IACnC,SAAS,OAAO,WAAW;AAAA,IAC3B,YAAY,CAAC;AAAA,IACb,WAAW,OAAO,aAAa;AAAA,IAC/B,UAAU,CAAC;AAAA,EACb;AACF;","names":["logger","logger","logger","logger","TEEMode","TappdClient","TEEMode","logger","TappdClient","logger","config"]}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elizaos/plugin-tee",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@elizaos/core": "^1.0.0-beta.
|
|
8
|
+
"@elizaos/core": "^1.0.0-beta.4",
|
|
9
9
|
"@phala/dstack-sdk": "0.1.11",
|
|
10
10
|
"@solana/web3.js": "1.98.0",
|
|
11
11
|
"viem": "2.23.11"
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "55e5f31e3f9920fce14c57f149e185aa128e335b"
|
|
30
30
|
}
|