Skip to content

Commit 226198d

Browse files
authored
Merge branch 'feature/jss-93-refactor-bun-pnpm' into feature/jss-105-refactor-auth-services-from-elysia-to-express
2 parents 36cb13a + dba7110 commit 226198d

File tree

11 files changed

+193
-104
lines changed

11 files changed

+193
-104
lines changed

packages/access-control-conditions/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"typings": "./src/index.d.ts",
2727
"dependencies": {
2828
"ethers": "^5.7.1",
29-
"zod": "3.24.3"
29+
"zod": "3.24.3",
30+
"@ethersproject/providers": "5.7.0"
3031
}
3132
}

packages/artillery/project.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,53 @@
77
"init": {
88
"executor": "nx:run-commands",
99
"options": {
10-
"command": "tsx packages/artillery/src/init.ts"
10+
"cwd": "{projectRoot}",
11+
"command": "tsx src/init.ts"
1112
}
1213
},
1314
"balance-status": {
1415
"executor": "nx:run-commands",
1516
"options": {
16-
"command": "tsx packages/artillery/src/balance-status.ts"
17+
"cwd": "{projectRoot}",
18+
"command": "tsx src/balance-status.ts"
1719
}
1820
},
1921
"run:pkp-sign": {
2022
"executor": "nx:run-commands",
2123
"options": {
22-
"command": "artillery run packages/artillery/configs/pkp-sign.yml"
24+
"cwd": "{projectRoot}",
25+
"command": "artillery run configs/pkp-sign.yml"
2326
}
2427
},
2528
"run:encrypt-decrypt": {
2629
"executor": "nx:run-commands",
2730
"options": {
28-
"command": "artillery run packages/artillery/configs/encrypt-decrypt.yml"
31+
"cwd": "{projectRoot}",
32+
"command": "artillery run configs/encrypt-decrypt.yml"
2933
}
3034
},
3135
"run:execute": {
3236
"executor": "nx:run-commands",
3337
"options": {
34-
"command": "artillery run packages/artillery/configs/execute.yml"
38+
"cwd": "{projectRoot}",
39+
"command": "artillery run configs/execute.yml"
3540
}
3641
},
3742
"run:mix": {
3843
"executor": "nx:run-commands",
3944
"options": {
40-
"command": "artillery run packages/artillery/configs/mix.yml"
45+
"cwd": "{projectRoot}",
46+
"command": "artillery run configs/mix.yml"
4147
}
4248
},
4349
"run:sign-session-key": {
4450
"executor": "nx:run-commands",
4551
"options": {
46-
"command": "artillery run packages/artillery/configs/sign-session-key.yml"
52+
"cwd": "{projectRoot}",
53+
"command": "artillery run configs/sign-session-key.yml"
4754
}
4855
}
4956
},
5057
"tags": []
5158
}
5259

53-

packages/auth-helpers/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"siwe": "^2.3.2",
3535
"siwe-recap": "0.0.2-alpha.0",
3636
"viem": "2.29.4",
37-
"zod": "3.24.3"
37+
"zod": "3.24.3",
38+
"@ethersproject/transactions": "5.7.0"
3839
}
3940
}

packages/auth/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"universal"
2323
],
2424
"dependencies": {
25-
"@noble/curves": "^1.8.1",
25+
"@noble/hashes": "1.8.0",
26+
"@noble/curves": "1.8.1",
2627
"@simplewebauthn/browser": "^7.2.0",
2728
"@simplewebauthn/typescript-types": "^7.0.0",
2829
"@wagmi/core": "^2.17.1",

packages/e2e/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@
3030
"author": "Lit Protocol",
3131
"license": "MIT",
3232
"dependencies": {
33-
"viem": "2.29.4",
34-
"zod": "^3.22.0"
33+
"zod": "3.24.3"
3534
},
3635
"devDependencies": {
37-
"@types/node": "^20.0.0",
38-
"typescript": "^5.0.0"
36+
"@types/node": "20.0.0",
37+
"typescript": "5.8.3"
3938
},
4039
"peerDependencies": {
4140
"@lit-protocol/access-control-conditions": "workspace:*",
4241
"@lit-protocol/auth": "workspace:*",
4342
"@lit-protocol/lit-client": "workspace:*",
4443
"@lit-protocol/networks": "workspace:*",
45-
"@lit-protocol/schemas": "workspace:*"
44+
"@lit-protocol/schemas": "workspace:*",
45+
"viem": "2.29.4"
4646
},
4747
"engines": {
4848
"node": ">=18.0.0"

packages/e2e/src/e2e.spec.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,13 @@ describe('all', () => {
144144
ctx.eveViemAccountPkp.pubkey
145145
)());
146146
it('viewPKPsByAddress', () =>
147-
createViewPKPsByAddressTest(
148-
ctx,
149-
() => eveCustomAuthContext,
150-
ctx.eveViemAccountPkp.pubkey
151-
)());
147+
createViewPKPsByAddressTest(ctx, () => ctx.aliceEoaAuthContext)());
152148
it('viewPKPsByAuthData', () =>
153149
createViewPKPsByAuthDataTest(ctx, () => eveCustomAuthContext)());
154150
it('pkpEncryptDecrypt', () =>
155-
createPkpEncryptDecryptTest(
156-
ctx,
157-
() => eveCustomAuthContext,
158-
ctx.eveViemAccountPkp.ethAddress
159-
)());
151+
createPkpEncryptDecryptTest(ctx, () => ctx.aliceEoaAuthContext)());
160152
it('encryptDecryptFlow', () =>
161-
createEncryptDecryptFlowTest(
162-
ctx,
163-
() => eveCustomAuthContext,
164-
ctx.eveViemAccountPkp.pubkey
165-
)());
153+
createEncryptDecryptFlowTest(ctx, () => ctx.aliceEoaAuthContext)());
166154

167155
// Disable for now because it requires a different flow
168156
// it('pkpPermissionsManagerFlow', () =>

packages/e2e/src/helper/auth-contexts.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import { init } from '../init';
55
*/
66
export const createPkpAuthContext: (
77
ctx: Awaited<ReturnType<typeof init>>
8-
) => Promise<any> = async (
9-
ctx: Awaited<ReturnType<typeof init>>
10-
) => {
8+
) => Promise<any> = async (ctx: Awaited<ReturnType<typeof init>>) => {
119
console.log('🔁 Creating PKP Auth Context');
1210
try {
1311
const pkpAuthContext = await ctx.authManager.createPkpAuthContext({
@@ -37,22 +35,14 @@ export const createPkpAuthContext: (
3735
*/
3836
export const createCustomAuthContext: (
3937
ctx: Awaited<ReturnType<typeof init>>
40-
) => Promise<any> = async (
41-
ctx: Awaited<ReturnType<typeof init>>
42-
) => {
38+
) => Promise<any> = async (ctx: Awaited<ReturnType<typeof init>>) => {
4339
console.log('🔁 Creating Custom Auth Context');
40+
4441
try {
4542
// Set up custom auth method type and validation IPFS CID (from custom-auth-flow example)
46-
const uniqueDappName = 'e2e-test-dapp';
47-
const uniqueAuthMethodType = hexToBigInt(
48-
keccak256(toBytes(uniqueDappName))
49-
);
50-
const uniqueUserId = `${uniqueDappName}-alice`;
51-
const authMethodId = keccak256(toBytes(uniqueUserId));
52-
const validationIpfsCid = 'QmYLeVmwJPVs7Uebk85YdVPivMyrvoeKR6X37kyVRZUXW4';
5343

5444
const customAuthContext = await ctx.authManager.createCustomAuthContext({
55-
pkpPublicKey: ctx.aliceViemAccountPkp.publicKey,
45+
pkpPublicKey: ctx.eveViemAccountPkp.pubkey,
5646
authConfig: {
5747
resources: [
5848
['pkp-signing', '*'],
@@ -63,17 +53,17 @@ export const createCustomAuthContext: (
6353
},
6454
litClient: ctx.litClient,
6555
customAuthParams: {
66-
litActionIpfsId: validationIpfsCid,
56+
litActionIpfsId: ctx.eveValidationIpfsCid,
6757
jsParams: {
68-
pkpPublicKey: ctx.aliceViemAccountPkp.publicKey,
69-
username: 'alice',
58+
pkpPublicKey: ctx.eveViemAccountPkp.pubkey,
59+
username: 'eve',
7060
password: 'lit',
71-
authMethodId: authMethodId,
61+
authMethodId: ctx.eveCustomAuthData.authMethodId,
7262
},
7363
},
7464
});
7565

76-
console.log('✅ Custom Auth Context created');
66+
console.log('✅ Custom Auth Context created', customAuthContext);
7767
return customAuthContext;
7868
} catch (e) {
7969
console.error('❌ Error creating Custom Auth Context', e);

packages/lit-client/src/lib/LitClient/createLitClient.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ import {
1010
} from '@lit-protocol/access-control-conditions';
1111
import { encrypt as blsEncrypt } from '@lit-protocol/crypto';
1212
import { getChildLogger } from '@lit-protocol/logger';
13-
import type {
14-
LitNetworkModule,
15-
PKPStorageProvider,
13+
import {
14+
type LitNetworkModule,
15+
type PKPStorageProvider,
16+
type ExpectedAccountOrWalletClient,
17+
type GenericTxRes,
18+
type LitTxRes,
19+
type PKPData,
20+
type AuthMethod,
21+
PKPPermissionsManager,
22+
PaymentManager,
1623
} from '@lit-protocol/networks';
24+
1725
import {
1826
AuthContextSchema2,
1927
AuthData,
@@ -736,8 +744,14 @@ export const _createNagaLitClient = async (
736744
loginUrl: networkModule.getDefaultLoginBaseUrl(),
737745
},
738746
disconnect: _stateManager.stop,
739-
mintWithEoa: networkModule.chainApi.mintWithEoa,
740-
mintWithAuth: networkModule.chainApi.mintWithAuth,
747+
mintWithEoa: networkModule.chainApi.mintWithEoa as (params: {
748+
account: ExpectedAccountOrWalletClient;
749+
}) => Promise<GenericTxRes<LitTxRes<PKPData>, PKPData>>,
750+
mintWithAuth: networkModule.chainApi.mintWithAuth as (params: {
751+
account: ExpectedAccountOrWalletClient;
752+
authData: any;
753+
scopes: string[];
754+
}) => Promise<GenericTxRes<LitTxRes<PKPData>, PKPData>>,
741755
mintWithCustomAuth: async (params: MintWithCustomAuthRequest) => {
742756
const validatedParams = MintWithCustomAuthSchema.parse(params);
743757

packages/networks/src/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,18 @@ export type { PKPStorageProvider } from './storage/types';
3939

4040
// Schema types
4141
export type { MintRequestRaw } from './networks/vNaga/shared/managers/LitChainClient/schemas/MintRequestSchema';
42+
43+
// ----- re-exports for SDK consumers
44+
export type { ExpectedAccountOrWalletClient } from './networks/vNaga/shared/managers/contract-manager/createContractsManager';
45+
export { PKPPermissionsManager } from './networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager';
46+
export { PaymentManager } from './networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager';
47+
export type {
48+
GenericTxRes,
49+
LitTxRes,
50+
} from './networks/vNaga/shared/managers/LitChainClient/apis/types';
51+
export type { PKPData } from './networks/vNaga/shared/managers/LitChainClient/schemas/shared/PKPDataSchema';
52+
export type { AuthMethod } from './networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext';
53+
export type { PkpIdentifierRaw } from './networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId';
54+
export { getMaxPricesForNodeProduct } from './networks/vNaga/shared/managers/pricing-manager/getMaxPricesForNodeProduct';
55+
export { getUserMaxPrice } from './networks/vNaga/shared/managers/pricing-manager/getUserMaxPrice';
56+
export { PRODUCT_IDS } from './networks/vNaga/shared/managers/pricing-manager/constants';

packages/networks/src/storage/types.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { PKPInfo } from '@lit-protocol/types';
2-
1+
import { PKPData } from '@lit-protocol/schemas';
32
export interface PKPStorageProvider {
43
readPKPTokens?(params: {
54
authMethodType: number | bigint;
@@ -37,11 +36,11 @@ export interface PKPStorageProvider {
3736
readPKPs?(params: {
3837
authMethodType: number | bigint;
3938
authMethodId: string;
40-
}): Promise<PKPInfo[] | null>;
39+
}): Promise<PKPData[] | null>;
4140

4241
writePKPs?(params: {
4342
authMethodType: number | bigint;
4443
authMethodId: string;
45-
pkps: PKPInfo[];
44+
pkps: PKPData[];
4645
}): Promise<void>;
4746
}

0 commit comments

Comments
 (0)