Skip to content

Commit f79e3dc

Browse files
chore(wrapped-keys-lit-actions): LIT-3920 - Update signTransactionWithEncryptedSolanaKey LA to validate unsigned tx before decrypting the private key
1 parent 765b437 commit f79e3dc

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

local-tests/test.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -291,22 +291,22 @@ setLitActionsCodeToLocal();
291291
tests: {
292292
// testExample,
293293
// testBundleSpeed,
294-
...eoaSessionSigsTests,
295-
...pkpSessionSigsTests,
296-
...litActionSessionSigsTests,
297-
...litActionIpfsIdSessionSigsTests,
298-
...capacityDelegationTests,
299-
...bareAuthSigTests,
300-
301-
...pkpEthersTest.eoaSessionSigs,
302-
...pkpEthersTest.pkpSessionSigs,
303-
...pkpEthersTest.litActionSessionSigs,
304-
305-
...litActionCombiningTests.broadcastAndCombine,
306-
...litActionCombiningTests.decryptAndCombine,
307-
...litActionCombiningTests.ecdsaSignAndCombine,
308-
309-
...relayerTests,
294+
// ...eoaSessionSigsTests,
295+
// ...pkpSessionSigsTests,
296+
// ...litActionSessionSigsTests,
297+
// ...litActionIpfsIdSessionSigsTests,
298+
// ...capacityDelegationTests,
299+
// ...bareAuthSigTests,
300+
//
301+
// ...pkpEthersTest.eoaSessionSigs,
302+
// ...pkpEthersTest.pkpSessionSigs,
303+
// ...pkpEthersTest.litActionSessionSigs,
304+
//
305+
// ...litActionCombiningTests.broadcastAndCombine,
306+
// ...litActionCombiningTests.decryptAndCombine,
307+
// ...litActionCombiningTests.ecdsaSignAndCombine,
308+
//
309+
// ...relayerTests,
310310
...wrappedKeysTests,
311311
},
312312
devEnv,

packages/wrapped-keys-lit-actions/src/lib/solana/internal/signTransaction.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const {
77

88
/* global ethers */
99

10-
function validateUnsignedTransaction(unsignedTransaction) {
10+
export function validateUnsignedTransaction(unsignedTransaction) {
1111
const VALID_NETWORKS = ['devnet', 'testnet', 'mainnet-beta'];
1212

1313
if (!VALID_NETWORKS.includes(unsignedTransaction.chain)) {
@@ -48,7 +48,7 @@ export async function signTransactionSolanaKey({
4848
privateKey,
4949
unsignedTransaction,
5050
}) {
51-
validateUnsignedTransaction(unsignedTransaction);
51+
// Be sure you call validateUnsignedTransaction(unsignedTransaction); before calling this method!
5252

5353
const solanaKeyPair = Keypair.fromSecretKey(Buffer.from(privateKey, 'hex'));
5454

packages/wrapped-keys-lit-actions/src/lib/solana/signTransactionWithEncryptedSolanaKey.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
const { signTransactionSolanaKey } = require('./internal/signTransaction');
1+
const {
2+
signTransactionSolanaKey,
3+
validateUnsignedTransaction,
4+
} = require('./internal/signTransaction');
25
const {
36
getDecryptedKeyToSingleNode,
47
} = require('../common/internal/getDecryptedKeyToSingleNode');
@@ -22,6 +25,8 @@ const { removeSaltFromDecryptedKey } = require('../utils');
2225

2326
(async () => {
2427
try {
28+
validateUnsignedTransaction(unsignedTransaction);
29+
2530
const decryptedPrivateKey = await getDecryptedKeyToSingleNode({
2631
accessControlConditions,
2732
ciphertext,

0 commit comments

Comments
 (0)