-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1e7b585
commit 7798a1d
Showing
3 changed files
with
137 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#![no_std] | ||
#![no_main] | ||
|
||
// Force boot section to be embedded in | ||
use ledger_device_sdk as _; | ||
|
||
use include_gif::include_gif; | ||
use ledger_device_sdk::io::*; | ||
use ledger_device_sdk::nbgl::{init_comm, NbglChoice, NbglGlyph}; | ||
use ledger_secure_sdk_sys::*; | ||
|
||
#[panic_handler] | ||
fn panic(_: &core::panic::PanicInfo) -> ! { | ||
exit_app(1); | ||
} | ||
|
||
#[no_mangle] | ||
extern "C" fn sample_main() { | ||
unsafe { | ||
nbgl_refreshReset(); | ||
} | ||
|
||
let mut comm = Comm::new(); | ||
// Initialize reference to Comm instance for NBGL | ||
// API calls. | ||
init_comm(&mut comm); | ||
|
||
// Load glyph from 64x64 4bpp gif file with include_gif macro. Creates an NBGL compatible glyph. | ||
const WARNING: NbglGlyph = | ||
NbglGlyph::from_include(include_gif!("icons/Warning_64px.gif", NBGL)); | ||
|
||
let back_to_safety = NbglChoice::new().glyph(&WARNING) | ||
.status_text(Some("Transaction rejected"),None) | ||
.show( | ||
"Security risk detected", | ||
"It may not be safe to sign this transaction. To continue, you'll need to review the risk.", | ||
"Back to safety", | ||
"Review risk", | ||
); | ||
|
||
if !back_to_safety { | ||
NbglChoice::new() | ||
.status_text(Some("Transaction confirmed"), Some("Transaction rejected")) | ||
.show( | ||
"The transaction cannot be trusted", | ||
"Your Ledger cannot decode this transaction. If you sign it, you could be authorizing malicious actions that can drain your wallet.\n\nLearn more: ledger.com/e8", | ||
"I accept the risk", | ||
"Reject transaction" | ||
); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters