Skip to content

Commit 602658d

Browse files
committed
Tidy up decrypt scenario
1 parent cab70d6 commit 602658d

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

packages/artillery/src/processors/multi-endpoints.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -262,20 +262,26 @@ export async function runExecuteJSTest(context: any, _events: any) {
262262

263263
// Set up access control conditions requiring wallet ownership
264264
const builder = createAccBuilder();
265-
const accs = builder
266-
.requireWalletOwnership(authContext.account.address)
267-
.on('ethereum')
268-
.build();
269-
265+
let accs: any;
270266
let encryptedData: any;
271267
if (variant === 'decryptToSingleNode') {
268+
accs = builder
269+
.requireWalletOwnership(authContext.account.address)
270+
.on('ethereum')
271+
.build();
272+
272273
// Encrypt data with the access control conditions
273274
const dataToEncrypt = 'Hello from encrypt-decrypt test!';
274275
encryptedData = await litClient.encrypt({
275276
dataToEncrypt,
276277
unifiedAccessControlConditions: accs,
277278
chain: 'ethereum',
278279
});
280+
} else {
281+
accs = builder
282+
.requireWalletOwnership(state.masterAccount.pkp.ethAddress)
283+
.on('ethereum')
284+
.build();
279285
}
280286

281287
// Perform executeJs operation
@@ -284,7 +290,7 @@ export async function runExecuteJSTest(context: any, _events: any) {
284290
state,
285291
encryptedData,
286292
accs,
287-
null
293+
await authContext.authNeededCallback()
288294
);
289295

290296
const result = await litClient.executeJs({
@@ -435,20 +441,19 @@ function getLitActionCodeAndJsParams(
435441
return {
436442
litActionCode: `
437443
(async () => {
438-
const { accessControlConditions, authSig, ciphertext, dataToEncryptHash } = jsParams;
439-
const resp = await Lit.Actions.decryptAndCombine({
444+
const { accessControlConditions, ciphertext, dataToEncryptHash } = jsParams;
445+
const resp = await Lit.Actions.decryptToSingleNode({
440446
accessControlConditions,
441447
ciphertext,
442448
dataToEncryptHash,
443-
authSig,
449+
authSig: null,
444450
chain: 'ethereum',
445451
});
446452
Lit.Actions.setResponse({ response: JSON.stringify(resp) });
447453
})();`,
448454
jsParams: {
449455
accessControlConditions:
450456
accs || state.masterAccount.pkp.accessControlConditions,
451-
authSig,
452457
ciphertext: encryptedData?.ciphertext,
453458
dataToEncryptHash: encryptedData?.dataToEncryptHash,
454459
},

0 commit comments

Comments
 (0)