Skip to content

Commit

Permalink
Use custom NbglReviewDisplay
Browse files Browse the repository at this point in the history
  • Loading branch information
yogh333 committed Oct 7, 2024
1 parent bacad90 commit 5387c6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion starknet/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ pub fn show_status(flag: bool, ctx: &mut Ctx) {
#[cfg(any(target_os = "stax", target_os = "flex"))]
{
let status = NbglReviewStatus::new();
status.show(flag);
status.show_and_return(flag);
ctx.home.show_and_return();
}
}
Expand Down
10 changes: 5 additions & 5 deletions starknet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ use ledger_device_sdk::io::Reply;

const SIG_LENGTH: u8 = 0x41;

fn handle_apdu(comm: &mut io::Comm, ins: &Ins, ctx: &mut Ctx) -> Result<(), Reply> {
fn handle_apdu(comm: &mut io::Comm, ins: &Ins, ctx: &mut Ctx) -> Result<Vec<u8>, Reply> {
if comm.rx == 0 {
return Err(io::StatusWords::NothingReceived.into());
}
Expand Down Expand Up @@ -215,11 +215,11 @@ fn handle_apdu(comm: &mut io::Comm, ins: &Ins, ctx: &mut Ctx) -> Result<(), Repl
ctx.hash.m_hash = crypto::tx_hash(&ctx.tx);
comm.append(ctx.hash.m_hash.value.as_ref());
crypto::sign_hash(ctx).unwrap();
display::show_status(true, ctx);
comm.append([SIG_LENGTH].as_slice());
comm.append(ctx.hash.r.as_ref());
comm.append(ctx.hash.s.as_ref());
comm.append([ctx.hash.v].as_slice());
display::show_status(true, ctx);
}
false => {
display::show_status(false, ctx);
Expand All @@ -233,11 +233,11 @@ fn handle_apdu(comm: &mut io::Comm, ins: &Ins, ctx: &mut Ctx) -> Result<(), Repl
true => {
comm.append(ctx.hash.m_hash.value.as_ref());
crypto::sign_hash(ctx).unwrap();
display::show_status(true, ctx);
comm.append([SIG_LENGTH].as_slice());
comm.append(ctx.hash.r.as_ref());
comm.append(ctx.hash.s.as_ref());
comm.append([ctx.hash.v].as_slice());
display::show_status(true, ctx);
}
false => {
display::show_status(false, ctx);
Expand Down Expand Up @@ -286,11 +286,11 @@ fn handle_apdu(comm: &mut io::Comm, ins: &Ins, ctx: &mut Ctx) -> Result<(), Repl
ctx.hash.m_hash = crypto::tx_hash(&ctx.tx);
comm.append(ctx.hash.m_hash.value.as_ref());
crypto::sign_hash(ctx).unwrap();
display::show_status(true, ctx);
comm.append([0x41].as_slice());
comm.append(ctx.hash.r.as_ref());
comm.append(ctx.hash.s.as_ref());
comm.append([ctx.hash.v].as_slice());
display::show_status(true, ctx);
}
false => {
display::show_status(false, ctx);
Expand All @@ -304,11 +304,11 @@ fn handle_apdu(comm: &mut io::Comm, ins: &Ins, ctx: &mut Ctx) -> Result<(), Repl
true => {
comm.append(ctx.hash.m_hash.value.as_ref());
crypto::sign_hash(ctx).unwrap();
display::show_status(true, ctx);
comm.append([0x41].as_slice());
comm.append(ctx.hash.r.as_ref());
comm.append(ctx.hash.s.as_ref());
comm.append([ctx.hash.v].as_slice());
display::show_status(true, ctx);
}
false => {
display::show_status(false, ctx);
Expand Down

0 comments on commit 5387c6f

Please sign in to comment.