1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-18 13:38:12 +00:00

fixup! feat(core): implement thp context and cache

This commit is contained in:
M1nd3r 2024-11-18 14:26:19 +01:00
parent d666899cb9
commit 42df05750f
2 changed files with 2 additions and 5 deletions

View File

@ -15,11 +15,10 @@ from trezor.wire.errors import * # isort:skip # noqa: F401,F403
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any, Callable, Container from typing import Callable, Container
from trezor.wire import Handler, LoadedMessageType, WireInterface from trezor.wire import Handler, LoadedMessageType, WireInterface
HandlerFinder = Callable[[Any, Any], Handler | None]
Filter = Callable[[int, Handler], Handler] Filter = Callable[[int, Handler], Handler]
# If set to False protobuf messages marked with "experimental_message" option are rejected. # If set to False protobuf messages marked with "experimental_message" option are rejected.

View File

@ -5,7 +5,7 @@ from storage.cache_thp import MANAGEMENT_SESSION_ID, SessionThpCache
from trezor import log, loop, protobuf, utils from trezor import log, loop, protobuf, utils
from trezor.wire import message_handler, protocol_common from trezor.wire import message_handler, protocol_common
from trezor.wire.context import UnexpectedMessageException from trezor.wire.context import UnexpectedMessageException
from trezor.wire.message_handler import failure, find_handler from trezor.wire.message_handler import failure
from ..protocol_common import Context, Message from ..protocol_common import Context, Message
from . import SessionState from . import SessionState
@ -15,7 +15,6 @@ if TYPE_CHECKING:
from storage.cache_common import DataCache from storage.cache_common import DataCache
from ..message_handler import HandlerFinder
from .channel import Channel from .channel import Channel
pass pass
@ -34,7 +33,6 @@ class GenericSessionContext(Context):
self.channel: Channel = channel self.channel: Channel = channel
self.session_id: int = session_id self.session_id: int = session_id
self.incoming_message = loop.mailbox() self.incoming_message = loop.mailbox()
self.handler_finder: HandlerFinder = find_handler
async def handle(self) -> None: async def handle(self) -> None:
if __debug__ and utils.ALLOW_DEBUG_MESSAGES: if __debug__ and utils.ALLOW_DEBUG_MESSAGES: