Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,36 @@ jobs:
- name: Install project dependencies
run: bun install

- name: Debug Git and Environment
run: |
echo "Current branch:"
git branch --show-current
echo "Available branches:"
git branch -a
echo "Git remotes:"
git remote -v
echo "Last 3 commits:"
git log --oneline -3
echo "Git status:"
git status
echo "NX configuration:"
cat nx.json | head -10
echo "Prettier configuration:"
cat .prettierrc

- name: Lint
run: bun run nx format:check --all
run: |
echo "Running format check..."
# Use prettier directly to avoid NX git issues
npx prettier --check . || {
echo "Format check failed. Running prettier --write to fix issues..."
npx prettier --write .
echo "Checking again after formatting..."
npx prettier --check . || {
echo "Still failing after auto-format. Manual intervention needed."
exit 1
}
echo "Auto-formatting successful. All files are now properly formatted."
echo "Note: Some files were auto-formatted. Consider committing these changes in your next commit."
}
echo "Format check passed!"
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
tools
/packages/wasm/rust/*
/packages/wasm/src/pkg/*
**/*/dist
**/*/dist
1 change: 0 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"insertPragma": false,
"singleAttributePerLine": false,
"bracketSameLine": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
Expand Down
152 changes: 79 additions & 73 deletions e2e/src/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,93 +65,99 @@ describe('all', () => {
createPaymentManagerFlowTest(ctx, () => ctx.aliceEoaAuthContext)());
it('paymentDelegationFlow', () =>
createPaymentDelegationFlowTest(ctx, () => ctx.aliceEoaAuthContext)());
});

describe('integrations', () => {
describe('pkp viem account', () => {
it('sign message', () =>
createViemSignMessageTest(ctx, () => ctx.aliceEoaAuthContext)());
it('sign transaction', () =>
createViemSignTransactionTest(ctx, () => ctx.aliceEoaAuthContext)());
it('sign typed data', () =>
createViemSignTypedDataTest(ctx, () => ctx.aliceEoaAuthContext)());
describe('integrations', () => {
describe('pkp viem account', () => {
it('sign message', () =>
createViemSignMessageTest(ctx, () => ctx.aliceEoaAuthContext)());
it('sign transaction', () =>
createViemSignTransactionTest(
ctx,
() => ctx.aliceEoaAuthContext
)());
it('sign typed data', () =>
createViemSignTypedDataTest(ctx, () => ctx.aliceEoaAuthContext)());
});
});
});
});

describe('PKP Auth', () => {
console.log('🔐 Testing using Programmable Key Pair authentication');
describe('PKP Auth', () => {
console.log('🔐 Testing using Programmable Key Pair authentication');

describe('endpoints', () => {
it('pkpSign', () =>
createPkpSignTest(ctx, () => ctx.alicePkpAuthContext)());
it('executeJs', () =>
createExecuteJsTest(ctx, () => ctx.alicePkpAuthContext)());
it('viewPKPsByAddress', () =>
createViewPKPsByAddressTest(ctx, () => ctx.alicePkpAuthContext)());
it('viewPKPsByAuthData', () =>
createViewPKPsByAuthDataTest(ctx, () => ctx.alicePkpAuthContext)());
it('pkpEncryptDecrypt', () =>
createPkpEncryptDecryptTest(ctx, () => ctx.alicePkpAuthContext)());
it('encryptDecryptFlow', () =>
createEncryptDecryptFlowTest(ctx, () => ctx.alicePkpAuthContext)());
it('pkpPermissionsManagerFlow', () =>
createPkpPermissionsManagerFlowTest(
ctx,
() => ctx.alicePkpAuthContext
)());
});
describe('endpoints', () => {
it('pkpSign', () =>
createPkpSignTest(ctx, () => ctx.alicePkpAuthContext)());
it('executeJs', () =>
createExecuteJsTest(ctx, () => ctx.alicePkpAuthContext)());
it('viewPKPsByAddress', () =>
createViewPKPsByAddressTest(ctx, () => ctx.alicePkpAuthContext)());
it('viewPKPsByAuthData', () =>
createViewPKPsByAuthDataTest(ctx, () => ctx.alicePkpAuthContext)());
it('pkpEncryptDecrypt', () =>
createPkpEncryptDecryptTest(ctx, () => ctx.alicePkpAuthContext)());
it('encryptDecryptFlow', () =>
createEncryptDecryptFlowTest(ctx, () => ctx.alicePkpAuthContext)());
it('pkpPermissionsManagerFlow', () =>
createPkpPermissionsManagerFlowTest(
ctx,
() => ctx.alicePkpAuthContext
)());
});

describe('integrations', () => {
describe('pkp viem account', () => {
it('sign message', () =>
createViemSignMessageTest(ctx, () => ctx.alicePkpAuthContext)());
it('sign transaction', () =>
createViemSignTransactionTest(ctx, () => ctx.alicePkpAuthContext)());
it('sign typed data', () =>
createViemSignTypedDataTest(ctx, () => ctx.alicePkpAuthContext)());
describe('integrations', () => {
describe('pkp viem account', () => {
it('sign message', () =>
createViemSignMessageTest(ctx, () => ctx.alicePkpAuthContext)());
it('sign transaction', () =>
createViemSignTransactionTest(
ctx,
() => ctx.alicePkpAuthContext
)());
it('sign typed data', () =>
createViemSignTypedDataTest(ctx, () => ctx.alicePkpAuthContext)());
});
});
});
});

describe('Custom Auth', () => {
console.log('🔐 Testing using Custom authentication method');
describe('Custom Auth', () => {
console.log('🔐 Testing using Custom authentication method');

describe('endpoints', () => {
it('pkpSign', () =>
createPkpSignTest(ctx, () => aliceCustomAuthContext)());
it('executeJs', () =>
createExecuteJsTest(ctx, () => aliceCustomAuthContext)());
it('viewPKPsByAddress', () =>
createViewPKPsByAddressTest(ctx, () => aliceCustomAuthContext)());
it('viewPKPsByAuthData', () =>
createViewPKPsByAuthDataTest(ctx, () => aliceCustomAuthContext)());
it('pkpEncryptDecrypt', () =>
createPkpEncryptDecryptTest(ctx, () => aliceCustomAuthContext)());
it('encryptDecryptFlow', () =>
createEncryptDecryptFlowTest(ctx, () => aliceCustomAuthContext)());
it('pkpPermissionsManagerFlow', () =>
createPkpPermissionsManagerFlowTest(
ctx,
() => aliceCustomAuthContext
)());
});
describe('endpoints', () => {
it('pkpSign', () =>
createPkpSignTest(ctx, () => aliceCustomAuthContext)());
it('executeJs', () =>
createExecuteJsTest(ctx, () => aliceCustomAuthContext)());
it('viewPKPsByAddress', () =>
createViewPKPsByAddressTest(ctx, () => aliceCustomAuthContext)());
it('viewPKPsByAuthData', () =>
createViewPKPsByAuthDataTest(ctx, () => aliceCustomAuthContext)());
it('pkpEncryptDecrypt', () =>
createPkpEncryptDecryptTest(ctx, () => aliceCustomAuthContext)());
it('encryptDecryptFlow', () =>
createEncryptDecryptFlowTest(ctx, () => aliceCustomAuthContext)());
it('pkpPermissionsManagerFlow', () =>
createPkpPermissionsManagerFlowTest(
ctx,
() => aliceCustomAuthContext
)());
});

describe('integrations', () => {
describe('pkp viem account', () => {
it('sign message', () =>
createViemSignMessageTest(ctx, () => aliceCustomAuthContext)());
it('sign transaction', () =>
createViemSignTransactionTest(ctx, () => aliceCustomAuthContext)());
it('sign typed data', () =>
createViemSignTypedDataTest(ctx, () => aliceCustomAuthContext)());
describe('integrations', () => {
describe('pkp viem account', () => {
it('sign message', () =>
createViemSignMessageTest(ctx, () => aliceCustomAuthContext)());
it('sign transaction', () =>
createViemSignTransactionTest(ctx, () => aliceCustomAuthContext)());
it('sign typed data', () =>
createViemSignTypedDataTest(ctx, () => aliceCustomAuthContext)());
});
});
});
});

describe('EOA Native', () => {
console.log('🔐 Testing EOA native authentication and PKP minting');
describe('EOA Native', () => {
console.log('🔐 Testing EOA native authentication and PKP minting');

it('eoaNativeAuthFlow', () => createEoaNativeAuthFlowTest(ctx)());
it('eoaNativeAuthFlow', () => createEoaNativeAuthFlowTest(ctx)());
});
});
});
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "./node_modules/nx/schemas/nx-schema.json",
"affected": {
"defaultBase": "main"
"defaultBase": "origin/master"
Copy link
Preview

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the default base from 'main' to 'origin/master' may cause issues if the repository's primary branch is actually 'main'. Verify that 'master' is the correct primary branch name for this repository.

Suggested change
"defaultBase": "origin/master"
"defaultBase": "main"

Copilot uses AI. Check for mistakes.

},
"tasksRunnerOptions": {
"default": {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"gen:docs": "node ./tools/scripts/gen-doc.mjs",
"gen:readme": "node ./tools/scripts/gen-readme.mjs",
"prettier": "npx nx format:write --all",
"format:check": "npx nx format:check --all",
"link-all": "for dir in packages/*/; do echo \"Linking in $dir\"; (cd \"$dir\" && bun link) || { echo \"ERROR: Failed to link in $dir\"; exit 1; }; done",
"unlink-all": "for dir in packages/*/; do echo \"Unlinking in $dir\"; (cd \"$dir\" && bun unlink) || { echo \"ERROR: Failed to unlink in $dir\"; exit 1; }; done",
"auth-services": "cd packages/auth-services && bun run start",
Expand Down
3 changes: 3 additions & 0 deletions packages/constants/src/lib/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1428,3 +1428,6 @@ export const SIWE_URI_PREFIX = {

export type SIWE_URI_PREFIX_TYPE = ConstantKeys<typeof SIWE_URI_PREFIX>;
export type SIWE_URI_PREFIX_VALUES = ConstantValues<typeof SIWE_URI_PREFIX>;


Copy link
Preview

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DEV_PRIVATE_KEY constant should include a comment explaining its purpose and that it's the standard Anvil/Hardhat development private key to avoid confusion about security implications.

Suggested change
/**
* Standard Anvil/Hardhat development private key.
* This key is used for local development and testing only.
* It is publicly known and should never be used in production environments.
*/

Copilot uses AI. Check for mistakes.

export const DEV_PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
28 changes: 14 additions & 14 deletions packages/lit-client/src/lib/LitClient/createLitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
MintWithCustomAuthSchema,
} from './schemas/MintWithCustomAuthSchema';
import { NagaNetworkModule } from './type';
import { DEV_PRIVATE_KEY } from '@lit-protocol/constants';

const _logger = getChildLogger({
module: 'createLitClient',
Expand Down Expand Up @@ -175,8 +176,7 @@ export const _createNagaLitClient = async (
}
): Promise<LitNodeSignature> {
_logger.info(
`🔥 signing on ${params.chain} with ${params.signingScheme} (bypass: ${
params.bypassAutoHashing || false
`🔥 signing on ${params.chain} with ${params.signingScheme} (bypass: ${params.bypassAutoHashing || false
})`
);

Expand Down Expand Up @@ -219,7 +219,7 @@ export const _createNagaLitClient = async (
pricingContext: {
product: 'SIGN',
userMaxPrice: params.userMaxPrice,
nodePrices: currentConnectionInfo.priceFeedInfo.networkPrices,
nodePrices: jitContext.nodePrices,
threshold: currentHandshakeResult.threshold,
},
authContext: params.authContext,
Expand Down Expand Up @@ -383,7 +383,7 @@ export const _createNagaLitClient = async (
pricingContext: {
product: 'LIT_ACTION',
userMaxPrice: params.userMaxPrice,
nodePrices: currentConnectionInfo.priceFeedInfo.networkPrices,
nodePrices: jitContext.nodePrices,
threshold: currentHandshakeResult.threshold,
},
authContext: params.authContext,
Expand Down Expand Up @@ -650,7 +650,7 @@ export const _createNagaLitClient = async (
pricingContext: {
product: 'DECRYPTION',
userMaxPrice: params.userMaxPrice,
nodePrices: currentConnectionInfo.priceFeedInfo.networkPrices,
nodePrices: jitContext.nodePrices,
threshold: currentHandshakeResult.threshold,
},
authContext: params.authContext,
Expand Down Expand Up @@ -809,7 +809,7 @@ export const _createNagaLitClient = async (
viewPKPPermissions: async (pkpIdentifier: PkpIdentifierRaw) => {
// It's an Anvil private key, chill. 🤣
const account = privateKeyToAccount(
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
DEV_PRIVATE_KEY
);

const pkpPermissionsManager =
Expand All @@ -829,18 +829,18 @@ export const _createNagaLitClient = async (
},
viewPKPsByAuthData: async (params: {
authData:
| {
authMethodType: number | bigint;
authMethodId: string;
accessToken?: string;
}
| AuthData;
| {
authMethodType: number | bigint;
authMethodId: string;
accessToken?: string;
}
| AuthData;
pagination?: { limit?: number; offset?: number };
storageProvider?: PKPStorageProvider;
}) => {
// Use read-only account for viewing PKPs
const account = privateKeyToAccount(
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
DEV_PRIVATE_KEY
);

return await networkModule.chainApi.getPKPsByAuthData({
Expand All @@ -857,7 +857,7 @@ export const _createNagaLitClient = async (
}) => {
// Use read-only account for viewing PKPs
const account = privateKeyToAccount(
'0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'
DEV_PRIVATE_KEY
);

return await networkModule.chainApi.getPKPsByAddress({
Expand Down
Loading
Loading