Skip to content

Conversation

@kouraf
Copy link
Contributor

@kouraf kouraf commented Oct 29, 2025

Description

This PR adds signTypedData functionality to the wrapped-keys package, enabling users to sign EIP-712 typed data using encrypted Ethereum keys. The implementation includes both the API layer and the underlying Lit Action functionality.

Key Changes:

  • Added signTypedDataWithEncryptedKey API function for signing typed data
  • Implemented signTypedDataEthereumKey Lit Action for actual signing logic
  • Enhanced type definitions to support typed data message parameters
  • Updated code repository and constants to include new signTypedData actions

Note: I'm unsure if this implementation meets your standards, but I needed this functionality ASAP for my project and it's working a 100% as expected. I'm happy to make any required changes to make it production-ready. I also have a signRawMessage implementation that I didn't include here to keep the PR cleaner.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • End-to-end testing with real PKP sessions

…hereum key

- Introduced signTypedDataWithEncryptedEthereumKey function for signing typed data using an encrypted Ethereum key.
- Updated API to include signTypedDataWithEncryptedKey.
- Enhanced types to support signTypedData message parameters.
- Updated constants and code repositories to include new signTypedData actions.
- Added tests for signTypedData functionality in the lit actions client.
@kouraf kouraf requested a review from Ansonhkg as a code owner October 29, 2025 13:01
@Ansonhkg
Copy link
Collaborator

Hi @kouraf, thanks for the PR!

Could you please also add tests in local-tests/tests/wrapped-keys, you could see how other tests are written in the same directory.

Thanks!

@kouraf
Copy link
Contributor Author

kouraf commented Oct 29, 2025

Hi @Ansonhkg do you have an up to date readme for running tests ? the one in local-tests says to use lit-assets but couldn't find it. and when i use run yarn test:local without setting the network to custom, i got a bunch of errors saying insufficient funds and [𐬺🧪 Tinny Environment𐬺] No available keys. Waiting...
i may be missing something if that's the case sorry for that!

@Ansonhkg
Copy link
Collaborator

Ansonhkg commented Oct 29, 2025

Hi @Ansonhkg do you have an up to date readme for running tests ? the one in local-tests says to use lit-assets but couldn't find it. and when i use run yarn test:local without setting the network to custom, i got a bunch of errors saying insufficient funds and [𐬺🧪 Tinny Environment𐬺] No available keys. Waiting... i may be missing something if that's the case sorry for that!

Yea sorry for the outdated docs, been busy on Naga!

yarn test:local is testing against local nodes using the lit-assets repo, I supposed you won't have access to this as it's private. So you will need to test it against live nodes.

You can do:

// datil-dev for Dev, datil-test for Test, datil for Mainnet
NETWORK=datil-dev yarn test:local --filter=<your_test_name>

You must also have the PRIVATE_KEYS env set, it accepts a string array of private keys. eg.

PRIVATE_KEYS="0x...1, 0x...2"

If you still can't run the tests, just commit the changes for the tests and we will take a look :)

- Introduced tests for signing typed data with both wrapped and generated Ethereum keys.
- Added failure tests for invalid parameters and decryption scenarios.
- Updated utility functions to derive Ethereum addresses from generated public keys.
- Enhanced existing test suite to include new test cases for Ethereum typed data signing.
…t parameters

- Updated the TypedData message structure to use more specific types for domain, types, and value fields.
- Simplified the test parameters in the Ethereum signing test to directly use wallet addresses.
- Updated related interfaces and types for consistency across the codebase.
@kouraf
Copy link
Contributor Author

kouraf commented Oct 29, 2025

Hi @Ansonhkg , I’ve added the tests and ran them on datil-dev with my keys. I also added some types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants