Skip to content

Commit 42c1369

Browse files
committed
feat(python): evolu CLI
[no changelog]
1 parent 396611f commit 42c1369

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

python/src/trezorlib/cli/evolu.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This file is part of the Trezor project.
2+
#
3+
# Copyright (C) 2012-2025 SatoshiLabs and contributors
4+
#
5+
# This library is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU Lesser General Public License version 3
7+
# as published by the Free Software Foundation.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the License along with this library.
15+
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
16+
17+
from __future__ import annotations
18+
19+
import typing as t
20+
21+
import click
22+
23+
from .. import evolu, messages
24+
from . import with_client
25+
26+
if t.TYPE_CHECKING:
27+
from ..client import TrezorClient
28+
29+
30+
@click.group(name="evolu")
31+
def cli() -> None:
32+
"""Evolu commands."""
33+
34+
35+
@cli.command()
36+
@with_client
37+
def get_keys(
38+
client: "TrezorClient",
39+
) -> dict[str, str]:
40+
"""Return the SLIP-21 Evolu keys."""
41+
42+
keys: messages.EvoluKeys = evolu.get_evolu_keys(
43+
client,
44+
)
45+
return {
46+
"owner_id": keys.owner_id.hex(),
47+
"write_key": keys.write_key.hex(),
48+
"encryption_key": keys.encryption_key.hex(),
49+
}

python/src/trezorlib/cli/trezorctl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
device,
4141
eos,
4242
ethereum,
43+
evolu,
4344
fido,
4445
firmware,
4546
monero,
@@ -405,6 +406,7 @@ def wait_for_emulator(obj: TrezorConnection, timeout: float) -> None:
405406
cli.add_command(device.cli)
406407
cli.add_command(eos.cli)
407408
cli.add_command(ethereum.cli)
409+
cli.add_command(evolu.cli)
408410
cli.add_command(fido.cli)
409411
cli.add_command(monero.cli)
410412
cli.add_command(nem.cli)

python/src/trezorlib/evolu.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This file is part of the Trezor project.
2+
#
3+
# Copyright (C) 2012-2025 SatoshiLabs and contributors
4+
#
5+
# This library is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU Lesser General Public License version 3
7+
# as published by the Free Software Foundation.
8+
#
9+
# This library is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU Lesser General Public License for more details.
13+
#
14+
# You should have received a copy of the License along with this library.
15+
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
16+
17+
18+
from typing import TYPE_CHECKING
19+
20+
from . import messages
21+
22+
if TYPE_CHECKING:
23+
from .client import TrezorClient
24+
25+
26+
def get_evolu_keys(client: "TrezorClient") -> messages.EvoluKeys:
27+
return client.call(
28+
messages.EvoluGetKeys(),
29+
expect=messages.EvoluKeys,
30+
)

0 commit comments

Comments
 (0)