From 5b7e311397cfaef3732822016c38f75659de4a9c Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Wed, 24 Apr 2024 15:28:03 +0100 Subject: [PATCH 01/20] fix(sessionKey): signed session key mismatch with the one being signed due to storage provider not found --- .../src/lib/lit-node-client-nodejs.ts | 27 ++++++++++++++++++- packages/types/src/lib/interfaces.ts | 5 ++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index be9431ae2b..6d967eaf85 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -107,6 +107,7 @@ import type { WebAuthnAuthenticationVerificationParams, ILitNodeClient, GetPkpSessionSigs, + SessionKeyCache, } from '@lit-protocol/types'; // TODO: move this to auth-helper for next patch @@ -126,6 +127,11 @@ interface CapacityCreditsRes { capacityDelegationAuthSig: AuthSig; } +const TEMP_CACHE_PERIOD = 30000; // 30 seconds + +// Global cache variable +let sessionKeyCache: SessionKeyCache | null = null; + export class LitNodeClientNodeJs extends LitCore implements LitClientSessionManager, ILitNodeClient @@ -385,6 +391,15 @@ export class LitNodeClientNodeJs `Storage key "${storageKey}" is missing. Not a problem. Contiune...` ); + // Check if a valid session key exists in cache + if ( + sessionKeyCache && + Date.now() - sessionKeyCache.timestamp < TEMP_CACHE_PERIOD + ) { + log(`[getSessionKey] Returning session key from cache.`); + return sessionKeyCache.value; + } + // Generate new one const newSessionKey = generateSessionKeyPair(); @@ -392,7 +407,17 @@ export class LitNodeClientNodeJs try { localStorage.setItem(storageKey, JSON.stringify(newSessionKey)); } catch (e) { - console.warn(`Localstorage not available. Not a problem. Contiune...`); + log( + `[getSessionKey] Localstorage not available.Not a problem.Contiune...` + ); + + // Store in cache + sessionKeyCache = { + value: newSessionKey, + timestamp: Date.now(), + }; + + log(`[getSessionKey] newSessionKey set to cache: `, sessionKeyCache); } return newSessionKey; diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index 1454ba293b..8f04c5df42 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -1612,3 +1612,8 @@ export interface GetPkpSessionSigs extends GetSessionSigsProps { sigName?: string; }; } + +export type SessionKeyCache = { + value: SessionKeyPair; + timestamp: number; +}; \ No newline at end of file From 4344d6af189b9b4fd53a84b2365b24ccc8cc74b0 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Wed, 24 Apr 2024 15:45:21 +0100 Subject: [PATCH 02/20] chore: pretty pretty lint --- packages/types/src/lib/interfaces.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index 8f04c5df42..5e178beed5 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -1616,4 +1616,4 @@ export interface GetPkpSessionSigs extends GetSessionSigsProps { export type SessionKeyCache = { value: SessionKeyPair; timestamp: number; -}; \ No newline at end of file +}; From 72bcd8d6485bf7a9dfe12c1a4e9e1a177841d9e4 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Wed, 24 Apr 2024 16:00:08 +0100 Subject: [PATCH 03/20] feat(accs): added compose lit action resource string helper function --- packages/auth-helpers/src/lib/resources.ts | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/packages/auth-helpers/src/lib/resources.ts b/packages/auth-helpers/src/lib/resources.ts index dee4c794fa..cda889d7ee 100644 --- a/packages/auth-helpers/src/lib/resources.ts +++ b/packages/auth-helpers/src/lib/resources.ts @@ -1,8 +1,11 @@ import { + AccessControlConditions, ILitResource, LitAbility, LitResourcePrefix, } from '@lit-protocol/types'; +import { hashAccessControlConditions } from '@lit-protocol/access-control-conditions'; +import { uint8arrayToString } from '@lit-protocol/uint8arrays'; abstract class LitResourceBase { abstract resourcePrefix: LitResourcePrefix; @@ -42,6 +45,34 @@ export class LitAccessControlConditionResource litAbility === LitAbility.AccessControlConditionSigning ); } + + /** + * Composes a resource string by hashing access control conditions and appending a data hash. + * + * @param {AccessControlConditions} accs - The access control conditions to hash. + * @param {string} dataToEncryptHash - The hash of the data to encrypt. + * @returns {Promise} The composed resource string in the format 'hashedAccs/dataToEncryptHash'. + */ + public static async composeLitActionResourceString( + accs: AccessControlConditions, + dataToEncryptHash: string + ): Promise { + if (!accs || !dataToEncryptHash) { + throw new Error( + 'Invalid input: Access control conditions and data hash are required.' + ); + } + + const hashedAccs = await hashAccessControlConditions(accs); + const hashedAccsStr = uint8arrayToString( + new Uint8Array(hashedAccs), + 'base16' + ); + + const resourceString = `${hashedAccsStr}/${dataToEncryptHash}`; + + return resourceString; + } } export class LitPKPResource extends LitResourceBase implements ILitResource { From fe71ddfba4c9701c513bb649a4e53af45ea66bd8 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Wed, 24 Apr 2024 16:00:28 +0100 Subject: [PATCH 04/20] feat(types): better interfaces --- packages/types/src/lib/interfaces.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index 1eb5295bce..8ffafc8abd 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -226,7 +226,7 @@ export interface BaseJsonExecutionRequest { // authSig?: AuthSig; // An object that contains params to expose to the Lit Action. These will be injected to the JS runtime before your code runs, so you can use any of these as normal variables in your Lit Action. - jsParams: any; + jsParams?: any; // JS code to run on the nodes code?: string; @@ -530,7 +530,19 @@ export interface SignConditionECDSA { * */ export interface ExecuteJsResponse { - signatures: any; + success?: boolean; + signatures: + | { + sig: { + r: string; + s: string; + recid: number; + signature: string; // 0x... + publicKey: string; // pkp public key + dataSigned: string; + }; + } + | any; decryptions: any[]; response: string; logs: string; From 430abb7f8b841a21823d1248ebd52cf0dfed3660 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Wed, 24 Apr 2024 16:00:58 +0100 Subject: [PATCH 05/20] feat(test): add new e2e tests --- local-tests/test.ts | 103 +++++++++- ...pacityCreditsNFTToAnotherPkpToExecuteJs.ts | 128 +++++++++++++ ...ityCreditsNFTToAnotherWalletToExecuteJs.ts | 116 +++++++++++ ...acityCreditsNFTToAnotherWalletToPkpSign.ts | 98 ++++++++++ ...thUnspecifiedCapacityTokenIdToExecuteJs.ts | 120 ++++++++++++ ...WithUnspecifiedCapacityTokenIdToPkpSign.ts | 100 ++++++++++ ...SigWithUnspecifiedDelegateesToExecuteJs.ts | 118 ++++++++++++ ...thSigWithUnspecifiedDelegateesToPkpSign.ts | 94 +++++++++ ...stUseEoaSessionSigsToEncryptDecryptFile.ts | 96 ++++++++++ ...UseEoaSessionSigsToEncryptDecryptString.ts | 89 +++++++++ ...estUseEoaSessionSigsToEncryptDecryptZip.ts | 91 +++++++++ ...stUseEoaSessionSigsToExecuteJsClaimKeys.ts | 181 ++++++++++++++++++ ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 105 ++++++++++ ...tUseEoaSessionSigsToExecuteJsConsoleLog.ts | 54 ++++++ ...seEoaSessionSigsToExecuteJsJsonResponse.ts | 69 +++++++ ...testUseEoaSessionSigsToExecuteJsSigning.ts | 66 +++++++ ...SessionSigsToExecuteJsSigningInParallel.ts | 121 ++++++++++++ .../tests/testUseEoaSessionSigsToPkpSign.ts | 62 ++++++ ...validLitActionCodeToGenerateSessionSigs.ts | 32 ++++ ...stUsePkpSessionSigsToEncryptDecryptFile.ts | 97 ++++++++++ ...UsePkpSessionSigsToEncryptDecryptString.ts | 83 ++++++++ ...estUsePkpSessionSigsToEncryptDecryptZip.ts | 92 +++++++++ ...stUsePkpSessionSigsToExecuteJsClaimKeys.ts | 170 ++++++++++++++++ ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 104 ++++++++++ ...tUsePkpSessionSigsToExecuteJsConsoleLog.ts | 52 +++++ ...sePkpSessionSigsToExecuteJsJsonResponse.ts | 69 +++++++ ...testUsePkpSessionSigsToExecuteJsSigning.ts | 80 ++++++++ ...SessionSigsToExecuteJsSigningInParallel.ts | 121 ++++++++++++ .../tests/testUsePkpSessionSigsToPkpSign.ts | 60 ++++++ ...eneratedSessionSigsToEncryptDecryptFile.ts | 99 ++++++++++ ...eratedSessionSigsToEncryptDecryptString.ts | 87 +++++++++ ...GeneratedSessionSigsToEncryptDecryptZip.ts | 94 +++++++++ ...eneratedSessionSigsToExecuteJsClaimKeys.ts | 116 +++++++++++ ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 106 ++++++++++ ...neratedSessionSigsToExecuteJsConsoleLog.ts | 67 +++++++ ...ratedSessionSigsToExecuteJsJsonResponse.ts | 70 +++++++ ...eGeneratedSessionSigsToExecuteJsSigning.ts | 82 ++++++++ ...SessionSigsToExecuteJsSigningInParallel.ts | 123 ++++++++++++ ...ActionCodeGeneratedSessionSigsToPkpSign.ts | 67 +++++++ 39 files changed, 3677 insertions(+), 5 deletions(-) create mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts create mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts create mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts create mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts create mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts create mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts create mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts create mode 100644 local-tests/tests/testUseEoaSessionSigsToPkpSign.ts create mode 100644 local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts create mode 100644 local-tests/tests/testUsePkpSessionSigsToPkpSign.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts create mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts diff --git a/local-tests/test.ts b/local-tests/test.ts index bfc0bcf724..24afa4b0f2 100644 --- a/local-tests/test.ts +++ b/local-tests/test.ts @@ -1,8 +1,47 @@ -import { LIT_ENDPOINT_VERSION, LIT_TESTNET } from './setup/tinny-config'; +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from './setup/tinny-config'; import { TinnyEnvironment } from './setup/tinny-environment'; import { runInBand, runTestsParallel } from './setup/tinny-operations'; -import { testBundleSpeed } from './tests/test-bundle-speed'; -import { testExample } from './tests/test-example'; +// import { testBundleSpeed } from './tests/test-bundle-speed'; +// import { testExample } from './tests/test-example'; +import { testUseEoaSessionSigsToExecuteJsSigning } from './tests/testUseEoaSessionSigsToExecuteJsSigning'; +import { testUseEoaSessionSigsToPkpSign } from './tests/testUseEoaSessionSigsToPkpSign'; +import { testUsePkpSessionSigsToExecuteJsSigning } from './tests/testUsePkpSessionSigsToExecuteJsSigning'; +import { testUsePkpSessionSigsToPkpSign } from './tests/testUsePkpSessionSigsToPkpSign'; +import { testUseValidLitActionCodeGeneratedSessionSigsToPkpSign } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning'; +import { testUseEoaSessionSigsToExecuteJsSigningInParallel } from './tests/testUseEoaSessionSigsToExecuteJsSigningInParallel'; +import { testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'; +import { testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign } from './tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign'; +import { testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs } from './tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs'; +import { testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs } from './tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs'; +import { testUseEoaSessionSigsToExecuteJsClaimKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimKeys'; +import { testUseEoaSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUseEoaSessionSigsToExecuteJsJsonResponse } from './tests/testUseEoaSessionSigsToExecuteJsJsonResponse'; +import { testUseEoaSessionSigsToExecuteJsConsoleLog } from './tests/testUseEoaSessionSigsToExecuteJsConsoleLog'; +import { testUseEoaSessionSigsToEncryptDecryptString } from './tests/testUseEoaSessionSigsToEncryptDecryptString'; +import { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; +import { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; +import { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; +import { testUseEoaSessionSigsToEncryptDecryptZip } from './tests/testUseEoaSessionSigsToEncryptDecryptZip'; +import { testUsePkpSessionSigsToExecuteJsSigningInParallel } from './tests/testUsePkpSessionSigsToExecuteJsSigningInParallel'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel'; +import { testUsePkpSessionSigsToExecuteJsClaimKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimKeys'; +import { testUsePkpSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUsePkpSessionSigsToExecuteJsJsonResponse } from './tests/testUsePkpSessionSigsToExecuteJsJsonResponse'; +import { testUsePkpSessionSigsToExecuteJsConsoleLog } from './tests/testUsePkpSessionSigsToExecuteJsConsoleLog'; +import { testUsePkpSessionSigsToEncryptDecryptFile } from './tests/testUsePkpSessionSigsToEncryptDecryptFile'; +import { testUsePkpSessionSigsToEncryptDecryptZip } from './tests/testUsePkpSessionSigsToEncryptDecryptZip'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse'; +import { testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile'; +import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip'; (async () => { console.log('[𐬺πŸ§ͺ Tinny𐬺] Running tests...'); @@ -23,10 +62,64 @@ import { testExample } from './tests/test-example'; ); } + const eoaSessionSigsTests = { + testUseEoaSessionSigsToExecuteJsSigning, + testUseEoaSessionSigsToPkpSign, + testUseEoaSessionSigsToExecuteJsSigningInParallel, + testUseEoaSessionSigsToExecuteJsClaimKeys, + testUseEoaSessionSigsToExecuteJsClaimMultipleKeys, + testUseEoaSessionSigsToExecuteJsJsonResponse, + testUseEoaSessionSigsToExecuteJsConsoleLog, + testUseEoaSessionSigsToEncryptDecryptString, + testUseEoaSessionSigsToEncryptDecryptFile, + testUseEoaSessionSigsToEncryptDecryptZip, + }; + + const pkpSessionSigsTests = { + testUsePkpSessionSigsToExecuteJsSigning, + testUsePkpSessionSigsToPkpSign, + testUsePkpSessionSigsToExecuteJsSigningInParallel, + testUsePkpSessionSigsToExecuteJsClaimKeys, + testUsePkpSessionSigsToExecuteJsClaimMultipleKeys, + testUsePkpSessionSigsToExecuteJsJsonResponse, + testUsePkpSessionSigsToExecuteJsConsoleLog, + testUsePkpSessionSigsToEncryptDecryptString, + testUsePkpSessionSigsToEncryptDecryptFile, + testUsePkpSessionSigsToEncryptDecryptZip, + }; + + const litActionSessionSigsTests = { + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning, + testUseValidLitActionCodeGeneratedSessionSigsToPkpSign, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse, + testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile, + testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip, + testUseInvalidLitActionCodeToGenerateSessionSigs, + }; + + const capacityDelegationTests = { + testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs, + testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign, + testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs, + testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign, + }; + const testConfig = { tests: { - testExample, - testBundleSpeed, + // testExample, + // testBundleSpeed, + ...eoaSessionSigsTests, + ...pkpSessionSigsTests, + ...litActionSessionSigsTests, + ...capacityDelegationTests, }, devEnv, }; diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts new file mode 100644 index 0000000000..f8de798aa5 --- /dev/null +++ b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts @@ -0,0 +1,128 @@ +import { + AuthMethodScope, + AuthMethodType, + LIT_ENDPOINT_VERSION, +} from '@lit-protocol/constants'; +import { LitAuthClient } from '@lit-protocol/lit-auth-client'; +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LitAbility } from '@lit-protocol/types'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; + +/** + * ## Scenario: + * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP + * - Given: The capacity credits NFT is minted by the dApp owner + * - When: The dApp owner creates a capacity delegation authSig + * - And: The dApp owner delegates the capacity credits NFT to Bob + * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT + * + * + * ## Test Commands: + * - ❌ Not supported in Cayenne + * - βœ… NETWORK=manzano yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs + * - βœ… NETWORK=localchain yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs + */ +export const testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs = async ( + devEnv: TinnyEnvironment +) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + // Checking the scopes of the PKP owned by Bob + const bobsAuthMethodAuthId = await LitAuthClient.getAuthIdByAuthMethod( + bob.authMethod + ); + + const scopes = + await bob.contractsClient.pkpPermissionsContract.read.getPermittedAuthMethodScopes( + bob.authMethodOwnedPkp.tokenId, + AuthMethodType.EthWallet, + bobsAuthMethodAuthId, + 3 + ); + + if (!scopes[AuthMethodScope.SignAnything]) { + throw new Error('Bob does not have the "SignAnything" scope on his PKP'); + } + + // As a dApp owner, create a capacity delegation authSig for Bob's PKP wallet + const capacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig( + [bob.pkp.ethAddress] + ); + + // As a dApp owner, delegate the capacity credits NFT to Bob + const bobPkpSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ + pkpPublicKey: bob.authMethodOwnedPkp.publicKey, + authMethods: [bob.authMethod], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ], + capabilityAuthSigs: [capacityDelegationAuthSig], + }); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobPkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.authMethodOwnedPkp.publicKey, + }, + }); + + console.log('βœ… res:', res); + + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "00fdf6f2fc3f13410393939bb678c8ec26c0eb46bfc39dbecdcf58540b7f9237", + // s: "480b578c78137150db2420669c47b220001b42a0bb4e92194ce7b76f6fd78ddc", + // recid: 0, + // signature: "0x00fdf6f2fc3f13410393939bb678c8ec26c0eb46bfc39dbecdcf58540b7f9237480b578c78137150db2420669c47b220001b42a0bb4e92194ce7b76f6fd78ddc1b", + // publicKey: "0465BFEE5CCFF60C0AF1D9B9481B680C2E34894A88F68F44CC094BA27501FD062A3C4AC61FA850BFA22D81D41AF72CBF983909501440FE51187F5FB3D1BC55C44E", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } +}; diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts new file mode 100644 index 0000000000..b3b7bc0a15 --- /dev/null +++ b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts @@ -0,0 +1,116 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP + * - Given: The capacity credits NFT is minted by the dApp owner + * - When: The dApp owner creates a capacity delegation authSig + * - And: The dApp owner delegates the capacity credits NFT to Bob + * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT + * + * + * ## Test Commands: + * - ❌ Not supported in Cayenne, but session sigs would still work + * - βœ… NETWORK=manzano yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs + * - βœ… NETWORK=localchain yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs + */ +export const testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = + await alice.createCapacityDelegationAuthSig([bob.wallet.address]); + + // 4. Bob receives the capacity delegation authSig use it to generate session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey, + }, + }); + + // Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", + // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", + // recid: 1, + // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", + // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- signatures.sig.recid must be parseable as a number + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + console.log( + 'βœ… testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs' + ); + }; diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts new file mode 100644 index 0000000000..00b0f4984b --- /dev/null +++ b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts @@ -0,0 +1,98 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP + * - Given: The capacity credits NFT is minted by the dApp owner + * - When: The dApp owner creates a capacity delegation authSig + * - And: The dApp owner delegates the capacity credits NFT to Bob + * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT + * + * + * ## Test Commands: + * - ❌ Not supported in Cayenne, but session sigs would still work + * - βœ… NETWORK=manzano yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign + * - βœ… NETWORK=localchain yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign + */ +export const testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign = async ( + devEnv: TinnyEnvironment +) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = + await alice.createCapacityDelegationAuthSig([bob.wallet.address]); + + // 4. Bob receives the capacity delegation authSig use it to generate session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.pkpSign({ + sessionSigs: bobsSessionSigs, + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey, + }); + + // -- Expected output: + // { + // r: "25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb636", + // s: "1e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c", + // recid: 0, + // signature: "0x25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb6361e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c1b", + // publicKey: "041FF0DC7B69D2B3C3E452AF9E0D30C7FDA6729A1B394059BDC8C4530D7F584FFCAEEEC19B1F22EFB054A22E5EF13AA0B5804994469570929066F5474D490B8A1F", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + // -- assertions + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + + // -- signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + console.log('βœ… res:', res); +}; diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts new file mode 100644 index 0000000000..16c45d1590 --- /dev/null +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts @@ -0,0 +1,120 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing unrestricted access to execute js code using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to execute js code using the capacity from the capacity credits NFT + * - Then: The user should be able to sign with his/her PKP using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ❌ Not supported in Cayenne, but session sigs would still work + * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs + * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs + */ +export const testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = ( + await devEnv.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet, + }) + ).capacityDelegationAuthSig; + + // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 4. Bob can now execute JS code using the capacity credits NFT + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey, + }, + }); + + // Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", + // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", + // recid: 1, + // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", + // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- signatures.sig.recid must be parseable as a number + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + console.log( + 'βœ… testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs' + ); + }; diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts new file mode 100644 index 0000000000..4abccce37e --- /dev/null +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts @@ -0,0 +1,100 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing unrestricted access to pkp sign using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to pkp sign using the capacity from the capacity credits NFT + * - Then: The user should be able to sign with his/her PKP using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ❌ Not supported in Cayenne, but session sigs would still work + * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign + * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign + */ +export const testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = ( + await devEnv.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet, + }) + ).capacityDelegationAuthSig; + + // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 4. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.pkpSign({ + sessionSigs: bobsSessionSigs, + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey, + }); + + // -- Expected output: + // { + // r: "25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb636", + // s: "1e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c", + // recid: 0, + // signature: "0x25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb6361e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c1b", + // publicKey: "041FF0DC7B69D2B3C3E452AF9E0D30C7FDA6729A1B394059BDC8C4530D7F584FFCAEEEC19B1F22EFB054A22E5EF13AA0B5804994469570929066F5474D490B8A1F", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + // -- assertions + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + + // -- signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + console.log('βœ… res:', res); + }; diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts new file mode 100644 index 0000000000..f98f9e7592 --- /dev/null +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts @@ -0,0 +1,118 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing unrestricted access to execute JS code using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to execute JS code using the capacity from the capacity credits NFT + * - Then: The user should be able to execute the JS code using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ❌ Not supported in Cayenne, but session sigs would still work + * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs + * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs + */ + +export const testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + // No delegatee addresses provided. It means that the capability will not restrict access based on delegatee list, but it may still enforce other restrictions such as usage limits and specific NFT IDs. + const appOwnersCapacityDelegationAuthSig = + await alice.createCapacityDelegationAuthSig(); + + // 4. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp.publicKey, + }, + }); + + // Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", + // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", + // recid: 1, + // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", + // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- signatures.sig.recid must be parseable as a number + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + console.log( + 'βœ… testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs' + ); + }; diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts new file mode 100644 index 0000000000..77f3700308 --- /dev/null +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts @@ -0,0 +1,94 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing unrestricted access to pkp sign code using a capacity delegation authSig without specific delegatee restrictions + * - Given: A capacity delegation authSig is created by the dApp owner + * - When: The authSig does not specifically restrict delegatees + * - And: Any user attempts to pkp sign code using the capacity from the capacity credits NFT + * - Then: The user should be able to execute the JS code using the capacity without restrictions due to the absence of delegatee limits + * + * + * ## Test Commands: + * - ❌ Not supported in Cayenne, but session sigs would still work + * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign + * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign + */ + +export const testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = + await alice.createCapacityDelegationAuthSig(); + + // 4. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 5. Bob can now pkp sign using the capacity credits NFT + const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: bob.pkp.publicKey, + sessionSigs: bobsSessionSigs, + }); + + // -- Expected output: + // { + // r: "36bd0039b4e4d1dae488a63437318790df86b8023ac4ffa842c8983245b7f629", + // s: "29135af930c40ee0901a9ea3ca5621d06a6b932aee2f2256cf2a99a65cb36d05", + // recid: 1, + // signature: "0x36bd0039b4e4d1dae488a63437318790df86b8023ac4ffa842c8983245b7f62929135af930c40ee0901a9ea3ca5621d06a6b932aee2f2256cf2a99a65cb36d051c", + // publicKey: "04837486BD4DCF221D463D976E6A392E12BC2DFEFB124E189AB0A8EA406DFB1C73F4DCD268CC2B8F854C202256BD08E22D688121061EA9CFB1317142DBD2EAB4C4", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + // -- assertions + // r, s, dataSigned, and public key should be present + if (!runWithSessionSigs.r) { + throw new Error(`Expected "r" in runWithSessionSigs`); + } + if (!runWithSessionSigs.s) { + throw new Error(`Expected "s" in runWithSessionSigs`); + } + if (!runWithSessionSigs.dataSigned) { + throw new Error(`Expected "dataSigned" in runWithSessionSigs`); + } + if (!runWithSessionSigs.publicKey) { + throw new Error(`Expected "publicKey" in runWithSessionSigs`); + } + + // signature must start with 0x + if (!runWithSessionSigs.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // recid must be parseable as a number + if (isNaN(runWithSessionSigs.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }; diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts new file mode 100644 index 0000000000..57af5ec840 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts @@ -0,0 +1,96 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile + */ +export const testUseEoaSessionSigsToEncryptDecryptFile = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + const message = 'Hello world'; + const blob = new Blob([message], { type: 'text/plain' }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address, + }); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: eoaSessionSigs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decriptedFile = await LitJsSdk.decryptToFile( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + if (blobArray.length !== decriptedFile.length) { + throw new Error( + `decrypted file should match the original file but received ${decriptedFile}` + ); + } + for (let i = 0; i < blobArray.length; i++) { + if (blobArray[i] !== decriptedFile[i]) { + throw new Error(`decrypted file should match the original file`); + } + } + + console.log('decriptedFile:', decriptedFile); +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts new file mode 100644 index 0000000000..a79276ac4a --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts @@ -0,0 +1,89 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString + */ +export const testUseEoaSessionSigsToEncryptDecryptString = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address, + }); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: eoaSessionSigs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptRes = await LitJsSdk.decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + if (decryptRes !== 'Hello world') { + + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } + +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts new file mode 100644 index 0000000000..de5dff56c7 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts @@ -0,0 +1,91 @@ +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptZip + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptZip + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptZip + */ +export const testUseEoaSessionSigsToEncryptDecryptZip = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + const message = 'Hello world'; + + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address, + }); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.zipAndEncryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: eoaSessionSigs, + dataToEncrypt: message, + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptedZip = await LitJsSdk.decryptToZip( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + const decryptedMessage = await decryptedZip['string.txt'].async('string'); + + if (message !== decryptedMessage) { + throw new Error( + `decryptedMessage should be ${message} but received ${decryptedMessage}` + ); + } + + console.log('decryptedMessage:', decryptedMessage); +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts new file mode 100644 index 0000000000..78cdb6b6f2 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts @@ -0,0 +1,181 @@ +// import { LitContracts } from '@lit-protocol/contracts-sdk'; +// import { log } from '@lit-protocol/misc'; +// import { +// ClaimRequest, +// ClaimResult, +// ClientClaimProcessor, +// } from '@lit-protocol/types'; +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * ## Scenario: + * Testing the capability to claim keys using EOA (Externally Owned Account) session sigs. This test ensures that keys can be claimed correctly. + * + * - Given: EOA sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * + * - Note: The key claiming process involves multiple nodes within the Lit network verifying the sessionSigs and collaboratively signing the claim, which results in the generation of a new key pair if successful. + * + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys + */ +export const testUseEoaSessionSigsToExecuteJsClaimKeys = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + })();`, + }); + + console.log('res:', res); + + // Expected output: + // { + // claims: { + // foo: { + // signatures: [ + // { + // r: "0x31e5dcf6eed3619aa6ff68d0c8f7a4bcf082acc2f12c3d5bcae9b8bbaf883c07", + // s: "0x405f671d1c659022105775b18afe805e01eaa1d0799c6b92887baef77dc023f5", + // v: 27, + // }, { + // r: "0xf2e9fe653d9155bd93feb7fe122c07a81769076fe44567c3ea93bb828f87146e", + // s: "0x01adf2b2780511f70b0b037360ff4b0c2b8d04657a689af780180bed9e6ea3c5", + // v: 27, + // }, { + // r: "0xfe1dcacd79f53b42b24dae75521f01315f34bbc492233e26083995c82218a3ff", + // s: "0x0b708b11704d986b50bce9f648bb5d40e8b9ad87f3a337a213999c7751dc1c0c", + // v: 27, + // } + // ], + // derivedKeyId: "22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + + res.claims.foo.signatures.forEach((sig: any) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + + // const claimRequest: ClaimRequest = { + // authMethod: devEnv.bobsWalletAuthMethod, + // signer: devEnv.hotWallet, + // mintCallback: async (claimRes: ClaimResult) => { + // console.log('claimRes:', claimRes); + + // const litContracts = await devEnv.getContractsClient(claimRes.signer); + // const pkpInfo = await litContracts.pkpNftContractUtils.write.claimAndMint( + // `0x${claimRes.derivedKeyId}`, + // claimRes.signatures + // ); + + // return pkpInfo.tokenId; + // }, + // }; + + // const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); + + // console.log('claimRes:', claimRes); + + // Expected output: + // { + // signatures: [ + // { + // r: "0xf73ec73f2dd7858d9b463598420169cf153f8cd409c82af606b3832ff82f8774", + // s: "0x0de6ab4437749fdf1e6239a8d13af516ac9a0744fc0725f9897a880151799fde", + // v: 28, + // }, { + // r: "0x65ec2ac206c4d18aaf12d6d1f17826543c1f329657214cea66c509fcdec8d633", + // s: "0x710e2efb2c61f9ae504721d7bea0b8d1d3c519167e48e4d67c77bf61dfeca735", + // v: 28, + // }, { + // r: "0xe51bd0670463cb5b5e9994870362b3eaa747cb5732e5c666ccf25495fe9aaa54", + // s: "0x1b49aed6d46833c9b9ee0fa13a4009c533309dafdfd51dd30165f2556b6cdcf1", + // v: 27, + // }, { + // r: "0x4278d3f7f2eb38801da5940858be54527e42ee11b25d7b239cb491139c00765d", + // s: "0x13dac60eaa90a548a4c99f1e09ac24e07cb1ef7447e55d3c82cf2ea6d69ec190", + // v: 27, + // }, { + // r: "0xb18158eccd4b099d0cfae4c2f987843cbaf039ce50164410fe4f529e6dc2bb6a", + // s: "0x284d9d5326deeb3d10e2c1d81ed1a7d6fca584c46ad9606a4dad9f12d81874ab", + // v: 27, + // }, { + // r: "0x28ad76574d39d646948642d05f599a982a1dd0776e2e36138315f5fb2c03666e", + // s: "0x2a125a028df39b9230f5d866383fcda0107cc7ee2f42fa1f323d41b34f67273a", + // v: 27, + // }, { + // r: "0xb7ab5120aeffeaee6e8d6ab1456d6823a15fae7e5a70b88d2556dc85450486cf", + // s: "0x6e1e9ac479066d95d62a6cd86f0cb3db92e07367acf43873fb5a7b8ad558a09d", + // v: 28, + // } + // ], + // claimedKeyId: "4825e3caf11a273792ad0405524820410cd15d6323ae4621537f0a89c1322a74", + // pubkey: "049528b98ac4829b5eaf8f8e6addaa9c12e94e83c4d17baf8f86554c111f2ac6d774f483fca03ad06b268059f7c8bcf64c7fb93689e153dc2fed79dada7b289195", + // mintTx: "0x0000000000000000000000000000000000000000000000000000000000000000", + // } + + // assertions + // if (!claimRes.claimedKeyId) { + // throw new Error(`Expected "claimedKeyId" in claimRes`); + // } + // if (!claimRes.pubkey) { + // throw new Error(`Expected "pubkey" in claimRes`); + // } + // if (!claimRes.mintTx) { + // throw new Error(`Expected "mintTx" in claimRes`); + // } + + // claimRes.signatures.forEach((sig: any) => { + // if (!sig.r) { + // throw new Error(`Expected "r" in sig`); + // } + // if (!sig.s) { + // throw new Error(`Expected "s" in sig`); + // } + // if (!sig.v) { + // throw new Error(`Expected "v" in sig`); + // } + // }); + + log('βœ… testUseEoaSessionSigsToExecuteJsClaimKeys'); +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts new file mode 100644 index 0000000000..270f431905 --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts @@ -0,0 +1,105 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing the capability to claim keys using EOA (Externally Owned Account) session sigs. This test ensures that multiple keys can be claimed correctly. + * + * - Given: EOA sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * * + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys + */ +export const testUseEoaSessionSigsToExecuteJsClaimMultipleKeys = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + + res.claims.foo.signatures.forEach((sig: any) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts new file mode 100644 index 0000000000..b09b213bbd --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts @@ -0,0 +1,54 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog + */ +export const testUseEoaSessionSigsToExecuteJsConsoleLog = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + }); + + console.log('res:', res); + + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "", + // logs: "hello world\n", + // } + + // -- assertions + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + + if (!res.success) { + throw new Error(`Expected "success" in res`); + } +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts new file mode 100644 index 0000000000..5489c1ea8e --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts @@ -0,0 +1,69 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse + */ +export const testUseEoaSessionSigsToExecuteJsJsonResponse = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "{\"hello\":\"world\"}", + // logs: "hello world\n", + // } + + // -- assertions + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + + if (!res.response.startsWith('{')) { + throw new Error(`Expected "response" to start with {`); + } + + if (!res.response.endsWith('}')) { + throw new Error(`Expected "response" to end with }`); + } + + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts new file mode 100644 index 0000000000..49275a856e --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts @@ -0,0 +1,66 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning + */ +export const testUseEoaSessionSigsToExecuteJsSigning = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey, + }, + }); + + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe79", + // s: "1c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a", + // recid: 0, + // signature: "0x63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe791c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a1b", + // publicKey: "0423F38A7663289FC58841B5F8E068FA43106BC7DDEE38D1F2542C03ABEC45B6733BE2D85A703C7B238865E45DF2175DD2A1736C56F2BAD0A965837F64BB21FB03", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // } + + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + log('βœ… testUseEoaSessionSigsToExecuteJsSigning'); +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts new file mode 100644 index 0000000000..719c4154bf --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts @@ -0,0 +1,121 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel + */ +export const testUseEoaSessionSigsToExecuteJsSigningInParallel = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const fn = async (index: number) => { + log(`Index: ${index}`); + + return await devEnv.litNodeClient.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp.publicKey, + }, + }); + }; + + const res = await Promise.all([fn(1), fn(2), fn(3)]); + log('res:', res); + + // -- Expected output: + // [ + // { + // claims: {}, + // signatures: { + // sig: { + // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", + // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", + // recid: 0, + // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", + // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", + // recid: 1, + // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", + // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", + // recid: 0, + // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // ] + + // -- assertions + res.forEach((r) => { + if (!r.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!r.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!r.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!r.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- signatures.sig.recid must be parseable as a number + if (isNaN(r.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + + log('βœ… testUseEoaSessionSigsToExecuteJsSigningInParallel'); +}; diff --git a/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts b/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts new file mode 100644 index 0000000000..a0fb81fe4c --- /dev/null +++ b/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts @@ -0,0 +1,62 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToPkpSign + * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToPkpSign + * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToPkpSign + */ +export const testUseEoaSessionSigsToPkpSign = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.pkp.publicKey, + sessionSigs: eoaSessionSigs, + }); + + // Expected output: + // { + // r: "25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9", + // s: "549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b101833214", + // recid: 1, + // signature: "0x25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b1018332141c", + // publicKey: "04A3CD53CCF63597D3FFCD1DF1E8236F642C7DF8196F532C8104625635DC55A1EE59ABD2959077432FF635DF2CED36CC153050902B71291C4D4867E7DAAF964049", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + // -- assertions + // r, s, dataSigned, and public key should be present + if (!runWithSessionSigs.r) { + throw new Error(`Expected "r" in runWithSessionSigs`); + } + if (!runWithSessionSigs.s) { + throw new Error(`Expected "s" in runWithSessionSigs`); + } + if (!runWithSessionSigs.dataSigned) { + throw new Error(`Expected "dataSigned" in runWithSessionSigs`); + } + if (!runWithSessionSigs.publicKey) { + throw new Error(`Expected "publicKey" in runWithSessionSigs`); + } + + // signature must start with 0x + if (!runWithSessionSigs.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // recid must be parseable as a number + if (isNaN(runWithSessionSigs.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + log('βœ… testUseEoaSessionSigsToPkpSign'); +}; diff --git a/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts b/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts new file mode 100644 index 0000000000..3a809b7f21 --- /dev/null +++ b/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts @@ -0,0 +1,32 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getInvalidLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * ❌ NOT AVAILABLE IN CAYENNE + * ❌ NOT AVAILABLE IN MANZANO + * βœ… NETWORK=localchain yarn test:local --filter=testUseInvalidLitActionCodeToGenerateSessionSigs + */ +export const testUseInvalidLitActionCodeToGenerateSessionSigs = async ( + devEnv: TinnyEnvironment +) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + try { + await getInvalidLitActionSessionSigs(devEnv, alice); + } catch (e: any) { + if ( + e.message === + 'There was an error getting the signing shares from the nodes' + ) { + console.log('βœ… testUseInvalidLitActionCodeToGenerateSessionSigs passed'); + } else { + throw e; + } + } +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts new file mode 100644 index 0000000000..6200661671 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts @@ -0,0 +1,97 @@ +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile + */ +export const testUsePkpSessionSigsToEncryptDecryptFile = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const message = 'Hello world'; + const blob = new Blob([message], { type: 'text/plain' }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: pkpSessionSigs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decriptedFile = await LitJsSdk.decryptToFile( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + if (blobArray.length !== decriptedFile.length) { + throw new Error( + `decrypted file should match the original file but received ${decriptedFile}` + ); + } + for (let i = 0; i < blobArray.length; i++) { + if (blobArray[i] !== decriptedFile[i]) { + throw new Error(`decrypted file should match the original file`); + } + } + + console.log('decriptedFile:', decriptedFile); +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts new file mode 100644 index 0000000000..daaf80e1d6 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts @@ -0,0 +1,83 @@ +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString + */ +export const testUsePkpSessionSigsToEncryptDecryptString = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: pkpSessionSigs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptRes = await LitJsSdk.decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + if (decryptRes !== 'Hello world') { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts new file mode 100644 index 0000000000..26c7e8afb0 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts @@ -0,0 +1,92 @@ +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptZip + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptZip + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptZip + */ +export const testUsePkpSessionSigsToEncryptDecryptZip = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const message = 'Hello world'; + + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.zipAndEncryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: pkpSessionSigs, + dataToEncrypt: message, + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptedZip = await LitJsSdk.decryptToZip( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + const decryptedMessage = await decryptedZip['string.txt'].async('string'); + + if (message !== decryptedMessage) { + throw new Error( + `decryptedMessage should be ${message} but received ${decryptedMessage}` + ); + } + + console.log('decryptedMessage:', decryptedMessage); +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts new file mode 100644 index 0000000000..c3084c34fa --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts @@ -0,0 +1,170 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing the capability to claim keys using PKP session sigs. This test ensures that keys can be claimed correctly. + * + * - Given: PKP sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * + * - Note: The key claiming process involves multiple nodes within the Lit network verifying the sessionSigs and collaboratively signing the claim, which results in the generation of a new key pair if successful. + * + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys + */ +export const testUsePkpSessionSigsToExecuteJsClaimKeys = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + })();`, + }); + + console.log('res:', res); + + // Expected output: + // { + // claims: { + // foo: { + // signatures: [ + // { + // r: "0x31e5dcf6eed3619aa6ff68d0c8f7a4bcf082acc2f12c3d5bcae9b8bbaf883c07", + // s: "0x405f671d1c659022105775b18afe805e01eaa1d0799c6b92887baef77dc023f5", + // v: 27, + // }, { + // r: "0xf2e9fe653d9155bd93feb7fe122c07a81769076fe44567c3ea93bb828f87146e", + // s: "0x01adf2b2780511f70b0b037360ff4b0c2b8d04657a689af780180bed9e6ea3c5", + // v: 27, + // }, { + // r: "0xfe1dcacd79f53b42b24dae75521f01315f34bbc492233e26083995c82218a3ff", + // s: "0x0b708b11704d986b50bce9f648bb5d40e8b9ad87f3a337a213999c7751dc1c0c", + // v: 27, + // } + // ], + // derivedKeyId: "22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + + res.claims.foo.signatures.forEach((sig: any) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + + // const claimRequest: ClaimRequest = { + // authMethod: devEnv.bobsWalletAuthMethod, + // signer: devEnv.hotWallet, + // mintCallback: async (claimRes: ClaimResult) => { + // console.log('claimRes:', claimRes); + + // const litContracts = await devEnv.getContractsClient(claimRes.signer); + // const pkpInfo = await litContracts.pkpNftContractUtils.write.claimAndMint( + // `0x${claimRes.derivedKeyId}`, + // claimRes.signatures + // ); + + // return pkpInfo.tokenId; + // }, + // }; + + // const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); + + // console.log('claimRes:', claimRes); + + // Expected output: + // { + // signatures: [ + // { + // r: "0xf73ec73f2dd7858d9b463598420169cf153f8cd409c82af606b3832ff82f8774", + // s: "0x0de6ab4437749fdf1e6239a8d13af516ac9a0744fc0725f9897a880151799fde", + // v: 28, + // }, { + // r: "0x65ec2ac206c4d18aaf12d6d1f17826543c1f329657214cea66c509fcdec8d633", + // s: "0x710e2efb2c61f9ae504721d7bea0b8d1d3c519167e48e4d67c77bf61dfeca735", + // v: 28, + // }, { + // r: "0xe51bd0670463cb5b5e9994870362b3eaa747cb5732e5c666ccf25495fe9aaa54", + // s: "0x1b49aed6d46833c9b9ee0fa13a4009c533309dafdfd51dd30165f2556b6cdcf1", + // v: 27, + // }, { + // r: "0x4278d3f7f2eb38801da5940858be54527e42ee11b25d7b239cb491139c00765d", + // s: "0x13dac60eaa90a548a4c99f1e09ac24e07cb1ef7447e55d3c82cf2ea6d69ec190", + // v: 27, + // }, { + // r: "0xb18158eccd4b099d0cfae4c2f987843cbaf039ce50164410fe4f529e6dc2bb6a", + // s: "0x284d9d5326deeb3d10e2c1d81ed1a7d6fca584c46ad9606a4dad9f12d81874ab", + // v: 27, + // }, { + // r: "0x28ad76574d39d646948642d05f599a982a1dd0776e2e36138315f5fb2c03666e", + // s: "0x2a125a028df39b9230f5d866383fcda0107cc7ee2f42fa1f323d41b34f67273a", + // v: 27, + // }, { + // r: "0xb7ab5120aeffeaee6e8d6ab1456d6823a15fae7e5a70b88d2556dc85450486cf", + // s: "0x6e1e9ac479066d95d62a6cd86f0cb3db92e07367acf43873fb5a7b8ad558a09d", + // v: 28, + // } + // ], + // claimedKeyId: "4825e3caf11a273792ad0405524820410cd15d6323ae4621537f0a89c1322a74", + // pubkey: "049528b98ac4829b5eaf8f8e6addaa9c12e94e83c4d17baf8f86554c111f2ac6d774f483fca03ad06b268059f7c8bcf64c7fb93689e153dc2fed79dada7b289195", + // mintTx: "0x0000000000000000000000000000000000000000000000000000000000000000", + // } + + // assertions + // if (!claimRes.claimedKeyId) { + // throw new Error(`Expected "claimedKeyId" in claimRes`); + // } + // if (!claimRes.pubkey) { + // throw new Error(`Expected "pubkey" in claimRes`); + // } + // if (!claimRes.mintTx) { + // throw new Error(`Expected "mintTx" in claimRes`); + // } + + // claimRes.signatures.forEach((sig: any) => { + // if (!sig.r) { + // throw new Error(`Expected "r" in sig`); + // } + // if (!sig.s) { + // throw new Error(`Expected "s" in sig`); + // } + // if (!sig.v) { + // throw new Error(`Expected "v" in sig`); + // } + // }); +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts new file mode 100644 index 0000000000..a4de221f96 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts @@ -0,0 +1,104 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing the capability to claim keys using PKP session sigs. This test ensures that multiple keys can be claimed correctly. + * + * - Given: PKP sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * * + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys + */ +export const testUsePkpSessionSigsToExecuteJsClaimMultipleKeys = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + + res.claims.foo.signatures.forEach((sig: any) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts new file mode 100644 index 0000000000..e5d18aeab7 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts @@ -0,0 +1,52 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog + */ +export const testUsePkpSessionSigsToExecuteJsConsoleLog = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + }); + + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "", + // logs: "hello world\n", + // } + + // -- assertions + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + + if (!res.success) { + throw new Error(`Expected "success" in res`); + } +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts new file mode 100644 index 0000000000..dfee097b12 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts @@ -0,0 +1,69 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse + */ +export const testUsePkpSessionSigsToExecuteJsJsonResponse = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "{\"hello\":\"world\"}", + // logs: "hello world\n", + // } + + // -- assertions + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + + if (!res.response.startsWith('{')) { + throw new Error(`Expected "response" to start with {`); + } + + if (!res.response.endsWith('}')) { + throw new Error(`Expected "response" to end with }`); + } + + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts new file mode 100644 index 0000000000..3e4145681b --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts @@ -0,0 +1,80 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning + */ +export const testUsePkpSessionSigsToExecuteJsSigning = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "8d2a3b3fa49e67b6bf9de15adfc0b5fbe04b6d730cbef60f4c211c4803bd9c3f", + // s: "1f819cc7a74a72e6f1b16a9a665f19cdd7294132d8a1c70871a752a6d70615e4", + // recid: 1, + // signature: "0x8d2a3b3fa49e67b6bf9de15adfc0b5fbe04b6d730cbef60f4c211c4803bd9c3f1f819cc7a74a72e6f1b16a9a665f19cdd7294132d8a1c70871a752a6d70615e41c", + // publicKey: "044395E44BA89AC0D0E76DEECD937C7BC0AE96B47766AB01CEC5449A8F869754560ACAEAC82CD48FAD3553AD47D7FAA99131F6E7E1B19DEBA058BB6D6B97F2BDB1", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!res.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- signatures.sig.recid must be parseable as a number + if (isNaN(res.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + log('βœ… res:', res); +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts new file mode 100644 index 0000000000..554f0ed1c6 --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts @@ -0,0 +1,121 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel + */ +export const testUsePkpSessionSigsToExecuteJsSigningInParallel = async ( + devEnv: TinnyEnvironment +) => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const fn = async (index: number) => { + log(`Index: ${index}`); + + return await devEnv.litNodeClient.executeJs({ + sessionSigs: pkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + }; + + const res = await Promise.all([fn(1), fn(2), fn(3)]); + log('res:', res); + + // -- Expected output: + // [ + // { + // claims: {}, + // signatures: { + // sig: { + // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", + // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", + // recid: 0, + // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", + // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", + // recid: 1, + // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", + // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", + // recid: 0, + // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // ] + + // -- assertions + res.forEach((r) => { + if (!r.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!r.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!r.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!r.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- signatures.sig.recid must be parseable as a number + if (isNaN(r.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + + log('βœ… testUsePkpSessionSigsToExecuteJsSigningInParallel'); +}; diff --git a/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts b/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts new file mode 100644 index 0000000000..f350628a7b --- /dev/null +++ b/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts @@ -0,0 +1,60 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToPkpSign + * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToPkpSign + * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToPkpSign + */ +export const testUsePkpSessionSigsToPkpSign = async (devEnv: TinnyEnvironment) => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp.publicKey, + sessionSigs: pkpSessionSigs, + }); + + // -- Expected output: + // { + // r: "f67785b9c516a1fdbd224e9591554171d594bb1fb9799c851bac56212956838a", + // s: "799edb2732f2ebeaf90ea84cbf4c2a2e2ba509487a19d5c6b88210afe362ce42", + // recid: 1, + // signature: "0xf67785b9c516a1fdbd224e9591554171d594bb1fb9799c851bac56212956838a799edb2732f2ebeaf90ea84cbf4c2a2e2ba509487a19d5c6b88210afe362ce421c", + // publicKey: "0486C6E6E854337411A3884E0DEFF15D6D69663594826313BB73E18C465A079B4C2850719F45E9BE2FAC18AA78FFF2C7AEC912FA9D646B2F088C6CAAA8F7A0144A", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + // -- assertions + // r, s, dataSigned, and public key should be present + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + + // signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + log('βœ… res:', res); +}; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts new file mode 100644 index 0000000000..2b3f765f8c --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts @@ -0,0 +1,99 @@ +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile + * βœ… NETWORK=manzano yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + const alice = await devEnv.createRandomPerson(); + + const message = 'Hello world'; + const blob = new Blob([message], { type: 'text/plain' }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: pkpSessionSigs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decriptedFile = await LitJsSdk.decryptToFile( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: pkpSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + if (blobArray.length !== decriptedFile.length) { + throw new Error( + `decrypted file should match the original file but received ${decriptedFile}` + ); + } + for (let i = 0; i < blobArray.length; i++) { + if (blobArray[i] !== decriptedFile[i]) { + throw new Error(`decrypted file should match the original file`); + } + } + + console.log('decriptedFile:', decriptedFile); + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts new file mode 100644 index 0000000000..cf72950d3e --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts @@ -0,0 +1,87 @@ +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * ❌ NOT AVAILABLE IN CAYENNE + * ❌ NOT AVAILABLE IN MANZANO + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString + * + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: litActionSessionSigs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const litActionSessionSigs2 = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptRes = await LitJsSdk.decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: litActionSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + if (decryptRes !== 'Hello world') { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts new file mode 100644 index 0000000000..c9a25bddd1 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts @@ -0,0 +1,94 @@ +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import { AccessControlConditions } from 'local-tests/setup/accs/accs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; +import { log } from '@lit-protocol/misc'; + +/** + * Test Commands: + * ❌ Not supported in Cayenne + * ❌ Not supported in Manzano + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + const alice = await devEnv.createRandomPerson(); + + const message = 'Hello world'; + + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp.ethAddress, + }); + + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.zipAndEncryptString( + { + accessControlConditions: accs, + chain: 'ethereum', + sessionSigs: litActionSessionSigs, + dataToEncrypt: message, + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.composeLitActionResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const litActionSessionSigs2 = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptedZip = await LitJsSdk.decryptToZip( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: litActionSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + const decryptedMessage = await decryptedZip['string.txt'].async('string'); + + if (message !== decryptedMessage) { + throw new Error( + `decryptedMessage should be ${message} but received ${decryptedMessage}` + ); + } + + console.log('decryptedMessage:', decryptedMessage); + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts new file mode 100644 index 0000000000..638988e3b6 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts @@ -0,0 +1,116 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LitAbility } from '@lit-protocol/types'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing the capability to claim keys using Lit ACtion PKP session sigs. This test ensures that multiple keys can be claimed correctly. + * + * - Given: Lit ACtion PKP sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * * + * Test Commands: + * ❌ Not supported in Cayenne + * ❌ Not supported in Manzano + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + + res.claims.foo.signatures.forEach((sig: any) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts new file mode 100644 index 0000000000..3fe3b2b482 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts @@ -0,0 +1,106 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * ## Scenario: + * Testing the capability to claim keys using Lit Action PKP session sigs. This test ensures that multiple keys can be claimed correctly. + * + * - Given: Lit Action PKP sessionSigs are properly generated for the environment. + * - When: These sessionSigs are used to execute JS code within Lit Action. + * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. + * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. + * * + * Test Commands: + * ❌ Not supported in Cayenne + * ❌ Not supported in Manzano + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + if (!res.claims.foo) { + throw new Error(`Expected "foo" in res.claims`); + } + if (!res.claims.foo.derivedKeyId) { + throw new Error(`Expected "derivedKeyId" in res.claims.foo`); + } + + if (!res.claims.foo.signatures) { + throw new Error(`Expected "signatures" in res.claims.foo`); + } + + res.claims.foo.signatures.forEach((sig: any) => { + if (!sig.r) { + throw new Error(`Expected "r" in sig`); + } + if (!sig.s) { + throw new Error(`Expected "s" in sig`); + } + if (!sig.v) { + throw new Error(`Expected "v" in sig`); + } + }); + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts new file mode 100644 index 0000000000..c81bbf5929 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts @@ -0,0 +1,67 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LitAbility } from '@lit-protocol/types'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * ❌ Not supported on cayenne + * ❌ Not supported on manzano + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + }); + + console.log('res:', res); + + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "", + // logs: "hello world\n", + // } + + // -- assertions + if (res.response) { + throw new Error(`Expected "response" to be falsy`); + } + + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts new file mode 100644 index 0000000000..5c968800f1 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts @@ -0,0 +1,70 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * ❌ Not supported on cayenne + * ❌ Not supported on manzano + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "{\"hello\":\"world\"}", + // logs: "hello world\n", + // } + + // -- assertions + if (!res.response) { + throw new Error(`Expected "response" in res`); + } + + if (!res.response.startsWith('{')) { + throw new Error(`Expected "response" to start with {`); + } + + if (!res.response.endsWith('}')) { + throw new Error(`Expected "response" to end with }`); + } + + if (!res.logs) { + throw new Error(`Expected "logs" in res`); + } + + if (!res.logs.includes('hello world')) { + throw new Error(`Expected "logs" to include 'hello world'`); + } + + if (!res.success) { + throw new Error(`Expected "success" in res`); + } + + if (res.success !== true) { + throw new Error(`Expected "success" to be true`); + } + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts new file mode 100644 index 0000000000..7f66deda66 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts @@ -0,0 +1,82 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LitAbility } from '@lit-protocol/types'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * ❌ NOT AVAILABLE IN CAYENNE + * ❌ NOT AVAILABLE IN HABANERO + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]); + + const res = await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef", + // s: "4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee145", + // recid: 1, + // signature: "0x6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee1451c", + // publicKey: "04D10D941B04491FDC99B048E2252A69137333254C482511D6CCDD401C080AF4F51BF65D9AE2413FCE066E326D7F0CED9C139DD9BA2D1C6334FD8C14CA4DD7F3D0", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // -- assertions + if (!res.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!res.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!res.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!res.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + log('βœ… res:', res); + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts new file mode 100644 index 0000000000..735e25f0b3 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts @@ -0,0 +1,123 @@ +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * ❌ Not available in Cayenne + * ❌ Not available in Habanero + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel + */ +export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel = + async (devEnv: TinnyEnvironment) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const fn = async (index: number) => { + log(`Index: ${index}`); + + return await devEnv.litNodeClient.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp.publicKey, + }, + }); + }; + + const res = await Promise.all([fn(1), fn(2), fn(3)]); + log('res:', res); + + // -- Expected output: + // [ + // { + // claims: {}, + // signatures: { + // sig: { + // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", + // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", + // recid: 0, + // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", + // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", + // recid: 1, + // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", + // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", + // recid: 0, + // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // ] + + // -- assertions + res.forEach((r) => { + if (!r.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!r.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!r.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!r.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- signatures.sig.recid must be parseable as a number + if (isNaN(r.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + + log('βœ… testUsePkpSessionSigsToExecuteJsSigningInParallel'); + }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts new file mode 100644 index 0000000000..603342f783 --- /dev/null +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts @@ -0,0 +1,67 @@ +import { LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LitAbility } from '@lit-protocol/types'; +import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; +import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; + +/** + * Test Commands: + * ❌ NOT AVAILABLE IN CAYENNE + * ❌ NOT AVAILABLE IN HABANERO + * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToPkpSign + * + **/ +export const testUseValidLitActionCodeGeneratedSessionSigsToPkpSign = async ( + devEnv: TinnyEnvironment +) => { + devEnv.setUnavailable(LIT_TESTNET.CAYENNE); + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp.publicKey, + sessionSigs: litActionSessionSigs, + }); + + // -- Expected output: + // { + // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", + // s: "4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e", + // recid: 1, + // signature: "0xab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e1c", + // publicKey: "04400AD53C2F8BA11EBC69F05D1076D5BEE4EAE668CD66BABADE2E0770F756FDEEFC2C1D20F9A698EA3FEC6E9C944FF9FAFC2DC339B8E9392AFB9CC8AE75C5E5EC", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + // -- assertions + // r, s, dataSigned, and public key should be present + if (!res.r) { + throw new Error(`Expected "r" in res`); + } + if (!res.s) { + throw new Error(`Expected "s" in res`); + } + if (!res.dataSigned) { + throw new Error(`Expected "dataSigned" in res`); + } + if (!res.publicKey) { + throw new Error(`Expected "publicKey" in res`); + } + + // signature must start with 0x + if (!res.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // recid must be parseable as a number + if (isNaN(res.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + + log('βœ… res:', res); +}; From 757d588dedc66864d0fcec692e9a22677ce38f0f Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Wed, 24 Apr 2024 16:21:50 +0100 Subject: [PATCH 06/20] fix: unable to polyfill fetch when using cross-fetch, replaced with node-fetch as dev dependency for now --- local-tests/build.mjs | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/local-tests/build.mjs b/local-tests/build.mjs index 0ea3586e8e..644b2bce10 100644 --- a/local-tests/build.mjs +++ b/local-tests/build.mjs @@ -34,7 +34,7 @@ export const build = async () => { export const postBuildPolyfill = () => { try { const file = fs.readFileSync(`./${TEST_DIR}/build/test.mjs`, 'utf8'); - const content = `import fetch from 'cross-fetch'; + const content = `import fetch from 'node-fetch'; try { if (!globalThis.fetch) { globalThis.fetch = fetch; diff --git a/package.json b/package.json index 91460ceed7..f396e9b806 100644 --- a/package.json +++ b/package.json @@ -172,9 +172,9 @@ "cypress-metamask": "^1.0.5-development", "cypress-metamask-v2": "^1.7.2", "esbuild": "0.19.12", - "esbuild-plugin-tsc": "^0.4.0", "esbuild-node-builtins": "^0.1.0", "esbuild-node-externals": "^1.13.0", + "esbuild-plugin-tsc": "^0.4.0", "eslint": "8.48.0", "eslint-config-next": "12.2.3", "eslint-config-prettier": "9.1.0", @@ -189,6 +189,7 @@ "lerna": "^5.4.3", "live-server": "^1.2.2", "lokijs": "^1.5.12", + "node-fetch": "^2.6.1", "node-localstorage": "^3.0.5", "nodemon": "^2.0.20", "nx": "17.3.0", From 84f7095fe06bd667c4117c601679ac7729b54cd9 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Wed, 24 Apr 2024 16:34:19 +0100 Subject: [PATCH 07/20] chore: pretty pretty pretty lint --- ...thSigWithUnspecifiedDelegateesToPkpSign.ts | 2 +- ...UseEoaSessionSigsToEncryptDecryptString.ts | 4 - ...stUseEoaSessionSigsToExecuteJsClaimKeys.ts | 1 - ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 1 - ...seEoaSessionSigsToExecuteJsJsonResponse.ts | 2 +- ...SessionSigsToExecuteJsSigningInParallel.ts | 2 +- .../tests/testUseEoaSessionSigsToPkpSign.ts | 2 +- ...validLitActionCodeToGenerateSessionSigs.ts | 2 +- ...stUsePkpSessionSigsToExecuteJsClaimKeys.ts | 2 +- ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 2 +- ...tUsePkpSessionSigsToExecuteJsConsoleLog.ts | 2 +- ...sePkpSessionSigsToExecuteJsJsonResponse.ts | 2 +- ...testUsePkpSessionSigsToExecuteJsSigning.ts | 2 +- ...SessionSigsToExecuteJsSigningInParallel.ts | 2 +- .../tests/testUsePkpSessionSigsToPkpSign.ts | 6 +- ...eneratedSessionSigsToExecuteJsClaimKeys.ts | 2 +- ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 2 +- ...neratedSessionSigsToExecuteJsConsoleLog.ts | 2 +- ...eGeneratedSessionSigsToExecuteJsSigning.ts | 2 +- ...SessionSigsToExecuteJsSigningInParallel.ts | 2 +- ...ActionCodeGeneratedSessionSigsToPkpSign.ts | 2 +- yarn.lock | 1527 ++++++++--------- 22 files changed, 733 insertions(+), 840 deletions(-) diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts index 77f3700308..c319e809e5 100644 --- a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts +++ b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts @@ -23,7 +23,7 @@ export const testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign devEnv.setUnavailable(LIT_TESTNET.CAYENNE); const alice = await devEnv.createRandomPerson(); const bob = await devEnv.createRandomPerson(); - + const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig(); diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts index a79276ac4a..840a8e0a9c 100644 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts @@ -45,12 +45,10 @@ export const testUseEoaSessionSigsToEncryptDecryptString = async ( // -- assertions if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); } if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); } @@ -80,10 +78,8 @@ export const testUseEoaSessionSigsToEncryptDecryptString = async ( ); if (decryptRes !== 'Hello world') { - throw new Error( `Expected decryptRes to be 'Hello world' but got ${decryptRes}` ); } - }; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts index 78cdb6b6f2..53d2c4ae37 100644 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts @@ -31,7 +31,6 @@ export const testUseEoaSessionSigsToExecuteJsClaimKeys = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts index 270f431905..eb10ff3d13 100644 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts @@ -21,7 +21,6 @@ export const testUseEoaSessionSigsToExecuteJsClaimMultipleKeys = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts index 5489c1ea8e..42ac64beeb 100644 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts @@ -13,7 +13,7 @@ export const testUseEoaSessionSigsToExecuteJsJsonResponse = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); const res = await devEnv.litNodeClient.executeJs({ diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts index 719c4154bf..e5c38682b6 100644 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts +++ b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts @@ -14,7 +14,7 @@ export const testUseEoaSessionSigsToExecuteJsSigningInParallel = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); const fn = async (index: number) => { diff --git a/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts b/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts index a0fb81fe4c..ae5d396788 100644 --- a/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts +++ b/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts @@ -14,7 +14,7 @@ export const testUseEoaSessionSigsToPkpSign = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ diff --git a/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts b/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts index 3a809b7f21..791b64047e 100644 --- a/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts +++ b/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts @@ -14,7 +14,7 @@ export const testUseInvalidLitActionCodeToGenerateSessionSigs = async ( ) => { devEnv.setUnavailable(LIT_TESTNET.CAYENNE); devEnv.setUnavailable(LIT_TESTNET.MANZANO); - + const alice = await devEnv.createRandomPerson(); try { diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts index c3084c34fa..61648d5598 100644 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts @@ -23,7 +23,7 @@ export const testUsePkpSessionSigsToExecuteJsClaimKeys = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); const res = await devEnv.litNodeClient.executeJs({ diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts index a4de221f96..d218252fd8 100644 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts @@ -21,7 +21,7 @@ export const testUsePkpSessionSigsToExecuteJsClaimMultipleKeys = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); const res = await devEnv.litNodeClient.executeJs({ diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts index e5d18aeab7..211af2f0d6 100644 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts @@ -13,7 +13,7 @@ export const testUsePkpSessionSigsToExecuteJsConsoleLog = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); const res = await devEnv.litNodeClient.executeJs({ diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts index dfee097b12..12a79fa9f7 100644 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts @@ -13,7 +13,7 @@ export const testUsePkpSessionSigsToExecuteJsJsonResponse = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); const res = await devEnv.litNodeClient.executeJs({ diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts index 3e4145681b..0ddfdb2bb4 100644 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts @@ -14,7 +14,7 @@ export const testUsePkpSessionSigsToExecuteJsSigning = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); const res = await devEnv.litNodeClient.executeJs({ diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts index 554f0ed1c6..796eef4732 100644 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts +++ b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts @@ -14,7 +14,7 @@ export const testUsePkpSessionSigsToExecuteJsSigningInParallel = async ( devEnv: TinnyEnvironment ) => { const alice = await devEnv.createRandomPerson(); - + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); const fn = async (index: number) => { diff --git a/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts b/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts index f350628a7b..e08e60a23c 100644 --- a/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts +++ b/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts @@ -10,9 +10,11 @@ import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToPkpSign * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToPkpSign */ -export const testUsePkpSessionSigsToPkpSign = async (devEnv: TinnyEnvironment) => { +export const testUsePkpSessionSigsToPkpSign = async ( + devEnv: TinnyEnvironment +) => { const alice = await devEnv.createRandomPerson(); - + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); const res = await devEnv.litNodeClient.pkpSign({ diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts index 638988e3b6..0606cac29b 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts @@ -23,7 +23,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys = async (devEnv: TinnyEnvironment) => { devEnv.setUnavailable(LIT_TESTNET.CAYENNE); devEnv.setUnavailable(LIT_TESTNET.MANZANO); - + const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ { diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts index 3fe3b2b482..4244e3be5e 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts @@ -21,7 +21,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultip async (devEnv: TinnyEnvironment) => { devEnv.setUnavailable(LIT_TESTNET.CAYENNE); devEnv.setUnavailable(LIT_TESTNET.MANZANO); - + const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts index c81bbf5929..c358f22d61 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts @@ -15,7 +15,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog async (devEnv: TinnyEnvironment) => { devEnv.setUnavailable(LIT_TESTNET.CAYENNE); devEnv.setUnavailable(LIT_TESTNET.MANZANO); - + const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts index 7f66deda66..345eebf948 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts @@ -16,7 +16,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning = async (devEnv: TinnyEnvironment) => { devEnv.setUnavailable(LIT_TESTNET.CAYENNE); devEnv.setUnavailable(LIT_TESTNET.MANZANO); - + const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ { diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts index 735e25f0b3..fbe8766817 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts @@ -14,7 +14,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInPa async (devEnv: TinnyEnvironment) => { devEnv.setUnavailable(LIT_TESTNET.CAYENNE); devEnv.setUnavailable(LIT_TESTNET.MANZANO); - + const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts index 603342f783..9ec3c85bf9 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts @@ -18,7 +18,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToPkpSign = async ( ) => { devEnv.setUnavailable(LIT_TESTNET.CAYENNE); devEnv.setUnavailable(LIT_TESTNET.MANZANO); - + const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); diff --git a/yarn.lock b/yarn.lock index 500b580f33..66ee163b86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2003,7 +2003,7 @@ resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA== -"@gar/promisify@^1.1.3": +"@gar/promisify@^1.0.1", "@gar/promisify@^1.1.3": version "1.1.3" resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== @@ -2078,14 +2078,7 @@ wrap-ansi "^8.1.0" wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" -"@isaacs/fs-minipass@^4.0.0": - version "4.0.1" - resolved "https://registry.yarnpkg.com/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz#2d59ae3ab4b38fb4270bfa23d30f8e2e86c7fe32" - integrity sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w== - dependencies: - minipass "^7.0.4" - -"@isaacs/string-locale-compare@*", "@isaacs/string-locale-compare@^1.1.0": +"@isaacs/string-locale-compare@^1.0.1", "@isaacs/string-locale-compare@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@isaacs/string-locale-compare/-/string-locale-compare-1.1.0.tgz#291c227e93fd407a96ecd59879a35809120e432b" integrity sha512-SQ7Kzhh9+D+ZW9MA0zkYv3VXhIDNx+LzM6EJ+/65I3QY+enU6Itte7E5XX7EWrqLW2FN4n06GWzBnPoC3th2aQ== @@ -3517,46 +3510,6 @@ lru-cache "^10.0.1" socks-proxy-agent "^8.0.3" -"@npmcli/arborist@*", "@npmcli/arborist@^7.2.1": - version "7.4.2" - resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-7.4.2.tgz#deb6eb3d88ab6913f0efeb4ebca64151d091d331" - integrity sha512-13flK0DTIhG7VEmPtoKFoi+88hIjuZxuZAvnHUTthIFql1Kc51VlsMRpbJPIcDEZHaHkILwFjHRXtCUYdFWvAQ== - dependencies: - "@isaacs/string-locale-compare" "^1.1.0" - "@npmcli/fs" "^3.1.0" - "@npmcli/installed-package-contents" "^2.0.2" - "@npmcli/map-workspaces" "^3.0.2" - "@npmcli/metavuln-calculator" "^7.0.0" - "@npmcli/name-from-folder" "^2.0.0" - "@npmcli/node-gyp" "^3.0.0" - "@npmcli/package-json" "^5.0.0" - "@npmcli/query" "^3.1.0" - "@npmcli/redact" "^1.1.0" - "@npmcli/run-script" "^7.0.2" - bin-links "^4.0.1" - cacache "^18.0.0" - common-ancestor-path "^1.0.1" - hosted-git-info "^7.0.1" - json-parse-even-better-errors "^3.0.0" - json-stringify-nice "^1.1.4" - minimatch "^9.0.4" - nopt "^7.0.0" - npm-install-checks "^6.2.0" - npm-package-arg "^11.0.1" - npm-pick-manifest "^9.0.0" - npm-registry-fetch "^16.2.0" - npmlog "^7.0.1" - pacote "^17.0.4" - parse-conflict-json "^3.0.0" - proc-log "^3.0.0" - promise-all-reject-late "^1.0.0" - promise-call-limit "^3.0.1" - read-package-json-fast "^3.0.2" - semver "^7.3.7" - ssri "^10.0.5" - treeverse "^3.0.0" - walk-up-path "^3.0.1" - "@npmcli/arborist@5.3.0": version "5.3.0" resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-5.3.0.tgz#321d9424677bfc08569e98a5ac445ee781f32053" @@ -3597,32 +3550,75 @@ treeverse "^2.0.0" walk-up-path "^1.0.0" -"@npmcli/ci-detect@*": - version "3.0.2" - resolved "https://registry.yarnpkg.com/@npmcli/ci-detect/-/ci-detect-3.0.2.tgz#facf5e48f553dd876cc9f5a749b269186ed7f7e6" - integrity sha512-P7nZG0skRVa9lH0OQmFG62CrzOySUiuPbKopjVAj3sXP0m1om9XfIvTp46h+NvlpTyd121JekiXFZj+1pnbm9g== - -"@npmcli/config@*": - version "8.2.2" - resolved "https://registry.yarnpkg.com/@npmcli/config/-/config-8.2.2.tgz#7383559f04e753cad007c845defaacd0c47c6e30" - integrity sha512-VvMHPIzcsKHCaNh9h4kCbn7NyDtcNJFMOUZ8Wu9SWhds5Egr1gMGU2fv+M50P1V5iAUZWZcv2Iguo5HTckpzww== +"@npmcli/arborist@^2.3.0", "@npmcli/arborist@^2.5.0", "@npmcli/arborist@^2.9.0": + version "2.10.0" + resolved "https://registry.yarnpkg.com/@npmcli/arborist/-/arborist-2.10.0.tgz#424c2d73a7ae59c960b0cc7f74fed043e4316c2c" + integrity sha512-CLnD+zXG9oijEEzViimz8fbOoFVb7hoypiaf7p6giJhvYtrxLAyY3cZAMPIFQvsG731+02eMDp3LqVBNo7BaZA== dependencies: - "@npmcli/map-workspaces" "^3.0.2" - ci-info "^4.0.0" - ini "^4.1.2" - nopt "^7.0.0" - proc-log "^3.0.0" - read-package-json-fast "^3.0.2" + "@isaacs/string-locale-compare" "^1.0.1" + "@npmcli/installed-package-contents" "^1.0.7" + "@npmcli/map-workspaces" "^1.0.2" + "@npmcli/metavuln-calculator" "^1.1.0" + "@npmcli/move-file" "^1.1.0" + "@npmcli/name-from-folder" "^1.0.1" + "@npmcli/node-gyp" "^1.0.1" + "@npmcli/package-json" "^1.0.1" + "@npmcli/run-script" "^1.8.2" + bin-links "^2.2.1" + cacache "^15.0.3" + common-ancestor-path "^1.0.1" + json-parse-even-better-errors "^2.3.1" + json-stringify-nice "^1.1.4" + mkdirp "^1.0.4" + mkdirp-infer-owner "^2.0.0" + npm-install-checks "^4.0.0" + npm-package-arg "^8.1.5" + npm-pick-manifest "^6.1.0" + npm-registry-fetch "^11.0.0" + pacote "^11.3.5" + parse-conflict-json "^1.1.1" + proc-log "^1.0.0" + promise-all-reject-late "^1.0.0" + promise-call-limit "^1.0.1" + read-package-json-fast "^2.0.2" + readdir-scoped-modules "^1.1.0" + rimraf "^3.0.2" semver "^7.3.5" - walk-up-path "^3.0.1" + ssri "^8.0.1" + treeverse "^1.0.4" + walk-up-path "^1.0.0" -"@npmcli/disparity-colors@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@npmcli/disparity-colors/-/disparity-colors-3.0.0.tgz#60ea8c6eb5ba9de2d1950e15b06205b2c3ab7833" - integrity sha512-5R/z157/f20Fi0Ou4ZttL51V0xz0EdPEOauFtPCEYOLInDBRCj1/TxOJ5aGTrtShxEshN2d+hXb9ZKSi5RLBcg== +"@npmcli/ci-detect@^1.2.0", "@npmcli/ci-detect@^1.3.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@npmcli/ci-detect/-/ci-detect-1.4.0.tgz#18478bbaa900c37bfbd8a2006a6262c62e8b0fe1" + integrity sha512-3BGrt6FLjqM6br5AhWRKTr3u5GIVkjRYeAFrMp3HjnfICrg4xOrVRwFavKT6tsp++bq5dluL5t8ME/Nha/6c1Q== + +"@npmcli/config@^2.3.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@npmcli/config/-/config-2.4.0.tgz#1447b0274f9502871dabd3ab1d8302472d515b1f" + integrity sha512-fwxu/zaZnvBJohXM3igzqa3P1IVYWi5N343XcKvKkJbAx+rTqegS5tAul4NLiMPQh6WoS5a4er6oo/ieUx1f4g== + dependencies: + ini "^2.0.0" + mkdirp-infer-owner "^2.0.0" + nopt "^5.0.0" + semver "^7.3.4" + walk-up-path "^1.0.0" + +"@npmcli/disparity-colors@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@npmcli/disparity-colors/-/disparity-colors-1.0.1.tgz#b23c864c9658f9f0318d5aa6d17986619989535c" + integrity sha512-kQ1aCTTU45mPXN+pdAaRxlxr3OunkyztjbbxDY/aIcPS5CnCUrx+1+NvA6pTcYR7wmLZe37+Mi5v3nfbwPxq3A== dependencies: ansi-styles "^4.3.0" +"@npmcli/fs@^1.0.0": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-1.1.1.tgz#72f719fe935e687c56a4faecf3c03d06ba593257" + integrity sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ== + dependencies: + "@gar/promisify" "^1.0.1" + semver "^7.3.5" + "@npmcli/fs@^2.1.0": version "2.1.2" resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-2.1.2.tgz#a9e2541a4a2fec2e69c29b35e6060973da79b865" @@ -3638,6 +3634,20 @@ dependencies: semver "^7.3.5" +"@npmcli/git@^2.0.7", "@npmcli/git@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-2.1.0.tgz#2fbd77e147530247d37f325930d457b3ebe894f6" + integrity sha512-/hBFX/QG1b+N7PZBFs0bi+evgRZcK9nWBxQKZkGoXUT5hJSwl5c4d7y8/hm+NQZRPhQ67RzFaj5UM9YeyKoryw== + dependencies: + "@npmcli/promise-spawn" "^1.3.2" + lru-cache "^6.0.0" + mkdirp "^1.0.4" + npm-pick-manifest "^6.1.1" + promise-inflight "^1.0.1" + promise-retry "^2.0.1" + semver "^7.3.5" + which "^2.0.2" + "@npmcli/git@^3.0.0": version "3.0.2" resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-3.0.2.tgz#5c5de6b4d70474cf2d09af149ce42e4e1dacb931" @@ -3653,21 +3663,7 @@ semver "^7.3.5" which "^2.0.2" -"@npmcli/git@^5.0.0", "@npmcli/git@^5.0.3": - version "5.0.6" - resolved "https://registry.yarnpkg.com/@npmcli/git/-/git-5.0.6.tgz#d7b24eb2cff98754c8868faab40405abfa1abe28" - integrity sha512-4x/182sKXmQkf0EtXxT26GEsaOATpD7WVtza5hrYivWZeo6QefC6xq9KAXrnjtFKBZ4rZwR7aX/zClYYXgtwLw== - dependencies: - "@npmcli/promise-spawn" "^7.0.0" - lru-cache "^10.0.1" - npm-pick-manifest "^9.0.0" - proc-log "^4.0.0" - promise-inflight "^1.0.1" - promise-retry "^2.0.1" - semver "^7.3.5" - which "^4.0.0" - -"@npmcli/installed-package-contents@^1.0.7": +"@npmcli/installed-package-contents@^1.0.6", "@npmcli/installed-package-contents@^1.0.7": version "1.0.7" resolved "https://registry.yarnpkg.com/@npmcli/installed-package-contents/-/installed-package-contents-1.0.7.tgz#ab7408c6147911b970a8abe261ce512232a3f4fa" integrity sha512-9rufe0wnJusCQoLpV9ZPKIVP55itrM5BxOXs10DmdbRfgWtHy1LDyskbwRnBghuB0PrF7pNPOqREVtpz4HqzKw== @@ -3675,23 +3671,15 @@ npm-bundled "^1.1.1" npm-normalize-package-bin "^1.0.1" -"@npmcli/installed-package-contents@^2.0.1", "@npmcli/installed-package-contents@^2.0.2": - version "2.0.2" - resolved "https://registry.yarnpkg.com/@npmcli/installed-package-contents/-/installed-package-contents-2.0.2.tgz#bfd817eccd9e8df200919e73f57f9e3d9e4f9e33" - integrity sha512-xACzLPhnfD51GKvTOOuNX2/V4G4mz9/1I2MfDoye9kBM3RYe5g2YbscsaGoTlaWqkxeiapBWyseULVKpSVHtKQ== - dependencies: - npm-bundled "^3.0.0" - npm-normalize-package-bin "^3.0.0" - -"@npmcli/map-workspaces@*", "@npmcli/map-workspaces@^3.0.2": - version "3.0.6" - resolved "https://registry.yarnpkg.com/@npmcli/map-workspaces/-/map-workspaces-3.0.6.tgz#27dc06c20c35ef01e45a08909cab9cb3da08cea6" - integrity sha512-tkYs0OYnzQm6iIRdfy+LcLBjcKuQCeE5YLb8KnrIlutJfheNaPvPpgoFEyEFgbjzl5PLZ3IA/BWAwRU0eHuQDA== +"@npmcli/map-workspaces@^1.0.2", "@npmcli/map-workspaces@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@npmcli/map-workspaces/-/map-workspaces-1.0.4.tgz#915708b55afa25e20bc2c14a766c124c2c5d4cab" + integrity sha512-wVR8QxhyXsFcD/cORtJwGQodeeaDf0OxcHie8ema4VgFeqwYkFsDPnSrIRSytX8xR6nKPAH89WnwTcaU608b/Q== dependencies: - "@npmcli/name-from-folder" "^2.0.0" - glob "^10.2.2" - minimatch "^9.0.0" - read-package-json-fast "^3.0.0" + "@npmcli/name-from-folder" "^1.0.1" + glob "^7.1.6" + minimatch "^3.0.4" + read-package-json-fast "^2.0.1" "@npmcli/map-workspaces@^2.0.3": version "2.0.4" @@ -3703,6 +3691,15 @@ minimatch "^5.0.1" read-package-json-fast "^2.0.3" +"@npmcli/metavuln-calculator@^1.1.0": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@npmcli/metavuln-calculator/-/metavuln-calculator-1.1.1.tgz#2f95ff3c6d88b366dd70de1c3f304267c631b458" + integrity sha512-9xe+ZZ1iGVaUovBVFI9h3qW+UuECUzhvZPxK9RaEA2mjU26o5D0JloGYWwLYvQELJNmBdQB6rrpuN8jni6LwzQ== + dependencies: + cacache "^15.0.5" + pacote "^11.1.11" + semver "^7.3.2" + "@npmcli/metavuln-calculator@^3.0.1": version "3.1.1" resolved "https://registry.yarnpkg.com/@npmcli/metavuln-calculator/-/metavuln-calculator-3.1.1.tgz#9359bd72b400f8353f6a28a25c8457b562602622" @@ -3713,16 +3710,13 @@ pacote "^13.0.3" semver "^7.3.5" -"@npmcli/metavuln-calculator@^7.0.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@npmcli/metavuln-calculator/-/metavuln-calculator-7.1.0.tgz#70aad00623d47297cd2c950a686ef4220e4a9040" - integrity sha512-D4VZzVLZ4Mw+oUCWyQ6qzlm5SGlrLnhKtZscDwQXFFc1FUPvw69Ibo2E5ZpJAmjFSYkA5UlCievWmREW0JLC3w== +"@npmcli/move-file@^1.0.1", "@npmcli/move-file@^1.1.0": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@npmcli/move-file/-/move-file-1.1.2.tgz#1a82c3e372f7cae9253eb66d72543d6b8685c674" + integrity sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg== dependencies: - cacache "^18.0.0" - json-parse-even-better-errors "^3.0.0" - pacote "^18.0.0" - proc-log "^4.1.0" - semver "^7.3.5" + mkdirp "^1.0.4" + rimraf "^3.0.2" "@npmcli/move-file@^2.0.0": version "2.0.1" @@ -3737,33 +3731,22 @@ resolved "https://registry.yarnpkg.com/@npmcli/name-from-folder/-/name-from-folder-1.0.1.tgz#77ecd0a4fcb772ba6fe927e2e2e155fbec2e6b1a" integrity sha512-qq3oEfcLFwNfEYOQ8HLimRGKlD8WSeGEdtUa7hmzpR8Sa7haL1KVQrvgO6wqMjhWFFVjgtrh1gIxDz+P8sjUaA== -"@npmcli/name-from-folder@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@npmcli/name-from-folder/-/name-from-folder-2.0.0.tgz#c44d3a7c6d5c184bb6036f4d5995eee298945815" - integrity sha512-pwK+BfEBZJbKdNYpHHRTNBwBoqrN/iIMO0AiGvYsp3Hoaq0WbgGSWQR6SCldZovoDpY3yje5lkFUe6gsDgJ2vg== +"@npmcli/node-gyp@^1.0.1", "@npmcli/node-gyp@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@npmcli/node-gyp/-/node-gyp-1.0.3.tgz#a912e637418ffc5f2db375e93b85837691a43a33" + integrity sha512-fnkhw+fmX65kiLqk6E3BFLXNC26rUhK90zVwe2yncPliVT/Qos3xjhTLE59Df8KnPlcwIERXKVlU1bXoUQ+liA== "@npmcli/node-gyp@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@npmcli/node-gyp/-/node-gyp-2.0.0.tgz#8c20e53e34e9078d18815c1d2dda6f2420d75e35" integrity sha512-doNI35wIe3bBaEgrlPfdJPaCpUR89pJWep4Hq3aRdh6gKazIVWfs0jHttvSSoq47ZXgC7h73kDsUl8AoIQUB+A== -"@npmcli/node-gyp@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@npmcli/node-gyp/-/node-gyp-3.0.0.tgz#101b2d0490ef1aa20ed460e4c0813f0db560545a" - integrity sha512-gp8pRXC2oOxu0DUE1/M3bYtb1b3/DbJ5aM113+XJBgfXdussRAsX0YOrOhdd8WvnAR6auDBvJomGAkLKA5ydxA== - -"@npmcli/package-json@*", "@npmcli/package-json@^5.0.0": - version "5.1.0" - resolved "https://registry.yarnpkg.com/@npmcli/package-json/-/package-json-5.1.0.tgz#10d117b5fb175acc14c70901a151c52deffc843e" - integrity sha512-1aL4TuVrLS9sf8quCLerU3H9J4vtCtgu8VauYozrmEyU57i/EdKleCnsQ7vpnABIH6c9mnTxcH5sFkO3BlV8wQ== +"@npmcli/package-json@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@npmcli/package-json/-/package-json-1.0.1.tgz#1ed42f00febe5293c3502fd0ef785647355f6e89" + integrity sha512-y6jnu76E9C23osz8gEMBayZmaZ69vFOIk8vR1FJL/wbEJ54+9aVG9rLTjQKSXfgYZEr50nw1txBBFfBZZe+bYg== dependencies: - "@npmcli/git" "^5.0.0" - glob "^10.2.2" - hosted-git-info "^7.0.0" - json-parse-even-better-errors "^3.0.0" - normalize-package-data "^6.0.0" - proc-log "^4.0.0" - semver "^7.5.3" + json-parse-even-better-errors "^2.3.1" "@npmcli/package-json@^2.0.0": version "2.0.0" @@ -3772,6 +3755,13 @@ dependencies: json-parse-even-better-errors "^2.3.1" +"@npmcli/promise-spawn@^1.2.0", "@npmcli/promise-spawn@^1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@npmcli/promise-spawn/-/promise-spawn-1.3.2.tgz#42d4e56a8e9274fba180dabc0aea6e38f29274f5" + integrity sha512-QyAGYo/Fbj4MXeGdJcFzZ+FkDkomfRBrPM+9QYJSg+PxgAUL+LU3FneQk37rKR2/zjqkCV1BLHccX98wRXG3Sg== + dependencies: + infer-owner "^1.0.4" + "@npmcli/promise-spawn@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@npmcli/promise-spawn/-/promise-spawn-3.0.0.tgz#53283b5f18f855c6925f23c24e67c911501ef573" @@ -3779,36 +3769,15 @@ dependencies: infer-owner "^1.0.4" -"@npmcli/promise-spawn@^7.0.0": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@npmcli/promise-spawn/-/promise-spawn-7.0.1.tgz#a836de2f42a2245d629cf6fbb8dd6c74c74c55af" - integrity sha512-P4KkF9jX3y+7yFUxgcUdDtLy+t4OlDGuEBLNs57AZsfSfg+uV6MLndqGpnl4831ggaEdXwR50XFoZP4VFtHolg== - dependencies: - which "^4.0.0" - -"@npmcli/query@^3.1.0": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@npmcli/query/-/query-3.1.0.tgz#bc202c59e122a06cf8acab91c795edda2cdad42c" - integrity sha512-C/iR0tk7KSKGldibYIB9x8GtO/0Bd0I2mhOaDb8ucQL/bQVTmGoeREaFj64Z5+iCBRf3dQfed0CjJL7I8iTkiQ== +"@npmcli/run-script@^1.8.2", "@npmcli/run-script@^1.8.3", "@npmcli/run-script@^1.8.4", "@npmcli/run-script@^1.8.6": + version "1.8.6" + resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-1.8.6.tgz#18314802a6660b0d4baa4c3afe7f1ad39d8c28b7" + integrity sha512-e42bVZnC6VluBZBAFEr3YrdqSspG3bgilyg4nSLBJ7TRGNCzxHa92XAHxQBLYg0BmgwO4b2mf3h/l5EkEWRn3g== dependencies: - postcss-selector-parser "^6.0.10" - -"@npmcli/redact@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@npmcli/redact/-/redact-1.1.0.tgz#78e53a6a34f013543a73827a07ebdc3a6f10454b" - integrity sha512-PfnWuOkQgu7gCbnSsAisaX7hKOdZ4wSAhAzH3/ph5dSGau52kCRrMMGbiSQLwyTZpgldkZ49b0brkOr1AzGBHQ== - -"@npmcli/run-script@*", "@npmcli/run-script@^8.0.0": - version "8.0.0" - resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-8.0.0.tgz#644f8e28fd3cde25e40a79d3b35cb14076ec848b" - integrity sha512-5noc+eCQmX1W9nlFUe65n5MIteikd3vOA2sEPdXtlUv68KWyHNFZnT/LDRXu/E4nZ5yxjciP30pADr/GQ97W1w== - dependencies: - "@npmcli/node-gyp" "^3.0.0" - "@npmcli/package-json" "^5.0.0" - "@npmcli/promise-spawn" "^7.0.0" - node-gyp "^10.0.0" - proc-log "^4.0.0" - which "^4.0.0" + "@npmcli/node-gyp" "^1.0.2" + "@npmcli/promise-spawn" "^1.3.2" + node-gyp "^7.1.0" + read-package-json-fast "^2.0.1" "@npmcli/run-script@^4.1.0", "@npmcli/run-script@^4.1.3", "@npmcli/run-script@^4.1.7": version "4.2.1" @@ -3821,17 +3790,6 @@ read-package-json-fast "^2.0.3" which "^2.0.2" -"@npmcli/run-script@^7.0.0", "@npmcli/run-script@^7.0.2": - version "7.0.4" - resolved "https://registry.yarnpkg.com/@npmcli/run-script/-/run-script-7.0.4.tgz#9f29aaf4bfcf57f7de2a9e28d1ef091d14b2e6eb" - integrity sha512-9ApYM/3+rBt9V80aYg6tZfzj3UWdiYyCt7gJUD1VJKvWF5nwKDSICXbYIQbspFTq6TOpbsEtIC0LArB8d9PFmg== - dependencies: - "@npmcli/node-gyp" "^3.0.0" - "@npmcli/package-json" "^5.0.0" - "@npmcli/promise-spawn" "^7.0.0" - node-gyp "^10.0.0" - which "^4.0.0" - "@nrwl/cli@15.9.7": version "15.9.7" resolved "https://registry.yarnpkg.com/@nrwl/cli/-/cli-15.9.7.tgz#1db113f5cb1cfe63213097be1ece041eef33da1f" @@ -4849,50 +4807,6 @@ resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== -"@sigstore/bundle@^2.3.0", "@sigstore/bundle@^2.3.1": - version "2.3.1" - resolved "https://registry.yarnpkg.com/@sigstore/bundle/-/bundle-2.3.1.tgz#f6cdc67c8400e58ca27f0ef495b27a9327512073" - integrity sha512-eqV17lO3EIFqCWK3969Rz+J8MYrRZKw9IBHpSo6DEcEX2c+uzDFOgHE9f2MnyDpfs48LFO4hXmk9KhQ74JzU1g== - dependencies: - "@sigstore/protobuf-specs" "^0.3.1" - -"@sigstore/core@^1.0.0", "@sigstore/core@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@sigstore/core/-/core-1.1.0.tgz#5583d8f7ffe599fa0a89f2bf289301a5af262380" - integrity sha512-JzBqdVIyqm2FRQCulY6nbQzMpJJpSiJ8XXWMhtOX9eKgaXXpfNOF53lzQEjIydlStnd/eFtuC1dW4VYdD93oRg== - -"@sigstore/protobuf-specs@^0.3.0", "@sigstore/protobuf-specs@^0.3.1": - version "0.3.1" - resolved "https://registry.yarnpkg.com/@sigstore/protobuf-specs/-/protobuf-specs-0.3.1.tgz#7095819fa7c5743efde48a858c37b30fab190a09" - integrity sha512-aIL8Z9NsMr3C64jyQzE0XlkEyBLpgEJJFDHLVVStkFV5Q3Il/r/YtY6NJWKQ4cy4AE7spP1IX5Jq7VCAxHHMfQ== - -"@sigstore/sign@^2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@sigstore/sign/-/sign-2.3.0.tgz#c35e10a3d707e0c69a29bd9f93fa2bdc6275817c" - integrity sha512-tsAyV6FC3R3pHmKS880IXcDJuiFJiKITO1jxR1qbplcsBkZLBmjrEw5GbC7ikD6f5RU1hr7WnmxB/2kKc1qUWQ== - dependencies: - "@sigstore/bundle" "^2.3.0" - "@sigstore/core" "^1.0.0" - "@sigstore/protobuf-specs" "^0.3.1" - make-fetch-happen "^13.0.0" - -"@sigstore/tuf@^2.3.1": - version "2.3.2" - resolved "https://registry.yarnpkg.com/@sigstore/tuf/-/tuf-2.3.2.tgz#e9c5bffc2a5f3434f87195902d7f9cd7f48c70fa" - integrity sha512-mwbY1VrEGU4CO55t+Kl6I7WZzIl+ysSzEYdA1Nv/FTrl2bkeaPXo5PnWZAVfcY2zSdhOpsUTJW67/M2zHXGn5w== - dependencies: - "@sigstore/protobuf-specs" "^0.3.0" - tuf-js "^2.2.0" - -"@sigstore/verify@^1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@sigstore/verify/-/verify-1.2.0.tgz#48549186305d8a5e471a3a304cf4cb3e0c99dde7" - integrity sha512-hQF60nc9yab+Csi4AyoAmilGNfpXT+EXdBgFkP9OgPwIBPwyqVf7JAWPtmqrrrneTmAT6ojv7OlH1f6Ix5BG4Q== - dependencies: - "@sigstore/bundle" "^2.3.1" - "@sigstore/core" "^1.1.0" - "@sigstore/protobuf-specs" "^0.3.1" - "@simplewebauthn/browser@^7.2.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@simplewebauthn/browser/-/browser-7.4.0.tgz#3e25b5e9f45d03eb60d3e4f8812d8d2acfd7dba6" @@ -5583,19 +5497,6 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== -"@tufjs/canonical-json@2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz#a52f61a3d7374833fca945b2549bc30a2dd40d0a" - integrity sha512-yVtV8zsdo8qFHe+/3kw81dSLyF7D576A5cCFCi4X7B39tWT7SekaEFUnvnWJHz+9qO7qJTah1JbrDjWKqFtdWA== - -"@tufjs/models@2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@tufjs/models/-/models-2.0.0.tgz#c7ab241cf11dd29deb213d6817dabb8c99ce0863" - integrity sha512-c8nj8BaOExmZKO2DXhDfegyhSGcG9E/mPN3U13L+/PsoWm1uaGiHHjxqSHQiasDBQwDA3aHuw9+9spYAP1qvvg== - dependencies: - "@tufjs/canonical-json" "2.0.0" - minimatch "^9.0.3" - "@typechain/ethers-v5@^11.1.1": version "11.1.2" resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-11.1.2.tgz#82510c1744f37a2f906b9e0532ac18c0b74ffe69" @@ -6817,16 +6718,16 @@ abab@^2.0.3, abab@^2.0.5: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== -abbrev@*, abbrev@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-2.0.0.tgz#cf59829b8b4f03f89dda2771cb7f3653828c89bf" - integrity sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ== - -abbrev@1, abbrev@^1.0.0: +abbrev@1, abbrev@^1.0.0, abbrev@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q== +abbrev@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-2.0.0.tgz#cf59829b8b4f03f89dda2771cb7f3653828c89bf" + integrity sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ== + abi-decoder@2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/abi-decoder/-/abi-decoder-2.3.0.tgz#e56b4e7b45f9a612c8aa2c76655948e7bb2687b3" @@ -6937,7 +6838,7 @@ agent-base@^7.0.2, agent-base@^7.1.0, agent-base@^7.1.1: dependencies: debug "^4.3.4" -agentkeepalive@^4.2.1: +agentkeepalive@^4.1.3, agentkeepalive@^4.2.1: version "4.5.0" resolved "https://registry.yarnpkg.com/agentkeepalive/-/agentkeepalive-4.5.0.tgz#2673ad1389b3c418c5a20c5d7364f93ca04be923" integrity sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew== @@ -7079,12 +6980,12 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -ansicolors@*, ansicolors@~0.3.2: +ansicolors@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" integrity sha512-QXu7BPrP29VllRxH8GwB7x5iX5qWKAAMLqKQGWTeLWVlNHNOpVMJ91dsxQAIWXpjuW5wqvxu3Jd/nRjrJ+0pqg== -ansistyles@*: +ansistyles@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ansistyles/-/ansistyles-0.1.3.tgz#5de60415bda071bb37127854c864f41b23254539" integrity sha512-6QWEyvMgIXX0eO972y7YPBLSBsq7UWKFAoNNTLGaOJ9bstcEL9sCbcjf96dVfNDdUsRoGOK82vWFJlKApXds7g== @@ -7129,6 +7030,11 @@ append-transform@^2.0.0: dependencies: default-require-extensions "^3.0.0" +aproba@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" + integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== + "aproba@^1.0.3 || ^2.0.0", aproba@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" @@ -7146,11 +7052,19 @@ archive-type@^4.0.0: dependencies: file-type "^4.2.0" -archy@*, archy@^1.0.0: +archy@^1.0.0, archy@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/archy/-/archy-1.0.0.tgz#f9c8c13757cc1dd7bc379ac77b2c62a5c2868c40" integrity sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw== +are-we-there-yet@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz#372e0e7bd279d8e94c653aaa1f67200884bf3e1c" + integrity sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw== + dependencies: + delegates "^1.0.0" + readable-stream "^3.6.0" + are-we-there-yet@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-3.0.1.tgz#679df222b278c64f2cdba1175cdc00b0d96164bd" @@ -7159,10 +7073,13 @@ are-we-there-yet@^3.0.0: delegates "^1.0.0" readable-stream "^3.6.0" -are-we-there-yet@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-4.0.2.tgz#aed25dd0eae514660d49ac2b2366b175c614785a" - integrity sha512-ncSWAawFhKMJDTdoAeOV+jyW1VCMj5QIAwULIBV0SSR7B/RLPPEQiknKcg/RIIZlUQrxELpsxMiTUoAQ4sIUyg== +are-we-there-yet@~1.1.2: + version "1.1.7" + resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.7.tgz#b15474a932adab4ff8a50d9adfa7e4e926f21146" + integrity sha512-nxwy40TuMiUGqMyRHgCSWZ9FM4VAoRP4xUYSTv5ImRog+h9yISPbVH7H8fASCIzYn9wlEv4zvFL7uKDMCFQm3g== + dependencies: + delegates "^1.0.0" + readable-stream "^2.0.6" arg@5.0.2, arg@^5.0.2: version "5.0.2" @@ -8442,6 +8359,18 @@ bignumber.js@^9.0.0, bignumber.js@^9.0.1: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== +bin-links@^2.2.1: + version "2.3.0" + resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-2.3.0.tgz#1ff241c86d2c29b24ae52f49544db5d78a4eb967" + integrity sha512-JzrOLHLwX2zMqKdyYZjkDgQGT+kHDkIhv2/IK2lJ00qLxV4TmFoHi8drDBb6H5Zrz1YfgHkai4e2MGPqnoUhqA== + dependencies: + cmd-shim "^4.0.1" + mkdirp-infer-owner "^2.0.0" + npm-normalize-package-bin "^1.0.0" + read-cmd-shim "^2.0.0" + rimraf "^3.0.0" + write-file-atomic "^3.0.3" + bin-links@^3.0.0: version "3.0.3" resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-3.0.3.tgz#3842711ef3db2cd9f16a5f404a996a12db355a6e" @@ -8454,22 +8383,12 @@ bin-links@^3.0.0: rimraf "^3.0.0" write-file-atomic "^4.0.0" -bin-links@^4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/bin-links/-/bin-links-4.0.3.tgz#9e4a3c5900830aee3d7f52178b65e01dcdde64a5" - integrity sha512-obsRaULtJurnfox/MDwgq6Yo9kzbv1CPTk/1/s7Z/61Lezc8IKkFCOXNeVLXz0456WRzBQmSsDWlai2tIhBsfA== - dependencies: - cmd-shim "^6.0.0" - npm-normalize-package-bin "^3.0.0" - read-cmd-shim "^4.0.0" - write-file-atomic "^5.0.0" - binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" integrity sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw== -binary-extensions@^2.0.0, binary-extensions@^2.3.0: +binary-extensions@^2.0.0, binary-extensions@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== @@ -8938,23 +8857,29 @@ bytes@3.1.2: resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== -cacache@*, cacache@^18.0.0: - version "18.0.2" - resolved "https://registry.yarnpkg.com/cacache/-/cacache-18.0.2.tgz#fd527ea0f03a603be5c0da5805635f8eef00c60c" - integrity sha512-r3NU8h/P+4lVUHfeRw1dtgQYar3DZMm4/cm2bZgOvrFC/su7budSOeqh52VJIC4U4iG1WWwV6vRW0znqBvxNuw== +cacache@^15.0.3, cacache@^15.0.5, cacache@^15.2.0, cacache@^15.3.0: + version "15.3.0" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.3.0.tgz#dc85380fb2f556fe3dda4c719bfa0ec875a7f1eb" + integrity sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ== dependencies: - "@npmcli/fs" "^3.1.0" - fs-minipass "^3.0.0" - glob "^10.2.2" - lru-cache "^10.0.1" - minipass "^7.0.3" - minipass-collect "^2.0.1" + "@npmcli/fs" "^1.0.0" + "@npmcli/move-file" "^1.0.1" + chownr "^2.0.0" + fs-minipass "^2.0.0" + glob "^7.1.4" + infer-owner "^1.0.4" + lru-cache "^6.0.0" + minipass "^3.1.1" + minipass-collect "^1.0.2" minipass-flush "^1.0.5" - minipass-pipeline "^1.2.4" + minipass-pipeline "^1.2.2" + mkdirp "^1.0.3" p-map "^4.0.0" - ssri "^10.0.0" - tar "^6.1.11" - unique-filename "^3.0.0" + promise-inflight "^1.0.1" + rimraf "^3.0.2" + ssri "^8.0.1" + tar "^6.0.2" + unique-filename "^1.1.1" cacache@^16.0.0, cacache@^16.0.6, cacache@^16.1.0: version "16.1.3" @@ -8980,6 +8905,24 @@ cacache@^16.0.0, cacache@^16.0.6, cacache@^16.1.0: tar "^6.1.11" unique-filename "^2.0.0" +cacache@^18.0.0: + version "18.0.2" + resolved "https://registry.yarnpkg.com/cacache/-/cacache-18.0.2.tgz#fd527ea0f03a603be5c0da5805635f8eef00c60c" + integrity sha512-r3NU8h/P+4lVUHfeRw1dtgQYar3DZMm4/cm2bZgOvrFC/su7budSOeqh52VJIC4U4iG1WWwV6vRW0znqBvxNuw== + dependencies: + "@npmcli/fs" "^3.1.0" + fs-minipass "^3.0.0" + glob "^10.2.2" + lru-cache "^10.0.1" + minipass "^7.0.3" + minipass-collect "^2.0.1" + minipass-flush "^1.0.5" + minipass-pipeline "^1.2.4" + p-map "^4.0.0" + ssri "^10.0.0" + tar "^6.1.11" + unique-filename "^3.0.0" + cache-base@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" @@ -9175,11 +9118,6 @@ chalk-template@0.4.0: dependencies: chalk "^4.1.2" -chalk@*, chalk@^5.0.1, chalk@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" - integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== - chalk@4.1.2, chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" @@ -9221,6 +9159,11 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^5.0.1, chalk@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" + integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== + chance@^1.1.4: version "1.1.11" resolved "https://registry.yarnpkg.com/chance/-/chance-1.1.11.tgz#78e10e1f9220a5bbc60a83e3f28a5d8558d84d1b" @@ -9331,11 +9274,6 @@ chokidar@^2.0.4: optionalDependencies: fsevents "^1.2.7" -chownr@*, chownr@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-3.0.0.tgz#9855e64ecd240a9cc4267ce8a4aa5d24a1da15e4" - integrity sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g== - chownr@^1.1.1, chownr@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" @@ -9356,17 +9294,12 @@ ci-info@^3.2.0, ci-info@^3.4.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.9.0.tgz#4279a62028a7b1f262f3473fc9605f5e218c59b4" integrity sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ== -ci-info@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-4.0.0.tgz#65466f8b280fc019b9f50a5388115d17a63a44f2" - integrity sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg== - -cidr-regex@^4.0.4: - version "4.0.5" - resolved "https://registry.yarnpkg.com/cidr-regex/-/cidr-regex-4.0.5.tgz#c90181992feb60ce28b8cc7590970ab94ab1060a" - integrity sha512-gljhROSwEnEvC+2lKqfkv1dU2v46h8Cwob19LlfGeGRMDLuwFD5+3D6+/vaa9/QrVLDASiSQ2OYQwzzjQ5I57A== +cidr-regex@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/cidr-regex/-/cidr-regex-3.1.1.tgz#ba1972c57c66f61875f18fd7dd487469770b571d" + integrity sha512-RBqYd32aDwbCMFJRL6wHOlDNYJsPNTt8vC82ErHF5vKt8QQzxm1FrkW8s/R5pVrXMf17sba09Uoy91PKiddAsw== dependencies: - ip-regex "^5.0.0" + ip-regex "^4.1.0" cids@^0.7.1: version "0.7.5" @@ -9450,13 +9383,13 @@ cli-boxes@^3.0.0: resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-3.0.0.tgz#71a10c716feeba005e4504f36329ef0b17cf3145" integrity sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g== -cli-columns@*: - version "4.0.0" - resolved "https://registry.yarnpkg.com/cli-columns/-/cli-columns-4.0.0.tgz#9fe4d65975238d55218c41bd2ed296a7fa555646" - integrity sha512-XW2Vg+w+L9on9wtwKpyzluIPCWXjaBahI7mTcYjx+BVIYD9c3yqcv/yKC7CmdCZat4rq2yiE1UMSJC5ivKfMtQ== +cli-columns@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/cli-columns/-/cli-columns-3.1.2.tgz#6732d972979efc2ae444a1f08e08fa139c96a18e" + integrity sha512-iQYpDgpPPmCjn534ikQOhi+ydP6uMar+DtJ6a0In4aGL/PKqWfao75s6eF81quQQaz7isGz+goNECLARRZswdg== dependencies: - string-width "^4.2.3" - strip-ansi "^6.0.1" + string-width "^2.0.0" + strip-ansi "^3.0.1" cli-cursor@3.1.0, cli-cursor@^3.1.0: version "3.1.0" @@ -9482,7 +9415,7 @@ cli-spinners@^2.5.0: resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.9.2.tgz#1773a8f4b9c4d6ac31563df53b3fc1d79462fe41" integrity sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg== -cli-table3@*, cli-table3@^0.6.0, cli-table3@~0.6.0, cli-table3@~0.6.1: +cli-table3@^0.6.0, cli-table3@~0.6.0, cli-table3@~0.6.1: version "0.6.4" resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.4.tgz#d1c536b8a3f2e7bec58f67ac9e5769b1b30088b0" integrity sha512-Lm3L0p+/npIQWNIiyF/nAn7T5dnOwR3xNTHXYEBFBFVPXzCVNZ5lqEC/1eo/EVfpDsQ1I+TX4ORPQgp+UI0CRw== @@ -9615,6 +9548,13 @@ clsx@^1.1.0: resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.2.1.tgz#0ddc4a20a549b59c93a4116bb26f5294ca17dc12" integrity sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg== +cmd-shim@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-4.1.0.tgz#b3a904a6743e9fede4148c6f3800bf2a08135bdd" + integrity sha512-lb9L7EM4I/ZRVuljLPEtUJOP+xiQVknZ4ZMpMgEp4JzNldPb27HU03hi6K1/6CoIuit/Zm/LQXySErFeXxDprw== + dependencies: + mkdirp-infer-owner "^2.0.0" + cmd-shim@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-5.0.0.tgz#8d0aaa1a6b0708630694c4dbde070ed94c707724" @@ -9622,11 +9562,6 @@ cmd-shim@^5.0.0: dependencies: mkdirp-infer-owner "^2.0.0" -cmd-shim@^6.0.0: - version "6.0.2" - resolved "https://registry.yarnpkg.com/cmd-shim/-/cmd-shim-6.0.2.tgz#435fd9e5c95340e61715e19f90209ed6fcd9e0a4" - integrity sha512-+FFYbB0YLaAkhkcrjkyNLYDiOsFSfRjwjY19LXk/psmMx1z00xlCv7hhQoTGXXIKi+YXHL/iiFo8NqMVQX9nOw== - co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -9682,7 +9617,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -color-support@^1.1.3: +color-support@^1.1.2, color-support@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== @@ -9697,7 +9632,7 @@ colors@1.4.0, colors@^1.4.0: resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== -columnify@*, columnify@^1.6.0: +columnify@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.6.0.tgz#6989531713c9008bb29735e61e37acf5bd553cf3" integrity sha512-lomjuFZKfM6MSAnV9aCZC9sc0qGbmZdfygNv+nCpqVkSKdCxCklLtd16O0EILGkImHw9ZpHkAnHaB+8Zxq5W6Q== @@ -9705,6 +9640,14 @@ columnify@*, columnify@^1.6.0: strip-ansi "^6.0.1" wcwidth "^1.0.0" +columnify@~1.5.4: + version "1.5.4" + resolved "https://registry.yarnpkg.com/columnify/-/columnify-1.5.4.tgz#4737ddf1c7b69a8a7c340570782e947eec8e78bb" + integrity sha512-rFl+iXVT1nhLQPfGDw+3WcS8rmm7XsLKUmhsGE3ihzzpIikeGrTaZPIRKYWeLsLBypsHzjXIvYEltVUZS84XxQ== + dependencies: + strip-ansi "^3.0.0" + wcwidth "^1.0.0" + combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -9922,7 +9865,7 @@ console-browserify@^1.2.0: resolved "https://registry.yarnpkg.com/console-browserify/-/console-browserify-1.2.0.tgz#67063cef57ceb6cf4993a2ab3a55840ae8c49336" integrity sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA== -console-control-strings@^1.1.0: +console-control-strings@^1.0.0, console-control-strings@^1.1.0, console-control-strings@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/console-control-strings/-/console-control-strings-1.1.0.tgz#3d7cf4464db6446ea644bf4b39507f9851008e8e" integrity sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ== @@ -10363,11 +10306,6 @@ css-what@^6.0.1, css-what@^6.1.0: resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4" integrity sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw== -cssesc@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" - integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== - csso@^5.0.5: version "5.0.5" resolved "https://registry.yarnpkg.com/csso/-/csso-5.0.5.tgz#f9b7fe6cc6ac0b7d90781bb16d5e9874303e2ca6" @@ -11142,7 +11080,7 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== -diff@^5.1.0: +diff@^5.0.0: version "5.2.0" resolved "https://registry.yarnpkg.com/diff/-/diff-5.2.0.tgz#26ded047cd1179b78b9537d5ef725503ce1ae531" integrity sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A== @@ -11514,7 +11452,7 @@ encodeurl@~1.0.2: resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== -encoding@^0.1.11, encoding@^0.1.13: +encoding@^0.1.11, encoding@^0.1.12, encoding@^0.1.13: version "0.1.13" resolved "https://registry.yarnpkg.com/encoding/-/encoding-0.1.13.tgz#56574afdd791f54a8e9b2785c0582a2d26210fa9" integrity sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A== @@ -13370,7 +13308,7 @@ fast-url-parser@1.1.3, fast-url-parser@^1.1.3: dependencies: punycode "^1.3.2" -fastest-levenshtein@*: +fastest-levenshtein@^1.0.12: version "1.0.16" resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5" integrity sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg== @@ -13924,6 +13862,21 @@ g@^2.0.1: resolved "https://registry.yarnpkg.com/g/-/g-2.0.1.tgz#0b5963ebd0ca70e3bc8c6766934a021821c8b857" integrity sha512-Fi6Ng5fZ/ANLQ15H11hCe+09sgUoNvDEBevVgx3KoYOhsH5iLNPn54hx0jPZ+3oSWr+xajnp2Qau9VmPsc7hTA== +gauge@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-3.0.2.tgz#03bf4441c044383908bcfa0656ad91803259b395" + integrity sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q== + dependencies: + aproba "^1.0.3 || ^2.0.0" + color-support "^1.1.2" + console-control-strings "^1.0.0" + has-unicode "^2.0.1" + object-assign "^4.1.1" + signal-exit "^3.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + wide-align "^1.1.2" + gauge@^4.0.3: version "4.0.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-4.0.4.tgz#52ff0652f2bbf607a989793d53b751bef2328dce" @@ -13938,19 +13891,19 @@ gauge@^4.0.3: strip-ansi "^6.0.1" wide-align "^1.1.5" -gauge@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/gauge/-/gauge-5.0.1.tgz#1efc801b8ff076b86ef3e9a7a280a975df572112" - integrity sha512-CmykPMJGuNan/3S4kZOpvvPYSNqSHANiWnh9XcMU2pSjtBfF0XzZ2p1bFAxTbnFxyBuPxQYHhzwaoOmUdqzvxQ== +gauge@~2.7.3: + version "2.7.4" + resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" + integrity sha512-14x4kjc6lkD3ltw589k0NrPD6cCNTD6CWoVUNpB85+DrtONoZn+Rug6xZU5RvSC4+TZPxA5AnBibQYAvZn41Hg== dependencies: - aproba "^1.0.3 || ^2.0.0" - color-support "^1.1.3" - console-control-strings "^1.1.0" - has-unicode "^2.0.1" - signal-exit "^4.0.1" - string-width "^4.2.3" - strip-ansi "^6.0.1" - wide-align "^1.1.5" + aproba "^1.0.3" + console-control-strings "^1.0.0" + has-unicode "^2.0.0" + object-assign "^4.1.0" + signal-exit "^3.0.0" + string-width "^1.0.1" + strip-ansi "^3.0.1" + wide-align "^1.1.0" gensync@^1.0.0-beta.2: version "1.0.0-beta.2" @@ -14188,17 +14141,6 @@ glob-slasher@^1.0.1: lodash.isobject "^2.4.1" toxic "^1.0.0" -glob@*, glob@^10.2.2, glob@^10.3.10, glob@^10.3.7: - version "10.3.12" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.12.tgz#3a65c363c2e9998d220338e88a5f6ac97302960b" - integrity sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg== - dependencies: - foreground-child "^3.1.0" - jackspeak "^2.3.6" - minimatch "^9.0.1" - minipass "^7.0.4" - path-scurry "^1.10.2" - glob@7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" @@ -14223,6 +14165,17 @@ glob@7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^10.2.2, glob@^10.3.10: + version "10.3.12" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.3.12.tgz#3a65c363c2e9998d220338e88a5f6ac97302960b" + integrity sha512-TCNv8vJ+xz4QiqTpfOJA7HvYv+tNIRHKfUWw/q+v2jdgN4ebz+KY9tGx5J4rHP0o84mNP+ApH66HRX8us3Khqg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^2.3.6" + minimatch "^9.0.1" + minipass "^7.0.4" + path-scurry "^1.10.2" + glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.0, glob@~7.2.3: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -14431,7 +14384,7 @@ got@^9.6.0: to-readable-stream "^1.0.0" url-parse-lax "^3.0.0" -graceful-fs@*, graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.9: +graceful-fs@^4.1.10, graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0, graceful-fs@^4.2.3, graceful-fs@^4.2.4, graceful-fs@^4.2.6, graceful-fs@^4.2.8, graceful-fs@^4.2.9: version "4.2.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== @@ -14555,7 +14508,7 @@ has-tostringtag@^1.0.0, has-tostringtag@^1.0.2: dependencies: has-symbols "^1.0.3" -has-unicode@^2.0.1: +has-unicode@^2.0.0, has-unicode@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" integrity sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ== @@ -14718,13 +14671,6 @@ hook-std@^2.0.0: resolved "https://registry.yarnpkg.com/hook-std/-/hook-std-2.0.0.tgz#ff9aafdebb6a989a354f729bb6445cf4a3a7077c" integrity sha512-zZ6T5WcuBMIUVh49iPQS9t977t7C0l7OtHrpeMb5uk48JdflRX0NSFvCekfYNmGQETnLq9W/isMyHl69kxGi8g== -hosted-git-info@*, hosted-git-info@^7.0.0, hosted-git-info@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-7.0.1.tgz#9985fcb2700467fecf7f33a4d4874e30680b5322" - integrity sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA== - dependencies: - lru-cache "^10.0.1" - hosted-git-info@^2.1.4: version "2.8.9" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.9.tgz#dffc0bf9a21c02209090f2aa69429e1414daf3f9" @@ -14737,7 +14683,7 @@ hosted-git-info@^3.0.6: dependencies: lru-cache "^6.0.0" -hosted-git-info@^4.0.0, hosted-git-info@^4.0.1: +hosted-git-info@^4.0.0, hosted-git-info@^4.0.1, hosted-git-info@^4.0.2: version "4.1.0" resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-4.1.0.tgz#827b82867e9ff1c8d0c4d9d53880397d2c86d224" integrity sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA== @@ -14751,6 +14697,13 @@ hosted-git-info@^5.0.0: dependencies: lru-cache "^7.5.1" +hosted-git-info@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-7.0.1.tgz#9985fcb2700467fecf7f33a4d4874e30680b5322" + integrity sha512-+K84LB1DYwMHoHSgaOY/Jfhw3ucPmSET5v98Ke/HdNSw4a0UktWzyW1mjhjpuxxTqOOsfWT/7iVshHmVZ4IpOA== + dependencies: + lru-cache "^10.0.1" + hpack.js@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" @@ -15103,6 +15056,13 @@ ignore-by-default@^1.0.1: resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09" integrity sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA== +ignore-walk@^3.0.3: + version "3.0.4" + resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-3.0.4.tgz#c9a09f69b7c7b479a5d74ac1a3c0d4236d2a6335" + integrity sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ== + dependencies: + minimatch "^3.0.4" + ignore-walk@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-5.0.1.tgz#5f199e23e1288f518d90358d461387788a154776" @@ -15110,13 +15070,6 @@ ignore-walk@^5.0.1: dependencies: minimatch "^5.0.1" -ignore-walk@^6.0.4: - version "6.0.4" - resolved "https://registry.yarnpkg.com/ignore-walk/-/ignore-walk-6.0.4.tgz#89950be94b4f522225eb63a13c56badb639190e9" - integrity sha512-t7sv42WkwFkyKbivUCglsQW5YWMskWtbEf4MNKX5u/CCWHKSPzN4FtBQGsQZgCLbxOzpVlcbWVK5KB3auIOjSw== - dependencies: - minimatch "^9.0.0" - ignore@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" @@ -15198,17 +15151,12 @@ inherits@2.0.3: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw== -ini@*, ini@^4.1.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/ini/-/ini-4.1.2.tgz#7f646dbd9caea595e61f88ef60bfff8b01f8130a" - integrity sha512-AMB1mvwR1pyBFY/nSevUX6y8nJWS63/SzUKD3JyQn97s4xgIdgQPT75IRouIiBAN4yLQBUShNYVW0+UG25daCw== - ini@1.3.7: version "1.3.7" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== -ini@2.0.0: +ini@2.0.0, ini@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== @@ -15218,18 +15166,18 @@ ini@^1.3.2, ini@^1.3.4, ini@~1.3.0: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -init-package-json@*: - version "6.0.2" - resolved "https://registry.yarnpkg.com/init-package-json/-/init-package-json-6.0.2.tgz#0d780b752dd1dd83b8649945df38a07df4f990a6" - integrity sha512-ZQ9bxt6PkqIH6fPU69HPheOMoUqIqVqwZj0qlCBfoSCG4lplQhVM/qB3RS4f0RALK3WZZSrNQxNtCZgphuf3IA== +init-package-json@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/init-package-json/-/init-package-json-2.0.5.tgz#78b85f3c36014db42d8f32117252504f68022646" + integrity sha512-u1uGAtEFu3VA6HNl/yUWw57jmKEMx8SKOxHhxjGnOFUiIlFnohKDFg4ZrPpv9wWqk44nDxGJAtqjdQFm+9XXQA== dependencies: - "@npmcli/package-json" "^5.0.0" - npm-package-arg "^11.0.0" - promzard "^1.0.0" - read "^3.0.1" + npm-package-arg "^8.1.5" + promzard "^0.3.0" + read "~1.0.1" + read-package-json "^4.1.1" semver "^7.3.5" validate-npm-package-license "^3.0.4" - validate-npm-package-name "^5.0.0" + validate-npm-package-name "^3.0.0" init-package-json@^3.0.2: version "3.0.2" @@ -15357,10 +15305,10 @@ ip-address@^9.0.5: jsbn "1.1.0" sprintf-js "^1.1.3" -ip-regex@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-5.0.0.tgz#cd313b2ae9c80c07bd3851e12bf4fa4dc5480632" - integrity sha512-fOCG6lhoKKakwv+C6KdsOnGvgXnmgfmp0myi3bcNwj3qfwPAxRKWEuFhvEFF7ceYIz6+1jRZ+yguLFAmUNPEfw== +ip-regex@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ip-regex/-/ip-regex-4.3.0.tgz#687275ab0f57fa76978ff8f4dddc8a23d5990db5" + integrity sha512-B9ZWJxHHOHUhUjCPrMpLD4xEq35bUTClHM1S6CBU5ixQnkZmwipwgc96vAd7AAGM9TGHvJR+Uss+/Ak6UphK+Q== ipaddr.js@1.9.1: version "1.9.1" @@ -15477,12 +15425,12 @@ is-ci@^3.0.0, is-ci@^3.0.1: dependencies: ci-info "^3.2.0" -is-cidr@*: - version "5.0.5" - resolved "https://registry.yarnpkg.com/is-cidr/-/is-cidr-5.0.5.tgz#6898e3e84a320cecaa505654b33463399baf9e8e" - integrity sha512-zDlCvz2v8dBpumuGD4/fc7wzFKY6UYOvFW29JWSstdJoByGN3TKwS0tFA9VWc7DM01VOVOn/DaR84D8Mihp9Rg== +is-cidr@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/is-cidr/-/is-cidr-4.0.2.tgz#94c7585e4c6c77ceabf920f8cde51b8c0fda8814" + integrity sha512-z4a1ENUajDbEl/Q6/pVBpTR1nBjjEE1X7qb7bmWYanNnPoKAvUCPFKeXV6Fe4mgTkWKBqiHIcwsI3SndiO5FeA== dependencies: - cidr-regex "^4.0.4" + cidr-regex "^3.1.1" is-core-module@^2.13.0, is-core-module@^2.13.1, is-core-module@^2.5.0, is-core-module@^2.6.0, is-core-module@^2.8.1: version "2.13.1" @@ -17020,11 +16968,6 @@ json-parse-better-errors@^1.0.1: resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== -json-parse-even-better-errors@*, json-parse-even-better-errors@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.1.tgz#02bb29fb5da90b5444581749c22cedd3597c6cb0" - integrity sha512-aatBvbL26wVUCLmbWdCpeu9iF5wOyWpagiKkInA+kfws3sWdBrTnsvN2CKcyCYyUrc7rebNBlK6+kteg7ksecg== - json-parse-even-better-errors@^2.3.0, json-parse-even-better-errors@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" @@ -17220,21 +17163,26 @@ jszip@^3.10.1: readable-stream "~2.3.6" setimmediate "^1.0.5" +just-diff-apply@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/just-diff-apply/-/just-diff-apply-3.1.2.tgz#710d8cda00c65dc4e692df50dbe9bac5581c2193" + integrity sha512-TCa7ZdxCeq6q3Rgms2JCRHTCfWAETPZ8SzYUbkYF6KR3I03sN29DaOIC+xyWboIcMvjAsD5iG2u/RWzHD8XpgQ== + just-diff-apply@^5.2.0: version "5.5.0" resolved "https://registry.yarnpkg.com/just-diff-apply/-/just-diff-apply-5.5.0.tgz#771c2ca9fa69f3d2b54e7c3f5c1dfcbcc47f9f0f" integrity sha512-OYTthRfSh55WOItVqwpefPtNt2VdKsq5AnAK6apdtR6yCH8pr0CmSr710J0Mf+WdQy7K/OzMy7K2MgAfdQURDw== +just-diff@^3.0.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/just-diff/-/just-diff-3.1.1.tgz#d50c597c6fd4776495308c63bdee1b6839082647" + integrity sha512-sdMWKjRq8qWZEjDcVA6llnUT8RDEBIfOiGpYFPYa9u+2c39JCsejktSP7mj5eRid5EIvTzIpQ2kDOCw1Nq9BjQ== + just-diff@^5.0.1: version "5.2.0" resolved "https://registry.yarnpkg.com/just-diff/-/just-diff-5.2.0.tgz#60dca55891cf24cd4a094e33504660692348a241" integrity sha512-6ufhP9SHjb7jibNFrNxyFZ6od3g+An6Ai9mhGRvcYe8UJlH0prseN64M+6ZBBUoKYHZsitDP42gAJ8+eVWr3lw== -just-diff@^6.0.0: - version "6.0.2" - resolved "https://registry.yarnpkg.com/just-diff/-/just-diff-6.0.2.tgz#03b65908543ac0521caf6d8eb85035f7d27ea285" - integrity sha512-S59eriX5u3/QhMNq3v/gm8Kd0w8OS6Tz2FS1NG4blv+z0MuQcBRJyFWjdovM0Rad4/P4aUPFtnkNjMjyMlMSYA== - keccak@^1.0.2: version "1.4.0" resolved "https://registry.yarnpkg.com/keccak/-/keccak-1.4.0.tgz#572f8a6dbee8e7b3aa421550f9e6408ca2186f80" @@ -17442,13 +17390,15 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" -libnpmaccess@*: - version "8.0.3" - resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-8.0.3.tgz#7377b2fa07f722cb68a29e1e31f19972cf01f5e0" - integrity sha512-0dU2ZZ8eWrI3JcPIEA5wnQ5s+OGeNtjrg0MHz1vcs06hRLDhZeXBWthuXG47jV1GO5ogClQi7RAFNAWVEjViWw== +libnpmaccess@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/libnpmaccess/-/libnpmaccess-4.0.3.tgz#dfb0e5b0a53c315a2610d300e46b4ddeb66e7eec" + integrity sha512-sPeTSNImksm8O2b6/pf3ikv4N567ERYEpeKRPSmqlNt1dTZbvgpJIzg5vAhXHpw2ISBsELFRelk0jEahj1c6nQ== dependencies: - npm-package-arg "^11.0.1" - npm-registry-fetch "^16.2.0" + aproba "^2.0.0" + minipass "^3.1.1" + npm-package-arg "^8.1.2" + npm-registry-fetch "^11.0.0" libnpmaccess@^6.0.3: version "6.0.4" @@ -17460,84 +17410,79 @@ libnpmaccess@^6.0.3: npm-package-arg "^9.0.1" npm-registry-fetch "^13.0.0" -libnpmdiff@*: - version "6.0.9" - resolved "https://registry.yarnpkg.com/libnpmdiff/-/libnpmdiff-6.0.9.tgz#7a8a1bfd5209342e852c5ee65d604b57a6c19dbe" - integrity sha512-K3Ey7VFXkasHOHa9S8SbALRMMEJkx5cHdAitJoLZH4pPL2cX89hdkNTQi8vcvjOlENbE2AjNsSjRkGhzeKfiSA== - dependencies: - "@npmcli/arborist" "^7.2.1" - "@npmcli/disparity-colors" "^3.0.0" - "@npmcli/installed-package-contents" "^2.0.2" - binary-extensions "^2.3.0" - diff "^5.1.0" - minimatch "^9.0.4" - npm-package-arg "^11.0.1" - pacote "^17.0.4" - tar "^6.2.1" - -libnpmexec@*: - version "7.0.10" - resolved "https://registry.yarnpkg.com/libnpmexec/-/libnpmexec-7.0.10.tgz#dd41dddaf5987a59e067e686d10b5189a9302065" - integrity sha512-MwjY0SzG9pHBMW+Otl/6ZA2s4kRUYxelo9vIKeWHG3CV0b/4mzi88rYNk3fv46hQ4ypIIEZYOzV/pHky/DS8og== - dependencies: - "@npmcli/arborist" "^7.2.1" - "@npmcli/run-script" "^7.0.2" - ci-info "^4.0.0" - npm-package-arg "^11.0.1" - npmlog "^7.0.1" - pacote "^17.0.4" - proc-log "^3.0.0" - read "^3.0.1" - read-package-json-fast "^3.0.2" - semver "^7.3.7" - walk-up-path "^3.0.1" +libnpmdiff@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/libnpmdiff/-/libnpmdiff-2.0.4.tgz#bb1687992b1a97a8ea4a32f58ad7c7f92de53b74" + integrity sha512-q3zWePOJLHwsLEUjZw3Kyu/MJMYfl4tWCg78Vl6QGSfm4aXBUSVzMzjJ6jGiyarsT4d+1NH4B1gxfs62/+y9iQ== + dependencies: + "@npmcli/disparity-colors" "^1.0.1" + "@npmcli/installed-package-contents" "^1.0.7" + binary-extensions "^2.2.0" + diff "^5.0.0" + minimatch "^3.0.4" + npm-package-arg "^8.1.1" + pacote "^11.3.0" + tar "^6.1.0" -libnpmfund@*: - version "5.0.7" - resolved "https://registry.yarnpkg.com/libnpmfund/-/libnpmfund-5.0.7.tgz#0ac10dc7e554f3ba596089557d6f2dd6a35664b1" - integrity sha512-wRQSh2AeXFUtfHBciYha7m2+0xhX9PWa+ufMlfUFtUm6yTNsgghoZe8dciERklwhh2iax/9I+O/1lqKsGvJBaQ== +libnpmexec@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/libnpmexec/-/libnpmexec-2.0.1.tgz#729ae3e15a3ba225964ccf248117a75d311eeb73" + integrity sha512-4SqBB7eJvJWmUKNF42Q5qTOn20DRjEE4TgvEh2yneKlAiRlwlhuS9MNR45juWwmoURJlf2K43bozlVt7OZiIOw== dependencies: - "@npmcli/arborist" "^7.2.1" + "@npmcli/arborist" "^2.3.0" + "@npmcli/ci-detect" "^1.3.0" + "@npmcli/run-script" "^1.8.4" + chalk "^4.1.0" + mkdirp-infer-owner "^2.0.0" + npm-package-arg "^8.1.2" + pacote "^11.3.1" + proc-log "^1.0.0" + read "^1.0.7" + read-package-json-fast "^2.0.2" + walk-up-path "^1.0.0" -libnpmhook@*: - version "10.0.2" - resolved "https://registry.yarnpkg.com/libnpmhook/-/libnpmhook-10.0.2.tgz#1528c6c8120bf97523bc1671dc49b48b96170c89" - integrity sha512-LF5peX3rmk2HqABmMXWhjdJ+HHHPIwMz7NXUM67MLSIy+JAExTymcQZgbGM9m/YQ6JDRPW8SBhWeWM0+vPNezw== +libnpmfund@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/libnpmfund/-/libnpmfund-1.1.0.tgz#ee91313905b3194b900530efa339bc3f9fc4e5c4" + integrity sha512-Kfmh3pLS5/RGKG5WXEig8mjahPVOxkik6lsbH4iX0si1xxNi6eeUh/+nF1MD+2cgalsQif3O5qyr6mNz2ryJrQ== dependencies: - aproba "^2.0.0" - npm-registry-fetch "^16.2.0" + "@npmcli/arborist" "^2.5.0" -libnpmorg@*: +libnpmhook@^6.0.2: version "6.0.3" - resolved "https://registry.yarnpkg.com/libnpmorg/-/libnpmorg-6.0.3.tgz#6c2af127fc54e965800c53ace0b3e6e55a8a2d21" - integrity sha512-oxyQjJqvhvi0YqCOHQWLfWWre7NtWOGghX29LhhaqcDv3+Q61c4lJbht/iEEd00eucuHPjqfeh4aWXP6ftj2aA== + resolved "https://registry.yarnpkg.com/libnpmhook/-/libnpmhook-6.0.3.tgz#1d7f0d7e6a7932fbf7ce0881fdb0ed8bf8748a30" + integrity sha512-3fmkZJibIybzmAvxJ65PeV3NzRc0m4xmYt6scui5msocThbEp4sKFT80FhgrCERYDjlUuFahU6zFNbJDHbQ++g== dependencies: aproba "^2.0.0" - npm-registry-fetch "^16.2.0" + npm-registry-fetch "^11.0.0" -libnpmpack@*: - version "6.0.9" - resolved "https://registry.yarnpkg.com/libnpmpack/-/libnpmpack-6.0.9.tgz#c1e42cef93d46c9f31e015c298232fff15bbb734" - integrity sha512-rkGVbP0amt7qNPL/u4NbH0MqhECRrvdRPcszXalYc6TP2ubEBPT54c5LFLxTLROSKjfre6PVvzc1ZNKc8jBWhQ== +libnpmorg@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/libnpmorg/-/libnpmorg-2.0.3.tgz#4e605d4113dfa16792d75343824a0625c76703bc" + integrity sha512-JSGl3HFeiRFUZOUlGdiNcUZOsUqkSYrg6KMzvPZ1WVZ478i47OnKSS0vkPmX45Pai5mTKuwIqBMcGWG7O8HfdA== dependencies: - "@npmcli/arborist" "^7.2.1" - "@npmcli/run-script" "^7.0.2" - npm-package-arg "^11.0.1" - pacote "^17.0.4" + aproba "^2.0.0" + npm-registry-fetch "^11.0.0" -libnpmpublish@*: - version "9.0.5" - resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-9.0.5.tgz#39e06b94fa140ae733e7ad0cdbbdc385ab31728e" - integrity sha512-MSKHZN2NXmp8GafDMy2eH/FK6c0BjpCbuJ4vJU4xPqCguy0w805VoRnsCwxyrvzCC13MB2tU6VOAX08GioINBA== +libnpmpack@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/libnpmpack/-/libnpmpack-2.0.1.tgz#d3eac25cc8612f4e7cdeed4730eee339ba51c643" + integrity sha512-He4/jxOwlaQ7YG7sIC1+yNeXeUDQt8RLBvpI68R3RzPMZPa4/VpxhlDo8GtBOBDYoU8eq6v1wKL38sq58u4ibQ== dependencies: - ci-info "^4.0.0" - normalize-package-data "^6.0.0" - npm-package-arg "^11.0.1" - npm-registry-fetch "^16.2.0" - proc-log "^3.0.0" - semver "^7.3.7" - sigstore "^2.2.0" - ssri "^10.0.5" + "@npmcli/run-script" "^1.8.3" + npm-package-arg "^8.1.0" + pacote "^11.2.6" + +libnpmpublish@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/libnpmpublish/-/libnpmpublish-4.0.2.tgz#be77e8bf5956131bcb45e3caa6b96a842dec0794" + integrity sha512-+AD7A2zbVeGRCFI2aO//oUmapCwy7GHqPXFJh3qpToSRNU+tXKJ2YFUgjt04LPPAf2dlEH95s6EhIHM1J7bmOw== + dependencies: + normalize-package-data "^3.0.2" + npm-package-arg "^8.1.2" + npm-registry-fetch "^11.0.0" + semver "^7.1.3" + ssri "^8.0.1" libnpmpublish@^6.0.4: version "6.0.5" @@ -17550,31 +17495,31 @@ libnpmpublish@^6.0.4: semver "^7.3.7" ssri "^9.0.0" -libnpmsearch@*: - version "7.0.2" - resolved "https://registry.yarnpkg.com/libnpmsearch/-/libnpmsearch-7.0.2.tgz#d088934c720179513baca0d8cccaddcf0da76e49" - integrity sha512-SvYcq3SmexQWhch1i/9ML+vQx82+thVMRvgtZc/Yjf6s0Cfu/87ZQ3bb6jFe/whwaXxjwdDX8MrdmNXNKG+JPA== +libnpmsearch@^3.1.1: + version "3.1.2" + resolved "https://registry.yarnpkg.com/libnpmsearch/-/libnpmsearch-3.1.2.tgz#aee81b9e4768750d842b627a3051abc89fdc15f3" + integrity sha512-BaQHBjMNnsPYk3Bl6AiOeVuFgp72jviShNBw5aHaHNKWqZxNi38iVNoXbo6bG/Ccc/m1To8s0GtMdtn6xZ1HAw== dependencies: - npm-registry-fetch "^16.2.0" + npm-registry-fetch "^11.0.0" -libnpmteam@*: - version "6.0.2" - resolved "https://registry.yarnpkg.com/libnpmteam/-/libnpmteam-6.0.2.tgz#f83cf778785b89cdbf463dd6025669c0df2aa06b" - integrity sha512-EUTKCj1PmstpZE/MJ8QVs9L6wi4lMzD7TPyxHXiXWSsUy0/a1gKysW8TjC9dIAMVb/3okUUxiP/LIRwdShBpAQ== +libnpmteam@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/libnpmteam/-/libnpmteam-2.0.4.tgz#9dbe2e18ae3cb97551ec07d2a2daf9944f3edc4c" + integrity sha512-FPrVJWv820FZFXaflAEVTLRWZrerCvfe7ZHSMzJ/62EBlho2KFlYKjyNEsPW3JiV7TLSXi3vo8u0gMwIkXSMTw== dependencies: aproba "^2.0.0" - npm-registry-fetch "^16.2.0" + npm-registry-fetch "^11.0.0" -libnpmversion@*: - version "5.0.2" - resolved "https://registry.yarnpkg.com/libnpmversion/-/libnpmversion-5.0.2.tgz#aea7b09bc270c778cbc8be7bf02e4b60566989cf" - integrity sha512-6JBnLhd6SYgKRekJ4cotxpURLGbEtKxzw+a8p5o+wNwrveJPMH8yW/HKjeewyHzWmxzzwn9EQ3TkF2onkrwstA== +libnpmversion@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/libnpmversion/-/libnpmversion-1.2.1.tgz#689aa7fe0159939b3cbbf323741d34976f4289e9" + integrity sha512-AA7x5CFgBFN+L4/JWobnY5t4OAHjQuPbAwUYJ7/NtHuyLut5meb+ne/aj0n7PWNiTGCJcRw/W6Zd2LoLT7EZuQ== dependencies: - "@npmcli/git" "^5.0.3" - "@npmcli/run-script" "^7.0.2" - json-parse-even-better-errors "^3.0.0" - proc-log "^3.0.0" - semver "^7.3.7" + "@npmcli/git" "^2.0.7" + "@npmcli/run-script" "^1.8.4" + json-parse-even-better-errors "^2.3.1" + semver "^7.3.5" + stringify-package "^1.0.1" libsodium-wrappers@^0.7.6: version "0.7.13" @@ -18096,7 +18041,29 @@ make-error@1.x, make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== -make-fetch-happen@*, make-fetch-happen@^13.0.0: +make-fetch-happen@^10.0.3, make-fetch-happen@^10.0.6: + version "10.2.1" + resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz#f5e3835c5e9817b617f2770870d9492d28678164" + integrity sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w== + dependencies: + agentkeepalive "^4.2.1" + cacache "^16.1.0" + http-cache-semantics "^4.1.0" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.0" + is-lambda "^1.0.1" + lru-cache "^7.7.1" + minipass "^3.1.6" + minipass-collect "^1.0.2" + minipass-fetch "^2.0.3" + minipass-flush "^1.0.5" + minipass-pipeline "^1.2.4" + negotiator "^0.6.3" + promise-retry "^2.0.1" + socks-proxy-agent "^7.0.0" + ssri "^9.0.0" + +make-fetch-happen@^13.0.0: version "13.0.0" resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-13.0.0.tgz#705d6f6cbd7faecb8eac2432f551e49475bfedf0" integrity sha512-7ThobcL8brtGo9CavByQrQi+23aIfgYU++wg4B87AIS8Rb2ZBt/MEaDqzA00Xwv/jUjAjYkLHjVolYuTLKda2A== @@ -18113,27 +18080,27 @@ make-fetch-happen@*, make-fetch-happen@^13.0.0: promise-retry "^2.0.1" ssri "^10.0.0" -make-fetch-happen@^10.0.3, make-fetch-happen@^10.0.6: - version "10.2.1" - resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz#f5e3835c5e9817b617f2770870d9492d28678164" - integrity sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w== +make-fetch-happen@^9.0.1, make-fetch-happen@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz#53085a09e7971433e6765f7971bf63f4e05cb968" + integrity sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg== dependencies: - agentkeepalive "^4.2.1" - cacache "^16.1.0" + agentkeepalive "^4.1.3" + cacache "^15.2.0" http-cache-semantics "^4.1.0" - http-proxy-agent "^5.0.0" + http-proxy-agent "^4.0.1" https-proxy-agent "^5.0.0" is-lambda "^1.0.1" - lru-cache "^7.7.1" - minipass "^3.1.6" + lru-cache "^6.0.0" + minipass "^3.1.3" minipass-collect "^1.0.2" - minipass-fetch "^2.0.3" + minipass-fetch "^1.3.2" minipass-flush "^1.0.5" minipass-pipeline "^1.2.4" - negotiator "^0.6.3" + negotiator "^0.6.2" promise-retry "^2.0.1" - socks-proxy-agent "^7.0.0" - ssri "^9.0.0" + socks-proxy-agent "^6.0.0" + ssri "^8.0.0" makeerror@1.0.12: version "1.0.12" @@ -18456,7 +18423,7 @@ minimatch@^7.1.3: dependencies: brace-expansion "^2.0.1" -minimatch@^9.0.0, minimatch@^9.0.1, minimatch@^9.0.3, minimatch@^9.0.4: +minimatch@^9.0.1: version "9.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51" integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw== @@ -18491,6 +18458,17 @@ minipass-collect@^2.0.1: dependencies: minipass "^7.0.3" +minipass-fetch@^1.3.0, minipass-fetch@^1.3.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-1.4.1.tgz#d75e0091daac1b0ffd7e9d41629faff7d0c1f1b6" + integrity sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw== + dependencies: + minipass "^3.1.0" + minipass-sized "^1.0.3" + minizlib "^2.0.0" + optionalDependencies: + encoding "^0.1.12" + minipass-fetch@^2.0.3: version "2.1.2" resolved "https://registry.yarnpkg.com/minipass-fetch/-/minipass-fetch-2.1.2.tgz#95560b50c472d81a3bc76f20ede80eaed76d8add" @@ -18528,7 +18506,7 @@ minipass-json-stream@^1.0.1: jsonparse "^1.3.1" minipass "^3.0.0" -minipass-pipeline@*, minipass-pipeline@^1.2.4: +minipass-pipeline@^1.2.2, minipass-pipeline@^1.2.4: version "1.2.4" resolved "https://registry.yarnpkg.com/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz#68472f79711c084657c067c5c6ad93cddea8214c" integrity sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A== @@ -18542,11 +18520,6 @@ minipass-sized@^1.0.3: dependencies: minipass "^3.0.0" -minipass@*, "minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.0.2, minipass@^7.0.3, minipass@^7.0.4: - version "7.0.4" - resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" - integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== - minipass@^2.6.0, minipass@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" @@ -18555,7 +18528,7 @@ minipass@^2.6.0, minipass@^2.9.0: safe-buffer "^5.1.2" yallist "^3.0.0" -minipass@^3.0.0, minipass@^3.1.1, minipass@^3.1.6: +minipass@^3.0.0, minipass@^3.1.0, minipass@^3.1.1, minipass@^3.1.3, minipass@^3.1.6: version "3.3.6" resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.6.tgz#7bba384db3a1520d18c9c0e5251c3444e95dd94a" integrity sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw== @@ -18567,6 +18540,11 @@ minipass@^5.0.0: resolved "https://registry.yarnpkg.com/minipass/-/minipass-5.0.0.tgz#3e9788ffb90b694a5d0ec94479a45b5d8738133d" integrity sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ== +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.0.2, minipass@^7.0.3, minipass@^7.0.4: + version "7.0.4" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.0.4.tgz#dbce03740f50a4786ba994c1fb908844d27b038c" + integrity sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ== + minizlib@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-1.3.3.tgz#2290de96818a34c29551c8a8d301216bd65a861d" @@ -18574,7 +18552,7 @@ minizlib@^1.3.3: dependencies: minipass "^2.9.0" -minizlib@^2.1.1, minizlib@^2.1.2: +minizlib@^2.0.0, minizlib@^2.1.1, minizlib@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" integrity sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg== @@ -18582,14 +18560,6 @@ minizlib@^2.1.1, minizlib@^2.1.2: minipass "^3.0.0" yallist "^4.0.0" -minizlib@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-3.0.1.tgz#46d5329d1eb3c83924eff1d3b858ca0a31581012" - integrity sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg== - dependencies: - minipass "^7.0.4" - rimraf "^5.0.5" - mixin-deep@^1.2.0: version "1.3.2" resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.2.tgz#1120b43dc359a785dce65b55b82e257ccf479566" @@ -18603,7 +18573,7 @@ mkdirp-classic@^0.5.2: resolved "https://registry.yarnpkg.com/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz#fa10c9115cc6d8865be221ba47ee9bed78601113" integrity sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A== -mkdirp-infer-owner@*, mkdirp-infer-owner@^2.0.0: +mkdirp-infer-owner@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/mkdirp-infer-owner/-/mkdirp-infer-owner-2.0.0.tgz#55d3b368e7d89065c38f32fd38e638f0ab61d316" integrity sha512-sdqtiFt3lkOaYvTXSRIUjkIdPTcxgv5+fgqYE/5qgwdw12cOrAuzzgzvVExIkH/ul1oeHN3bCLOWSG3XOqbKKw== @@ -18619,7 +18589,7 @@ mkdirp-promise@^5.0.1: dependencies: mkdirp "*" -mkdirp@*, mkdirp@^3.0.1: +mkdirp@*: version "3.0.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50" integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg== @@ -18696,11 +18666,6 @@ mri@^1.2.0: resolved "https://registry.yarnpkg.com/mri/-/mri-1.2.0.tgz#6721480fec2a11a4889861115a48b6cbe7cc8f0b" integrity sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA== -ms@*, ms@2.1.3, ms@^2.0.0, ms@^2.1.1: - version "2.1.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" - integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -18711,6 +18676,11 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== +ms@2.1.3, ms@^2.0.0, ms@^2.1.1, ms@^2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" + integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA== + multibase@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/multibase/-/multibase-0.7.0.tgz#1adfc1c50abe05eefeb5091ac0c2728d6b84581b" @@ -18795,11 +18765,6 @@ mute-stream@0.0.8, mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -mute-stream@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-1.0.0.tgz#e31bd9fe62f0aed23520aa4324ea6671531e013e" - integrity sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA== - nan@^2.12.1, nan@^2.14.0, nan@^2.18.0, nan@^2.2.1: version "2.19.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.19.0.tgz#bb58122ad55a6c5bc973303908d5b16cfdd5a8c0" @@ -18862,7 +18827,7 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -negotiator@0.6.3, negotiator@^0.6.3: +negotiator@0.6.3, negotiator@^0.6.2, negotiator@^0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" integrity sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg== @@ -18981,7 +18946,7 @@ node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.8.0.tgz#3fee9c1731df4581a3f9ead74664369ff00d26dd" integrity sha512-u6fs2AEUljNho3EYTJNBfImO5QTo/J/1Etd+NVdCj7qWKUSN/bSLkZwhDv7I+w/MSC6qJ4cknepkAYykDdK8og== -node-gyp@*, node-gyp@^10.0.0, node-gyp@^10.0.1: +node-gyp@^10.0.1: version "10.1.0" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-10.1.0.tgz#75e6f223f2acb4026866c26a2ead6aab75a8ca7e" integrity sha512-B4J5M1cABxPc5PwfjhbV5hoy2DP9p8lFXASnEN6hugXOa61416tnTZ29x9sSwAd0o99XNIcpvDDy1swAExsVKA== @@ -18997,6 +18962,22 @@ node-gyp@*, node-gyp@^10.0.0, node-gyp@^10.0.1: tar "^6.1.2" which "^4.0.0" +node-gyp@^7.1.0, node-gyp@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-7.1.2.tgz#21a810aebb187120251c3bcec979af1587b188ae" + integrity sha512-CbpcIo7C3eMu3dL1c3d0xw449fHIGALIJsRP4DDPHpyiW8vcriNY7ubh9TE4zEKfSxscY7PjeFnshE7h75ynjQ== + dependencies: + env-paths "^2.2.0" + glob "^7.1.4" + graceful-fs "^4.2.3" + nopt "^5.0.0" + npmlog "^4.1.2" + request "^2.88.2" + rimraf "^3.0.2" + semver "^7.3.2" + tar "^6.0.2" + which "^2.0.2" + node-gyp@^9.0.0: version "9.4.1" resolved "https://registry.yarnpkg.com/node-gyp/-/node-gyp-9.4.1.tgz#8a1023e0d6766ecb52764cc3a734b36ff275e185" @@ -19069,13 +19050,6 @@ nofilter@^3.1.0: resolved "https://registry.yarnpkg.com/nofilter/-/nofilter-3.1.0.tgz#c757ba68801d41ff930ba2ec55bab52ca184aa66" integrity sha512-l2NNj07e9afPnhAhvgVrCD/oy2Ai1yfLpuo3EpiO1jFTsB4sFz6oIfAfSZyQzVpkZQ9xS8ZS5g1jCBgq4Hwo0g== -nopt@*, nopt@^7.0.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-7.2.0.tgz#067378c68116f602f552876194fd11f1292503d7" - integrity sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA== - dependencies: - abbrev "^2.0.0" - nopt@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/nopt/-/nopt-5.0.0.tgz#530942bb58a512fccafe53fe210f13a25355dc88" @@ -19090,6 +19064,13 @@ nopt@^6.0.0: dependencies: abbrev "^1.0.0" +nopt@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/nopt/-/nopt-7.2.0.tgz#067378c68116f602f552876194fd11f1292503d7" + integrity sha512-CVDtwCdhYIvnAzFoJ6NJ6dX3oga9/HyciQDnG1vQDjSLMeKLJ4A93ZqYKDrgYSr1FBY5/hMYC+2VCi24pgpkGA== + dependencies: + abbrev "^2.0.0" + nopt@~1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" @@ -19107,7 +19088,7 @@ normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-package-data@^3.0.0: +normalize-package-data@^3.0.0, normalize-package-data@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-3.0.3.tgz#dbcc3e2da59509a0983422884cd172eefdfa525e" integrity sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA== @@ -19127,16 +19108,6 @@ normalize-package-data@^4.0.0: semver "^7.3.5" validate-npm-package-license "^3.0.4" -normalize-package-data@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-6.0.0.tgz#68a96b3c11edd462af7189c837b6b1064a484196" - integrity sha512-UL7ELRVxYBHBgYEtZCXjxuD5vPxnmvMGq0jp/dGPKKrN7tfsBh2IY7TlJ15WWwdjRWD3RJbnsygUurTK3xkPkg== - dependencies: - hosted-git-info "^7.0.0" - is-core-module "^2.8.1" - semver "^7.3.5" - validate-npm-package-license "^3.0.4" - normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -19168,10 +19139,12 @@ normalize-url@^6.0.0, normalize-url@^6.0.1: resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a" integrity sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A== -npm-audit-report@*: - version "5.0.0" - resolved "https://registry.yarnpkg.com/npm-audit-report/-/npm-audit-report-5.0.0.tgz#83ac14aeff249484bde81eff53c3771d5048cf95" - integrity sha512-EkXrzat7zERmUhHaoren1YhTxFwsOu5jypE84k6632SXTHcQE1z8V51GC6GVZt8LxkC+tbBcKMUBZAgk8SUSbw== +npm-audit-report@^2.1.5: + version "2.1.5" + resolved "https://registry.yarnpkg.com/npm-audit-report/-/npm-audit-report-2.1.5.tgz#a5b8850abe2e8452fce976c8960dd432981737b5" + integrity sha512-YB8qOoEmBhUH1UJgh1xFAv7Jg1d+xoNhsDYiFQlEFThEBui0W1vIz2ZK6FVg4WZjwEdl7uBQlm1jy3MUfyHeEw== + dependencies: + chalk "^4.0.0" npm-bundled@^1.1.1: version "1.1.2" @@ -19187,17 +19160,10 @@ npm-bundled@^2.0.0: dependencies: npm-normalize-package-bin "^2.0.0" -npm-bundled@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-3.0.0.tgz#7e8e2f8bb26b794265028491be60321a25a39db7" - integrity sha512-Vq0eyEQy+elFpzsKjMss9kxqb9tG3YHg4dsyWuUENuzvSUWe1TCnW/vV9FkhvBk/brEDoDiVd+M1Btosa6ImdQ== - dependencies: - npm-normalize-package-bin "^3.0.0" - -npm-install-checks@*, npm-install-checks@^6.0.0, npm-install-checks@^6.2.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/npm-install-checks/-/npm-install-checks-6.3.0.tgz#046552d8920e801fa9f919cad569545d60e826fe" - integrity sha512-W29RiK/xtpCGqn6f3ixfRYGk+zRyr+Ew9F2E20BfXxT5/euLdA/Nm7fO7OeTGuAmTs30cpgInyJ0cYe708YTZw== +npm-install-checks@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/npm-install-checks/-/npm-install-checks-4.0.0.tgz#a37facc763a2fde0497ef2c6d0ac7c3fbe00d7b4" + integrity sha512-09OmyDkNLYwqKPOnbI8exiOZU2GVVmQp7tgez2BPi5OZC8M82elDAps7sxC4l//uSUtotWqoEIDwjRvWH4qz8w== dependencies: semver "^7.1.1" @@ -19208,7 +19174,7 @@ npm-install-checks@^5.0.0: dependencies: semver "^7.1.1" -npm-normalize-package-bin@^1.0.1: +npm-normalize-package-bin@^1.0.0, npm-normalize-package-bin@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-1.0.1.tgz#6e79a41f23fd235c0623218228da7d9c23b8f6e2" integrity sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA== @@ -19218,21 +19184,6 @@ npm-normalize-package-bin@^2.0.0: resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-2.0.0.tgz#9447a1adaaf89d8ad0abe24c6c84ad614a675fff" integrity sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ== -npm-normalize-package-bin@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/npm-normalize-package-bin/-/npm-normalize-package-bin-3.0.1.tgz#25447e32a9a7de1f51362c61a559233b89947832" - integrity sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ== - -npm-package-arg@*, npm-package-arg@^11.0.0, npm-package-arg@^11.0.1: - version "11.0.2" - resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-11.0.2.tgz#1ef8006c4a9e9204ddde403035f7ff7d718251ca" - integrity sha512-IGN0IAwmhDJwy13Wc8k+4PEbTPhpJnMtfR53ZbOyjkvmEcLS4nCwp6mvMWjS5sUjeiW3mpx6cHmuhKEu9XmcQw== - dependencies: - hosted-git-info "^7.0.0" - proc-log "^4.0.0" - semver "^7.3.5" - validate-npm-package-name "^5.0.0" - npm-package-arg@11.0.1: version "11.0.1" resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-11.0.1.tgz#f208b0022c29240a1c532a449bdde3f0a4708ebc" @@ -19252,6 +19203,15 @@ npm-package-arg@8.1.1: semver "^7.0.0" validate-npm-package-name "^3.0.0" +npm-package-arg@^8.0.0, npm-package-arg@^8.0.1, npm-package-arg@^8.1.0, npm-package-arg@^8.1.1, npm-package-arg@^8.1.2, npm-package-arg@^8.1.5: + version "8.1.5" + resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-8.1.5.tgz#3369b2d5fe8fdc674baa7f1786514ddc15466e44" + integrity sha512-LhgZrg0n0VgvzVdSm1oiZworPbTxYHUJCgtsJW8mGvlDpxTM1vSJc3m5QZeUkhAHIzbz3VCHd/R4osi1L1Tg/Q== + dependencies: + hosted-git-info "^4.0.1" + semver "^7.3.4" + validate-npm-package-name "^3.0.0" + npm-package-arg@^9.0.0, npm-package-arg@^9.0.1: version "9.1.2" resolved "https://registry.yarnpkg.com/npm-package-arg/-/npm-package-arg-9.1.2.tgz#fc8acecb00235f42270dda446f36926ddd9ac2bc" @@ -19262,6 +19222,16 @@ npm-package-arg@^9.0.0, npm-package-arg@^9.0.1: semver "^7.3.5" validate-npm-package-name "^4.0.0" +npm-packlist@^2.1.4: + version "2.2.2" + resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-2.2.2.tgz#076b97293fa620f632833186a7a8f65aaa6148c8" + integrity sha512-Jt01acDvJRhJGthnUJVF/w6gumWOZxO7IkpY/lsX9//zqQgnF7OJaxgQXcerd4uQOLu7W5bkb4mChL9mdfm+Zg== + dependencies: + glob "^7.1.6" + ignore-walk "^3.0.3" + npm-bundled "^1.1.1" + npm-normalize-package-bin "^1.0.1" + npm-packlist@^5.1.0, npm-packlist@^5.1.1: version "5.1.3" resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-5.1.3.tgz#69d253e6fd664b9058b85005905012e00e69274b" @@ -19272,22 +19242,15 @@ npm-packlist@^5.1.0, npm-packlist@^5.1.1: npm-bundled "^2.0.0" npm-normalize-package-bin "^2.0.0" -npm-packlist@^8.0.0: - version "8.0.2" - resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-8.0.2.tgz#5b8d1d906d96d21c85ebbeed2cf54147477c8478" - integrity sha512-shYrPFIS/JLP4oQmAwDyk5HcyysKW8/JLTEA32S0Z5TzvpaeeX2yMFfoK1fjEBnCBvVyIB/Jj/GBFdm0wsgzbA== - dependencies: - ignore-walk "^6.0.4" - -npm-pick-manifest@*, npm-pick-manifest@^9.0.0: - version "9.0.0" - resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-9.0.0.tgz#f87a4c134504a2c7931f2bb8733126e3c3bb7e8f" - integrity sha512-VfvRSs/b6n9ol4Qb+bDwNGUXutpy76x6MARw/XssevE0TnctIKcmklJZM5Z7nqs5z5aW+0S63pgCNbpkUNNXBg== +npm-pick-manifest@^6.0.0, npm-pick-manifest@^6.1.0, npm-pick-manifest@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/npm-pick-manifest/-/npm-pick-manifest-6.1.1.tgz#7b5484ca2c908565f43b7f27644f36bb816f5148" + integrity sha512-dBsdBtORT84S8V8UTad1WlUyKIY9iMsAmqxHbLdeEeBNMLQDlDWWra3wYUx9EBEIiG/YwAy0XyNHDd2goAsfuA== dependencies: - npm-install-checks "^6.0.0" - npm-normalize-package-bin "^3.0.0" - npm-package-arg "^11.0.0" - semver "^7.3.5" + npm-install-checks "^4.0.0" + npm-normalize-package-bin "^1.0.1" + npm-package-arg "^8.1.2" + semver "^7.3.4" npm-pick-manifest@^7.0.0: version "7.0.2" @@ -19299,27 +19262,24 @@ npm-pick-manifest@^7.0.0: npm-package-arg "^9.0.0" semver "^7.3.5" -npm-profile@*: - version "9.0.1" - resolved "https://registry.yarnpkg.com/npm-profile/-/npm-profile-9.0.1.tgz#b0817357addb1804992bd9fed363992441847738" - integrity sha512-9o6dw5eu3tiqX1XFOXjznO73Jzin48Oyo9qAhfaEHXzeZHXpdzgDmzWruWk7uJsu5GMIsigx5hva5rB5NhfSWw== +npm-profile@^5.0.3: + version "5.0.4" + resolved "https://registry.yarnpkg.com/npm-profile/-/npm-profile-5.0.4.tgz#73e5bd1d808edc2c382d7139049cc367ac43161b" + integrity sha512-OKtU7yoAEBOnc8zJ+/uo5E4ugPp09sopo+6y1njPp+W99P8DvQon3BJYmpvyK2Bf1+3YV5LN1bvgXRoZ1LUJBA== dependencies: - npm-registry-fetch "^16.0.0" - proc-log "^4.0.0" + npm-registry-fetch "^11.0.0" -npm-registry-fetch@*, npm-registry-fetch@^16.0.0, npm-registry-fetch@^16.2.0: - version "16.2.1" - resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-16.2.1.tgz#c367df2d770f915da069ff19fd31762f4bca3ef1" - integrity sha512-8l+7jxhim55S85fjiDGJ1rZXBWGtRLi1OSb4Z3BPLObPuIaeKRlPRiYMSHU4/81ck3t71Z+UwDDl47gcpmfQQA== +npm-registry-fetch@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/npm-registry-fetch/-/npm-registry-fetch-11.0.0.tgz#68c1bb810c46542760d62a6a965f85a702d43a76" + integrity sha512-jmlgSxoDNuhAtxUIG6pVwwtz840i994dL14FoNVZisrmZW5kWd63IUTNv1m/hyRSGSqWjCUp/YZlS1BJyNp9XA== dependencies: - "@npmcli/redact" "^1.1.0" - make-fetch-happen "^13.0.0" - minipass "^7.0.2" - minipass-fetch "^3.0.0" + make-fetch-happen "^9.0.1" + minipass "^3.1.3" + minipass-fetch "^1.3.0" minipass-json-stream "^1.0.1" - minizlib "^2.1.2" - npm-package-arg "^11.0.0" - proc-log "^4.0.0" + minizlib "^2.0.0" + npm-package-arg "^8.0.0" npm-registry-fetch@^13.0.0, npm-registry-fetch@^13.0.1, npm-registry-fetch@^13.3.0: version "13.3.1" @@ -19348,10 +19308,10 @@ npm-run-path@^5.1.0: dependencies: path-key "^4.0.0" -npm-user-validate@*: - version "2.0.0" - resolved "https://registry.yarnpkg.com/npm-user-validate/-/npm-user-validate-2.0.0.tgz#7b69bbbff6f7992a1d9a8968d52fd6b6db5431b6" - integrity sha512-sSWeqAYJ2dUPStJB+AEj0DyLRltr/f6YNcvCA7phkB8/RMLMnVsQ41GMwHo/ERZLYNDsyB2wPm7pZo1mqPOl7Q== +npm-user-validate@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/npm-user-validate/-/npm-user-validate-1.0.1.tgz#31428fc5475fe8416023f178c0ab47935ad8c561" + integrity sha512-uQwcd/tY+h1jnEaze6cdX/LrhWhoBxfSknxentoqmIuStxUExxjWd3ULMLFPiFUrZKbOVMowH6Jq2FRWfmhcEw== npm@^7.0.0: version "7.24.2" @@ -19429,14 +19389,24 @@ npm@^7.0.0: which "^2.0.2" write-file-atomic "^3.0.3" -npmlog@*, npmlog@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-7.0.1.tgz#7372151a01ccb095c47d8bf1d0771a4ff1f53ac8" - integrity sha512-uJ0YFk/mCQpLBt+bxN88AKd+gyqZvZDbtiNxk6Waqcj2aPRyfVx8ITawkyQynxUagInjdYT1+qj4NfA5KJJUxg== +npmlog@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" + integrity sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg== + dependencies: + are-we-there-yet "~1.1.2" + console-control-strings "~1.1.0" + gauge "~2.7.3" + set-blocking "~2.0.0" + +npmlog@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-5.0.1.tgz#f06678e80e29419ad67ab964e0fa69959c1eb8b0" + integrity sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw== dependencies: - are-we-there-yet "^4.0.0" + are-we-there-yet "^2.0.0" console-control-strings "^1.1.0" - gauge "^5.0.0" + gauge "^3.0.0" set-blocking "^2.0.0" npmlog@^6.0.0, npmlog@^6.0.2: @@ -19860,7 +19830,7 @@ open@^8.0.9, open@^8.4.0, open@~8.4.0: is-docker "^2.1.1" is-wsl "^2.2.0" -opener@*, opener@^1.5.1: +opener@^1.5.1, opener@^1.5.2: version "1.5.2" resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598" integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== @@ -20168,29 +20138,30 @@ package-json@^6.3.0: registry-url "^5.0.0" semver "^6.2.0" -pacote@*, pacote@^18.0.0: - version "18.0.0" - resolved "https://registry.yarnpkg.com/pacote/-/pacote-18.0.0.tgz#974491c8b5a40f42830bc55361924ca7c7e45784" - integrity sha512-ma7uVt/q3Sb3XbLwUjOeClz+7feHjMOFegHn5whw++x+GzikZkAq/2auklSbRuy6EI2iJh1/ZqCpVaUcxRaeqQ== +pacote@^11.1.11, pacote@^11.2.6, pacote@^11.3.0, pacote@^11.3.1, pacote@^11.3.5: + version "11.3.5" + resolved "https://registry.yarnpkg.com/pacote/-/pacote-11.3.5.tgz#73cf1fc3772b533f575e39efa96c50be8c3dc9d2" + integrity sha512-fT375Yczn4zi+6Hkk2TBe1x1sP8FgFsEIZ2/iWaXY2r/NkhDJfxbcn5paz1+RTFCyNf+dPnaoBDJoAxXSU8Bkg== dependencies: - "@npmcli/git" "^5.0.0" - "@npmcli/installed-package-contents" "^2.0.1" - "@npmcli/promise-spawn" "^7.0.0" - "@npmcli/run-script" "^8.0.0" - cacache "^18.0.0" - fs-minipass "^3.0.0" - minipass "^7.0.2" - npm-package-arg "^11.0.0" - npm-packlist "^8.0.0" - npm-pick-manifest "^9.0.0" - npm-registry-fetch "^16.0.0" - proc-log "^4.0.0" + "@npmcli/git" "^2.1.0" + "@npmcli/installed-package-contents" "^1.0.6" + "@npmcli/promise-spawn" "^1.2.0" + "@npmcli/run-script" "^1.8.2" + cacache "^15.0.5" + chownr "^2.0.0" + fs-minipass "^2.1.0" + infer-owner "^1.0.4" + minipass "^3.1.3" + mkdirp "^1.0.3" + npm-package-arg "^8.0.1" + npm-packlist "^2.1.4" + npm-pick-manifest "^6.0.0" + npm-registry-fetch "^11.0.0" promise-retry "^2.0.1" - read-package-json "^7.0.0" - read-package-json-fast "^3.0.0" - sigstore "^2.2.0" - ssri "^10.0.0" - tar "^6.1.11" + read-package-json-fast "^2.0.1" + rimraf "^3.0.2" + ssri "^8.0.1" + tar "^6.1.0" pacote@^13.0.3, pacote@^13.6.1: version "13.6.2" @@ -20219,30 +20190,6 @@ pacote@^13.0.3, pacote@^13.6.1: ssri "^9.0.0" tar "^6.1.11" -pacote@^17.0.4: - version "17.0.7" - resolved "https://registry.yarnpkg.com/pacote/-/pacote-17.0.7.tgz#14b59a9bf5e3442c891af86825b97b7d72f48fba" - integrity sha512-sgvnoUMlkv9xHwDUKjKQFXVyUi8dtJGKp3vg6sYy+TxbDic5RjZCHF3ygv0EJgNRZ2GfRONjlKPUfokJ9lDpwQ== - dependencies: - "@npmcli/git" "^5.0.0" - "@npmcli/installed-package-contents" "^2.0.1" - "@npmcli/promise-spawn" "^7.0.0" - "@npmcli/run-script" "^7.0.0" - cacache "^18.0.0" - fs-minipass "^3.0.0" - minipass "^7.0.2" - npm-package-arg "^11.0.0" - npm-packlist "^8.0.0" - npm-pick-manifest "^9.0.0" - npm-registry-fetch "^16.0.0" - proc-log "^4.0.0" - promise-retry "^2.0.1" - read-package-json "^7.0.0" - read-package-json-fast "^3.0.0" - sigstore "^2.2.0" - ssri "^10.0.0" - tar "^6.1.11" - pako@~1.0.2, pako@~1.0.5: version "1.0.11" resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" @@ -20282,14 +20229,14 @@ parse-asn1@^5.0.0, parse-asn1@^5.1.7: pbkdf2 "^3.1.2" safe-buffer "^5.2.1" -parse-conflict-json@*, parse-conflict-json@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/parse-conflict-json/-/parse-conflict-json-3.0.1.tgz#67dc55312781e62aa2ddb91452c7606d1969960c" - integrity sha512-01TvEktc68vwbJOtWZluyWeVGWjP+bZwXtPDMQVbBKzbJ/vZBif0L69KH1+cHv1SZ6e0FKLvjyHe8mqsIqYOmw== +parse-conflict-json@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/parse-conflict-json/-/parse-conflict-json-1.1.1.tgz#54ec175bde0f2d70abf6be79e0e042290b86701b" + integrity sha512-4gySviBiW5TRl7XHvp1agcS7SOe0KZOjC//71dzZVWJrY9hCrgtvl5v3SyIxCZ4fZF47TxD9nfzmxcx76xmbUw== dependencies: - json-parse-even-better-errors "^3.0.0" - just-diff "^6.0.0" - just-diff-apply "^5.2.0" + json-parse-even-better-errors "^2.3.0" + just-diff "^3.0.1" + just-diff-apply "^3.0.0" parse-conflict-json@^2.0.1: version "2.0.2" @@ -20727,14 +20674,6 @@ possible-typed-array-names@^1.0.0: resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f" integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q== -postcss-selector-parser@^6.0.10: - version "6.0.16" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.16.tgz#3b88b9f5c5abd989ef4e2fc9ec8eedd34b20fb04" - integrity sha512-A0RVJrX+IUkVZbW3ClroRWurercFhieevHB38sr2+l9eUClMqome3LmEmnhlNy+5Mr2EYN6B2Kaw9wYdd+VHiw== - dependencies: - cssesc "^3.0.0" - util-deprecate "^1.0.2" - postcss@8.4.14: version "8.4.14" resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf" @@ -20835,6 +20774,11 @@ private@^0.1.6, private@^0.1.8: resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== +proc-log@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-1.0.0.tgz#0d927307401f69ed79341e83a0b2c9a13395eb77" + integrity sha512-aCk8AO51s+4JyuYGg3Q/a6gnrlDO09NpVWePtjp7xwphcoQ04x5WAfCyugcsbLooWcMJ87CLkD4+604IckEdhg== + proc-log@^2.0.0, proc-log@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-2.0.1.tgz#8f3f69a1f608de27878f91f5c688b225391cb685" @@ -20845,11 +20789,6 @@ proc-log@^3.0.0: resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-3.0.0.tgz#fb05ef83ccd64fd7b20bbe9c8c1070fc08338dd8" integrity sha512-++Vn7NS4Xf9NacaU9Xq3URUuqZETPsf8L4j5/ckhaRYsfPeRyzGw+iDjFhV/Jr3uNmTvvddEJFWh5R1gRgUH8A== -proc-log@^4.0.0, proc-log@^4.1.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/proc-log/-/proc-log-4.2.0.tgz#b6f461e4026e75fdfe228b265e9f7a00779d7034" - integrity sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA== - process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -20887,11 +20826,6 @@ promise-call-limit@^1.0.1: resolved "https://registry.yarnpkg.com/promise-call-limit/-/promise-call-limit-1.0.2.tgz#f64b8dd9ef7693c9c7613e7dfe8d6d24de3031ea" integrity sha512-1vTUnfI2hzui8AEIixbdAJlFY4LFDXqQswy/2eOlThAscXCY4It8FdVuI0fMJGAB2aWGbdQf/gv0skKYXmdrHA== -promise-call-limit@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/promise-call-limit/-/promise-call-limit-3.0.1.tgz#3570f7a3f2aaaf8e703623a552cd74749688cf19" - integrity sha512-utl+0x8gIDasV5X+PI5qWEPqH6fJS0pFtQ/4gZ95xfEFb/89dmh+/b895TbFDBLiafBvxD/PGTKfvxl4kH/pQg== - promise-inflight@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/promise-inflight/-/promise-inflight-1.0.1.tgz#98472870bf228132fcbdd868129bad12c3c029e3" @@ -20928,13 +20862,6 @@ promzard@^0.3.0: dependencies: read "1" -promzard@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/promzard/-/promzard-1.0.1.tgz#3b77251a24f988c0886f5649d4f642bcdd53e558" - integrity sha512-ulDF77aULEHUoJkN5XZgRV5loHXBaqd9eorMvLNLvi2gXMuRAtwH6Gh4zsMHQY1kTt7tyv/YZwZW5C2gtj8F2A== - dependencies: - read "^3.0.1" - prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" @@ -21098,7 +21025,7 @@ q@^1.5.1: resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" integrity sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw== -qrcode-terminal@*: +qrcode-terminal@^0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz#bb5b699ef7f9f0505092a3748be4464fe71b5819" integrity sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ== @@ -21331,25 +21258,17 @@ react@18.0.0: dependencies: loose-envify "^1.1.0" +read-cmd-shim@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-2.0.0.tgz#4a50a71d6f0965364938e9038476f7eede3928d9" + integrity sha512-HJpV9bQpkl6KwjxlJcBoqu9Ba0PQg8TqSNIOrulGt54a0uup0HtevreFHzYzkm0lpnleRdNBzXznKrgxglEHQw== + read-cmd-shim@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-3.0.1.tgz#868c235ec59d1de2db69e11aec885bc095aea087" integrity sha512-kEmDUoYf/CDy8yZbLTmhB1X9kkjf9Q80PCNsDMb7ufrGd6zZSQA1+UyjrO+pZm5K/S4OXCWJeiIt1JA8kAsa6g== -read-cmd-shim@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/read-cmd-shim/-/read-cmd-shim-4.0.0.tgz#640a08b473a49043e394ae0c7a34dd822c73b9bb" - integrity sha512-yILWifhaSEEytfXI76kB9xEEiG1AiozaCJZ83A87ytjRiN+jVibXjedjCRNjoZviinhG+4UkalO3mWTd8u5O0Q== - -read-package-json-fast@*, read-package-json-fast@^3.0.0, read-package-json-fast@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/read-package-json-fast/-/read-package-json-fast-3.0.2.tgz#394908a9725dc7a5f14e70c8e7556dff1d2b1049" - integrity sha512-0J+Msgym3vrLOUB3hzQCuZHII0xkNGCtz/HJH9xZshwv9DbDwkw1KaE3gx/e2J5rpEY5rtOy6cyhKOPrkP7FZw== - dependencies: - json-parse-even-better-errors "^3.0.0" - npm-normalize-package-bin "^3.0.0" - -read-package-json-fast@^2.0.2, read-package-json-fast@^2.0.3: +read-package-json-fast@^2.0.1, read-package-json-fast@^2.0.2, read-package-json-fast@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/read-package-json-fast/-/read-package-json-fast-2.0.3.tgz#323ca529630da82cb34b36cc0b996693c98c2b83" integrity sha512-W/BKtbL+dUjTuRL2vziuYhp76s5HZ9qQhd/dKfWIZveD0O40453QNyZhC0e63lqZrAQ4jiOapVoeJ7JrszenQQ== @@ -21357,15 +21276,15 @@ read-package-json-fast@^2.0.2, read-package-json-fast@^2.0.3: json-parse-even-better-errors "^2.3.0" npm-normalize-package-bin "^1.0.1" -read-package-json@*, read-package-json@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-7.0.0.tgz#d605c9dcf6bc5856da24204aa4e9518ee9714be0" - integrity sha512-uL4Z10OKV4p6vbdvIXB+OzhInYtIozl/VxUBPgNkBuUi2DeRonnuspmaVAMcrkmfjKGNmRndyQAbE7/AmzGwFg== +read-package-json@^4.1.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/read-package-json/-/read-package-json-4.1.2.tgz#b444d047de7c75d4a160cb056d00c0693c1df703" + integrity sha512-Dqer4pqzamDE2O4M55xp1qZMuLPqi4ldk2ya648FOMHRjwMzFhuxVrG04wd0c38IsvkVdr3vgHI6z+QTPdAjrQ== dependencies: - glob "^10.2.2" - json-parse-even-better-errors "^3.0.0" - normalize-package-data "^6.0.0" - npm-normalize-package-bin "^3.0.0" + glob "^7.1.1" + json-parse-even-better-errors "^2.3.0" + normalize-package-data "^3.0.0" + npm-normalize-package-bin "^1.0.0" read-package-json@^5.0.0, read-package-json@^5.0.1: version "5.0.2" @@ -21430,14 +21349,7 @@ read-pkg@^5.0.0, read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -read@*, read@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/read/-/read-3.0.1.tgz#926808f0f7c83fa95f1ef33c0e2c09dbb28fd192" - integrity sha512-SLBrDU/Srs/9EoWhU5GdbAoxG1GzpQHo/6qiGItaoLJ1thmYpcNIM1qISEUvyHBzfGlWIyd6p2DNi1oV1VmAuw== - dependencies: - mute-stream "^1.0.0" - -read@1, read@^1.0.7: +read@1, read@^1.0.7, read@~1.0.1, read@~1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" integrity sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ== @@ -21463,7 +21375,7 @@ readable-stream@^1.0.33: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.0, readable-stream@^2.3.5, readable-stream@^2.3.8, readable-stream@~2.3.6: +readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.2.2, readable-stream@^2.2.9, readable-stream@^2.3.0, readable-stream@^2.3.5, readable-stream@^2.3.8, readable-stream@~2.3.6: version "2.3.8" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== @@ -21486,7 +21398,7 @@ readable-stream@~1.0.15: isarray "0.0.1" string_decoder "~0.10.x" -readdir-scoped-modules@*, readdir-scoped-modules@^1.1.0: +readdir-scoped-modules@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/readdir-scoped-modules/-/readdir-scoped-modules-1.1.0.tgz#8d45407b4f870a0dcaebc0e28670d18e74514309" integrity sha512-asaikDeqAQg7JifRsZn1NJZXo9E+VwlyCfbkZhwyISinqk5zNS6266HS5kah6P0SaQKGF6SkNnZVHUzHFYxYDw== @@ -21763,7 +21675,7 @@ request-progress@^3.0.0: dependencies: throttleit "^1.0.0" -request@^2.79.0, request@^2.85.0: +request@^2.79.0, request@^2.85.0, request@^2.88.2: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -21934,13 +21846,6 @@ rfdc@^1.3.0: resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.1.tgz#2b6d4df52dffe8bb346992a10ea9451f24373a8f" integrity sha512-r5a3l5HzYlIC68TpmYKlxWjmOP6wiPJ1vWv2HeLhNsRZMrCkxeqxiHlQ21oXmQ4F3SiryXBHhAD7JZqvOJjFmg== -rimraf@*, rimraf@^5.0.5: - version "5.0.5" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-5.0.5.tgz#9be65d2d6e683447d2e9013da2bf451139a61ccf" - integrity sha512-CqDakW+hMe/Bz202FPEymy68P+G50RfMQK+Qo5YUqc9SPipvbGjCGKd0RSKEelbsfQuw3g5NZDSrlZZAJurH1A== - dependencies: - glob "^10.3.7" - rimraf@^2.2.8: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" @@ -22235,13 +22140,6 @@ semver-regex@^3.1.2: resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.4.tgz#13053c0d4aa11d070a2f2872b6b1e3ae1e1971b4" integrity sha512-6IiqeZNgq01qGf0TId0t3NvKzSvUsjcpdEO3AQNeIjR6A2+ckTnQlDpl4qu1bjRv0RzN3FP9hzFmws3lKqRWkA== -semver@*, semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4: - version "7.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" - integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== - dependencies: - lru-cache "^6.0.0" - "semver@2 || 3 || 4 || 5", semver@^5.0.1, semver@^5.3.0, semver@^5.6.0, semver@^5.7.1: version "5.7.2" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" @@ -22266,6 +22164,13 @@ semver@^6.0.0, semver@^6.1.0, semver@^6.2.0, semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== +semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.1.3, semver@^7.2.1, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4: + version "7.6.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" + integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== + dependencies: + lru-cache "^6.0.0" + semver@~5.4.1: version "5.4.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.4.1.tgz#e059c09d8571f0540823733433505d3a2f00b18e" @@ -22375,7 +22280,7 @@ servify@^0.1.12: request "^2.79.0" xhr "^2.3.3" -set-blocking@^2.0.0: +set-blocking@^2.0.0, set-blocking@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw== @@ -22496,7 +22401,7 @@ side-channel@^1.0.4, side-channel@^1.0.6: get-intrinsic "^1.2.4" object-inspect "^1.13.1" -signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: +signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== @@ -22515,18 +22420,6 @@ signale@^1.2.1: figures "^2.0.0" pkg-conf "^2.1.0" -sigstore@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/sigstore/-/sigstore-2.3.0.tgz#c56b32818d4dc989f6ea3c0897f4d9bff5d14bed" - integrity sha512-q+o8L2ebiWD1AxD17eglf1pFrl9jtW7FHa0ygqY6EKvibK8JHyq9Z26v9MZXeDiw+RbfOJ9j2v70M10Hd6E06A== - dependencies: - "@sigstore/bundle" "^2.3.1" - "@sigstore/core" "^1.0.0" - "@sigstore/protobuf-specs" "^0.3.1" - "@sigstore/sign" "^2.3.0" - "@sigstore/tuf" "^2.3.1" - "@sigstore/verify" "^1.2.0" - simple-concat@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" @@ -22664,6 +22557,15 @@ sockjs@^0.3.24: uuid "^8.3.2" websocket-driver "^0.7.4" +socks-proxy-agent@^6.0.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-6.2.1.tgz#2687a31f9d7185e38d530bef1944fe1f1496d6ce" + integrity sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ== + dependencies: + agent-base "^6.0.2" + debug "^4.3.3" + socks "^2.6.2" + socks-proxy-agent@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/socks-proxy-agent/-/socks-proxy-agent-7.0.0.tgz#dc069ecf34436621acb41e3efa66ca1b5fed15b6" @@ -22973,13 +22875,20 @@ sshpk@^1.14.1, sshpk@^1.7.0: safer-buffer "^2.0.2" tweetnacl "~0.14.0" -ssri@*, ssri@^10.0.0, ssri@^10.0.5: +ssri@^10.0.0: version "10.0.5" resolved "https://registry.yarnpkg.com/ssri/-/ssri-10.0.5.tgz#e49efcd6e36385196cb515d3a2ad6c3f0265ef8c" integrity sha512-bSf16tAFkGeRlUNDjXu8FzaMQt6g2HZJrun7mtMbIPOddxt3GLMSz5VWUWcqTJUPfLEaDIepGxv+bYQW49596A== dependencies: minipass "^7.0.3" +ssri@^8.0.0, ssri@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/ssri/-/ssri-8.0.1.tgz#638e4e439e2ffbd2cd289776d5ca457c4f51a2af" + integrity sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ== + dependencies: + minipass "^3.1.1" + ssri@^9.0.0, ssri@^9.0.1: version "9.0.1" resolved "https://registry.yarnpkg.com/ssri/-/ssri-9.0.1.tgz#544d4c357a8d7b71a19700074b6883fcb4eae057" @@ -23158,7 +23067,7 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -string-width@^2.1.0: +string-width@^2.0.0, string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== @@ -23249,6 +23158,11 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" +stringify-package@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" + integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== + "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" @@ -23670,18 +23584,6 @@ tar-stream@^2.1.4, tar-stream@~2.2.0: inherits "^2.0.3" readable-stream "^3.1.1" -tar@*: - version "7.0.1" - resolved "https://registry.yarnpkg.com/tar/-/tar-7.0.1.tgz#8f6ccebcd91b69e9767a6fc4892799e8b0e606d5" - integrity sha512-IjMhdQMZFpKsHEQT3woZVxBtCQY+0wk3CVxdRkGXEgyGa0dNS/ehPvOMr2nmfC7x5Zj2N+l6yZUpmICjLGS35w== - dependencies: - "@isaacs/fs-minipass" "^4.0.0" - chownr "^3.0.0" - minipass "^5.0.0" - minizlib "^3.0.1" - mkdirp "^3.0.1" - yallist "^5.0.0" - tar@6.1.11: version "6.1.11" resolved "https://registry.yarnpkg.com/tar/-/tar-6.1.11.tgz#6760a38f003afa1b2ffd0ffe9e9abbd0eab3d621" @@ -23707,7 +23609,7 @@ tar@^4.0.2: safe-buffer "^5.2.1" yallist "^3.1.1" -tar@^6.1.0, tar@^6.1.11, tar@^6.1.2, tar@^6.2.1: +tar@^6.0.2, tar@^6.1.0, tar@^6.1.11, tar@^6.1.2: version "6.2.1" resolved "https://registry.yarnpkg.com/tar/-/tar-6.2.1.tgz#717549c541bc3c2af15751bea94b1dd068d4b03a" integrity sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A== @@ -23791,7 +23693,7 @@ text-extensions@^1.0.0: resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" integrity sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ== -text-table@*, text-table@^0.2.0: +text-table@^0.2.0, text-table@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== @@ -23850,7 +23752,7 @@ timers-browserify@^2.0.12: dependencies: setimmediate "^1.0.4" -tiny-relative-date@*: +tiny-relative-date@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/tiny-relative-date/-/tiny-relative-date-1.3.0.tgz#fa08aad501ed730f31cc043181d995c39a935e07" integrity sha512-MOQHpzllWxDCHHaDno30hhLfbouoYlOI8YlMNtvKe1zXbjEVhbcEovQxvZrPvtiYW630GQDoMMarCnjfyfHA+A== @@ -24000,10 +23902,10 @@ tree-kill@^1.2.2: resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== -treeverse@*, treeverse@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/treeverse/-/treeverse-3.0.0.tgz#dd82de9eb602115c6ebd77a574aae67003cb48c8" - integrity sha512-gcANaAnd2QDZFmHFEOF4k7uc1J/6a6z3DJMd/QwEyxLoKGiptJRwid582r7QIsFlFMIZ3SnxfS52S4hm2DHkuQ== +treeverse@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/treeverse/-/treeverse-1.0.4.tgz#a6b0ebf98a1bca6846ddc7ecbc900df08cb9cd5f" + integrity sha512-whw60l7r+8ZU8Tu/Uc2yxtc4ZTZbR/PF3u1IPNKGQ6p8EICLb3Z2lAgoqw9bqYd8IkgnsaOcLzYHFckjqNsf0g== treeverse@^2.0.0: version "2.0.0" @@ -24130,15 +24032,6 @@ tty-browserify@^0.0.1: resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.1.tgz#3f05251ee17904dfd0677546670db9651682b811" integrity sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw== -tuf-js@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/tuf-js/-/tuf-js-2.2.0.tgz#4daaa8620ba7545501d04dfa933c98abbcc959b9" - integrity sha512-ZSDngmP1z6zw+FIkIBjvOp/II/mIub/O7Pp12j1WNsiCpg5R5wAc//i555bBQsE44O94btLt0xM/Zr2LQjwdCg== - dependencies: - "@tufjs/models" "2.0.0" - debug "^4.3.4" - make-fetch-happen "^13.0.0" - tunnel-agent@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz#27a5dea06b36b04a0a9966774b290868f0fc40fd" @@ -24490,6 +24383,13 @@ union@~0.5.0: dependencies: qs "^6.4.0" +unique-filename@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-1.1.1.tgz#1d69769369ada0583103a1e6ae87681b56573230" + integrity sha512-Vmp0jIp2ln35UTXuryvjzkjGdRyf9b2lTXuSYUiPmzRcl3FDtYqAwOnTJkAngD9SWhnoJzDbTKwaOrZ+STtxNQ== + dependencies: + unique-slug "^2.0.0" + unique-filename@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/unique-filename/-/unique-filename-2.0.1.tgz#e785f8675a9a7589e0ac77e0b5c34d2eaeac6da2" @@ -24504,6 +24404,13 @@ unique-filename@^3.0.0: dependencies: unique-slug "^4.0.0" +unique-slug@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-2.0.2.tgz#baabce91083fc64e945b0f3ad613e264f7cd4e6c" + integrity sha512-zoWr9ObaxALD3DOPfjPSqxt4fnZiWblxHIgeWqW8x7UqDzEtHEQLzji2cuJYQFCU6KmoJikOYAZlrTHHebjx2w== + dependencies: + imurmurhash "^0.1.4" + unique-slug@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/unique-slug/-/unique-slug-3.0.0.tgz#6d347cf57c8a7a7a6044aabd0e2d74e4d76dc7c9" @@ -24748,7 +24655,7 @@ utf8@3.0.0, utf8@^3.0.0: resolved "https://registry.yarnpkg.com/utf8/-/utf8-3.0.0.tgz#f052eed1364d696e769ef058b183df88c87f69d1" integrity sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ== -util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: +util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== @@ -24855,14 +24762,7 @@ validate-npm-package-license@^3.0.1, validate-npm-package-license@^3.0.4: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -validate-npm-package-name@*, validate-npm-package-name@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz#f16afd48318e6f90a1ec101377fa0384cfc8c713" - integrity sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ== - dependencies: - builtins "^5.0.0" - -validate-npm-package-name@^3.0.0: +validate-npm-package-name@^3.0.0, validate-npm-package-name@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-3.0.0.tgz#5fa912d81eb7d0c74afc140de7317f0ca7df437e" integrity sha512-M6w37eVCMMouJ9V/sdPGnC5H4uDr73/+xdq0FBLO3TFFX1+7wiUY6Es328NN+y43tmY+doUdN9g9J21vqB7iLw== @@ -24876,6 +24776,13 @@ validate-npm-package-name@^4.0.0: dependencies: builtins "^5.0.0" +validate-npm-package-name@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz#f16afd48318e6f90a1ec101377fa0384cfc8c713" + integrity sha512-YuKoXDAhBYxY7SfOKxHBDoSyENFeW5VvIIQp2TGQuit8gpK6MnWaQelBKxso72DoxTZfZdcP3W90LqpSkgPzLQ== + dependencies: + builtins "^5.0.0" + valtio@1.11.0: version "1.11.0" resolved "https://registry.yarnpkg.com/valtio/-/valtio-1.11.0.tgz#c029dcd17a0f99d2fbec933721fe64cfd32a31ed" @@ -24955,11 +24862,6 @@ walk-up-path@^1.0.0: resolved "https://registry.yarnpkg.com/walk-up-path/-/walk-up-path-1.0.0.tgz#d4745e893dd5fd0dbb58dd0a4c6a33d9c9fec53e" integrity sha512-hwj/qMDUEjCU5h0xr90KGCf0tg0/LgJbmOWgrWKYlcJZM7XvquvUJZ0G/HMGr7F7OQMOUuPHWP9JpriinkAlkg== -walk-up-path@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/walk-up-path/-/walk-up-path-3.0.1.tgz#c8d78d5375b4966c717eb17ada73dbd41490e886" - integrity sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA== - walker@^1.0.7, walker@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f" @@ -25502,13 +25404,6 @@ which-typed-array@^1.1.13, which-typed-array@^1.1.14, which-typed-array@^1.1.15, gopd "^1.0.1" has-tostringtag "^1.0.2" -which@*, which@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/which/-/which-4.0.0.tgz#cd60b5e74503a3fbcfbf6cd6b4138a8bae644c1a" - integrity sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg== - dependencies: - isexe "^3.1.1" - which@^2.0.1, which@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -25516,7 +25411,14 @@ which@^2.0.1, which@^2.0.2: dependencies: isexe "^2.0.0" -wide-align@^1.1.5: +which@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/which/-/which-4.0.0.tgz#cd60b5e74503a3fbcfbf6cd6b4138a8bae644c1a" + integrity sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg== + dependencies: + isexe "^3.1.1" + +wide-align@^1.1.0, wide-align@^1.1.2, wide-align@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.5.tgz#df1d4c206854369ecf3c9a4898f1b23fbd9d15d3" integrity sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg== @@ -25609,14 +25511,6 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -write-file-atomic@*, write-file-atomic@^5.0.0, write-file-atomic@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-5.0.1.tgz#68df4717c55c6fa4281a7860b4c2ba0a6d2b11e7" - integrity sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw== - dependencies: - imurmurhash "^0.1.4" - signal-exit "^4.0.1" - write-file-atomic@^2.4.2: version "2.4.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" @@ -25626,7 +25520,7 @@ write-file-atomic@^2.4.2: imurmurhash "^0.1.4" signal-exit "^3.0.2" -write-file-atomic@^3.0.0: +write-file-atomic@^3.0.0, write-file-atomic@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.3.tgz#56bd5c5a5c70481cd19c571bd39ab965a5de56e8" integrity sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q== @@ -25644,6 +25538,14 @@ write-file-atomic@^4.0.0, write-file-atomic@^4.0.1, write-file-atomic@^4.0.2: imurmurhash "^0.1.4" signal-exit "^3.0.7" +write-file-atomic@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-5.0.1.tgz#68df4717c55c6fa4281a7860b4c2ba0a6d2b11e7" + integrity sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw== + dependencies: + imurmurhash "^0.1.4" + signal-exit "^4.0.1" + write-json-file@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-3.2.0.tgz#65bbdc9ecd8a1458e15952770ccbadfcff5fe62a" @@ -25820,11 +25722,6 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== -yallist@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-5.0.0.tgz#00e2de443639ed0d78fd87de0d27469fbcffb533" - integrity sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw== - yaml@^1.10.0, yaml@^1.7.2: version "1.10.2" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" From 35ede368ee826b7323dcdb1ff87f332393cdf935 Mon Sep 17 00:00:00 2001 From: Anson Date: Thu, 25 Apr 2024 22:00:05 +0100 Subject: [PATCH 08/20] feat(migration): update pkpSign function --- packages/core/src/lib/lit-core.ts | 54 +++++++-------- .../src/lib/helpers/normalize-array.test.ts | 28 ++++++++ .../src/lib/helpers/normalize-array.ts | 15 +++++ .../src/lib/lit-node-client-nodejs.ts | 67 ++++++++++--------- packages/types/src/lib/interfaces.ts | 60 +++++------------ 5 files changed, 121 insertions(+), 103 deletions(-) create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts diff --git a/packages/core/src/lib/lit-core.ts b/packages/core/src/lib/lit-core.ts index 27cdb169e0..293eebe194 100644 --- a/packages/core/src/lib/lit-core.ts +++ b/packages/core/src/lib/lit-core.ts @@ -1018,48 +1018,40 @@ export class LitCore { }; /** + * Retrieves the session signature for a given URL from the sessionSigs map. + * Throws an error if sessionSigs is not provided or if the session signature for the URL is not found. * - * Get either auth sig or session auth sig - * + * @param sessionSigs - The session signatures map. + * @param url - The URL for which to retrieve the session signature. + * @returns The session signature for the given URL. + * @throws An error if sessionSigs is not provided or if the session signature for the URL is not found. */ - getSessionOrAuthSig = ({ - authSig, + getSessionSigByUrl = ({ sessionSigs, url, - mustHave = true, }: { - authSig?: AuthSig; - sessionSigs?: SessionSigsMap; + sessionSigs: SessionSigsMap; url: string; - mustHave?: boolean; - }): AuthSig | SessionSig => { - if (!authSig && !sessionSigs) { - if (mustHave) { - throwError({ - message: `You must pass either authSig, or sessionSigs`, - errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, - errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, - }); - } else { - log(`authSig or sessionSigs not found. This may be using authMethod`); - } + }): AuthSig => { + if (!sessionSigs) { + return throwError({ + message: `You must pass in sessionSigs`, + errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, + errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, + }); } - if (sessionSigs) { - const sigToPassToNode = sessionSigs[url]; + const sigToPassToNode = sessionSigs[url]; - if (!sigToPassToNode) { - throwError({ - message: `You passed sessionSigs but we could not find session sig for node ${url}`, - errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, - errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, - }); - } - - return sigToPassToNode; + if (!sessionSigs[url]) { + throwError({ + message: `You passed sessionSigs but we could not find session sig for node ${url}`, + errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, + errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, + }); } - return authSig!; + return sigToPassToNode; }; validateAccessControlConditionsSchema = async ( diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.test.ts new file mode 100644 index 0000000000..a2b9424e16 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.test.ts @@ -0,0 +1,28 @@ +import { ethers } from 'ethers'; +import { normalizeArray } from './normalize-array'; + +describe('normalizeArray', () => { + it('should normalize an array-like object', () => { + const toSign = new Uint8Array([1, 2, 3]); + + const result = normalizeArray(toSign); + + expect(result).toEqual([1, 2, 3]); + }); + + it('should normalize a Buffer', () => { + const toSign = Buffer.from('hello'); + + const result = normalizeArray(toSign); + + expect(result).toEqual([104, 101, 108, 108, 111]); + }); + + it('should normalize a Buffer from ethers', () => { + const toSign = ethers.utils.toUtf8Bytes('hello'); + + const result = normalizeArray(toSign); + + expect(result).toEqual([104, 101, 108, 108, 111]); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts new file mode 100644 index 0000000000..2da12ecbe7 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts @@ -0,0 +1,15 @@ +/** + * Converts an ArrayLike object to a regular array. + * + * Context: the nodes will only accept a normal array type as a paramater due to serizalization issues with Uint8Array type. this loop below is to normalize the message to a basic array. + * + * @param toSign - The ArrayLike object to be converted. + * @returns The converted array.Β΄ + */ +export const normalizeArray = (toSign: ArrayLike) => { + const arr = []; + for (let i = 0; i < toSign.length; i++) { + arr.push((toSign as Buffer)[i]); + } + return arr; +}; diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index 54f77b9d0e..71c4cf444b 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -118,8 +118,10 @@ import type { JsonSignSessionKeyRequestV1, BlsResponseData, SessionKeyCache, + JsonPkpSignSdkParams, } from '@lit-protocol/types'; import * as blsSdk from '@lit-protocol/bls-sdk'; +import { normalizeArray } from './helpers/normalize-array'; const TEMP_CACHE_PERIOD = 30000; // 30 seconds @@ -1068,8 +1070,7 @@ export class LitNodeClientNodeJs this.getLitActionRequestBody(params); // -- choose the right signature - const sigToPassToNode = this.getSessionOrAuthSig({ - authSig, + const sigToPassToNode = this.getSessionSigByUrl({ sessionSigs, url, }); @@ -1577,7 +1578,7 @@ export class LitNodeClientNodeJs ): Promise | RejectedNodePromises> => { const nodePromises = this.getNodePromises((url: string) => { // -- choose the right signature - const sigToPassToNode = this.getSessionOrAuthSig({ + const sigToPassToNode = this.getSessionSigByUrl({ authSig, sessionSigs, url, @@ -1741,13 +1742,19 @@ export class LitNodeClientNodeJs return returnVal; }; - pkpSign = async (params: JsonPkpSignRequest) => { - let { authSig, sessionSigs, toSign, pubKey, authMethods } = params; - - pubKey = hexPrefixed(pubKey); - + /** + * Use PKP to sign + * + * @param { JsonPkpSignSdkParams } params + * @param params.toSign - The data to sign + * @param params.pubKey - The public key to sign with + * @param params.sessionSigs - The session signatures to use + * @param params.authMethods - (optional) The auth methods to use + */ + pkpSign = async (params: JsonPkpSignSdkParams) => { // -- validate required params - (['toSign', 'pubKey'] as (keyof JsonPkpSignRequest)[]).forEach((key) => { + const requiredParamKeys = ['toSign', 'pubKey']; + (requiredParamKeys as (keyof JsonPkpSignSdkParams)[]).forEach((key) => { if (!params[key]) { throwError({ message: `"${key}" cannot be undefined, empty, or null. Please provide a valid value.`, @@ -1758,42 +1765,42 @@ export class LitNodeClientNodeJs }); // -- validate present of accepted auth methods - if (!authSig && !sessionSigs && (!authMethods || authMethods.length <= 0)) { + if ( + !params.sessionSigs && + (!params.authMethods || params.authMethods.length <= 0) + ) { throwError({ - message: `Either authSig, sessionSigs, or authMethods (length > 0) must be present.`, + message: `Either sessionSigs or authMethods (length > 0) must be present.`, errorKind: LIT_ERROR.PARAM_NULL_ERROR.kind, errorCode: LIT_ERROR.PARAM_NULL_ERROR.name, }); } - // the nodes will only accept a normal array type as a paramater due to serizalization issues with Uint8Array type. - // this loop below is to normalize the message to a basic array. - const arr = []; - for (let i = 0; i < toSign.length; i++) { - arr.push((toSign as Buffer)[i]); - } - toSign = arr; + // yes, 'key' is in lower case, because this is what the node expects + const pubkey = hexPrefixed(params.pubKey); + + const normalizedToSignArray = normalizeArray(params.toSign); const wrapper = async ( id: string ): Promise | RejectedNodePromises> => { const nodePromises = this.getNodePromises((url: string) => { - // -- choose the right signature - const sigToPassToNode = this.getSessionOrAuthSig({ - authSig, - sessionSigs, + // -- get the session sig from the url key + const sessionSig = this.getSessionSigByUrl({ + sessionSigs: params.sessionSigs, url, - mustHave: false, }); - logWithRequestId(id, 'sigToPassToNode:', sigToPassToNode); + const hasAuthMethod = + params.authMethods && params.authMethods.length > 0; - const reqBody = { - toSign, - pubkey: pubKey, - ...(sigToPassToNode && - sigToPassToNode !== undefined && { authSig: sigToPassToNode }), - ...(authMethods && authMethods.length > 0 && { authMethods }), + const reqBody: JsonPkpSignRequest = { + toSign: normalizedToSignArray, + pubkey: pubkey, + authSig: sessionSig, + ...(hasAuthMethod && { + authMethods: params.authMethods, + }), }; logWithRequestId(id, 'reqBody:', reqBody); diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index 8ffafc8abd..67f1c4da2e 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -244,17 +244,7 @@ export interface BaseJsonExecutionRequest { authMethods?: AuthMethod[]; } -export interface WithAuthSig extends BaseJsonExecutionRequest { - authSig: AuthSig; - sessionSigs?: any; -} - -export interface WithSessionSigs extends BaseJsonExecutionRequest { - sessionSigs: any; - authSig?: AuthSig; -} - -export type JsonExecutionRequest = WithAuthSig | WithSessionSigs; +export type JsonExecutionRequest = {} & BaseJsonExecutionRequest; export interface JsExecutionRequestBody { authSig?: AuthSig; @@ -266,32 +256,26 @@ export interface JsExecutionRequestBody { export interface BaseJsonPkpSignRequest { toSign: ArrayLike; - pubKey: string; + pubkey: string; // yes, pub"key" is lower case in the node. + authMethods?: AuthMethod[]; } -export interface WithAuthMethodSigning extends BaseJsonPkpSignRequest { - // auth methods to resolve - authMethods: AuthMethod[]; - sessionSigs?: any; - authSig?: AuthSig; -} -export interface WithSessionSigsSigning extends BaseJsonPkpSignRequest { - sessionSigs: any; - authSig?: AuthSig; - authMethods?: AuthMethod[]; +/** + * The 'pkpSign' function param. Please note that the structure + * is different than the payload sent to the node. + */ +export interface JsonPkpSignSdkParams extends BaseJsonPkpSignRequest { + pubKey: string; + sessionSigs: SessionSigsMap; } -export interface WithAuthSigSigning extends BaseJsonPkpSignRequest { +/** + * The actual payload structure sent to the node /pkp/sign endpoint. + */ +export interface JsonPkpSignRequest extends BaseJsonPkpSignRequest { authSig: AuthSig; - sessionSigs?: any; - authMethods?: AuthMethod[]; } -export type JsonPkpSignRequest = - | WithSessionSigsSigning - | WithAuthSigSigning - | WithAuthMethodSigning; - /** * Struct in rust * ----- @@ -377,7 +361,7 @@ export interface JsonAccsRequest extends MultipleAccessControlConditions { // The authentication signature that proves that the user owns the crypto wallet address that meets the access control conditions authSig?: AuthSig; - sessionSigs?: SessionSig; + sessionSigs?: SessionSigsMap; } /** @@ -412,7 +396,7 @@ export interface SigningAccessControlConditionRequest chain?: string; // The authentication signature that proves that the user owns the crypto wallet address that meets the access control conditions - authSig?: SessionSig; + authSig?: AuthSig; iat?: number; exp?: number; @@ -1005,17 +989,9 @@ export type AuthCallback = (params: AuthCallbackParams) => Promise; * A map of node addresses to the session signature payload * for that node specifically. */ -export type SessionSigsMap = Record; - -export interface SessionSig { - sig: string; - derivedVia: string; - signedMessage: string; - address: string; - algo?: string; -} +export type SessionSigsMap = Record; -export type SessionSigs = Record; +export type SessionSigs = Record; export interface SessionRequestBody { sessionKey: string; From 45f9eed7d639e30493af358ad348e1486092ddf1 Mon Sep 17 00:00:00 2001 From: Anson Date: Fri, 26 Apr 2024 22:25:31 +0100 Subject: [PATCH 09/20] feat(remove-authSig): 1. Removed authSig and use sessionSigs 2. Moved all parsers/helpers to its own folder with unit tests 3. Updated `ExecuteJsProps` type to `JsonExecutionSdkParams` type and `JsonExecutionRequest` type to nodes 4. --- packages/contracts-sdk/src/lib/auth-utils.ts | 2 +- packages/core/src/lib/lit-core.ts | 1 - .../encryption/src/lib/params-validators.ts | 43 +- .../src/lib/helpers/encode-code.test.ts | 31 + .../src/lib/helpers/encode-code.ts | 17 + .../src/lib/helpers/get-claims-list.test.ts | 89 ++ .../src/lib/helpers/get-claims-list.ts | 30 + .../src/lib/helpers/get-claims.test.ts | 133 +++ .../src/lib/helpers/get-claims.ts | 41 + .../src/lib/helpers/get-signatures.test.ts | 86 ++ .../src/lib/helpers/get-signatures.ts | 251 ++++++ .../src/lib/helpers/normalize-params.test.ts | 100 +++ .../src/lib/helpers/normalize-params.ts | 24 + .../helpers/parse-as-json-or-string.test.ts | 21 + .../lib/helpers/parse-as-json-or-string.ts | 21 + .../lib/helpers/remove-double-quotes.test.ts | 51 ++ .../src/lib/helpers/remove-double-quotes.ts | 20 + .../src/lib/lit-node-client-nodejs.ts | 792 ++++-------------- packages/misc/src/lib/misc.spec.ts | 248 ++++++ packages/misc/src/lib/misc.ts | 67 +- packages/pkp-base/src/lib/pkp-base.ts | 23 +- packages/types/src/lib/ILitNodeClient.ts | 52 +- packages/types/src/lib/interfaces.ts | 189 +++-- 23 files changed, 1516 insertions(+), 816 deletions(-) create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/encode-code.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/encode-code.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/get-claims.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/get-claims.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.ts diff --git a/packages/contracts-sdk/src/lib/auth-utils.ts b/packages/contracts-sdk/src/lib/auth-utils.ts index 98c55093c8..6e7d379359 100644 --- a/packages/contracts-sdk/src/lib/auth-utils.ts +++ b/packages/contracts-sdk/src/lib/auth-utils.ts @@ -1,4 +1,4 @@ -import { SessionSig, StytchToken } from '@lit-protocol/types'; +import { StytchToken } from '@lit-protocol/types'; import { ethers } from 'ethers'; import * as jose from 'jose'; /** diff --git a/packages/core/src/lib/lit-core.ts b/packages/core/src/lib/lit-core.ts index 293eebe194..4176bb87a5 100644 --- a/packages/core/src/lib/lit-core.ts +++ b/packages/core/src/lib/lit-core.ts @@ -54,7 +54,6 @@ import type { NodeErrorV3, RejectedNodePromises, SendNodeCommand, - SessionSig, SessionSigsMap, SuccessNodePromises, SupportedJsonRequests, diff --git a/packages/encryption/src/lib/params-validators.ts b/packages/encryption/src/lib/params-validators.ts index 3e687b4cdd..b221a0f685 100644 --- a/packages/encryption/src/lib/params-validators.ts +++ b/packages/encryption/src/lib/params-validators.ts @@ -34,9 +34,10 @@ import { EncryptToJsonProps, EncryptZipRequest, EvmContractConditions, - ExecuteJsProps, GetSignedTokenRequest, + JsonExecutionSdkParams, SessionSigs, + SessionSigsMap, SolRpcConditions, UnifiedAccessControlConditions, } from '@lit-protocol/types'; @@ -71,7 +72,7 @@ export const paramsValidators: Record< string, (params: any) => ParamsValidator[] > = { - executeJs: (params: ExecuteJsProps) => [ + executeJs: (params: JsonExecutionSdkParams) => [ new AuthMaterialValidator('executeJs', params), new ExecuteJsValidator('executeJs', params), new AuthMethodValidator('executeJs', params.authMethods), @@ -379,8 +380,7 @@ class FileValidator implements ParamsValidator { } export interface AuthMaterialValidatorProps { - authSig?: AuthSig; - sessionSigs?: SessionSigs; + sessionSigs?: SessionSigsMap; chain?: string; } @@ -400,14 +400,7 @@ class AuthMaterialValidator implements ParamsValidator { } validate(): IEither { - const { authSig, sessionSigs } = this.authMaterial; - - if (authSig && !is(authSig, 'Object', 'authSig', this.fnName)) - return ELeft({ - message: 'authSig is not an object', - errorKind: LIT_ERROR.INVALID_PARAM_TYPE.kind, - errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, - }); + const { sessionSigs } = this.authMaterial; if (this.checkIfAuthSigRequiresChainParam) { if (!this.authMaterial.chain) @@ -416,20 +409,6 @@ class AuthMaterialValidator implements ParamsValidator { errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, }); - - if ( - authSig && - !checkIfAuthSigRequiresChainParam( - authSig, - this.authMaterial.chain, - this.fnName - ) - ) - return ELeft({ - message: 'authSig is not valid', - errorKind: LIT_ERROR.INVALID_PARAM_TYPE.kind, - errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, - }); } if (sessionSigs && !is(sessionSigs, 'Object', 'sessionSigs', this.fnName)) @@ -439,17 +418,9 @@ class AuthMaterialValidator implements ParamsValidator { errorCode: LIT_ERROR.INVALID_PARAM_TYPE.name, }); - if (!sessionSigs && !authSig) - return ELeft({ - message: 'You must pass either authSig or sessionSigs', - errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, - errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, - }); - - // -- validate: if sessionSig and authSig exists - if (sessionSigs && authSig) + if (!sessionSigs) return ELeft({ - message: 'You cannot have both authSig and sessionSigs', + message: 'You must pass in sessionSigs', errorKind: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.kind, errorCode: LIT_ERROR.INVALID_ARGUMENT_EXCEPTION.name, }); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/encode-code.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/encode-code.test.ts new file mode 100644 index 0000000000..9cf408584c --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/encode-code.test.ts @@ -0,0 +1,31 @@ +import { encodeCode } from './encode-code'; + +describe('encodeCode', () => { + it('should encode a string to base64', () => { + const code = 'console.log("Hello, World!")'; + const encodedCode = encodeCode(code); + + expect(encodedCode).toEqual('Y29uc29sZS5sb2coIkhlbGxvLCBXb3JsZCEiKQ=='); + }); + + it('should handle empty string', () => { + const code = ''; + const encodedCode = encodeCode(code); + + expect(encodedCode).toEqual(''); + }); + + it('should handle special characters', () => { + const code = 'const x = 10 + 5 - 3 * 2 / 1;'; + const encodedCode = encodeCode(code); + + expect(encodedCode).toEqual('Y29uc3QgeCA9IDEwICsgNSAtIDMgKiAyIC8gMTs='); + }); + + it('should handle non-ASCII characters', () => { + const code = 'const name = "JΓ©rΓ©my";'; + const encodedCode = encodeCode(code); + + expect(encodedCode).toEqual('Y29uc3QgbmFtZSA9ICJKw6lyw6lteSI7'); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/encode-code.ts b/packages/lit-node-client-nodejs/src/lib/helpers/encode-code.ts new file mode 100644 index 0000000000..1b45f2c58a --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/encode-code.ts @@ -0,0 +1,17 @@ +import { + uint8arrayFromString, + uint8arrayToString, +} from '@lit-protocol/uint8arrays'; + +/** + * Encodes the given code string into base64 format. + * + * @param code - The code string to be encoded. + * @returns The encoded code string in base64 format. + */ +export const encodeCode = (code: string) => { + const _uint8Array = uint8arrayFromString(code, 'utf8'); + const encodedJs = uint8arrayToString(_uint8Array, 'base64'); + + return encodedJs; +}; diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.test.ts new file mode 100644 index 0000000000..499034e6a5 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.test.ts @@ -0,0 +1,89 @@ +import { NodeShare } from '@lit-protocol/types'; +import { getClaimsList } from './get-claims-list'; + +describe('getClaimsList', () => { + it('should return an empty array if responseData is empty', () => { + const responseData: NodeShare[] = []; + const result = getClaimsList(responseData); + expect(result).toEqual([]); + }); + + it('should parse the real data correctly', () => { + const responseData = [ + { + success: true, + signedData: {}, + decryptedData: {}, + claimData: { + foo: { + signature: + '36ffccaec30f52730dcc6fa411383dd23233be55da5bce7e9e0161dc88cfd0541a7f18f9dbb37677f660bc812ff6d29c1c3f92cb7245c0e20f97787ff3324ad31c', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + response: '', + logs: '', + }, + { + success: true, + signedData: {}, + decryptedData: {}, + claimData: { + foo: { + signature: + 'ac4e1b37a969af3a03331dabb9418d137cec9e8b366ff7cafcf6688ff07b15d070c42c8c16b0f945ea03653a0d286f2f59fdef529db38e7c33b65aae4b287ce71b', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + response: '', + logs: '', + }, + { + success: true, + signedData: {}, + decryptedData: {}, + claimData: { + foo: { + signature: + 'fd5bad778bd70ece43616c0531b13a70bf9b0a853d38aa7b92560a0070e59e7b619979bc79b1ac2dc6886b44a2bdb402e5804a00d010f415d8cf5c6673540d131c', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + response: '', + logs: '', + }, + ] as NodeShare[]; + + const result = getClaimsList(responseData); + + expect(result).toEqual([ + { + foo: { + signature: + '36ffccaec30f52730dcc6fa411383dd23233be55da5bce7e9e0161dc88cfd0541a7f18f9dbb37677f660bc812ff6d29c1c3f92cb7245c0e20f97787ff3324ad31c', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + { + foo: { + signature: + 'ac4e1b37a969af3a03331dabb9418d137cec9e8b366ff7cafcf6688ff07b15d070c42c8c16b0f945ea03653a0d286f2f59fdef529db38e7c33b65aae4b287ce71b', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + { + foo: { + signature: + 'fd5bad778bd70ece43616c0531b13a70bf9b0a853d38aa7b92560a0070e59e7b619979bc79b1ac2dc6886b44a2bdb402e5804a00d010f415d8cf5c6673540d131c', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + ]); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.ts new file mode 100644 index 0000000000..64d08fcc8b --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-claims-list.ts @@ -0,0 +1,30 @@ +import { ClaimsList, NodeShare } from '@lit-protocol/types'; + +/** + * Retrieves a list of claims from the provided response data. + * @param responseData The response data containing the claims. + * @returns An array of claims. + */ +export const getClaimsList = (responseData: NodeShare[]): ClaimsList => { + const claimsList = responseData + .map((r) => { + const { claimData } = r; + if (claimData) { + for (const key of Object.keys(claimData)) { + for (const subkey of Object.keys(claimData[key])) { + if (typeof claimData[key][subkey] == 'string') { + claimData[key][subkey] = claimData[key][subkey].replaceAll( + '"', + '' + ); + } + } + } + return claimData; + } + return null; + }) + .filter((item) => item !== null); + + return claimsList as unknown as ClaimsList; +}; diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-claims.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-claims.test.ts new file mode 100644 index 0000000000..8db4df5596 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-claims.test.ts @@ -0,0 +1,133 @@ +import { getClaims } from './get-claims'; + +describe('getClaims', () => { + it('should return the correct claims object', () => { + const claims = [ + { + foo: { + signature: + '36ffccaec30f52730dcc6fa411383dd23233be55da5bce7e9e0161dc88cfd0541a7f18f9dbb37677f660bc812ff6d29c1c3f92cb7245c0e20f97787ff3324ad31c', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + { + foo: { + signature: + 'ac4e1b37a969af3a03331dabb9418d137cec9e8b366ff7cafcf6688ff07b15d070c42c8c16b0f945ea03653a0d286f2f59fdef529db38e7c33b65aae4b287ce71b', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + { + foo: { + signature: + 'fd5bad778bd70ece43616c0531b13a70bf9b0a853d38aa7b92560a0070e59e7b619979bc79b1ac2dc6886b44a2bdb402e5804a00d010f415d8cf5c6673540d131c', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + ]; + + const expectedClaims = { + foo: { + signatures: [ + { + r: '0x36ffccaec30f52730dcc6fa411383dd23233be55da5bce7e9e0161dc88cfd054', + s: '0x1a7f18f9dbb37677f660bc812ff6d29c1c3f92cb7245c0e20f97787ff3324ad3', + v: 28, + }, + { + r: '0xac4e1b37a969af3a03331dabb9418d137cec9e8b366ff7cafcf6688ff07b15d0', + s: '0x70c42c8c16b0f945ea03653a0d286f2f59fdef529db38e7c33b65aae4b287ce7', + v: 27, + }, + { + r: '0xfd5bad778bd70ece43616c0531b13a70bf9b0a853d38aa7b92560a0070e59e7b', + s: '0x619979bc79b1ac2dc6886b44a2bdb402e5804a00d010f415d8cf5c6673540d13', + v: 28, + }, + ], + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }; + + const result = getClaims(claims); + + expect(result).toEqual(expectedClaims); + }); + + it('should return the correct claims object with different claims', () => { + ``; + const claims = [ + { + foo: { + signature: + '36ffccaec30f52730dcc6fa411383dd23233be55da5bce7e9e0161dc88cfd0541a7f18f9dbb37677f660bc812ff6d29c1c3f92cb7245c0e20f97787ff3324ad31c', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + bar: { + signature: + 'ac4e1b37a969af3a03331dabb9418d137cec9e8b366ff7cafcf6688ff07b15d070c42c8c16b0f945ea03653a0d286f2f59fdef529db38e7c33b65aae4b287ce71b', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + { + foo: { + signature: + 'fd5bad778bd70ece43616c0531b13a70bf9b0a853d38aa7b92560a0070e59e7b619979bc79b1ac2dc6886b44a2bdb402e5804a00d010f415d8cf5c6673540d131c', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + bar: { + signature: + 'ac4e1b37a969af3a03331dabb9418d137cec9e8b366ff7cafcf6688ff07b15d070c42c8c16b0f945ea03653a0d286f2f59fdef529db38e7c33b65aae4b287ce71b', + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }, + ]; + + const expectedClaims = { + foo: { + signatures: [ + { + r: '0x36ffccaec30f52730dcc6fa411383dd23233be55da5bce7e9e0161dc88cfd054', + s: '0x1a7f18f9dbb37677f660bc812ff6d29c1c3f92cb7245c0e20f97787ff3324ad3', + v: 28, + }, + { + r: '0xfd5bad778bd70ece43616c0531b13a70bf9b0a853d38aa7b92560a0070e59e7b', + s: '0x619979bc79b1ac2dc6886b44a2bdb402e5804a00d010f415d8cf5c6673540d13', + v: 28, + }, + ], + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + bar: { + signatures: [ + { + r: '0xac4e1b37a969af3a03331dabb9418d137cec9e8b366ff7cafcf6688ff07b15d0', + s: '0x70c42c8c16b0f945ea03653a0d286f2f59fdef529db38e7c33b65aae4b287ce7', + v: 27, + }, + { + r: '0xac4e1b37a969af3a03331dabb9418d137cec9e8b366ff7cafcf6688ff07b15d0', + s: '0x70c42c8c16b0f945ea03653a0d286f2f59fdef529db38e7c33b65aae4b287ce7', + v: 27, + }, + ], + derivedKeyId: + '22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0', + }, + }; + + const result = getClaims(claims); + + expect(result).toEqual(expectedClaims); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-claims.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-claims.ts new file mode 100644 index 0000000000..8bc984efe4 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-claims.ts @@ -0,0 +1,41 @@ +import { Signature } from '@lit-protocol/types'; +import { ethers } from 'ethers'; + +/** + * Retrieves the claims from an array of objects and organizes them into a record. + * Each claim is associated with its corresponding signatures and derived key ID. + * + * @param claims - An array of objects representing the claims. + * @returns A record where each key represents a claim, and the value is an object containing the claim's signatures and derived key ID. + */ +export const getClaims = ( + claims: any[] +): Record => { + const keys: string[] = Object.keys(claims[0]); + const signatures: Record = {}; + const claimRes: Record< + string, + { signatures: Signature[]; derivedKeyId: string } + > = {}; + for (let i = 0; i < keys.length; i++) { + const claimSet: { signature: string; derivedKeyId: string }[] = claims.map( + (c) => c[keys[i]] + ); + signatures[keys[i]] = []; + claimSet.map((c) => { + const sig = ethers.utils.splitSignature(`0x${c.signature}`); + const convertedSig = { + r: sig.r, + s: sig.s, + v: sig.v, + }; + signatures[keys[i]].push(convertedSig); + }); + + claimRes[keys[i]] = { + signatures: signatures[keys[i]], + derivedKeyId: claimSet[0].derivedKeyId, + }; + } + return claimRes; +}; diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts new file mode 100644 index 0000000000..cdd9e82636 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts @@ -0,0 +1,86 @@ +import { initWasmEcdsaSdk } from '@lit-protocol/ecdsa-sdk'; + +import { getSignatures } from './get-signatures'; + +describe('getSignatures', () => { + beforeAll(async () => { + await initWasmEcdsaSdk(); + }); + + it('should return signatures object', () => { + const networkPubKeySet = 'testing'; + const minNodeCount = 1; + const signedData = [ + { + sig: { + sigType: 'K256', + dataSigned: 'fail', + signatureShare: '', + shareIndex: 0, + bigR: '', + publicKey: '', + sigName: 'sig', + }, + }, + { + sig: { + sigType: 'K256', + dataSigned: + '7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', + signatureShare: + '1301BE04CF3A269709C2BDC29F7EFD1FBB3FC037C00AD2B5BDA8726B74CB5AF4', + shareIndex: 0, + bigR: '0290947D801A421D4A347FFFD386703C97BEF8E8AC83C3AB256ACE09255C37C521', + publicKey: + '04423427A87DEE9420BAC5C38355FE4A8C30EA796D87950C0143B49422D88C8FC70C381CB45300D8AD8A95139FFEEA5F265EFE00B65481BBB97B311C6833B69AE3', + sigName: 'sig', + }, + }, + { + sig: { + sigType: 'K256', + dataSigned: + '7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', + signatureShare: + 'F649B4CEAEE015877161AC8F062270200F65EC166C9BD7BF6F877EBB345F2F8F', + shareIndex: 0, + bigR: '0290947D801A421D4A347FFFD386703C97BEF8E8AC83C3AB256ACE09255C37C521', + publicKey: + '04423427A87DEE9420BAC5C38355FE4A8C30EA796D87950C0143B49422D88C8FC70C381CB45300D8AD8A95139FFEEA5F265EFE00B65481BBB97B311C6833B69AE3', + sigName: 'sig', + }, + }, + ]; + const requestId = ''; + + const signatures = getSignatures({ + networkPubKeySet, + minNodeCount, + signedData, + requestId, + }); + + expect(signatures.sig).toHaveProperty('dataSigned'); + expect(signatures.sig).toHaveProperty('publicKey'); + expect(signatures.sig).toHaveProperty('r'); + expect(signatures.sig).toHaveProperty('recid'); + expect(signatures.sig).toHaveProperty('s'); + expect(signatures.sig).toHaveProperty('signature'); + expect(signatures.sig.dataSigned).toBe( + '7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4' + ); + expect(signatures.sig.publicKey).toBe( + '04423427A87DEE9420BAC5C38355FE4A8C30EA796D87950C0143B49422D88C8FC70C381CB45300D8AD8A95139FFEEA5F265EFE00B65481BBB97B311C6833B69AE3' + ); + expect(signatures.sig.r).toBe( + '90947d801a421d4a347fffd386703c97bef8e8ac83c3ab256ace09255c37c521' + ); + expect(signatures.sig.recid).toBe(0); + expect(signatures.sig.s).toBe( + '094b72d37e1a3c1e7b246a51a5a16d410ff6cf677d5e0a396d5d9299d8f44942' + ); + expect(signatures.sig.signature).toBe( + '0x90947d801a421d4a347fffd386703c97bef8e8ac83c3ab256ace09255c37c521094b72d37e1a3c1e7b246a51a5a16d410ff6cf677d5e0a396d5d9299d8f449421b' + ); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts new file mode 100644 index 0000000000..9a5b1e5bd5 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts @@ -0,0 +1,251 @@ +import { LIT_CURVE, LIT_ERROR } from '@lit-protocol/constants'; +import { combineEcdsaShares } from '@lit-protocol/crypto'; +import { + logErrorWithRequestId, + logWithRequestId, + mostCommonString, + throwError, +} from '@lit-protocol/misc'; +import { SigResponse, SigShare } from '@lit-protocol/types'; +import { joinSignature } from 'ethers/lib/utils'; + +export const getFlattenShare = (share: any): SigShare => { + // flatten the signature object so that the properties of the signature are top level + const flattenObj = Object.entries(share).map(([key, item]) => { + if (item === null || item === undefined) { + return null; + } + + const typedItem = item as SigShare; + + const requiredShareProps = [ + 'sigType', + 'dataSigned', + 'signatureShare', + 'shareIndex', + 'bigR', + 'publicKey', + ]; + + const requiredSessionSigsShareProps = [ + ...requiredShareProps, + 'siweMessage', + ] as const; + + const requiredSignatureShareProps = [ + ...requiredShareProps, + 'sigName', + ] as const; + + const hasProps = (props: any) => { + return [...props].every( + (prop) => + typedItem[prop as keyof SigShare] !== undefined && + typedItem[prop as keyof SigShare] !== null + ); + }; + + if ( + hasProps(requiredSessionSigsShareProps) || + hasProps(requiredSignatureShareProps) + ) { + const bigR = typedItem.bigR ?? typedItem.bigr; + + typedItem.signatureShare = (typedItem.signatureShare ?? '').replaceAll( + '"', + '' + ); + typedItem.bigR = (bigR ?? '').replaceAll('"', ''); + typedItem.publicKey = (typedItem.publicKey ?? '').replaceAll('"', ''); + typedItem.dataSigned = (typedItem.dataSigned ?? '').replaceAll('"', ''); + + return typedItem; + } + + return null; + }); + + // removed all null values and should only have one item + const flattenShare = flattenObj.filter( + (item) => item !== null + )[0] as SigShare; + + if (flattenShare === null || flattenShare === undefined) { + return share; + } + return flattenShare; +}; + +/** + * + * Get signatures from signed data + * + * @param { Array } signedData + * + * @returns { any } + * + */ +export const getSignatures = ({ + networkPubKeySet, + minNodeCount, + signedData, + requestId = '', +}: { + networkPubKeySet: any; + minNodeCount: number; + signedData: any[]; + requestId: string; +}): { sig: SigResponse } => { + const initialKeys = [...new Set(signedData.flatMap((i) => Object.keys(i)))]; + + // processing signature shares for failed or invalid contents. mutates the signedData object. + for (const signatureResponse of signedData) { + for (const sigName of Object.keys(signatureResponse)) { + const requiredFields = ['signatureShare']; + + for (const field of requiredFields) { + if (!signatureResponse[sigName][field]) { + logWithRequestId( + requestId, + `invalid field ${field} in signature share: ${sigName}, continuing with share processing` + ); + // destructive operation on the object to remove invalid shares inline, without a new collection. + delete signatureResponse[sigName]; + } else { + let share = getFlattenShare(signatureResponse[sigName]); + + share = { + sigType: share.sigType, + signatureShare: share.signatureShare, + shareIndex: share.shareIndex, + bigR: share.bigR, + publicKey: share.publicKey, + dataSigned: share.dataSigned, + sigName: share.sigName ? share.sigName : 'sig', + }; + signatureResponse[sigName] = share; + } + } + } + } + + const validatedSignedData = signedData; + + // -- prepare + const signatures: any = {}; + + // get all signature shares names from all node responses. + // use a set to filter duplicates and copy into an array + const allKeys = [ + ...new Set(validatedSignedData.flatMap((i) => Object.keys(i))), + ]; + + if (allKeys.length !== initialKeys.length) { + throwError({ + message: 'total number of valid signatures does not match requested', + errorKind: LIT_ERROR.NO_VALID_SHARES.kind, + errorCode: LIT_ERROR.NO_VALID_SHARES.code, + }); + } + + // -- combine + for (var i = 0; i < allKeys.length; i++) { + // here we use a map filter implementation to find common shares in each node response. + // we then filter out undefined object from the key access. + // currently we are unable to know the total signature count requested by the user. + // but this allows for incomplete sets of signature shares to be aggregated + // and then checked against threshold + const shares = validatedSignedData + .map((r: any) => r[allKeys[i]]) + .filter((r: any) => r !== undefined); + + shares.sort((a: any, b: any) => a.shareIndex - b.shareIndex); + + const sigName = shares[0].sigName; + logWithRequestId( + requestId, + `starting signature combine for sig name: ${sigName}`, + shares + ); + logWithRequestId( + requestId, + `number of shares for ${sigName}:`, + signedData.length + ); + logWithRequestId( + requestId, + `validated length for signature: ${sigName}`, + shares.length + ); + logWithRequestId( + requestId, + 'minimum required shares for threshold:', + minNodeCount + ); + + if (shares.length < minNodeCount) { + logErrorWithRequestId( + requestId, + `not enough nodes to get the signatures. Expected ${minNodeCount}, got ${shares.length}` + ); + + throwError({ + message: `The total number of valid signatures shares ${shares.length} does not meet the threshold of ${minNodeCount}`, + errorKind: LIT_ERROR.NO_VALID_SHARES.kind, + errorCode: LIT_ERROR.NO_VALID_SHARES.code, + requestId, + }); + } + + const sigType = mostCommonString(shares.map((s: any) => s.sigType)); + + // -- validate if this.networkPubKeySet is null + if (networkPubKeySet === null) { + return throwError({ + message: 'networkPubKeySet cannot be null', + errorKind: LIT_ERROR.PARAM_NULL_ERROR.kind, + errorCode: LIT_ERROR.PARAM_NULL_ERROR.name, + }); + } + + // -- validate if signature type is ECDSA + if ( + sigType !== LIT_CURVE.EcdsaCaitSith && + sigType !== LIT_CURVE.EcdsaK256 && + sigType !== LIT_CURVE.EcdsaCAITSITHP256 + ) { + return throwError({ + message: `signature type is ${sigType} which is invalid`, + errorKind: LIT_ERROR.UNKNOWN_SIGNATURE_TYPE.kind, + errorCode: LIT_ERROR.UNKNOWN_SIGNATURE_TYPE.name, + }); + } + + const signature = combineEcdsaShares(shares); + + console.log('signature:', signature); + + if (!signature.r) { + throwError({ + message: 'siganture could not be combined', + errorKind: LIT_ERROR.UNKNOWN_SIGNATURE_ERROR.kind, + errorCode: LIT_ERROR.UNKNOWN_SIGNATURE_ERROR.name, + }); + } + + const encodedSig = joinSignature({ + r: '0x' + signature.r, + s: '0x' + signature.s, + v: signature.recid, + }); + + signatures[allKeys[i]] = { + ...signature, + signature: encodedSig, + publicKey: mostCommonString(shares.map((s: any) => s.publicKey)), + dataSigned: mostCommonString(shares.map((s: any) => s.dataSigned)), + }; + } + + return signatures; +}; diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.test.ts new file mode 100644 index 0000000000..3c1c6be524 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.test.ts @@ -0,0 +1,100 @@ +import { ethers } from 'ethers'; +import { normalizeJsParams } from './normalize-params'; + +describe('normalizeJsParams', () => { + it('should convert ArrayBuffer to array', () => { + const jsParams = { + key1: new Uint8Array([1, 2, 3]).buffer, + key2: new Uint8Array([4, 5, 6]).buffer, + }; + + const normalizedParams = normalizeJsParams(jsParams); + + expect(normalizedParams.key1).toEqual([1, 2, 3]); + expect(normalizedParams.key2).toEqual([4, 5, 6]); + }); + + it('should not modify non-ArrayBuffer values', () => { + const jsParams = { + key1: [1, 2, 3], + key2: 'test', + key3: { prop: 'value' }, + }; + + const normalizedParams = normalizeJsParams(jsParams); + + expect(normalizedParams.key1).toEqual([1, 2, 3]); + expect(normalizedParams.key2).toEqual('test'); + expect(normalizedParams.key3).toEqual({ prop: 'value' }); + }); + + it('should handle empty object', () => { + const jsParams = {}; + + const normalizedParams = normalizeJsParams(jsParams); + + expect(normalizedParams).toEqual({}); + }); + + it('should handle real world example of jsParams', () => { + const jsParams = { + dataToSign: ethers.utils.arrayify( + ethers.utils.keccak256([1, 2, 3, 4, 5]) + ), + publicKey: + '04940acdc50052416b0458623a99a12cc5717959222bfa5dc0553702b91efcaf7527889af26cfad48ac6c96417a2f06412d22e06a98d856202809743b614403dd5', + }; + + const normalizedParams = normalizeJsParams(jsParams); + expect(normalizedParams.dataToSign).toEqual([ + 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, 26, + 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, 244, + ]); + }); + + it('should handle multiple types', () => { + const jsParams = { + foo: 'bar', + num: 123, + arr: [1, 2, 3], + obj: { + nested: 'value', + }, + uint8Arr: new Uint8Array([1, 2, 3]), + }; + + const normalizedParams = normalizeJsParams(jsParams); + + expect(normalizedParams).toEqual({ + foo: 'bar', + num: 123, + arr: [1, 2, 3], + obj: { + nested: 'value', + }, + uint8Arr: [1, 2, 3], + }); + }); + + it('should recursively convert nested objects', () => { + const jsParams = { + foo: 'bar', + obj: { + nested: { + deep: 'value', + }, + }, + }; + + const normalizedParams = normalizeJsParams(jsParams); + + expect(normalizedParams).toEqual({ + foo: 'bar', + obj: { + nested: { + deep: 'value', + }, + }, + }); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.ts b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.ts new file mode 100644 index 0000000000..753b77116b --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-params.ts @@ -0,0 +1,24 @@ +/** + * Normalize the `jsParams`, convert types before sending to Lit Actions as jsParams, some JS types don't serialize well, so we will convert them before sending to the nodes + * + * It converts both + * + * @param {any} jsParams - The jsParams you are sending to Lit Action + * + * * @returns { object } The jsParams object, but with any incompatible types automatically converted + */ +export const normalizeJsParams = (jsParams: any) => { + for (const key of Object.keys(jsParams)) { + const value = jsParams[key]; + if (ArrayBuffer.isView(value)) { + // Correctly converting ArrayBuffer view to a standard array + jsParams[key] = Array.from( + new Uint8Array(value.buffer, value.byteOffset, value.byteLength) + ); + } else if (value instanceof ArrayBuffer) { + // Correctly converting plain ArrayBuffer to a standard array + jsParams[key] = Array.from(new Uint8Array(value)); + } + } + return jsParams; +}; diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.test.ts new file mode 100644 index 0000000000..9311a6a9e3 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.test.ts @@ -0,0 +1,21 @@ +import { parseAsJsonOrString } from './parse-as-json-or-string'; + +describe('parseAsJsonOrString', () => { + it('should parse a valid JSON response', () => { + const responseString = '{"message": "Hello, World!"}'; + const expectedResponse = { message: 'Hello, World!' }; + + const result = parseAsJsonOrString(responseString); + + expect(result).toEqual(expectedResponse); + }); + + it('should return the response as string if parsing fails', () => { + const responseString = 'abcdefg'; + const expectedResponse = 'abcdefg'; + + const result = parseAsJsonOrString(responseString); + + expect(result).toEqual(expectedResponse); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.ts b/packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.ts new file mode 100644 index 0000000000..c980d2fea7 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/parse-as-json-or-string.ts @@ -0,0 +1,21 @@ +import { log } from '@lit-protocol/misc'; + +/** + * Parses a response string into a JS object. + * + * @param responseString - The response string to parse. + * @returns The parsed response object. + */ +export const parseAsJsonOrString = ( + responseString: string +): object | string => { + try { + return JSON.parse(responseString); + } catch (e) { + log( + '[parseResponses] Error parsing response as json. Swallowing and returning as string.', + responseString + ); + return responseString; + } +}; diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.test.ts new file mode 100644 index 0000000000..9bb118bd35 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.test.ts @@ -0,0 +1,51 @@ +import { removeDoubleQuotes } from './remove-double-quotes'; + +describe('removeDoubleQuotes', () => { + it('should remove double quotes from string values in the object', () => { + const obj = { + key1: { + subkey1: '"value1"', + subkey2: '"value2"', + }, + key2: { + subkey3: 'value3"', + }, + key3: { + subkey3: '"""""value3"""""', + }, + }; + + const expectedObj = { + key1: { + subkey1: 'value1', + subkey2: 'value2', + }, + key2: { + subkey3: 'value3', + }, + key3: { + subkey3: 'value3', + }, + }; + + const result = removeDoubleQuotes(obj); + + expect(result).toEqual(expectedObj); + }); + + it('should not modify the object if there are no string values with double quotes', () => { + const obj = { + key1: { + subkey1: 'value1', + subkey2: 'value2', + }, + key2: { + subkey3: 'value3', + }, + }; + + const result = removeDoubleQuotes(obj); + + expect(result).toEqual(obj); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.ts b/packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.ts new file mode 100644 index 0000000000..11109e8ca1 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/remove-double-quotes.ts @@ -0,0 +1,20 @@ +/** + * Sanitise strings in an object by removing double quotes. + * - remove quotes from the signed data eg '"walup"' => 'walup' + * @param obj The object to sanitize + * + * @returns The sanitized object + */ +export const removeDoubleQuotes = (obj: any) => { + for (const key of Object.keys(obj)) { + const value = (obj as any)[key]; + + for (const subkey of Object.keys(value)) { + if (typeof value[subkey] === 'string') { + value[subkey] = value[subkey].replaceAll('"', ''); + } + } + } + + return obj; +}; diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index 71c4cf444b..9dee40f4da 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -15,7 +15,6 @@ import { createSiweMessageWithCapacityDelegation, createSiweMessageWithRecaps, createSiweMessage, - LitRLIResource, } from '@lit-protocol/auth-helpers'; import { AUTH_METHOD_TYPE_IDS, @@ -28,11 +27,9 @@ import { LOCAL_STORAGE_KEYS, LitNetwork, LIT_CURVE, - SIWE_DELEGATION_URI, } from '@lit-protocol/constants'; import { LitCore, composeLitUrl } from '@lit-protocol/core'; import { - checkSevSnpAttestation, combineEcdsaShares, combineSignatureShares, encrypt, @@ -41,9 +38,9 @@ import { } from '@lit-protocol/crypto'; import { safeParams } from '@lit-protocol/encryption'; import { - convertLitActionsParams, defaultMintClaimCallback, executeWithRetry, + findMostCommonResponse, hexPrefixed, log, logError, @@ -77,7 +74,6 @@ import type { DecryptResponse, EncryptRequest, EncryptResponse, - ExecuteJsProps, ExecuteJsResponse, FormattedMultipleAccs, GetSessionSigsProps, @@ -86,14 +82,12 @@ import type { GetSigningShareForDecryptionRequest, GetWalletSigProps, JsonExecutionRequest, - JsonHandshakeResponse, JsonPkpSignRequest, LitClientSessionManager, LitNodeClientConfig, NodeBlsSigningShare, NodeCommandResponse, NodeLog, - NodeResponse, NodeShare, PKPSignShare, RejectedNodePromises, @@ -114,14 +108,25 @@ import type { GetPkpSessionSigs, CapacityCreditsReq, CapacityCreditsRes, - JsExecutionRequestBody, JsonSignSessionKeyRequestV1, BlsResponseData, SessionKeyCache, JsonPkpSignSdkParams, + JsonExecutionSdkParams, + ExecuteJsNoSigningResponse, + JsonExecutionSdkParamsTargetNode, + JsonExecutionRequestTargetNode, + SigResponse, } from '@lit-protocol/types'; import * as blsSdk from '@lit-protocol/bls-sdk'; import { normalizeArray } from './helpers/normalize-array'; +import { normalizeJsParams } from './helpers/normalize-params'; +import { encodeCode } from './helpers/encode-code'; +import { removeDoubleQuotes } from './helpers/remove-double-quotes'; +import { parseAsJsonOrString } from './helpers/parse-as-json-or-string'; +import { getFlattenShare, getSignatures } from './helpers/get-signatures'; +import { getClaimsList } from './helpers/get-claims-list'; +import { getClaims } from './helpers/get-claims'; const TEMP_CACHE_PERIOD = 30000; // 30 seconds @@ -143,38 +148,6 @@ export class LitNodeClientNodeJs } } - // ========== STATIC METHODS ========== - static getClaims = ( - claims: any[] - ): Record => { - const keys: string[] = Object.keys(claims[0]); - const signatures: Record = {}; - const claimRes: Record< - string, - { signatures: Signature[]; derivedKeyId: string } - > = {}; - for (let i = 0; i < keys.length; i++) { - const claimSet: { signature: string; derivedKeyId: string }[] = - claims.map((c) => c[keys[i]]); - signatures[keys[i]] = []; - claimSet.map((c) => { - const sig = ethers.utils.splitSignature(`0x${c.signature}`); - const convertedSig = { - r: sig.r, - s: sig.s, - v: sig.v, - }; - signatures[keys[i]].push(convertedSig); - }); - - claimRes[keys[i]] = { - signatures: signatures[keys[i]], - derivedKeyId: claimSet[0].derivedKeyId, - }; - } - return claimRes; - }; - // ========== Rate Limit NFT ========== // TODO: Add support for browser feature/lit-2321-js-sdk-add-browser-support-for-createCapacityDelegationAuthSig @@ -236,43 +209,6 @@ export class LitNodeClientNodeJs // ========== Scoped Class Helpers ========== - /** - * - * Get the request body of the lit action - * - * @param { ExecuteJsProps } params - * - * @returns { JsonExecutionRequest } - * - */ - getLitActionRequestBody = (params: ExecuteJsProps): JsonExecutionRequest => { - const reqBody: JsonExecutionRequest = { - ...(params.authSig && { authSig: params.authSig }), - ...(params.sessionSigs && { sessionSigs: params.sessionSigs }), - ...(params.authMethods && { authMethods: params.authMethods }), - jsParams: convertLitActionsParams(params.jsParams), - // singleNode: params.singleNode ?? false, - targetNodeRange: params.targetNodeRange ?? 0, - }; - - if (params.code) { - const _uint8Array = uint8arrayFromString(params.code, 'utf8'); - const encodedJs = uint8arrayToString(_uint8Array, 'base64'); - - reqBody.code = encodedJs; - } - - if (params.ipfsId) { - reqBody.ipfsId = params.ipfsId; - } - - if (params.authMethods && params.authMethods.length > 0) { - reqBody.authMethods = params.authMethods; - } - - return reqBody; - }; - /** * * we need to send jwt params iat (issued at) and exp (expiration) because the nodes may have different wall clock times, the nodes will verify that these params are withing a grace period @@ -286,30 +222,6 @@ export class LitNodeClientNodeJs return { iat, exp }; }; - /** - * - * Parse the response string to JSON - * - * @param { string } responseString - * - * @returns { any } JSON object - * - */ - parseResponses = (responseString: string): any => { - let response: any; - - try { - response = JSON.parse(responseString); - } catch (e) { - log( - 'Error parsing response as json. Swallowing and returning as string.', - responseString - ); - } - - return response; - }; - // ==================== SESSIONS ==================== /** * Try to get the session key in the local storage, @@ -677,74 +589,6 @@ export class LitNodeClientNodeJs }; // ==================== API Calls to Nodes ==================== - /** - * - * Get JS Execution Shares from Nodes - * - * @param { JsonExecutionRequest } params - * - * @returns { Promise } - */ - getJsExecutionShares = async ( - url: string, - params: JsonExecutionRequest, - requestId: string - ): Promise => { - const { code, ipfsId, authSig, jsParams, authMethods } = params; - - logWithRequestId(requestId, 'getJsExecutionShares'); - - // -- execute - const urlWithPath = composeLitUrl({ - url, - endpoint: LIT_ENDPOINT.EXECUTE_JS, - }); - - if (!authSig) { - throw new Error('authSig or sessionSig is required'); - } - const data: JsExecutionRequestBody = { - ...(authSig ? { authSig } : {}), - ...(code ? { code } : {}), - ...(ipfsId ? { ipfsId } : {}), - ...(authMethods ? { authMethods } : {}), - ...(jsParams ? { jsParams } : {}), - }; - - const res = await this.sendCommandToNode({ - url: urlWithPath, - data, - requestId, - }); - logWithRequestId( - requestId, - `response node with url: ${url} from endpoint ${urlWithPath}`, - res - ); - return res; - }; - - getPkpSignExecutionShares = async ( - url: string, - params: any, - requestId: string - ) => { - logWithRequestId(requestId, 'getPkpSigningShares'); - const urlWithPath = composeLitUrl({ - url, - endpoint: LIT_ENDPOINT.PKP_SIGN, - }); - if (!params.authSig) { - throw new Error('authSig is required'); - } - - return await this.sendCommandToNode({ - url: urlWithPath, - data: params, - requestId, - }); - }; - getClaimKeyExecutionShares = async ( url: string, params: any, @@ -946,27 +790,33 @@ export class LitNodeClientNodeJs // ========== Promise Handlers ========== getIpfsId = async ({ dataToHash, - authSig, - debug = false, + sessionSigs, }: { dataToHash: string; - authSig: AuthSig; + sessionSigs: SessionSigsMap; debug?: boolean; }) => { - const laRes = await this.executeJs({ - authSig, + const res = await this.executeJs({ ipfsId: LIT_ACTION_IPFS_HASH, + sessionSigs, authMethods: [], jsParams: { dataToHash, }, - debug, }).catch((e) => { logError('Error getting IPFS ID', e); throw e; }); - const data = JSON.parse(laRes.response).res; + let data; + + if (typeof res.response === 'string') { + try { + data = JSON.parse(res.response).res; + } catch (e) { + data = res.response; + } + } if (!data.success) { logError('Error getting IPFS ID', data.data); @@ -987,23 +837,13 @@ export class LitNodeClientNodeJs * */ runOnTargetedNodes = async ( - params: ExecuteJsProps + params: JsonExecutionSdkParamsTargetNode ): Promise< SuccessNodePromises | RejectedNodePromises > => { - const { - code, - authMethods, - authSig, - jsParams, - debug, - sessionSigs, - targetNodeRange, - } = params; - - log('running runOnTargetedNodes:', targetNodeRange); + log('running runOnTargetedNodes:', params.targetNodeRange); - if (!targetNodeRange) { + if (!params.targetNodeRange) { return throwError({ message: 'targetNodeRange is required', errorKind: LIT_ERROR.INVALID_PARAM_TYPE.kind, @@ -1013,9 +853,8 @@ export class LitNodeClientNodeJs // determine which node to run on const ipfsId = await this.getIpfsId({ - dataToHash: code!, - authSig: authSig!, - debug, + dataToHash: params.code!, + sessionSigs: params.sessionSigs, }); // select targetNodeRange number of random index of the bootstrapUrls.length @@ -1023,7 +862,7 @@ export class LitNodeClientNodeJs let nodeCounter = 0; - while (randomSelectedNodeIndexes.length < targetNodeRange) { + while (randomSelectedNodeIndexes.length < params.targetNodeRange) { const str = `${nodeCounter}:${ipfsId.toString()}`; const cidBuffer = Buffer.from(str); const hash = sha256(cidBuffer); @@ -1066,19 +905,25 @@ export class LitNodeClientNodeJs log(`running on node ${nodeIndex} at ${url}`); - const reqBody: JsonExecutionRequest = - this.getLitActionRequestBody(params); - // -- choose the right signature - const sigToPassToNode = this.getSessionSigByUrl({ - sessionSigs, + const sessionSig = this.getSessionSigByUrl({ + sessionSigs: params.sessionSigs, url, }); - reqBody.authSig = sigToPassToNode; + const reqBody: JsonExecutionRequestTargetNode = { + ...params, + targetNodeRange: params.targetNodeRange, + authSig: sessionSig, + }; // this return { url: string, data: JsonRequest } - const singleNodePromise = this.getJsExecutionShares(url, reqBody, id); + // const singleNodePromise = this.getJsExecutionShares(url, reqBody, id); + const singleNodePromise = this.sendCommandToNode({ + url: url, + data: params, + requestId: id, + }); nodePromises.push(singleNodePromise); } @@ -1086,7 +931,7 @@ export class LitNodeClientNodeJs const handledPromise = (await this.handleNodePromises( nodePromises, id, - targetNodeRange + params.targetNodeRange )) as SuccessNodePromises | RejectedNodePromises; // -- handle response @@ -1104,71 +949,6 @@ export class LitNodeClientNodeJs ); }; - // ========== Shares Resolvers ========== - _getFlattenShare = (share: any): SigShare => { - // flatten the signature object so that the properties of the signature are top level - const flattenObj = Object.entries(share).map(([key, item]) => { - if (item === null || item === undefined) { - return null; - } - - const typedItem = item as SigShare; - - const requiredShareProps = [ - 'sigType', - 'dataSigned', - 'signatureShare', - 'shareIndex', - 'bigR', - 'publicKey', - ]; - - const requiredSessionSigsShareProps = [ - ...requiredShareProps, - 'siweMessage', - ] as const; - - const requiredSignatureShareProps = [ - ...requiredShareProps, - 'sigName', - ] as const; - - const hasProps = (props: any) => { - return [...props].every( - (prop) => - typedItem[prop as keyof SigShare] !== undefined && - typedItem[prop as keyof SigShare] !== null - ); - }; - - if ( - hasProps(requiredSessionSigsShareProps) || - hasProps(requiredSignatureShareProps) - ) { - const bigR = typedItem.bigR ?? typedItem.bigr; - - typedItem.signatureShare = typedItem.signatureShare.replaceAll('"', ''); - typedItem.bigR = bigR?.replaceAll('"', ''); - typedItem.publicKey = typedItem.publicKey.replaceAll('"', ''); - typedItem.dataSigned = typedItem.dataSigned.replaceAll('"', ''); - - return typedItem; - } - - return null; - }); - - // removed all null values and should only have one item - const flattenShare = flattenObj.filter( - (item) => item !== null - )[0] as SigShare; - - if (flattenShare === null || flattenShare === undefined) { - return share; - } - return flattenShare; - }; - /** * * Get signatures from signed data @@ -1211,7 +991,7 @@ export class LitNodeClientNodeJs const sigShares: SigShare[] = shares.map((s: any, index: number) => { log('Original Share Struct:', s); - const share = this._getFlattenShare(s); + const share = getFlattenShare(s); log('share:', share); @@ -1297,169 +1077,6 @@ export class LitNodeClientNodeJs return signatures; }; - /** - * - * Get signatures from signed data - * - * @param { Array } signedData - * - * @returns { any } - * - */ - getSignatures = (signedData: any[], requestId: string = ''): any => { - const initialKeys = [...new Set(signedData.flatMap((i) => Object.keys(i)))]; - - // processing signature shares for failed or invalid contents. mutates the signedData object. - for (const signatureResponse of signedData) { - for (const sigName of Object.keys(signatureResponse)) { - const requiredFields = ['signatureShare']; - - for (const field of requiredFields) { - if (!signatureResponse[sigName][field]) { - logWithRequestId( - requestId, - `invalid field ${field} in signature share: ${sigName}, continuing with share processing` - ); - // destructive operation on the object to remove invalid shares inline, without a new collection. - delete signatureResponse[sigName]; - } else { - let share = this._getFlattenShare(signatureResponse[sigName]); - - share = { - sigType: share.sigType, - signatureShare: share.signatureShare, - shareIndex: share.shareIndex, - bigR: share.bigR, - publicKey: share.publicKey, - dataSigned: share.dataSigned, - sigName: share.sigName ? share.sigName : 'sig', - }; - signatureResponse[sigName] = share; - } - } - } - } - - const validatedSignedData = signedData; - - // -- prepare - const signatures: any = {}; - - // get all signature shares names from all node responses. - // use a set to filter duplicates and copy into an array - const allKeys = [ - ...new Set(validatedSignedData.flatMap((i) => Object.keys(i))), - ]; - - if (allKeys.length !== initialKeys.length) { - throwError({ - message: 'total number of valid signatures does not match requested', - errorKind: LIT_ERROR.NO_VALID_SHARES.kind, - errorCode: LIT_ERROR.NO_VALID_SHARES.code, - }); - } - - // -- combine - for (var i = 0; i < allKeys.length; i++) { - // here we use a map filter implementation to find common shares in each node response. - // we then filter out undefined object from the key access. - // currently we are unable to know the total signature count requested by the user. - // but this allows for incomplete sets of signature shares to be aggregated - // and then checked against threshold - const shares = validatedSignedData - .map((r: any) => r[allKeys[i]]) - .filter((r: any) => r !== undefined); - - shares.sort((a: any, b: any) => a.shareIndex - b.shareIndex); - - const sigName = shares[0].sigName; - logWithRequestId( - requestId, - `starting signature combine for sig name: ${sigName}`, - shares - ); - logWithRequestId( - requestId, - `number of shares for ${sigName}:`, - signedData.length - ); - logWithRequestId( - requestId, - `validated length for signature: ${sigName}`, - shares.length - ); - logWithRequestId( - requestId, - 'minimum required shares for threshold:', - this.config.minNodeCount - ); - - if (shares.length < this.config.minNodeCount) { - logErrorWithRequestId( - requestId, - `not enough nodes to get the signatures. Expected ${this.config.minNodeCount}, got ${shares.length}` - ); - - throwError({ - message: `The total number of valid signatures shares ${shares.length} does not meet the threshold of ${this.config.minNodeCount}`, - errorKind: LIT_ERROR.NO_VALID_SHARES.kind, - errorCode: LIT_ERROR.NO_VALID_SHARES.code, - requestId, - }); - } - - const sigType = mostCommonString(shares.map((s: any) => s.sigType)); - - // -- validate if this.networkPubKeySet is null - if (this.networkPubKeySet === null) { - throwError({ - message: 'networkPubKeySet cannot be null', - errorKind: LIT_ERROR.PARAM_NULL_ERROR.kind, - errorCode: LIT_ERROR.PARAM_NULL_ERROR.name, - }); - return; - } - - // -- validate if signature type is ECDSA - if ( - sigType !== LIT_CURVE.EcdsaCaitSith && - sigType !== LIT_CURVE.EcdsaK256 && - sigType !== LIT_CURVE.EcdsaCAITSITHP256 - ) { - throwError({ - message: `signature type is ${sigType} which is invalid`, - errorKind: LIT_ERROR.UNKNOWN_SIGNATURE_TYPE.kind, - errorCode: LIT_ERROR.UNKNOWN_SIGNATURE_TYPE.name, - }); - return; - } - - const signature = combineEcdsaShares(shares); - if (!signature.r) { - throwError({ - message: 'siganture could not be combined', - errorKind: LIT_ERROR.UNKNOWN_SIGNATURE_ERROR.kind, - errorCode: LIT_ERROR.UNKNOWN_SIGNATURE_ERROR.name, - }); - } - - const encodedSig = joinSignature({ - r: '0x' + signature.r, - s: '0x' + signature.s, - v: signature.recid, - }); - - signatures[allKeys[i]] = { - ...signature, - signature: encodedSig, - publicKey: mostCommonString(shares.map((s: any) => s.publicKey)), - dataSigned: mostCommonString(shares.map((s: any) => s.dataSigned)), - }; - } - - return signatures; - }; - /** * * Get a single signature @@ -1487,54 +1104,29 @@ export class LitNodeClientNodeJs // ========== Scoped Business Logics ========== // Normalize the data to a basic array - public static normalizeParams(params: ExecuteJsProps): ExecuteJsProps { - if (!params.jsParams) { - params.jsParams = {}; - return params; - } - for (const key of Object.keys(params.jsParams)) { - if ( - Array.isArray(params.jsParams[key]) || - ArrayBuffer.isView(params.jsParams[key]) - ) { - const arr = []; - for (let i = 0; i < params.jsParams[key].length; i++) { - arr.push((params.jsParams[key] as Buffer)[i]); - } - params.jsParams[key] = arr; - } - } - return params; - } + // TODO: executeJsWithTargettedNodes + // if (formattedParams.targetNodeRange) { + // // FIXME: we should make this a separate function + // res = await this.runOnTargetedNodes(formattedParams); + // } /** * * Execute JS on the nodes and combine and return any resulting signatures * - * @param { ExecuteJsRequest } params + * @param { JsonExecutionSdkParams } params * * @returns { ExecuteJsResponse } * */ - executeJs = async (params: ExecuteJsProps): Promise => { - // ========== Prepare Params ========== - const { - authMethods, - code, - ipfsId, - authSig, - jsParams, - debug, - sessionSigs, - targetNodeRange, - } = params; - + executeJs = async ( + params: JsonExecutionSdkParams + ): Promise => { // ========== Validate Params ========== - // -- validate: If it's NOT ready if (!this.ready) { const message = - '1 LitNodeClient is not ready. Please call await litNodeClient.connect() first.'; + '[executeJs] LitNodeClient is not ready. Please call await litNodeClient.connect() first.'; throwError({ message, @@ -1556,61 +1148,70 @@ export class LitNodeClientNodeJs }); } - // Call the normalizeParams function to normalize the parameters - params = LitNodeClientNodeJs.normalizeParams(params); + // Format the params + const formattedParams: JsonExecutionSdkParams = { + ...params, + jsParams: normalizeJsParams(params.jsParams), + ...(params.code && { code: encodeCode(params.code) }), + }; - let res; - let requestId = ''; - // -- only run on a single node - if (targetNodeRange) { - res = await this.runOnTargetedNodes(params); - } else { - // ========== Prepare Variables ========== - // -- prepare request body - const reqBody: JsonExecutionRequest = - this.getLitActionRequestBody(params); - - // ========== Get Node Promises ========== - - // -- fetch shares from nodes - const wrapper = async ( - requestId: string - ): Promise | RejectedNodePromises> => { - const nodePromises = this.getNodePromises((url: string) => { - // -- choose the right signature - const sigToPassToNode = this.getSessionSigByUrl({ - authSig, - sessionSigs, - url, - }); + // ========== Get Node Promises ========== + // Handle promises for commands sent to Lit nodes + const wrapper = async ( + requestId: string + ): Promise | RejectedNodePromises> => { + const nodePromises = this.getNodePromises(async (url: string) => { + // -- choose the right signature + const sessionSig = this.getSessionSigByUrl({ + sessionSigs: formattedParams.sessionSigs, + url, + }); - reqBody.authSig = sigToPassToNode; + const reqBody: JsonExecutionRequest = { + ...formattedParams, + authSig: sessionSig, + }; - const shares = this.getJsExecutionShares(url, reqBody, requestId); - return shares; + const composedUrl = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.EXECUTE_JS, }); - // -- resolve promises - res = await this.handleNodePromises( - nodePromises, + + const sharePromise = await this.sendCommandToNode({ + url: composedUrl, + data: reqBody, requestId, - this.connectedNodes.size - ); - return res; - }; - res = await executeWithRetry< - RejectedNodePromises | SuccessNodePromises - >( - wrapper, - (error: any, requestId: string, isFinal: boolean) => { - logError('an error occured, attempting to retry operation'); - }, - this.config.retryTolerance + }); + + return sharePromise; + }); + + // -- resolve promises + const res = await this.handleNodePromises( + nodePromises, + requestId, + this.connectedNodes.size ); - requestId = res.requestId; - } + return res; + }; // wrapper end + + // ========== Execute with Retry ========== + const res = await executeWithRetry< + RejectedNodePromises | SuccessNodePromises + >( + wrapper, + (error: any, requestId: string, isFinal: boolean) => { + logError('an error occured, attempting to retry operation'); + }, + this.config.retryTolerance + ); + + // ========== Handle Response ========== + const requestId = res.requestId; + // -- case: promises rejected - if (res.success === false) { + if (!res.success) { this._throwNodeError(res as RejectedNodePromises, requestId); } @@ -1623,47 +1224,37 @@ export class LitNodeClientNodeJs JSON.stringify(responseData, null, 2) ); - // -- in the case where we are not signing anything on Lit action and using it as purely serverless function - // we must also check for claim responses as a user may have submitted for a claim and signatures must be aggregated before returning - if ( - responseData[0].success && - Object.keys(responseData[0].signedData).length <= 0 && - Object.keys(responseData[0].claimData).length <= 0 - ) { - return responseData[0] as any as ExecuteJsResponse; + // -- find the responseData that has the most common response + const mostCommonResponse = findMostCommonResponse( + responseData + ) as NodeShare; + + const IS_SUCCESS = mostCommonResponse.success; + const HAS_SIGNED_DATA = + Object.keys(mostCommonResponse.signedData).length > 0; + const HAS_CLAIM_DATA = Object.keys(mostCommonResponse.claimData).length > 0; + + // -- we must also check for claim responses as a user may have submitted for a claim and signatures must be aggregated before returning + if (IS_SUCCESS && !HAS_SIGNED_DATA && !HAS_CLAIM_DATA) { + return mostCommonResponse as unknown as ExecuteJsResponse; } // -- in the case where we are not signing anything on Lit action and using it as purely serverless function - if ( - Object.keys(responseData[0].signedData).length <= 0 && - Object.keys(responseData[0].claimData).length <= 0 - ) { + if (!HAS_SIGNED_DATA && !HAS_CLAIM_DATA) { return { claims: {}, signatures: null, decryptions: [], - response: responseData[0].response, - logs: responseData[0].logs, - }; + response: mostCommonResponse.response, + logs: mostCommonResponse.logs, + } as ExecuteJsNoSigningResponse; } // ========== Extract shares from response data ========== + // -- 1. combine signed data as a list, and get the signatures from it const signedDataList = responseData.map((r) => { - const { signedData } = r; - for (const key of Object.keys(signedData)) { - for (const subkey of Object.keys(signedData[key])) { - //@ts-ignore - if (typeof signedData[key][subkey] === 'string') { - //@ts-ignore - signedData[key][subkey] = signedData[key][subkey].replaceAll( - '"', - '' - ); - } - } - } - return signedData; + return removeDoubleQuotes(r.signedData); }); logWithRequestId( @@ -1671,14 +1262,16 @@ export class LitNodeClientNodeJs 'signatures shares to combine: ', signedDataList ); - const signatures = this.getSignatures(signedDataList, requestId); - // -- 2. combine responses as a string, and get parse it as JSON - let response: string = mostCommonString( - responseData.map((r: NodeResponse) => r.response) - ); + const signatures = getSignatures({ + requestId, + networkPubKeySet: this.networkPubKeySet, + minNodeCount: this.config.minNodeCount, + signedData: signedDataList, + }); - response = this.parseResponses(response); + // -- 2. combine responses as a string, and parse it as JSON if possible + const parsedResponse = parseAsJsonOrString(mostCommonResponse.response); // -- 3. combine logs const mostCommonLogs: string = mostCommonString( @@ -1686,59 +1279,20 @@ export class LitNodeClientNodeJs ); // -- 4. combine claims - const claimsList = responseData - .map((r) => { - const { claimData } = r; - if (claimData) { - for (const key of Object.keys(claimData)) { - for (const subkey of Object.keys(claimData[key])) { - if (typeof claimData[key][subkey] == 'string') { - claimData[key][subkey] = claimData[key][subkey].replaceAll( - '"', - '' - ); - } - } - } - return claimData; - } - return null; - }) - .filter((item) => item !== null); - - // logWithRequestId(requestId, 'claimList:', claimsList); - - let claims = undefined; - - if (claimsList.length > 0) { - claims = LitNodeClientNodeJs.getClaims(claimsList); - } + const claimsList = getClaimsList(responseData); + const claims = claimsList.length > 0 ? getClaims(claimsList) : undefined; // ========== Result ========== const returnVal: ExecuteJsResponse = { claims, signatures, - decryptions: [], // FIXME: Fix if and when we enable decryptions from within a Lit Action. - response, + // decryptions: [], + response: parsedResponse, logs: mostCommonLogs, }; log('returnVal:', returnVal); - // -- case: debug mode - if (debug) { - const allNodeResponses = responseData.map( - (r: NodeResponse) => r.response - ); - const allNodeLogs = responseData.map((r: NodeLog) => r.logs); - - returnVal.debug = { - allNodeResponses, - allNodeLogs, - rawNodeHTTPResponses: responseData, - }; - } - return returnVal; }; @@ -1751,9 +1305,10 @@ export class LitNodeClientNodeJs * @param params.sessionSigs - The session signatures to use * @param params.authMethods - (optional) The auth methods to use */ - pkpSign = async (params: JsonPkpSignSdkParams) => { + pkpSign = async (params: JsonPkpSignSdkParams): Promise => { // -- validate required params const requiredParamKeys = ['toSign', 'pubKey']; + (requiredParamKeys as (keyof JsonPkpSignSdkParams)[]).forEach((key) => { if (!params[key]) { throwError({ @@ -1776,36 +1331,44 @@ export class LitNodeClientNodeJs }); } - // yes, 'key' is in lower case, because this is what the node expects - const pubkey = hexPrefixed(params.pubKey); - - const normalizedToSignArray = normalizeArray(params.toSign); - + // ========== Get Node Promises ========== + // Handle promises for commands sent to Lit nodes const wrapper = async ( id: string ): Promise | RejectedNodePromises> => { - const nodePromises = this.getNodePromises((url: string) => { + const nodePromises = this.getNodePromises(async (url: string) => { // -- get the session sig from the url key const sessionSig = this.getSessionSigByUrl({ sessionSigs: params.sessionSigs, url, }); - const hasAuthMethod = - params.authMethods && params.authMethods.length > 0; - const reqBody: JsonPkpSignRequest = { - toSign: normalizedToSignArray, - pubkey: pubkey, + toSign: normalizeArray(params.toSign), + pubkey: hexPrefixed(params.pubKey), authSig: sessionSig, - ...(hasAuthMethod && { - authMethods: params.authMethods, - }), + + // -- optional params + ...(params.authMethods && + params.authMethods.length > 0 && { + authMethods: params.authMethods, + }), }; logWithRequestId(id, 'reqBody:', reqBody); - return this.getPkpSignExecutionShares(url, reqBody, id); + const urlWithPath = composeLitUrl({ + url, + endpoint: LIT_ENDPOINT.PKP_SIGN, + }); + + const sharePromise = await this.sendCommandToNode({ + url: urlWithPath, + data: reqBody, + requestId, + }); + + return sharePromise; }); const res = await this.handleNodePromises( @@ -1814,7 +1377,9 @@ export class LitNodeClientNodeJs this.connectedNodes.size // ECDSA requires responses from all nodes, but only shares from minNodeCount. ); return res; - }; + }; // wrapper end + + // ========== Execute with Retry ========== const res = await executeWithRetry< RejectedNodePromises | SuccessNodePromises >( @@ -1826,6 +1391,8 @@ export class LitNodeClientNodeJs }, this.config.retryTolerance ); + + // ========== Handle Response ========== const requestId = res.requestId; // -- case: promises rejected @@ -1835,6 +1402,7 @@ export class LitNodeClientNodeJs // -- case: promises success (TODO: check the keys of "values") const responseData = (res as SuccessNodePromises).values; + logWithRequestId( requestId, 'responseData', @@ -1882,10 +1450,16 @@ export class LitNodeClientNodeJs }; }); - const signatures = this.getSignatures(signedDataList, requestId); + const signatures = getSignatures({ + requestId, + networkPubKeySet: this.networkPubKeySet, + minNodeCount: this.config.minNodeCount, + signedData: signedDataList, + }); + logWithRequestId(requestId, `signature combination`, signatures); - return signatures.signature; // only a single signature is ever present, so we just return it. + return signatures.sig; // only a single signature is ever present, so we just return it. }; /** diff --git a/packages/misc/src/lib/misc.spec.ts b/packages/misc/src/lib/misc.spec.ts index e3ca2c12b7..5f891f5e8b 100644 --- a/packages/misc/src/lib/misc.spec.ts +++ b/packages/misc/src/lib/misc.spec.ts @@ -239,3 +239,251 @@ describe('utils', () => { expect(res.requestId).toBeDefined(); }); }); +describe('find most common tings', () => { + it('should return the most common string in an array', () => { + const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 8]; + + const mostOccured = utilsModule.mostCommonString(arr); + + expect(mostOccured).toBe(8); + }); + + it('should return the last element of the array if every element only appears once', () => { + const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]; + + const mostOccured = utilsModule.mostCommonString(arr); + + expect(mostOccured).toBe(0); + }); + + it('should test real world example of responseData', () => { + const responseData = [ + { + success: true, + signedData: { + sig: { + sigType: 'ECDSA_CAIT_SITH', + dataSigned: 'fail', + signatureShare: '', + shareIndex: 0, + bigR: '', + publicKey: '', + sigName: 'sig', + }, + }, + decryptedData: {}, + claimData: {}, + response: '', + logs: '', + }, + { + success: true, + signedData: { + sig: { + sigType: 'ECDSA_CAIT_SITH', + dataSigned: 'fail', + signatureShare: '', + shareIndex: 0, + bigR: '', + publicKey: '', + sigName: 'sig', + }, + }, + decryptedData: {}, + claimData: {}, + response: '', + logs: '', + }, + { + success: true, + signedData: { + sig: { + sigType: 'ECDSA_CAIT_SITH', + dataSigned: 'fail', + signatureShare: '', + shareIndex: 0, + bigR: '', + publicKey: '', + sigName: 'sig', + }, + }, + decryptedData: {}, + claimData: {}, + response: '', + logs: '', + }, + { + success: true, + signedData: { + sig: { + sigType: 'ECDSA_CAIT_SITH', + dataSigned: + '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', + signatureShare: + '"A2022A52D6263F5AD61D1A4E29F2C2545FA6E711A30A35BF3456FD5297E4080A"', + shareIndex: 0, + bigR: '"035938946F745C3A6E8B8F0DF7849B0693AAB779695BA770F76906562F37DD005F"', + publicKey: + '"049C6E2DD71F553A29398FA0A93BBCB411EE442D97D253D9E82F41C8601B19BCD71F37F0A2A0A0F501593153C3FD2C9EC3A2BDFA8E43291B7B0E165A3E104BF0B2"', + sigName: 'sig', + }, + }, + decryptedData: {}, + claimData: {}, + response: '', + logs: '', + }, + { + success: true, + signedData: { + sig: { + sigType: 'ECDSA_CAIT_SITH', + dataSigned: + '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', + signatureShare: + '"35790072188D520CDAA61394BB822C4F9D95CC2FC21CBAF54EBB91FA8734F5FE"', + shareIndex: 0, + bigR: '"035938946F745C3A6E8B8F0DF7849B0693AAB779695BA770F76906562F37DD005F"', + publicKey: + '"049C6E2DD71F553A29398FA0A93BBCB411EE442D97D253D9E82F41C8601B19BCD71F37F0A2A0A0F501593153C3FD2C9EC3A2BDFA8E43291B7B0E165A3E104BF0B2"', + sigName: 'sig', + }, + }, + decryptedData: {}, + claimData: {}, + response: '', + logs: '', + }, + { + success: true, + signedData: { + sig: { + sigType: 'ECDSA_CAIT_SITH', + dataSigned: + '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', + signatureShare: + '"A1676E25812D6812BB24469943A15F68FAD4CC679E0376CE1EDD5E0D64236E7A"', + shareIndex: 0, + bigR: '"035938946F745C3A6E8B8F0DF7849B0693AAB779695BA770F76906562F37DD005F"', + publicKey: + '"049C6E2DD71F553A29398FA0A93BBCB411EE442D97D253D9E82F41C8601B19BCD71F37F0A2A0A0F501593153C3FD2C9EC3A2BDFA8E43291B7B0E165A3E104BF0B2"', + sigName: 'sig', + }, + }, + decryptedData: {}, + claimData: {}, + response: '', + logs: '', + }, + { + success: true, + signedData: { + sig: { + sigType: 'ECDSA_CAIT_SITH', + dataSigned: + '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', + signatureShare: + '"3E8184B2E3DC4725A711D4DBF8D32288A8AC4F31FD04B8ACB302B9BB3D209122"', + shareIndex: 0, + bigR: '"035938946F745C3A6E8B8F0DF7849B0693AAB779695BA770F76906562F37DD005F"', + publicKey: + '"049C6E2DD71F553A29398FA0A93BBCB411EE442D97D253D9E82F41C8601B19BCD71F37F0A2A0A0F501593153C3FD2C9EC3A2BDFA8E43291B7B0E165A3E104BF0B2"', + sigName: 'sig', + }, + }, + decryptedData: {}, + claimData: {}, + response: '', + logs: '', + }, + ]; + + const mostCommonResponse = utilsModule.findMostCommonResponse(responseData); + + expect(mostCommonResponse).toEqual({ + success: true, + signedData: { + sig: { + sigType: 'ECDSA_CAIT_SITH', + dataSigned: + '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', + signatureShare: + '"3E8184B2E3DC4725A711D4DBF8D32288A8AC4F31FD04B8ACB302B9BB3D209122"', + shareIndex: 0, + bigR: '"035938946F745C3A6E8B8F0DF7849B0693AAB779695BA770F76906562F37DD005F"', + publicKey: + '"049C6E2DD71F553A29398FA0A93BBCB411EE442D97D253D9E82F41C8601B19BCD71F37F0A2A0A0F501593153C3FD2C9EC3A2BDFA8E43291B7B0E165A3E104BF0B2"', + sigName: 'sig', + }, + }, + decryptedData: {}, + claimData: {}, + response: undefined, + logs: undefined, + }); + }); + it('should return the most common response object', () => { + const responses = [ + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }, + ]; + + const expectedResult = { + key1: 'value1', + key2: 'value2', + key3: 'value3', + }; + + const result = utilsModule.findMostCommonResponse(responses); + + expect(result).toEqual(expectedResult); + }); +}); diff --git a/packages/misc/src/lib/misc.ts b/packages/misc/src/lib/misc.ts index 8852753d41..d5099c8dea 100644 --- a/packages/misc/src/lib/misc.ts +++ b/packages/misc/src/lib/misc.ts @@ -67,6 +67,39 @@ export const mostCommonString = (arr: Array): any => { .pop(); }; +export const findMostCommonResponse = (responses: Array): object => { + const result: { [key: string]: any } = {}; + + // Aggregate all values for each key across all responses + const keys = new Set(responses.flatMap(Object.keys)); + + for (const key of keys) { + const values = responses.map( + (response: { [key: string]: any }) => response[key] + ); + + // Filter out undefined values before processing + const filteredValues = values.filter( + (value) => value !== undefined && value !== '' + ); + + if (filteredValues.length === 0) { + result[key] = undefined; // or set a default value if needed + } else if ( + typeof filteredValues[0] === 'object' && + !Array.isArray(filteredValues[0]) + ) { + // Recursive case for objects + result[key] = findMostCommonResponse(filteredValues); + } else { + // Most common element from filtered values + result[key] = mostCommonString(filteredValues); + } + } + + return result; +}; + export const throwError = (e: NodeClientErrorV0 | NodeClientErrorV1): never => { if (isNodeClientErrorV1(e)) { return throwErrorV1(e); @@ -560,40 +593,6 @@ export const is = ( return true; }; -/** - * Convert types before sending to Lit Actions as jsParams, some JS types don't serialize well, so we will convert them before sending to the nodes - * - * @param { object } params.jsParams The jsParams you are sending - * @returns { object } The jsParams object, but with any incompatible types automatically converted - */ -export const convertLitActionsParams = (jsParams: object): object => { - // -- property - const convertedParams: KV = {}; - - // -- execute - for (const [key, value] of Object.entries(jsParams)) { - const _key: string = key; - const _value: any = value; - - // -- get value type - const varType = getVarType(_value); - - // -- case: Unit8Array - if (varType === 'Uint8Array') { - convertedParams[_key] = Array.from(_value); - // -- case: Object, recurse over any objects - } else if (varType === 'Object') { - convertedParams[_key] = convertLitActionsParams(_value); - } - // -- default - else { - convertedParams[_key] = _value; - } - } - - return convertedParams; -}; - export const isNode = () => { var isNode = false; // @ts-ignore diff --git a/packages/pkp-base/src/lib/pkp-base.ts b/packages/pkp-base/src/lib/pkp-base.ts index 7dccf39971..9bcf6ea0e4 100644 --- a/packages/pkp-base/src/lib/pkp-base.ts +++ b/packages/pkp-base/src/lib/pkp-base.ts @@ -10,11 +10,10 @@ import { AuthenticationProps, - ExecuteJsProps, + JsonExecutionSdkParams, PKPBaseProp, AuthSig, PKPBaseDefaultParams, - GetSessionSigsProps, SessionSigs, RPCUrls, AuthMethod, @@ -22,7 +21,6 @@ import { } from '@lit-protocol/types'; import { LitNodeClient } from '@lit-protocol/lit-node-client'; import { publicKeyConvert } from 'secp256k1'; -import { toString as uint8arrayToString } from 'uint8arrays'; import { executeWithRetry, logError } from '@lit-protocol/misc'; /** @@ -49,6 +47,8 @@ const compressPubKey = (pubKey: string): string => { */ export class PKPBase { rpcs?: RPCUrls; + + // @deprecated controllerAuthSig?: AuthSig; controllerAuthMethods?: AuthMethod[]; controllerSessionSigs?: SessionSigs; @@ -282,11 +282,10 @@ export class PKPBase { this.authContext.getSessionSigsProps )) || this.controllerSessionSigs; - const executeJsArgs: ExecuteJsProps = { + const executeJsArgs: JsonExecutionSdkParams = { ...(this.litActionCode && { code: this.litActionCode }), ...(this.litActionIPFS && { ipfsId: this.litActionIPFS }), sessionSigs: controllerSessionSigs, - authSig: this.controllerAuthSig, authMethods: this.authContext?.authMethods, jsParams: { ...{ @@ -367,14 +366,7 @@ export class PKPBase { try { let sig; - if (this.controllerAuthSig) { - sig = await this.litNodeClient.pkpSign({ - toSign: toSign, - pubKey: this.uncompressedPubKey, - authSig: this.controllerAuthSig as AuthSig, - authMethods: [], - }); - } else if (controllerSessionSigs) { + if (controllerSessionSigs) { sig = await this.litNodeClient.pkpSign({ toSign, pubKey: this.uncompressedPubKey, @@ -386,9 +378,14 @@ export class PKPBase { toSign, pubKey: this.uncompressedPubKey, authMethods: this.authContext.authMethods, + sessionSigs: controllerSessionSigs!, }); } + if (!sig) { + throw new Error('No signature returned'); + } + // pad sigs with 0 if length is odd sig.r = sig.r.length % 2 === 0 ? sig.r : '0' + sig.r; sig.s = sig.s.length % 2 === 0 ? sig.s : '0' + sig.s; diff --git a/packages/types/src/lib/ILitNodeClient.ts b/packages/types/src/lib/ILitNodeClient.ts index e8b12e5755..8ebc666c1e 100644 --- a/packages/types/src/lib/ILitNodeClient.ts +++ b/packages/types/src/lib/ILitNodeClient.ts @@ -3,12 +3,12 @@ import { DecryptResponse, EncryptRequest, EncryptResponse, - ExecuteJsProps, ExecuteJsResponse, FormattedMultipleAccs, GetSignedTokenRequest, HandshakeWithNode, JsonExecutionRequest, + JsonExecutionSdkParams, JsonHandshakeResponse, LitNodeClientConfig, MultipleAccessControlConditions, @@ -41,15 +41,6 @@ export interface ILitNodeClient { // ========== Scoped Class Helpers ========== - /** - * - * (Browser Only) Get the config from browser local storage and override default config - * - * @returns { void } - * - */ - overrideConfigsFromLocalStorage?(): void; - /** * * Set bootstrapUrls to match the network litNetwork unless it's set to custom @@ -59,17 +50,6 @@ export interface ILitNodeClient { */ setCustomBootstrapUrls(): void; - /** - * - * Get the request body of the lit action - * - * @param { ExecuteJsProps } params - * - * @returns { JsonExecutionRequest } - * - */ - getLitActionRequestBody(params: ExecuteJsProps): JsonExecutionRequest; - /** * * we need to send jwt params iat (issued at) and exp (expiration) because the nodes may have different wall clock times, the nodes will verify that these params are withing a grace period @@ -155,27 +135,6 @@ export interface ILitNodeClient { _throwNodeError(res: RejectedNodePromises, requestId: string): void; // ========== Shares Resolvers ========== - /** - * - * Get signatures from signed data - * - * @param { Array } signedData - * - * @returns { any } - * - */ - getSignatures(signedData: any[], requestId: string): any; - - /** - * - * Parse the response string to JSON - * - * @param { string } responseString - * - * @returns { any } JSON object - * - */ - parseResponses(responseString: string): any; /** * @@ -199,11 +158,6 @@ export interface ILitNodeClient { * * @returns { Promise } */ - getJsExecutionShares( - url: string, - params: JsonExecutionRequest, - requestId: string - ): Promise; /** * Get Signing Shares for Token containing Access Control Condition @@ -260,7 +214,9 @@ export interface ILitNodeClient { * @returns { ExecuteJsResponse } * */ - executeJs(params: ExecuteJsProps): Promise; + executeJs( + params: JsonExecutionSdkParams + ): Promise; /** * diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index 67f1c4da2e..e77658645e 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -214,50 +214,21 @@ export interface ClaimKeyResponse { /** * Struct in rust * ----- - pub struct JsonExecutionRequest { - pub code: Option, - pub ipfs_id: Option, - pub auth_sig: AuthSigItem, - pub js_params: Option, +pub struct JsonExecutionRequest { + pub auth_sig: AuthSigItem, + #[serde(default = "default_epoch")] + pub epoch: u64, + + pub ipfs_id: Option, + pub code: Option, + pub js_params: Option, + pub auth_methods: Option>, } */ -export interface BaseJsonExecutionRequest { - // // the authSig to use to authorize the user with the nodes - // authSig?: AuthSig; - - // An object that contains params to expose to the Lit Action. These will be injected to the JS runtime before your code runs, so you can use any of these as normal variables in your Lit Action. - jsParams?: any; - - // JS code to run on the nodes - code?: string; - - // The IPFS ID of some JS code to run on the nodes - ipfsId?: string; - - // // the session signatures to use to authorize the user with the nodes - // sessionSigs?: any; - - // whether to run this on a single node or many - targetNodeRange?: number; - - // auth methods to resolve - authMethods?: AuthMethod[]; -} - -export type JsonExecutionRequest = {} & BaseJsonExecutionRequest; - -export interface JsExecutionRequestBody { - authSig?: AuthSig; - code?: string; - ipfsId?: string; - authMethods?: AuthMethod[]; - jsParams?: any; -} export interface BaseJsonPkpSignRequest { - toSign: ArrayLike; - pubkey: string; // yes, pub"key" is lower case in the node. authMethods?: AuthMethod[]; + toSign: ArrayLike; } /** @@ -267,6 +238,7 @@ export interface BaseJsonPkpSignRequest { export interface JsonPkpSignSdkParams extends BaseJsonPkpSignRequest { pubKey: string; sessionSigs: SessionSigsMap; + authMethods?: AuthMethod[]; } /** @@ -274,6 +246,11 @@ export interface JsonPkpSignSdkParams extends BaseJsonPkpSignRequest { */ export interface JsonPkpSignRequest extends BaseJsonPkpSignRequest { authSig: AuthSig; + + /** + * note that 'key' is in lower case, because this is what the node expects + */ + pubkey: string; } /** @@ -297,7 +274,7 @@ export interface JsonSignSessionKeyRequestV1 { sessionKey: string; authMethods: AuthMethod[]; pkpPublicKey?: string; - authSig?: AuthSig; + // authSig?: AuthSig; siweMessage: string; curveType: 'BLS' | 'ECDSA'; code?: string; @@ -441,10 +418,48 @@ export interface JsonEncryptionRetrieveRequest extends JsonAccsRequest { toDecrypt: string; } -export type ExecuteJsProps = JsonExecutionRequest & { - // A boolean that defines if debug info will be returned or not. - debug?: boolean; -}; +export interface JsonExecutionSdkParamsTargetNode + extends JsonExecutionSdkParams { + targetNodeRange: number; +} + +export interface JsonExecutionSdkParams { + // An object that contains params to expose to the Lit Action. These will be injected to the JS runtime before your code runs, so you can use any of these as normal variables in your Lit Action. + jsParams?: any; + + // JS code to run on the nodes + code?: string; + + // The IPFS ID of some JS code to run on the nodes + ipfsId?: string; + + // the session signatures to use to authorize the user with the nodes + sessionSigs?: any; + + // whether to run this on a single node or many + // targetNodeRange?: number; + + // auth methods to resolve + authMethods?: AuthMethod[]; +} + +export interface JsonExecutionRequestTargetNode extends JsonExecutionRequest { + targetNodeRange: number; +} + +export interface JsonExecutionRequest { + authSig: AuthSig; + + /** + * auto-filled before sending each command to the node, but + * in the rust struct, this type is required. + */ + // epoch: number; + ipfsId?: string; + code?: string; + jsParams?: any; + authMethods?: AuthMethod[]; +} export interface EncryptRequestBase extends MultipleAccessControlConditions { // The chain name of the chain that this contract is deployed on. See LIT_CHAINS for currently supported chains. @@ -508,27 +523,34 @@ export interface SignConditionECDSA { exp: number; } +export interface SigResponse { + r: string; + s: string; + recid: number; + signature: string; // 0x... + publicKey: string; // pkp public key + dataSigned: string; +} + +export interface ExecuteJsResponseBase { + signatures: + | { + sig: SigResponse; + } + | any; +} + /** * * An object containing the resulting signatures. Each signature comes with the public key and the data signed. * */ -export interface ExecuteJsResponse { +export interface ExecuteJsResponse extends ExecuteJsResponseBase { success?: boolean; - signatures: - | { - sig: { - r: string; - s: string; - recid: number; - signature: string; // 0x... - publicKey: string; // pkp public key - dataSigned: string; - }; - } - | any; - decryptions: any[]; - response: string; + + // FIXME: Fix if and when we enable decryptions from within a Lit Action. + // decryptions: any[]; + response: string | object; logs: string; claims?: Record; debug?: { @@ -538,6 +560,13 @@ export interface ExecuteJsResponse { }; } +export interface ExecuteJsNoSigningResponse extends ExecuteJsResponseBase { + claims: {}; + decryptions: []; + response: any; + logs: string; +} + export interface LitNodePromise {} export interface SendNodeCommand { @@ -545,16 +574,31 @@ export interface SendNodeCommand { data: any; requestId: string; } - +export interface SigShare { + sigType: + | 'BLS' + | 'K256' + | 'ECDSA_CAIT_SITH' // Legacy alias of K256 + | 'EcdsaCaitSithP256'; + + signatureShare: string; + shareIndex?: number; + bigr?: string; // backward compatibility + bigR?: string; + publicKey: string; + dataSigned?: string; + siweMessage?: string; + sigName?: string; +} export interface NodeShare { claimData: any; shareIndex: any; unsignedJwt: any; - signedData: any; + signedData: SigShare; decryptedData: any; response: any; logs: any; - success?: any; + success?: boolean | ''; } export interface PKPSignShare { @@ -640,18 +684,6 @@ export interface NodeClientErrorV1 { requestId?: string; } -export interface SigShare { - sigType: any; - signatureShare: any; - shareIndex: any; - bigr?: string; - bigR?: string; - publicKey: any; - dataSigned: any; - siweMessage?: string; - sigName?: string; -} - export interface SignedData { signedData: any; } @@ -1663,3 +1695,12 @@ export type SessionKeyCache = { value: SessionKeyPair; timestamp: number; }; + +export interface SignatureData { + signature: string; + derivedKeyId: string; +} + +export type ClaimsList = { + [key: string]: SignatureData; +}[]; From 63e3b54978007ce7504311080e2ee6d617723905 Mon Sep 17 00:00:00 2001 From: Anson Date: Fri, 26 Apr 2024 23:54:09 +0100 Subject: [PATCH 10/20] fix(tinny): set default MAX_ATTEMPT = 1 --- local-tests/setup/tinny-environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/local-tests/setup/tinny-environment.ts b/local-tests/setup/tinny-environment.ts index 0bc59fbe51..1e44718275 100644 --- a/local-tests/setup/tinny-environment.ts +++ b/local-tests/setup/tinny-environment.ts @@ -14,7 +14,7 @@ export class TinnyEnvironment { * Environment variables used in the process. */ public processEnvs: ProcessEnvs = { - MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS']) || 3, + MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS']) || 1, NETWORK: (process.env['NETWORK'] as LIT_TESTNET) || LIT_TESTNET.LOCALCHAIN, DEBUG: Boolean(process.env['DEBUG']) || false, REQUEST_PER_KILOSECOND: From e4c3e7967aa383ee5f7da9253917926881a08bdb Mon Sep 17 00:00:00 2001 From: Anson Date: Fri, 26 Apr 2024 23:54:27 +0100 Subject: [PATCH 11/20] fix(executeJs): jsParam is optional --- .../lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index 9dee40f4da..794222395d 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -1151,7 +1151,7 @@ export class LitNodeClientNodeJs // Format the params const formattedParams: JsonExecutionSdkParams = { ...params, - jsParams: normalizeJsParams(params.jsParams), + ...(params.jsParams && { jsParams: normalizeJsParams(params.jsParams) }), ...(params.code && { code: encodeCode(params.code) }), }; From e01daaa7b9a9c2067211af9ce98480d3c7d18856 Mon Sep 17 00:00:00 2001 From: Anson Date: Sat, 27 Apr 2024 01:54:57 +0100 Subject: [PATCH 12/20] fix: node promises. now `pkpSign` & `executeJs` work! --- .../constants/src/lib/constants/endpoints.ts | 8 ++-- .../src/lib/helpers/get-signatures.ts | 2 +- .../src/lib/lit-node-client-nodejs.ts | 46 ++++++++++++------- packages/types/src/lib/interfaces.ts | 2 +- 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/packages/constants/src/lib/constants/endpoints.ts b/packages/constants/src/lib/constants/endpoints.ts index 7dd1e36911..2ee56cdf5e 100644 --- a/packages/constants/src/lib/constants/endpoints.ts +++ b/packages/constants/src/lib/constants/endpoints.ts @@ -11,22 +11,22 @@ export const LIT_ENDPOINT = { }, SIGN_SESSION_KEY: { path: '/web/sign_session_key', - // version: LIT_ENDPOINT_VERSION.V1, + version: LIT_ENDPOINT_VERSION.V1, // FIXME: Change this to V1 once the new version is deployed to all public networks - version: LIT_ENDPOINT_VERSION.V0, + // version: LIT_ENDPOINT_VERSION.V0, envName: 'SIGN_SESSION_KEY', }, EXECUTE_JS: { path: '/web/execute', // FIXME: Change this to V1 once the new version is deployed to all public networks - version: LIT_ENDPOINT_VERSION.V0, + version: LIT_ENDPOINT_VERSION.V1, envName: 'EXECUTE_JS', }, PKP_SIGN: { path: '/web/pkp/sign', // version: LIT_ENDPOINT_VERSION.V1, - version: LIT_ENDPOINT_VERSION.V0, + version: LIT_ENDPOINT_VERSION.V1, envName: 'PKP_SIGN', }, PKP_CLAIM: { diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts index 9a5b1e5bd5..2b41980ac3 100644 --- a/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts @@ -95,7 +95,7 @@ export const getSignatures = ({ minNodeCount: number; signedData: any[]; requestId: string; -}): { sig: SigResponse } => { +}): { signature: SigResponse } => { const initialKeys = [...new Set(signedData.flatMap((i) => Object.keys(i)))]; // processing signature shares for failed or invalid contents. mutates the signedData object. diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index 794222395d..aa386e01c9 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -1172,18 +1172,12 @@ export class LitNodeClientNodeJs authSig: sessionSig, }; - const composedUrl = composeLitUrl({ + const urlWithPath = composeLitUrl({ url, endpoint: LIT_ENDPOINT.EXECUTE_JS, }); - const sharePromise = await this.sendCommandToNode({ - url: composedUrl, - data: reqBody, - requestId, - }); - - return sharePromise; + return this.generatePromise(urlWithPath, reqBody, requestId); }); // -- resolve promises @@ -1296,6 +1290,30 @@ export class LitNodeClientNodeJs return returnVal; }; + sharePromise = async (func: any) => { + return await func(); + }; + + /** + * Generates a promise by sending a command to the Lit node + * + * @param url - The URL to send the command to. + * @param params - The parameters to include in the command. + * @param requestId - The ID of the request. + * @returns A promise that resolves with the response from the server. + */ + generatePromise = async ( + url: string, + params: any, + requestId: string + ): Promise => { + return await this.sendCommandToNode({ + url, + data: params, + requestId, + }); + }; + /** * Use PKP to sign * @@ -1336,7 +1354,7 @@ export class LitNodeClientNodeJs const wrapper = async ( id: string ): Promise | RejectedNodePromises> => { - const nodePromises = this.getNodePromises(async (url: string) => { + const nodePromises = this.getNodePromises((url: string) => { // -- get the session sig from the url key const sessionSig = this.getSessionSigByUrl({ sessionSigs: params.sessionSigs, @@ -1362,13 +1380,7 @@ export class LitNodeClientNodeJs endpoint: LIT_ENDPOINT.PKP_SIGN, }); - const sharePromise = await this.sendCommandToNode({ - url: urlWithPath, - data: reqBody, - requestId, - }); - - return sharePromise; + return this.generatePromise(urlWithPath, reqBody, id); }); const res = await this.handleNodePromises( @@ -1459,7 +1471,7 @@ export class LitNodeClientNodeJs logWithRequestId(requestId, `signature combination`, signatures); - return signatures.sig; // only a single signature is ever present, so we just return it. + return signatures.signature; // only a single signature is ever present, so we just return it. }; /** diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index e77658645e..fd74318ea3 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -528,7 +528,7 @@ export interface SigResponse { s: string; recid: number; signature: string; // 0x... - publicKey: string; // pkp public key + publicKey: string; // pkp public key (no 0x prefix) dataSigned: string; } From e2adf7da27f49201b994dcd7417142a7cd3a65c2 Mon Sep 17 00:00:00 2001 From: Anson Date: Sat, 27 Apr 2024 02:37:08 +0100 Subject: [PATCH 13/20] feat: add pkp sign response parser as its own helper function and unit test --- .../src/lib/helpers/get-signatures.test.ts | 6 +- .../src/lib/helpers/get-signatures.ts | 20 +- .../helpers/parse-pkp-sign-response.test.ts | 230 ++++++++++++++++++ .../lib/helpers/parse-pkp-sign-response.ts | 65 +++++ .../src/lib/lit-node-client-nodejs.ts | 42 +--- packages/types/src/lib/interfaces.ts | 10 + 6 files changed, 324 insertions(+), 49 deletions(-) create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.test.ts create mode 100644 packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.ts diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts index cdd9e82636..9b555d9257 100644 --- a/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.test.ts @@ -1,6 +1,7 @@ import { initWasmEcdsaSdk } from '@lit-protocol/ecdsa-sdk'; import { getSignatures } from './get-signatures'; +import { SigResponse } from '@lit-protocol/types'; describe('getSignatures', () => { beforeAll(async () => { @@ -53,14 +54,15 @@ describe('getSignatures', () => { ]; const requestId = ''; - const signatures = getSignatures({ + const signatures = getSignatures<{ sig: SigResponse }>({ networkPubKeySet, minNodeCount, signedData, requestId, }); - expect(signatures.sig).toHaveProperty('dataSigned'); + console.log('signatures:', signatures.sig); + expect(signatures.sig).toHaveProperty('publicKey'); expect(signatures.sig).toHaveProperty('r'); expect(signatures.sig).toHaveProperty('recid'); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts index 2b41980ac3..d549f33a82 100644 --- a/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts +++ b/packages/lit-node-client-nodejs/src/lib/helpers/get-signatures.ts @@ -77,15 +77,21 @@ export const getFlattenShare = (share: any): SigShare => { }; /** + * Retrieves and combines signature shares from multiple nodes to generate the final signatures. * - * Get signatures from signed data + * @template T - The type of the final signatures. For `executeJs` endpoint, it returns as `signature`, and for `pkpSign` endpoint, it returns as `sig`. + * @param {any} params.networkPubKeySet - The public key set of the network. + * @param {number} params.minNodeCount - The threshold number of nodes + * @param {any[]} params.signedData - The array of signature shares from each node. + * @param {string} [params.requestId=''] - The optional request ID for logging purposes. + * @returns {T | { signature: SigResponse; sig: SigResponse }} - The final signatures or an object containing the final signatures. * - * @param { Array } signedData - * - * @returns { any } + * @example * + * executeJs: getSignatures<{ signature: SigResponse }> + * pkpSign: getSignatures<{ sig: SigResponse }> */ -export const getSignatures = ({ +export const getSignatures = ({ networkPubKeySet, minNodeCount, signedData, @@ -95,7 +101,7 @@ export const getSignatures = ({ minNodeCount: number; signedData: any[]; requestId: string; -}): { signature: SigResponse } => { +}): T | { signature: SigResponse; sig: SigResponse } => { const initialKeys = [...new Set(signedData.flatMap((i) => Object.keys(i)))]; // processing signature shares for failed or invalid contents. mutates the signedData object. @@ -223,8 +229,6 @@ export const getSignatures = ({ const signature = combineEcdsaShares(shares); - console.log('signature:', signature); - if (!signature.r) { throwError({ message: 'siganture could not be combined', diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.test.ts b/packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.test.ts new file mode 100644 index 0000000000..267863e607 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.test.ts @@ -0,0 +1,230 @@ +import { + cleanStringValues, + parsePkpSignResponse, + convertKeysToCamelCase, + snakeToCamel, +} from './parse-pkp-sign-response'; + +describe('parsePkpSignResponse', () => { + it('should parse PKP sign response correctly', () => { + const responseData = [ + { + success: true, + signedData: [ + 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, + 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, + 244, + ], + signatureShare: { + digest: 'fail', + result: 'fail', + share_index: 0, + signature_share: '', + big_r: '', + public_key: '', + sig_type: '', + }, + }, + { + success: true, + signedData: [ + 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, + 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, + 244, + ], + signatureShare: { + digest: + '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', + result: 'success', + share_index: 0, + signature_share: + '"3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827"', + big_r: + '"0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B"', + public_key: + '"04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726"', + sig_type: 'K256', + }, + }, + { + success: true, + signedData: [ + 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, + 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, + 244, + ], + signatureShare: { + digest: + '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', + result: 'success', + share_index: 0, + signature_share: + '"B1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB"', + big_r: + '"0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B"', + public_key: + '"04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726"', + sig_type: 'K256', + }, + }, + ]; + + const expectedOutput = [ + { + signature: { + digest: 'fail', + shareIndex: 0, + signatureShare: '', + bigR: '', + publicKey: '', + sigType: '', + dataSigned: 'fail', + }, + }, + { + signature: { + digest: + '7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', + shareIndex: 0, + signatureShare: + '3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827', + bigR: '0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B', + publicKey: + '04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726', + sigType: 'K256', + dataSigned: + '7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', + }, + }, + { + signature: { + digest: + '7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', + shareIndex: 0, + signatureShare: + 'B1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB', + bigR: '0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B', + publicKey: + '04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726', + sigType: 'K256', + dataSigned: + '7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', + }, + }, + ]; + + const output = parsePkpSignResponse(responseData); + + expect(output).toEqual(expectedOutput); + }); +}); + +describe('cleanStringValues', () => { + it('should remove double quotes from string values in an object', () => { + const input = { + name: '"Josh"', + age: 18, + city: '"New York"', + }; + + const expectedOutput = { + name: 'Josh', + age: 18, + city: 'New York', + }; + + const output = cleanStringValues(input); + + expect(output).toEqual(expectedOutput); + }); + + it('should not modify non-string values in an object', () => { + const input = { + name: 'John', + age: 25, + city: 'New York', + }; + + const expectedOutput = { + name: 'John', + age: 25, + city: 'New York', + }; + + const output = cleanStringValues(input); + + expect(output).toEqual(expectedOutput); + }); +}); + +describe('convertKeysToCamelCase', () => { + it('should convert keys to camel case', () => { + const input = { + first_name: 'John', + last_name: 'Doe', + age: 25, + city_name: 'New York', + }; + + const expectedOutput = { + firstName: 'John', + lastName: 'Doe', + age: 25, + cityName: 'New York', + }; + + const output = convertKeysToCamelCase(input); + + expect(output).toEqual(expectedOutput); + }); + + it('should not modify keys that are already in camel case', () => { + const input = { + firstName: 'John', + lastName: 'Doe', + age: 25, + cityName: 'New York', + }; + + const expectedOutput = { + firstName: 'John', + lastName: 'Doe', + age: 25, + cityName: 'New York', + }; + + const output = convertKeysToCamelCase(input); + + expect(output).toEqual(expectedOutput); + }); +}); + +describe('snakeToCamel', () => { + it('should convert snake case to camel case', () => { + const input = 'hello_world'; + const expectedOutput = 'helloWorld'; + const output = snakeToCamel(input); + expect(output).toEqual(expectedOutput); + }); + + it('should convert multiple snake case words to camel case', () => { + const input = 'hello_world_example'; + const expectedOutput = 'helloWorldExample'; + const output = snakeToCamel(input); + expect(output).toEqual(expectedOutput); + }); + + it('should not modify camel case words', () => { + const input = 'helloWorld'; + const expectedOutput = 'helloWorld'; + const output = snakeToCamel(input); + expect(output).toEqual(expectedOutput); + }); + + it('should not modify words without underscores', () => { + const input = 'hello'; + const expectedOutput = 'hello'; + const output = snakeToCamel(input); + expect(output).toEqual(expectedOutput); + }); +}); diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.ts b/packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.ts new file mode 100644 index 0000000000..02619392b9 --- /dev/null +++ b/packages/lit-node-client-nodejs/src/lib/helpers/parse-pkp-sign-response.ts @@ -0,0 +1,65 @@ +import { PKPSignShare, PkpSignedData } from '@lit-protocol/types'; + +/** + * Converts a snake_case string to camelCase. + * @param s The snake_case string to convert. + * @returns The camelCase version of the input string. + * + * @example + * snakeToCamel('hello_world') // 'helloWorld' + */ +export const snakeToCamel = (s: string): string => + s.replace(/(_\w)/g, (m) => m[1].toUpperCase()); + +/** + * Converts the keys of an object from snake_case to camelCase. + * + * @param obj - The object whose keys need to be converted. + * @returns The object with keys converted to camelCase. + */ +export const convertKeysToCamelCase = (obj: { [key: string]: any }): any => + Object.keys(obj).reduce( + (acc, key) => ({ + ...acc, + [snakeToCamel(key)]: obj[key], + }), + {} + ); + +/** + * Removes double quotes from string values in an object. + * @param obj - The object to clean string values from. + * @returns A new object with string values cleaned. + */ +export const cleanStringValues = (obj: { [key: string]: any }): any => + Object.keys(obj).reduce( + (acc, key) => ({ + ...acc, + [key]: + typeof obj[key] === 'string' ? obj[key].replace(/"/g, '') : obj[key], + }), + {} + ); + +/** + * Parses the PKP sign response data and transforms it into a standardised format. + * @param responseData - The response data containing PKP sign shares. + * @returns An array of objects with the signature data. + */ +export const parsePkpSignResponse = ( + responseData: PKPSignShare[] +): { signature: PkpSignedData }[] => + responseData.map(({ signatureShare }) => { + // Remove 'result' key if it exists + delete signatureShare.result; + + const camelCaseShare = convertKeysToCamelCase(signatureShare); + const cleanedShare = cleanStringValues(camelCaseShare); + + // Change 'dataSigned' from 'digest' + if (cleanedShare.digest) { + cleanedShare.dataSigned = cleanedShare.digest; + } + + return { signature: cleanedShare }; + }); diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index aa386e01c9..c565749f64 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -127,6 +127,7 @@ import { parseAsJsonOrString } from './helpers/parse-as-json-or-string'; import { getFlattenShare, getSignatures } from './helpers/get-signatures'; import { getClaimsList } from './helpers/get-claims-list'; import { getClaims } from './helpers/get-claims'; +import { parsePkpSignResponse } from './helpers/parse-pkp-sign-response'; const TEMP_CACHE_PERIOD = 30000; // 30 seconds @@ -1423,46 +1424,9 @@ export class LitNodeClientNodeJs // ========== Extract shares from response data ========== // -- 1. combine signed data as a list, and get the signatures from it - const signedDataList = responseData.map((r) => { - // add the signed data to the signature share - delete r.signatureShare.result; - - // nodes do not camel case the response from /web/pkp/sign. - const snakeToCamel = (s: string) => - s.replace(/(_\w)/g, (k) => k[1].toUpperCase()); - //@ts-ignore - const convertShare: any = (share: any) => { - const keys = Object.keys(share); - let convertedShare = {}; - for (const key of keys) { - convertedShare = Object.defineProperty( - convertedShare, - snakeToCamel(key), - Object.getOwnPropertyDescriptor(share, key) as PropertyDecorator - ); - } + const signedDataList = parsePkpSignResponse(responseData); - return convertedShare; - }; - const convertedShare: SigShare = convertShare(r.signatureShare); - const keys = Object.keys(convertedShare); - for (const key of keys) { - //@ts-ignore - if (typeof convertedShare[key] === 'string') { - //@ts-ignore - convertedShare[key] = convertedShare[key] - .replace('"', '') - .replace('"', ''); - } - } - //@ts-ignore - convertedShare.dataSigned = convertedShare.digest; - return { - signature: convertedShare, - }; - }); - - const signatures = getSignatures({ + const signatures = getSignatures<{ signature: SigResponse }>({ requestId, networkPubKeySet: this.networkPubKeySet, minNodeCount: this.config.minNodeCount, diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index fd74318ea3..a71fe17d88 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -590,6 +590,16 @@ export interface SigShare { siweMessage?: string; sigName?: string; } + +export interface PkpSignedData { + digest: string; + shareIndex: number; + signatureShare: string; + bigR: string; + publicKey: string; + sigType: string; + dataSigned: string; +} export interface NodeShare { claimData: any; shareIndex: any; From 1b9dd2c4471a139d3e8a040a25f6618c588c6791 Mon Sep 17 00:00:00 2001 From: Anson Date: Sat, 27 Apr 2024 02:39:08 +0100 Subject: [PATCH 14/20] fix: https://github.com/LIT-Protocol/js-sdk/pull/444#discussion_r1581347652 --- local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts | 2 +- .../tests/testUseEoaSessionSigsToEncryptDecryptString.ts | 2 +- local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts | 2 +- local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts | 2 +- .../tests/testUsePkpSessionSigsToEncryptDecryptString.ts | 2 +- local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts | 2 +- ...alidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts | 2 +- ...idLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts | 2 +- ...ValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts | 2 +- packages/auth-helpers/src/lib/resources.ts | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts index 57af5ec840..fdb1cf6e04 100644 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts @@ -57,7 +57,7 @@ export const testUseEoaSessionSigsToEncryptDecryptFile = async ( } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts index 840a8e0a9c..12f01ef681 100644 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts @@ -53,7 +53,7 @@ export const testUseEoaSessionSigsToEncryptDecryptString = async ( } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts index de5dff56c7..84fd945da2 100644 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts @@ -55,7 +55,7 @@ export const testUseEoaSessionSigsToEncryptDecryptZip = async ( } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts index 6200661671..c19e856401 100644 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts @@ -58,7 +58,7 @@ export const testUsePkpSessionSigsToEncryptDecryptFile = async ( } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts index daaf80e1d6..0b172e2935 100644 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts @@ -51,7 +51,7 @@ export const testUsePkpSessionSigsToEncryptDecryptString = async ( } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts index 26c7e8afb0..1f2b380a88 100644 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts @@ -56,7 +56,7 @@ export const testUsePkpSessionSigsToEncryptDecryptZip = async ( } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts index 2b3f765f8c..1f101e7d10 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts @@ -60,7 +60,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile = } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts index cf72950d3e..ce4b8cf6a4 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts @@ -55,7 +55,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts index c9a25bddd1..a5ef2bea35 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts @@ -58,7 +58,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip = } const accsResourceString = - await LitAccessControlConditionResource.composeLitActionResourceString( + await LitAccessControlConditionResource.generateLitActionResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/packages/auth-helpers/src/lib/resources.ts b/packages/auth-helpers/src/lib/resources.ts index cda889d7ee..6d2f3aad4d 100644 --- a/packages/auth-helpers/src/lib/resources.ts +++ b/packages/auth-helpers/src/lib/resources.ts @@ -53,7 +53,7 @@ export class LitAccessControlConditionResource * @param {string} dataToEncryptHash - The hash of the data to encrypt. * @returns {Promise} The composed resource string in the format 'hashedAccs/dataToEncryptHash'. */ - public static async composeLitActionResourceString( + public static async generateLitActionResourceString( accs: AccessControlConditions, dataToEncryptHash: string ): Promise { From 500967cc81abed93939b72760e1339ba4aa8a3e3 Mon Sep 17 00:00:00 2001 From: Anson Date: Mon, 29 Apr 2024 14:46:14 +0100 Subject: [PATCH 15/20] chore: remove unused function --- .../lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index c565749f64..37c1433ab5 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -1291,10 +1291,6 @@ export class LitNodeClientNodeJs return returnVal; }; - sharePromise = async (func: any) => { - return await func(); - }; - /** * Generates a promise by sending a command to the Lit node * From e30165e298ff708161ccf343f4a2a357843467ab Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 30 Apr 2024 14:42:07 +0100 Subject: [PATCH 16/20] fix: https://github.com/LIT-Protocol/js-sdk/pull/444#discussion_r1583857180 --- packages/constants/src/lib/constants/endpoints.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/constants/src/lib/constants/endpoints.ts b/packages/constants/src/lib/constants/endpoints.ts index 2ee56cdf5e..fc97194bad 100644 --- a/packages/constants/src/lib/constants/endpoints.ts +++ b/packages/constants/src/lib/constants/endpoints.ts @@ -12,20 +12,15 @@ export const LIT_ENDPOINT = { SIGN_SESSION_KEY: { path: '/web/sign_session_key', version: LIT_ENDPOINT_VERSION.V1, - - // FIXME: Change this to V1 once the new version is deployed to all public networks - // version: LIT_ENDPOINT_VERSION.V0, envName: 'SIGN_SESSION_KEY', }, EXECUTE_JS: { path: '/web/execute', - // FIXME: Change this to V1 once the new version is deployed to all public networks version: LIT_ENDPOINT_VERSION.V1, envName: 'EXECUTE_JS', }, PKP_SIGN: { path: '/web/pkp/sign', - // version: LIT_ENDPOINT_VERSION.V1, version: LIT_ENDPOINT_VERSION.V1, envName: 'PKP_SIGN', }, From 3b661139cc07d44fe2484914adb5fcbbe83f8316 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 30 Apr 2024 14:45:13 +0100 Subject: [PATCH 17/20] fix: https://github.com/LIT-Protocol/js-sdk/pull/444#discussion_r1583859603 --- .../encryption/src/lib/params-validators.ts | 2 +- packages/types/src/lib/interfaces.ts | 24 +++++-------------- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/packages/encryption/src/lib/params-validators.ts b/packages/encryption/src/lib/params-validators.ts index b221a0f685..aae0f8d82e 100644 --- a/packages/encryption/src/lib/params-validators.ts +++ b/packages/encryption/src/lib/params-validators.ts @@ -380,7 +380,7 @@ class FileValidator implements ParamsValidator { } export interface AuthMaterialValidatorProps { - sessionSigs?: SessionSigsMap; + sessionSigs: SessionSigsMap; chain?: string; } diff --git a/packages/types/src/lib/interfaces.ts b/packages/types/src/lib/interfaces.ts index a71fe17d88..0904310625 100644 --- a/packages/types/src/lib/interfaces.ts +++ b/packages/types/src/lib/interfaces.ts @@ -364,7 +364,7 @@ export interface JsonSigningRetrieveRequest extends JsonAccsRequest { export interface GetSignedTokenRequest extends SigningAccessControlConditionRequest { - sessionSigs?: SessionSigsMap; + sessionSigs: SessionSigsMap; } export interface SigningAccessControlConditionRequest @@ -434,7 +434,7 @@ export interface JsonExecutionSdkParams { ipfsId?: string; // the session signatures to use to authorize the user with the nodes - sessionSigs?: any; + sessionSigs: any; // whether to run this on a single node or many // targetNodeRange?: number; @@ -465,11 +465,8 @@ export interface EncryptRequestBase extends MultipleAccessControlConditions { // The chain name of the chain that this contract is deployed on. See LIT_CHAINS for currently supported chains. chain: Chain; - // The authSig of the user. Returned via the checkAndSignAuthMessage function - authSig?: AuthSig; - // the session signatures to use to authorize the user with the nodes - sessionSigs?: SessionSigsMap; + sessionSigs: SessionSigsMap; } export interface EncryptRequest extends EncryptRequestBase { @@ -820,11 +817,8 @@ export interface EncryptToJsonPayload extends EncryptRequestBase { } export interface DecryptFromJsonProps { - // The authSig of the user. Returned via the checkAndSignAuthMessage function - authSig?: AuthSig; - // the session signatures to use to authorize the user with the nodes - sessionSigs?: SessionSigsMap; + sessionSigs: SessionSigsMap; // An instance of LitNodeClient that is already connected litNodeClient: ILitNodeClient; @@ -834,11 +828,8 @@ export interface DecryptFromJsonProps { export interface EncryptFileAndZipWithMetadataProps extends MultipleAccessControlConditions { - // The authSig of the user. Returned via the checkAndSignAuthMessage function - authSig?: AuthSig; - // the session signatures to use to authorize the user with the nodes - sessionSigs?: SessionSigsMap; + sessionSigs: SessionSigsMap; // The chain name of the chain that this contract is deployed on. See LIT_CHAINS for currently supported chains. chain: string; @@ -854,11 +845,8 @@ export interface EncryptFileAndZipWithMetadataProps } export interface DecryptZipFileWithMetadataProps { - // The authSig of the user. Returned via the checkAndSignAuthMessage function - authSig?: AuthSig; - // the session signatures to use to authorize the user with the nodes - sessionSigs?: SessionSigsMap; + sessionSigs: SessionSigsMap; // The zip file blob with metadata inside it and the encrypted asset file: File | Blob; From 65e5f21defe6bfaecf25fddc7f7aa1aff1812144 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 30 Apr 2024 14:55:31 +0100 Subject: [PATCH 18/20] fix: https://github.com/LIT-Protocol/js-sdk/pull/444#discussion_r1583884147 --- .../src/lib/lit-node-client-nodejs.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index 37c1433ab5..76cbd0ca2c 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -1224,18 +1224,17 @@ export class LitNodeClientNodeJs responseData ) as NodeShare; - const IS_SUCCESS = mostCommonResponse.success; - const HAS_SIGNED_DATA = - Object.keys(mostCommonResponse.signedData).length > 0; - const HAS_CLAIM_DATA = Object.keys(mostCommonResponse.claimData).length > 0; + const isSuccess = mostCommonResponse.success; + const hasSignedData = Object.keys(mostCommonResponse.signedData).length > 0; + const hasClaimData = Object.keys(mostCommonResponse.claimData).length > 0; // -- we must also check for claim responses as a user may have submitted for a claim and signatures must be aggregated before returning - if (IS_SUCCESS && !HAS_SIGNED_DATA && !HAS_CLAIM_DATA) { + if (isSuccess && !hasSignedData && !hasClaimData) { return mostCommonResponse as unknown as ExecuteJsResponse; } // -- in the case where we are not signing anything on Lit action and using it as purely serverless function - if (!HAS_SIGNED_DATA && !HAS_CLAIM_DATA) { + if (!hasSignedData && !hasClaimData) { return { claims: {}, signatures: null, @@ -1666,8 +1665,7 @@ export class LitNodeClientNodeJs * */ decrypt = async (params: DecryptRequest): Promise => { - const { authSig, sessionSigs, chain, ciphertext, dataToEncryptHash } = - params; + const { sessionSigs, chain, ciphertext, dataToEncryptHash } = params; // ========== Validate Params ========== // -- validate if it's ready @@ -1753,7 +1751,7 @@ export class LitNodeClientNodeJs ): Promise | RejectedNodePromises> => { const nodePromises = this.getNodePromises((url: string) => { // -- if session key is available, use it - const authSigToSend = sessionSigs ? sessionSigs[url] : authSig; + const authSigToSend = sessionSigs[url]; return this.getSigningShareForDecryption( url, From ffa6555849e42d84ef8269f7789fb93993d14763 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 30 Apr 2024 15:07:51 +0100 Subject: [PATCH 19/20] fix: https://github.com/LIT-Protocol/js-sdk/pull/444#discussion_r1584821049 --- .../src/lib/helpers/normalize-array.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts index 2da12ecbe7..ba07bbd725 100644 --- a/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts +++ b/packages/lit-node-client-nodejs/src/lib/helpers/normalize-array.ts @@ -8,8 +8,10 @@ */ export const normalizeArray = (toSign: ArrayLike) => { const arr = []; - for (let i = 0; i < toSign.length; i++) { - arr.push((toSign as Buffer)[i]); + // Casting ArrayLike to Uint8Array for better compatibility and avoiding Node-specific types + const uint8Array = new Uint8Array(toSign); + for (let i = 0; i < uint8Array.length; i++) { + arr.push(uint8Array[i]); } return arr; }; From dce95813ca76748925e79a9f52e45853b97e89f4 Mon Sep 17 00:00:00 2001 From: Anson Date: Tue, 30 Apr 2024 15:52:11 +0100 Subject: [PATCH 20/20] fix: misleading function name --- local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts | 2 +- .../tests/testUseEoaSessionSigsToEncryptDecryptString.ts | 2 +- local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts | 2 +- local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts | 2 +- .../tests/testUsePkpSessionSigsToEncryptDecryptString.ts | 2 +- local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts | 2 +- ...alidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts | 2 +- ...idLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts | 2 +- ...ValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts | 2 +- packages/auth-helpers/src/lib/resources.ts | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts index fdb1cf6e04..3f2ebfe90c 100644 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts @@ -57,7 +57,7 @@ export const testUseEoaSessionSigsToEncryptDecryptFile = async ( } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts index 12f01ef681..5b63ca962c 100644 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts @@ -53,7 +53,7 @@ export const testUseEoaSessionSigsToEncryptDecryptString = async ( } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts index 84fd945da2..2e3fa881b8 100644 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts +++ b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts @@ -55,7 +55,7 @@ export const testUseEoaSessionSigsToEncryptDecryptZip = async ( } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts index c19e856401..fbe9af30ef 100644 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts @@ -58,7 +58,7 @@ export const testUsePkpSessionSigsToEncryptDecryptFile = async ( } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts index 0b172e2935..a04c8a682c 100644 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts @@ -51,7 +51,7 @@ export const testUsePkpSessionSigsToEncryptDecryptString = async ( } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts index 1f2b380a88..4554d54ef2 100644 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts +++ b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts @@ -56,7 +56,7 @@ export const testUsePkpSessionSigsToEncryptDecryptZip = async ( } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts index 1f101e7d10..3fc8c35ac3 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts @@ -60,7 +60,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile = } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts index ce4b8cf6a4..fde1ce5e39 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts @@ -55,7 +55,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts index a5ef2bea35..1e2576865d 100644 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts +++ b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts @@ -58,7 +58,7 @@ export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip = } const accsResourceString = - await LitAccessControlConditionResource.generateLitActionResourceString( + await LitAccessControlConditionResource.generateResourceString( accs, encryptRes.dataToEncryptHash ); diff --git a/packages/auth-helpers/src/lib/resources.ts b/packages/auth-helpers/src/lib/resources.ts index 6d2f3aad4d..11d82184fa 100644 --- a/packages/auth-helpers/src/lib/resources.ts +++ b/packages/auth-helpers/src/lib/resources.ts @@ -53,7 +53,7 @@ export class LitAccessControlConditionResource * @param {string} dataToEncryptHash - The hash of the data to encrypt. * @returns {Promise} The composed resource string in the format 'hashedAccs/dataToEncryptHash'. */ - public static async generateLitActionResourceString( + public static async generateResourceString( accs: AccessControlConditions, dataToEncryptHash: string ): Promise {