Skip to content

Commit 4cefcba

Browse files
authored
Merge pull request #2049 from elizaOS/revert-2039-fix/tee-derive-key
Revert "fix: Update Key Derive in TEE"
2 parents 941b8d1 + e6b5bbe commit 4cefcba

File tree

9 files changed

+8
-354
lines changed

9 files changed

+8
-354
lines changed

docs/docs/advanced/eliza-in-tee.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,16 @@ Example usage:
5757
const provider = new DeriveKeyProvider(teeMode);
5858
// For Solana
5959
const { keypair, attestation } = await provider.deriveEd25519Keypair(
60+
"/",
6061
secretSalt,
61-
"solana",
6262
agentId,
6363
);
6464
// For EVM
6565
const { keypair, attestation } = await provider.deriveEcdsaKeypair(
66+
"/",
6667
secretSalt,
67-
"evm",
6868
agentId,
6969
);
70-
71-
// For raw key derivation
72-
const rawKey = await provider.deriveRawKey(
73-
secretSalt,
74-
"raw",
75-
);
7670
```
7771

7872
---

packages/plugin-evm/src/providers/wallet.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ export const initWalletProvider = async (runtime: IAgentRuntime) => {
292292

293293
const deriveKeyProvider = new DeriveKeyProvider(teeMode);
294294
const deriveKeyResult = await deriveKeyProvider.deriveEcdsaKeypair(
295+
"/",
295296
walletSecretSalt,
296-
"evm",
297297
runtime.agentId
298298
);
299299
return new WalletProvider(

packages/plugin-solana/src/keypairUtils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export async function getWalletKey(
3030

3131
const deriveKeyProvider = new DeriveKeyProvider(teeMode);
3232
const deriveKeyResult = await deriveKeyProvider.deriveEd25519Keypair(
33+
"/",
3334
walletSecretSalt,
34-
"solana",
3535
runtime.agentId
3636
);
3737

packages/plugin-tee/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
"scripts": {
3333
"build": "tsup --format esm --dts",
3434
"dev": "tsup --format esm --dts --watch",
35-
"lint": "eslint --fix --cache .",
36-
"test": "vitest run"
35+
"lint": "eslint --fix --cache ."
3736
},
3837
"peerDependencies": {
3938
"whatwg-url": "7.1.0"

packages/plugin-tee/src/providers/deriveKeyProvider.ts

+2-22
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ class DeriveKeyProvider {
7272
return quote;
7373
}
7474

75-
/**
76-
* Derives a raw key from the given path and subject.
77-
* @param path - The path to derive the key from. This is used to derive the key from the root of trust.
78-
* @param subject - The subject to derive the key from. This is used for the certificate chain.
79-
* @returns The derived key.
80-
*/
8175
async rawDeriveKey(
8276
path: string,
8377
subject: string
@@ -100,13 +94,6 @@ class DeriveKeyProvider {
10094
}
10195
}
10296

103-
/**
104-
* Derives an Ed25519 keypair from the given path and subject.
105-
* @param path - The path to derive the key from. This is used to derive the key from the root of trust.
106-
* @param subject - The subject to derive the key from. This is used for the certificate chain.
107-
* @param agentId - The agent ID to generate an attestation for.
108-
* @returns An object containing the derived keypair and attestation.
109-
*/
11097
async deriveEd25519Keypair(
11198
path: string,
11299
subject: string,
@@ -143,13 +130,6 @@ class DeriveKeyProvider {
143130
}
144131
}
145132

146-
/**
147-
* Derives an ECDSA keypair from the given path and subject.
148-
* @param path - The path to derive the key from. This is used to derive the key from the root of trust.
149-
* @param subject - The subject to derive the key from. This is used for the certificate chain.
150-
* @param agentId - The agent ID to generate an attestation for. This is used for the certificate chain.
151-
* @returns An object containing the derived keypair and attestation.
152-
*/
153133
async deriveEcdsaKeypair(
154134
path: string,
155135
subject: string,
@@ -204,13 +184,13 @@ const deriveKeyProvider: Provider = {
204184
const secretSalt =
205185
runtime.getSetting("WALLET_SECRET_SALT") || "secret_salt";
206186
const solanaKeypair = await provider.deriveEd25519Keypair(
187+
"/",
207188
secretSalt,
208-
"solana",
209189
agentId
210190
);
211191
const evmKeypair = await provider.deriveEcdsaKeypair(
192+
"/",
212193
secretSalt,
213-
"evm",
214194
agentId
215195
);
216196
return JSON.stringify({

packages/plugin-tee/src/providers/walletProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,8 @@ const walletProvider: Provider = {
299299
keypair: Keypair;
300300
attestation: RemoteAttestationQuote;
301301
} = await deriveKeyProvider.deriveEd25519Keypair(
302+
"/",
302303
runtime.getSetting("WALLET_SECRET_SALT"),
303-
"solana",
304304
agentId
305305
);
306306
publicKey = derivedKeyPair.keypair.publicKey;

packages/plugin-tee/src/tests/deriveKey.test.ts

-135
This file was deleted.

packages/plugin-tee/src/tests/remoteAttestation.test.ts

-81
This file was deleted.

0 commit comments

Comments
 (0)