Skip to content

Commit ea9ec8f

Browse files
committed
Use blind signing dedicated API
1 parent 76916f0 commit ea9ec8f

File tree

3 files changed

+46
-21
lines changed

3 files changed

+46
-21
lines changed

ledger_device_sdk/src/nbgl.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use alloc::ffi::CString;
66
use alloc::vec::Vec;
77
use core::ffi::{c_char, c_int};
88
use core::mem::transmute;
9-
use include_gif::include_gif;
109
use ledger_secure_sdk_sys::*;
1110

1211
#[no_mangle]
@@ -210,15 +209,12 @@ trait ToMessage {
210209
}
211210

212211
impl TransactionType {
213-
pub fn to_c_type(&self, blind: bool, skippable: bool) -> nbgl_operationType_t {
212+
fn to_c_type(&self, skippable: bool) -> nbgl_operationType_t {
214213
let mut tx_type = match self {
215214
TransactionType::Transaction => TYPE_TRANSACTION.into(),
216215
TransactionType::Message => TYPE_MESSAGE.into(),
217216
TransactionType::Operation => TYPE_OPERATION.into(),
218217
};
219-
if blind {
220-
tx_type |= BLIND_OPERATION;
221-
}
222218
if skippable {
223219
tx_type |= SKIPPABLE_OPERATION;
224220
}

ledger_device_sdk/src/nbgl/nbgl_review.rs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,31 @@ impl<'a> NbglReview<'a> {
9292

9393
// Show the review on the device.
9494
self.ux_sync_init();
95-
nbgl_useCaseReview(
96-
self.tx_type.to_c_type(self.blind, false),
97-
&tag_value_list as *const nbgl_contentTagValueList_t,
98-
&icon as *const nbgl_icon_details_t,
99-
self.title.as_ptr() as *const c_char,
100-
self.subtitle.as_ptr() as *const c_char,
101-
self.finish_title.as_ptr() as *const c_char,
102-
Some(choice_callback),
103-
);
95+
match self.blind {
96+
true => {
97+
nbgl_useCaseReviewBlindSigning(
98+
self.tx_type.to_c_type(false),
99+
&tag_value_list as *const nbgl_contentTagValueList_t,
100+
&icon as *const nbgl_icon_details_t,
101+
self.title.as_ptr() as *const c_char,
102+
self.subtitle.as_ptr() as *const c_char,
103+
self.finish_title.as_ptr() as *const c_char,
104+
core::ptr::null(),
105+
Some(choice_callback),
106+
);
107+
}
108+
false => {
109+
nbgl_useCaseReview(
110+
self.tx_type.to_c_type(false),
111+
&tag_value_list as *const nbgl_contentTagValueList_t,
112+
&icon as *const nbgl_icon_details_t,
113+
self.title.as_ptr() as *const c_char,
114+
self.subtitle.as_ptr() as *const c_char,
115+
self.finish_title.as_ptr() as *const c_char,
116+
Some(choice_callback),
117+
);
118+
}
119+
}
104120
let sync_ret = self.ux_sync_wait(false);
105121

106122
// Return true if the user approved the transaction, false otherwise.

ledger_device_sdk/src/nbgl/nbgl_streaming_review.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,26 @@ impl NbglStreamingReview {
4343
let subtitle = CString::new(subtitle).unwrap();
4444

4545
self.ux_sync_init();
46-
nbgl_useCaseReviewStreamingStart(
47-
self.tx_type.to_c_type(self.blind, false),
48-
&self.icon as *const nbgl_icon_details_t,
49-
title.as_ptr() as *const c_char,
50-
subtitle.as_ptr() as *const c_char,
51-
Some(choice_callback),
52-
);
46+
match self.blind {
47+
true => {
48+
nbgl_useCaseReviewStreamingBlindSigningStart(
49+
self.tx_type.to_c_type(false),
50+
&self.icon as *const nbgl_icon_details_t,
51+
title.as_ptr() as *const c_char,
52+
subtitle.as_ptr() as *const c_char,
53+
Some(choice_callback),
54+
);
55+
}
56+
false => {
57+
nbgl_useCaseReviewStreamingStart(
58+
self.tx_type.to_c_type(false),
59+
&self.icon as *const nbgl_icon_details_t,
60+
title.as_ptr() as *const c_char,
61+
subtitle.as_ptr() as *const c_char,
62+
Some(choice_callback),
63+
);
64+
}
65+
}
5366
let sync_ret = self.ux_sync_wait(false);
5467

5568
// Return true if the user approved the transaction, false otherwise.

0 commit comments

Comments
 (0)