mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-25 07:48:10 +00:00
common: rename ClearSession to LockDevice, introduce EndSession
This commit is contained in:
parent
32fcc4ad9c
commit
0600d87c8c
@ -93,11 +93,21 @@ message Features {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: clear session (removes cached PIN, passphrase, etc).
|
||||
* Request: soft-lock the device. Following actions will require PIN. Passphrases remain cached.
|
||||
* @start
|
||||
* @next Success
|
||||
*/
|
||||
message ClearSession {
|
||||
message LockDevice {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request: end the current sesson. Following actions must call Initialize again.
|
||||
* Cache for the current session is discarded, other sessions remain intact.
|
||||
* Device is not PIN-locked.
|
||||
* @start
|
||||
* @next Success
|
||||
*/
|
||||
message EndSession {
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ enum MessageType {
|
||||
MessageType_PinMatrixRequest = 18 [(wire_out) = true];
|
||||
MessageType_PinMatrixAck = 19 [(wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true];
|
||||
MessageType_Cancel = 20 [(wire_in) = true, (wire_tiny) = true];
|
||||
MessageType_ClearSession = 24 [(wire_in) = true];
|
||||
MessageType_LockDevice = 24 [(wire_in) = true];
|
||||
MessageType_ApplySettings = 25 [(wire_in) = true];
|
||||
MessageType_ButtonRequest = 26 [(wire_out) = true];
|
||||
MessageType_ButtonAck = 27 [(wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true];
|
||||
@ -63,6 +63,7 @@ enum MessageType {
|
||||
MessageType_GetNextU2FCounter = 80 [(wire_in) = true];
|
||||
MessageType_NextU2FCounter = 81 [(wire_out) = true];
|
||||
MessageType_ChangeWipeCode = 82 [(wire_in) = true];
|
||||
MessageType_EndSession = 83 [(wire_in) = true];
|
||||
|
||||
// Deprecated messages, kept for protobuf compatibility.
|
||||
// Both are marked wire_out so that we don't need to implement incoming handler for legacy
|
||||
|
14
core/src/trezor/messages/EndSession.py
Normal file
14
core/src/trezor/messages/EndSession.py
Normal file
@ -0,0 +1,14 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
import protobuf as p
|
||||
|
||||
if __debug__:
|
||||
try:
|
||||
from typing import Dict, List # noqa: F401
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class EndSession(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 83
|
@ -10,5 +10,5 @@ if __debug__:
|
||||
pass
|
||||
|
||||
|
||||
class ClearSession(p.MessageType):
|
||||
class LockDevice(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 24
|
@ -19,7 +19,7 @@ Features = 17 # type: Literal[17]
|
||||
PinMatrixRequest = 18 # type: Literal[18]
|
||||
PinMatrixAck = 19 # type: Literal[19]
|
||||
Cancel = 20 # type: Literal[20]
|
||||
ClearSession = 24 # type: Literal[24]
|
||||
LockDevice = 24 # type: Literal[24]
|
||||
ApplySettings = 25 # type: Literal[25]
|
||||
ButtonRequest = 26 # type: Literal[26]
|
||||
ButtonAck = 27 # type: Literal[27]
|
||||
@ -38,6 +38,7 @@ SdProtect = 79 # type: Literal[79]
|
||||
GetNextU2FCounter = 80 # type: Literal[80]
|
||||
NextU2FCounter = 81 # type: Literal[81]
|
||||
ChangeWipeCode = 82 # type: Literal[82]
|
||||
EndSession = 83 # type: Literal[83]
|
||||
Deprecated_PassphraseStateRequest = 77 # type: Literal[77]
|
||||
Deprecated_PassphraseStateAck = 78 # type: Literal[78]
|
||||
FirmwareErase = 6 # type: Literal[6]
|
||||
|
@ -62,7 +62,8 @@ void fsm_msgResetDevice(const ResetDevice *msg);
|
||||
void fsm_msgEntropyAck(const EntropyAck *msg);
|
||||
void fsm_msgBackupDevice(const BackupDevice *msg);
|
||||
void fsm_msgCancel(const Cancel *msg);
|
||||
void fsm_msgClearSession(const ClearSession *msg);
|
||||
void fsm_msgLockDevice(const LockDevice *msg);
|
||||
void fsm_msgEndSession(const EndSession *msg);
|
||||
void fsm_msgApplySettings(const ApplySettings *msg);
|
||||
void fsm_msgApplyFlags(const ApplyFlags *msg);
|
||||
void fsm_msgRecoveryDevice(const RecoveryDevice *msg);
|
||||
|
@ -345,15 +345,19 @@ void fsm_msgCancel(const Cancel *msg) {
|
||||
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
|
||||
}
|
||||
|
||||
void fsm_msgClearSession(const ClearSession *msg) {
|
||||
void fsm_msgLockDevice(const LockDevice *msg) {
|
||||
(void)msg;
|
||||
// we do not actually clear the session, we just lock it
|
||||
// TODO: the message should be called LockSession see #819
|
||||
config_lockDevice();
|
||||
layoutScreensaver();
|
||||
fsm_sendSuccess(_("Session cleared"));
|
||||
}
|
||||
|
||||
void fsm_msgEndSession(const EndSession *msg) {
|
||||
(void)msg;
|
||||
// TODO
|
||||
fsm_sendFailure(FailureType_Failure_FirmwareError, "Not implemented");
|
||||
}
|
||||
|
||||
void fsm_msgApplySettings(const ApplySettings *msg) {
|
||||
CHECK_PARAM(
|
||||
!msg->has_passphrase_always_on_device,
|
||||
|
@ -285,7 +285,7 @@ class TrezorClient:
|
||||
|
||||
@tools.session
|
||||
def clear_session(self):
|
||||
resp = self.call_raw(messages.ClearSession())
|
||||
resp = self.call_raw(messages.LockDevice()) # TODO fix this
|
||||
if isinstance(resp, messages.Success):
|
||||
self.session_id = None
|
||||
self.init_device()
|
||||
|
14
python/src/trezorlib/messages/EndSession.py
Normal file
14
python/src/trezorlib/messages/EndSession.py
Normal file
@ -0,0 +1,14 @@
|
||||
# Automatically generated by pb2py
|
||||
# fmt: off
|
||||
from .. import protobuf as p
|
||||
|
||||
if __debug__:
|
||||
try:
|
||||
from typing import Dict, List # noqa: F401
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
|
||||
class EndSession(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 83
|
@ -10,5 +10,5 @@ if __debug__:
|
||||
pass
|
||||
|
||||
|
||||
class ClearSession(p.MessageType):
|
||||
class LockDevice(p.MessageType):
|
||||
MESSAGE_WIRE_TYPE = 24
|
@ -17,7 +17,7 @@ Features = 17 # type: Literal[17]
|
||||
PinMatrixRequest = 18 # type: Literal[18]
|
||||
PinMatrixAck = 19 # type: Literal[19]
|
||||
Cancel = 20 # type: Literal[20]
|
||||
ClearSession = 24 # type: Literal[24]
|
||||
LockDevice = 24 # type: Literal[24]
|
||||
ApplySettings = 25 # type: Literal[25]
|
||||
ButtonRequest = 26 # type: Literal[26]
|
||||
ButtonAck = 27 # type: Literal[27]
|
||||
@ -36,6 +36,7 @@ SdProtect = 79 # type: Literal[79]
|
||||
GetNextU2FCounter = 80 # type: Literal[80]
|
||||
NextU2FCounter = 81 # type: Literal[81]
|
||||
ChangeWipeCode = 82 # type: Literal[82]
|
||||
EndSession = 83 # type: Literal[83]
|
||||
Deprecated_PassphraseStateRequest = 77 # type: Literal[77]
|
||||
Deprecated_PassphraseStateAck = 78 # type: Literal[78]
|
||||
FirmwareErase = 6 # type: Literal[6]
|
||||
|
@ -34,7 +34,6 @@ from .ChangePin import ChangePin
|
||||
from .ChangeWipeCode import ChangeWipeCode
|
||||
from .CipherKeyValue import CipherKeyValue
|
||||
from .CipheredKeyValue import CipheredKeyValue
|
||||
from .ClearSession import ClearSession
|
||||
from .CosiCommit import CosiCommit
|
||||
from .CosiCommitment import CosiCommitment
|
||||
from .CosiSign import CosiSign
|
||||
@ -59,6 +58,7 @@ from .DebugMoneroDiagRequest import DebugMoneroDiagRequest
|
||||
from .Deprecated_PassphraseStateAck import Deprecated_PassphraseStateAck
|
||||
from .Deprecated_PassphraseStateRequest import Deprecated_PassphraseStateRequest
|
||||
from .ECDHSessionKey import ECDHSessionKey
|
||||
from .EndSession import EndSession
|
||||
from .Entropy import Entropy
|
||||
from .EntropyAck import EntropyAck
|
||||
from .EntropyRequest import EntropyRequest
|
||||
@ -130,6 +130,7 @@ from .LiskTransactionAsset import LiskTransactionAsset
|
||||
from .LiskTransactionCommon import LiskTransactionCommon
|
||||
from .LiskVerifyMessage import LiskVerifyMessage
|
||||
from .LoadDevice import LoadDevice
|
||||
from .LockDevice import LockDevice
|
||||
from .MessageSignature import MessageSignature
|
||||
from .MoneroAccountPublicAddress import MoneroAccountPublicAddress
|
||||
from .MoneroAddress import MoneroAddress
|
||||
|
Loading…
Reference in New Issue
Block a user