Skip to content

Generate Evolu keys #5220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Generate Evolu keys #5220

wants to merge 1 commit into from

Conversation

obrusvit
Copy link
Contributor

@obrusvit obrusvit commented Jun 17, 2025

This PR implements generating keys for evolu by Trezor device.

For now, the functionality is available only in Debug firmware, so use e.g. this command for T3T1:

make build_firmware TREZOR_MODEL=T3T1 QUIET_MODE=1 PYOPT=0

The following trezorctl command triggers the feature:

trezorctl evolu get-keys

The resulting id, write key and encryption key is returned formatted in hex:

Please confirm action on your Trezor device.
owner_id: 653fd8c264386ec2354a338f1ea54633f1084d3b8e4fe7fca6310de5f7360536
write_key: c2b0dba320bedb87c6c410f4be0202f8ca3ffe3cc96f8be9f72abb7e943908ec
encryption_key: 9b8eac5f3f2e57a052d5ba56abceeca082909bef0b17a44f73f280d1296de1e5

Basic test against "all all ... all" seed included.

TODO:

  • update test vestors based on the new SLIP-21 path
  • rebase on main and update fixtures (new tests)
  • drop the DROP commit

@obrusvit obrusvit self-assigned this Jun 17, 2025
@obrusvit obrusvit added the core Trezor Core firmware. Runs on Trezor Model T and Safe models. label Jun 17, 2025
@github-project-automation github-project-automation bot moved this to 🔎 Needs review in Firmware Jun 17, 2025
Copy link

github-actions bot commented Jun 17, 2025

en main(all)

model device_test click_test persistence_test
T2T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3B1 test(all) main(all) test(all) main(all) test(all) main(all)
T3T1 test(all) main(all) test(all) main(all) test(all) main(all)
T3W1 test(all) main(all) test(all) main(all) test(all) main(all)

Latest CI run: 17157361698

@obrusvit obrusvit requested a review from Copilot June 17, 2025 21:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This draft PR introduces Evolu key generation support using a Trezor device in debug mode. Key changes include adding Evolu-related message types and classes across Rust, Python, and core modules, implementing a CLI command for retrieving keys, and updating protocol definitions and build scripts accordingly.

  • Added Evolu message enums and classes in both Rust and Python libraries.
  • Integrated a new CLI command (trezorctl evolu get-keys) that triggers the Evolu key derivation process.
  • Updated core modules, build scripts, and protocol files to support Evolu key functionality.

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rust/trezor-client/src/messages/generated.rs Added Evolu message definitions for key handling.
python/src/trezorlib/messages.py Introduced Evolu message types and classes in the Python messages API.
python/src/trezorlib/evolu.py Implemented the get_evolu_keys function.
python/src/trezorlib/cli/trezorctl.py Registered the evolu CLI command.
python/src/trezorlib/cli/evolu.py Defined the CLI command for retrieving Evolu keys.
core/src/trezor/messages.py Added Evolu message classes (note: EvoluKeys.init is a placeholder).
core/src/trezor/enums/init.py & MessageType.py Included Evolu message type enums.
core/src/apps/workflow_handlers.py Mapped EvoluGetKeys message to its corresponding app handler.
core/src/apps/evolu/get_keys.py Implemented derivation logic for Evolu keys.
core/src/apps/evolu/init.py Restricted Evolu functionality to non-production builds.
core/embed/upymod/qstrdefsport.h Updated Q definitions to include evolu messages.
core/SConscript.unix & core/SConscript.firmware Extended source file lists to include evolu modules.
common/protob/messages.proto & messages-evolu.proto Added protocol definitions for EvoluGetKeys and EvoluKeys.
Comments suppressed due to low confidence (1)

core/src/apps/evolu/get_keys.py:7

  • This new Evolu key derivation functionality lacks accompanying tests. Please add test cases to verify the derivation logic and behavior of the new feature.
async def get_keys(_msg: EvoluGetKeys) -> EvoluKeys:

@obrusvit obrusvit force-pushed the obrusvit/evolu-slip21-keys branch from 446a4f5 to dd6c4ff Compare July 14, 2025 21:38
@obrusvit obrusvit marked this pull request as ready for review July 14, 2025 21:39
@obrusvit obrusvit requested a review from M1nd3r July 14, 2025 21:39
@obrusvit
Copy link
Contributor Author

Fixups:

  • use the correct messages block (starting 2100) 8a1fbef
  • ignore Evolu messages on Legacy cf48add

@obrusvit obrusvit changed the title [DRAFT] Generate Evolu keys Generate Evolu keys Jul 15, 2025
Copy link
Member

@mmilata mmilata left a comment

Choose a reason for hiding this comment

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

Nit: could use link to the Evolu project somewhere, otherwise it's not very clear what it is.

@TychoVrahe TychoVrahe removed their request for review July 29, 2025 05:34
@obrusvit obrusvit force-pushed the obrusvit/evolu-slip21-keys branch from cb12cfe to 7cd60c8 Compare August 19, 2025 13:06
@obrusvit
Copy link
Contributor Author

I rebased on top of main and also made changes:

  • the handler was moved to apps/misc because having apps/nostr seems like an overkill
  • it's now also in production FW
  • the handler was reworked as of the comment from Petr Generate Evolu keys #5220 (comment)

@obrusvit obrusvit force-pushed the obrusvit/evolu-slip21-keys branch from 7cd60c8 to 4a29495 Compare August 19, 2025 16:13
@obrusvit obrusvit force-pushed the obrusvit/evolu-slip21-keys branch from 4a29495 to 83697b7 Compare August 22, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Trezor Core firmware. Runs on Trezor Model T and Safe models.
Projects
Status: 🔎 Needs review
Development

Successfully merging this pull request may close these issues.

5 participants