Skip to content

Commit 58d4e02

Browse files
committed
feat(reset): drive and verify on-device dice-entropy collection
Regenerated bindings for device-protocol feat/dice-entropy (ResetDevice.dice_entropy, DebugLinkDecision.input, DebugLinkState.dice_digest, ButtonRequest_DiceRoll). debuglink gains press_input() (chunked synthetic roll injection; each chunk must fit the firmware's 40-char max_size) and read_dice_digest(). test_reset_device_dice runs the full flow against the emulator: the DiceRoll ButtonRequest announcement, injection in 40-char chunks with undo churn, a host-side simulation of the same append/undo rules, the device digest matching sha256 of exactly the expected 99-roll string, and the post-mix internal entropy still producing the documented sha256(internal || external) mnemonic. Version-gated to 7.15.0.
1 parent 1f2eecd commit 58d4e02

5 files changed

Lines changed: 217 additions & 97 deletions

File tree

‎device-protocol‎

‎keepkeylib/debuglink.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ def read_reset_entropy(self):
8787
obj = self._call(proto.DebugLinkGetState())
8888
return obj.reset_entropy
8989

90+
def read_dice_digest(self):
91+
obj = self._call(proto.DebugLinkGetState())
92+
return obj.dice_digest
93+
9094
def read_passphrase_protection(self):
9195
obj = self._call(proto.DebugLinkGetState())
9296
return obj.passphrase_protection
@@ -127,6 +131,13 @@ def press_button(self, yes_no):
127131
def press_yes(self):
128132
self.press_button(True)
129133

134+
def press_input(self, text):
135+
"""Send synthetic keyboard input to an on-device entry flow
136+
(dice rolls: '1'-'6' and 'u' for undo). Keep each chunk within
137+
the firmware's DebugLinkDecision.input max_size (40 chars)."""
138+
self.log("Injecting input", text)
139+
self._call(proto.DebugLinkDecision(yes_no=False, input=text), nowait=True)
140+
130141
def press_no(self):
131142
self.press_button(False)
132143

‎keepkeylib/messages_pb2.py‎

Lines changed: 113 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎keepkeylib/types_pb2.py‎

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)