flipbip_scene_1.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. #include "../flipbip.h"
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. #include <input/input.h>
  5. #include <gui/elements.h>
  6. //#include <dolphin/dolphin.h>
  7. #include <storage/storage.h>
  8. #include "FlipBIP_icons.h"
  9. #include "../helpers/flipbip_haptic.h"
  10. #include "../helpers/flipbip_led.h"
  11. #include "../helpers/flipbip_string.h"
  12. #include "../helpers/flipbip_file.h"
  13. #include <string.h>
  14. #include "../crypto/rand.h"
  15. #include "../crypto/bip32.h"
  16. #include "../crypto/bip39.h"
  17. #include "../crypto/curves.h"
  18. #include "../crypto/memzero.h"
  19. #define DERIV_PURPOSE 44
  20. #define DERIV_ACCOUNT 0
  21. #define DERIV_CHANGE 0
  22. // bip44_coin, xprv_version, xpub_version, addr_version, wif_version, addr_format
  23. const uint32_t COIN_INFO_ARRAY[3][6] = {
  24. {COIN_BTC, 0x0488ade4, 0x0488b21e, 0x00, 0x80, FlipBipCoinBTC0},
  25. {COIN_ETH, 0x0488ade4, 0x0488b21e, 0x00, 0x80, FlipBipCoinETH60},
  26. {COIN_DOGE, 0x02fac398, 0x02facafd, 0x1e, 0x9e, FlipBipCoinBTC0}
  27. };
  28. // coin_name, derivation_path
  29. const char* COIN_TEXT_ARRAY[3][2] = {
  30. {"BTC", "m/44'/0'/0'/0"},
  31. {"ETH", "m/44'/60'/0'/0"},
  32. {"DOGE", "m/44'/3'/0'/0"}
  33. };
  34. struct FlipBipScene1 {
  35. View* view;
  36. FlipBipScene1Callback callback;
  37. void* context;
  38. };
  39. typedef struct {
  40. int page;
  41. int strength;
  42. uint32_t coin;
  43. bool overwrite;
  44. bool mnemonic_only;
  45. CONFIDENTIAL const char* mnemonic;
  46. CONFIDENTIAL uint8_t seed[64];
  47. CONFIDENTIAL const HDNode* node;
  48. CONFIDENTIAL const char* xprv_root;
  49. CONFIDENTIAL const char* xprv_account;
  50. CONFIDENTIAL const char* xpub_account;
  51. CONFIDENTIAL const char* xprv_extended;
  52. CONFIDENTIAL const char* xpub_extended;
  53. } FlipBipScene1Model;
  54. static CONFIDENTIAL char s_disp_text1[30 + 1];
  55. static CONFIDENTIAL char s_disp_text2[30 + 1];
  56. static CONFIDENTIAL char s_disp_text3[30 + 1];
  57. static CONFIDENTIAL char s_disp_text4[30 + 1];
  58. static CONFIDENTIAL char s_disp_text5[30 + 1];
  59. static CONFIDENTIAL char s_disp_text6[30 + 1];
  60. static const char* s_derivation_text = "m/44'/X'/0'/0";
  61. //static bool s_busy = false;
  62. void flipbip_scene_1_set_callback(
  63. FlipBipScene1* instance,
  64. FlipBipScene1Callback callback,
  65. void* context) {
  66. furi_assert(instance);
  67. furi_assert(callback);
  68. instance->callback = callback;
  69. instance->context = context;
  70. }
  71. static void flipbip_scene_1_draw_generic(const char* text, size_t line_len) {
  72. // Split the text into parts
  73. for(size_t si = 1; si <= 6; si++) {
  74. char* ptr = NULL;
  75. if(si == 1)
  76. ptr = s_disp_text1;
  77. else if(si == 2)
  78. ptr = s_disp_text2;
  79. else if(si == 3)
  80. ptr = s_disp_text3;
  81. else if(si == 4)
  82. ptr = s_disp_text4;
  83. else if(si == 5)
  84. ptr = s_disp_text5;
  85. else if(si == 6)
  86. ptr = s_disp_text6;
  87. memzero(ptr, 30 + 1);
  88. if(line_len > 30) {
  89. strncpy(ptr, text + ((si - 1) * 30), 30);
  90. } else {
  91. strncpy(ptr, text + ((si - 1) * line_len), line_len);
  92. }
  93. }
  94. }
  95. static void flipbip_scene_1_draw_mnemonic(const char* mnemonic) {
  96. // Delineate sections of the mnemonic every 4 words
  97. char* mnemonic_working = malloc(strlen(mnemonic) + 1);
  98. strcpy(mnemonic_working, mnemonic);
  99. int word = 0;
  100. for(size_t i = 0; i < strlen(mnemonic_working); i++) {
  101. if(mnemonic_working[i] == ' ') {
  102. word++;
  103. if(word % 4 == 0) {
  104. mnemonic_working[i] = ',';
  105. }
  106. }
  107. }
  108. // Split the mnemonic into parts
  109. char* mnemonic_part = flipbip_strtok(mnemonic_working, ",");
  110. int mi = 0;
  111. while(mnemonic_part != NULL) {
  112. char* ptr = NULL;
  113. mi++;
  114. if(mi == 1)
  115. ptr = s_disp_text1;
  116. else if(mi == 2)
  117. ptr = s_disp_text2;
  118. else if(mi == 3)
  119. ptr = s_disp_text3;
  120. else if(mi == 4)
  121. ptr = s_disp_text4;
  122. else if(mi == 5)
  123. ptr = s_disp_text5;
  124. else if(mi == 6)
  125. ptr = s_disp_text6;
  126. memzero(ptr, 30 + 1);
  127. if(strlen(mnemonic_part) > 30) {
  128. strncpy(ptr, mnemonic_part, 30);
  129. } else {
  130. strncpy(ptr, mnemonic_part, strlen(mnemonic_part));
  131. }
  132. mnemonic_part = flipbip_strtok(NULL, ",");
  133. }
  134. // Free the working mnemonic memory
  135. memzero(mnemonic_working, strlen(mnemonic_working));
  136. free(mnemonic_working);
  137. }
  138. static void flipbip_scene_1_draw_seed(FlipBipScene1Model* const model) {
  139. char* seed_working = malloc(64 * 2 + 1);
  140. // Convert the seed to a hex string
  141. flipbip_btox(model->seed, 64, seed_working);
  142. flipbip_scene_1_draw_generic(seed_working, 22);
  143. // Free the working seed memory
  144. memzero(seed_working, sizeof(seed_working));
  145. free(seed_working);
  146. }
  147. static void
  148. flipbip_scene_1_draw_address(const HDNode* node, uint32_t addr_type, uint32_t addr_index) {
  149. //s_busy = true;
  150. // buffer for key serialization
  151. const size_t buflen = 128;
  152. char buf[128 + 1];
  153. HDNode* addr_node = malloc(sizeof(HDNode));
  154. memcpy(addr_node, node, sizeof(HDNode));
  155. hdnode_private_ckd(addr_node, addr_index);
  156. hdnode_fill_public_key(addr_node);
  157. // coin info
  158. // bip44_coin, xprv_version, xpub_version, addr_version, wif_version, addr_format
  159. uint32_t coin_info[6] = {0};
  160. for (size_t i = 0; i < 6; i++) {
  161. coin_info[i] = COIN_INFO_ARRAY[addr_type][i];
  162. }
  163. if(coin_info[5] == FlipBipCoinBTC0) { // BTC / DOGE style address
  164. // BTC / DOGE style address
  165. ecdsa_get_address(
  166. addr_node->public_key, coin_info[3], HASHER_SHA2_RIPEMD, HASHER_SHA2D, buf, buflen);
  167. char* address = malloc(buflen + 1);
  168. strncpy(address, buf, buflen);
  169. flipbip_scene_1_draw_generic(address, 12);
  170. memzero(address, buflen + 1);
  171. free(address);
  172. //ecdsa_get_wif(addr_node->private_key, WIF_VERSION, HASHER_SHA2D, buf, buflen);
  173. //char *wif = malloc(buflen + 1);
  174. //strncpy(wif, buf, buflen);
  175. } else if(coin_info[5] == FlipBipCoinETH60) { // ETH
  176. // ETH style address
  177. hdnode_get_ethereum_pubkeyhash(addr_node, (uint8_t*)buf);
  178. char* address = malloc(42 + 1);
  179. memcpy(address, "0x", 2);
  180. // Convert the hash to a hex string
  181. flipbip_btox((uint8_t*)buf, 20, address + 2);
  182. flipbip_scene_1_draw_generic(address, 12);
  183. memzero(address, 42 + 1);
  184. free(address);
  185. }
  186. memzero(addr_node, sizeof(HDNode));
  187. free(addr_node);
  188. //s_busy = false;
  189. }
  190. static void flipbip_scene_1_clear_text() {
  191. memzero((void*)s_disp_text1, 30 + 1);
  192. memzero((void*)s_disp_text2, 30 + 1);
  193. memzero((void*)s_disp_text3, 30 + 1);
  194. memzero((void*)s_disp_text4, 30 + 1);
  195. memzero((void*)s_disp_text5, 30 + 1);
  196. memzero((void*)s_disp_text6, 30 + 1);
  197. }
  198. void flipbip_scene_1_draw(Canvas* canvas, FlipBipScene1Model* model) {
  199. //UNUSED(model);
  200. canvas_clear(canvas);
  201. canvas_set_color(canvas, ColorBlack);
  202. flipbip_scene_1_clear_text();
  203. if(model->page == 1) {
  204. const char* info = "-Scroll pages with up/down-"
  205. "p1,2) Mnemonic/Seed "
  206. "p3) xprv Root Key "
  207. "p4,5) xprv/xpub Accnt Keys"
  208. "p6,7) xprv/xpub Extnd Keys"
  209. "p8+) Receive Addresses ";
  210. flipbip_scene_1_draw_generic(info, 27);
  211. } else if(model->page == 2) {
  212. flipbip_scene_1_draw_mnemonic(model->mnemonic);
  213. } else if(model->page == 3) {
  214. flipbip_scene_1_draw_seed(model);
  215. } else if(model->page == 4) {
  216. flipbip_scene_1_draw_generic(model->xprv_root, 20);
  217. } else if(model->page == 5) {
  218. flipbip_scene_1_draw_generic(model->xprv_account, 20);
  219. } else if(model->page == 6) {
  220. flipbip_scene_1_draw_generic(model->xpub_account, 20);
  221. } else if(model->page == 7) {
  222. flipbip_scene_1_draw_generic(model->xprv_extended, 20);
  223. } else if(model->page == 8) {
  224. flipbip_scene_1_draw_generic(model->xpub_extended, 20);
  225. } else if(model->page >= 9 && model->page <= 13) {
  226. flipbip_scene_1_draw_address(model->node, model->coin, model->page - 9);
  227. }
  228. if(model->page == 0) {
  229. canvas_set_font(canvas, FontPrimary);
  230. canvas_draw_str(canvas, 1, 10, "Loading...");
  231. canvas_draw_str(canvas, 6, 30, s_derivation_text);
  232. canvas_draw_icon(canvas, 86, 25, &I_Keychain_39x36);
  233. } else if(model->page >= 9 && model->page <= 13) {
  234. canvas_set_font(canvas, FontSecondary);
  235. // coin_name, derivation_path
  236. const char* receive_text = COIN_TEXT_ARRAY[model->coin][0];
  237. if (receive_text == NULL) {
  238. receive_text = "Coin";
  239. }
  240. canvas_draw_str_aligned(canvas, 1, 2, AlignLeft, AlignTop, receive_text);
  241. canvas_draw_str_aligned(canvas, strlen(receive_text) * 7, 2, AlignLeft, AlignTop, "receive address:");
  242. canvas_set_font(canvas, FontPrimary);
  243. canvas_draw_str(canvas, 6, 22, s_disp_text1);
  244. canvas_draw_str(canvas, 6, 34, s_disp_text2);
  245. canvas_draw_str(canvas, 6, 46, s_disp_text3);
  246. canvas_draw_str(canvas, 6, 58, s_disp_text4);
  247. } else {
  248. canvas_set_font(canvas, FontSecondary);
  249. canvas_draw_str_aligned(canvas, 1, 2, AlignLeft, AlignTop, s_disp_text1);
  250. canvas_draw_str_aligned(canvas, 1, 12, AlignLeft, AlignTop, s_disp_text2);
  251. canvas_draw_str_aligned(canvas, 1, 22, AlignLeft, AlignTop, s_disp_text3);
  252. canvas_draw_str_aligned(canvas, 1, 32, AlignLeft, AlignTop, s_disp_text4);
  253. canvas_draw_str_aligned(canvas, 1, 42, AlignLeft, AlignTop, s_disp_text5);
  254. canvas_draw_str_aligned(canvas, 1, 52, AlignLeft, AlignTop, s_disp_text6);
  255. }
  256. }
  257. static int flipbip_scene_1_model_init(
  258. FlipBipScene1Model* const model,
  259. const int strength,
  260. const uint32_t coin,
  261. const bool overwrite) {
  262. model->page = 0;
  263. model->mnemonic_only = false;
  264. model->strength = strength;
  265. model->coin = coin;
  266. model->overwrite = overwrite;
  267. // Allocate memory for mnemonic
  268. char* mnemonic = malloc(256);
  269. memzero(mnemonic, 256);
  270. // Check if the mnemonic key & data is already saved in persistent storage, or overwrite is true
  271. if(overwrite || (!flipbip_has_settings(true) && !flipbip_has_settings(false))) {
  272. // Generate a random mnemonic using trezor-crypto
  273. const char* mnemonic_gen = mnemonic_generate(strength);
  274. // Save the mnemonic to persistent storage
  275. if(!flipbip_save_settings_secure(mnemonic_gen)) return 1; // 1 = save error
  276. // Clear the generated mnemonic from memory
  277. mnemonic_clear();
  278. model->mnemonic_only = true;
  279. }
  280. // Load the mnemonic from persistent storage
  281. if(!flipbip_load_settings_secure(mnemonic)) return 2; // 2 = load error
  282. model->mnemonic = mnemonic;
  283. // Check if the mnemonic is valid
  284. if(mnemonic_check(model->mnemonic) == 0) return 3; // 3 = mnemonic check error
  285. // if we are only generating the mnemonic, return
  286. if(model->mnemonic_only) {
  287. return -1; // -1 = mnemonic only, return from parent
  288. }
  289. // test mnemonic
  290. //model->mnemonic = "wealth budget salt video delay obey neutral tail sure soda hold rubber joy movie boat raccoon tornado noise off inmate payment patch group topple";
  291. // Generate a BIP39 seed from the mnemonic
  292. mnemonic_to_seed(model->mnemonic, "", model->seed, 0);
  293. // Generate a BIP32 root HD node from the mnemonic
  294. HDNode* root = malloc(sizeof(HDNode));
  295. hdnode_from_seed(model->seed, 64, SECP256K1_NAME, root);
  296. // buffer for key serialization
  297. const size_t buflen = 128;
  298. char buf[128 + 1];
  299. // coin info
  300. // bip44_coin, xprv_version, xpub_version, addr_version, wif_version, addr_format
  301. uint32_t coin_info[6] = {0};
  302. for (size_t i = 0; i < 6; i++) {
  303. coin_info[i] = COIN_INFO_ARRAY[coin][i];
  304. }
  305. // root
  306. uint32_t fingerprint = 0;
  307. hdnode_serialize_private(root, fingerprint, coin_info[1], buf, buflen);
  308. char* xprv_root = malloc(buflen + 1);
  309. strncpy(xprv_root, buf, buflen);
  310. model->xprv_root = xprv_root;
  311. HDNode* node = root;
  312. // purpose m/44'
  313. fingerprint = hdnode_fingerprint(node);
  314. hdnode_private_ckd_prime(node, DERIV_PURPOSE); // purpose
  315. // coin m/44'/0' or m/44'/60'
  316. fingerprint = hdnode_fingerprint(node);
  317. hdnode_private_ckd_prime(node, coin_info[0]); // coin
  318. // account m/44'/0'/0' or m/44'/60'/0'
  319. fingerprint = hdnode_fingerprint(node);
  320. hdnode_private_ckd_prime(node, DERIV_ACCOUNT); // account
  321. hdnode_serialize_private(node, fingerprint, coin_info[1], buf, buflen);
  322. char* xprv_acc = malloc(buflen + 1);
  323. strncpy(xprv_acc, buf, buflen);
  324. model->xprv_account = xprv_acc;
  325. hdnode_serialize_public(node, fingerprint, coin_info[2], buf, buflen);
  326. char* xpub_acc = malloc(buflen + 1);
  327. strncpy(xpub_acc, buf, buflen);
  328. model->xpub_account = xpub_acc;
  329. // external/internal (change) m/44'/0'/0'/0 or m/44'/60'/0'/0
  330. fingerprint = hdnode_fingerprint(node);
  331. hdnode_private_ckd(node, DERIV_CHANGE); // external/internal (change)
  332. hdnode_serialize_private(node, fingerprint, coin_info[1], buf, buflen);
  333. char* xprv_ext = malloc(buflen + 1);
  334. strncpy(xprv_ext, buf, buflen);
  335. model->xprv_extended = xprv_ext;
  336. hdnode_serialize_public(node, fingerprint, coin_info[2], buf, buflen);
  337. char* xpub_ext = malloc(buflen + 1);
  338. strncpy(xpub_ext, buf, buflen);
  339. model->xpub_extended = xpub_ext;
  340. model->node = node;
  341. model->page = 1;
  342. #if USE_BIP39_CACHE
  343. // Clear the BIP39 cache
  344. bip39_cache_clear();
  345. #endif
  346. // 0 = success
  347. return 0;
  348. }
  349. bool flipbip_scene_1_input(InputEvent* event, void* context) {
  350. furi_assert(context);
  351. FlipBipScene1* instance = context;
  352. // Ignore input if busy
  353. // if(s_busy) {
  354. // return false;
  355. // }
  356. if(event->type == InputTypeRelease) {
  357. switch(event->key) {
  358. case InputKeyBack:
  359. with_view_model(
  360. instance->view,
  361. FlipBipScene1Model * model,
  362. {
  363. UNUSED(model);
  364. instance->callback(FlipBipCustomEventScene1Back, instance->context);
  365. },
  366. true);
  367. break;
  368. case InputKeyRight:
  369. case InputKeyDown:
  370. case InputKeyOk:
  371. with_view_model(
  372. instance->view,
  373. FlipBipScene1Model * model,
  374. {
  375. //UNUSED(model);
  376. model->page = (model->page + 1) % 14;
  377. if(model->page == 0) {
  378. model->page = 1;
  379. }
  380. },
  381. true);
  382. break;
  383. case InputKeyLeft:
  384. case InputKeyUp:
  385. with_view_model(
  386. instance->view,
  387. FlipBipScene1Model * model,
  388. {
  389. //UNUSED(model);
  390. model->page = (model->page - 1) % 14;
  391. if(model->page == 0) {
  392. model->page = 13;
  393. }
  394. },
  395. true);
  396. break;
  397. case InputKeyMAX:
  398. break;
  399. }
  400. }
  401. return true;
  402. }
  403. void flipbip_scene_1_exit(void* context) {
  404. furi_assert(context);
  405. FlipBipScene1* instance = (FlipBipScene1*)context;
  406. with_view_model(
  407. instance->view,
  408. FlipBipScene1Model * model,
  409. {
  410. model->page = 0;
  411. model->strength = 0;
  412. model->coin = FlipBipCoinBTC0;
  413. memzero(model->seed, 64);
  414. // if mnemonic_only is true, then we don't need to free the data here
  415. if(!model->mnemonic_only) {
  416. memzero((void*)model->mnemonic, strlen(model->mnemonic));
  417. free((void*)model->mnemonic);
  418. memzero((void*)model->node, sizeof(HDNode));
  419. free((void*)model->node);
  420. memzero((void*)model->xprv_root, strlen(model->xprv_root));
  421. memzero((void*)model->xprv_account, strlen(model->xprv_account));
  422. memzero((void*)model->xpub_account, strlen(model->xpub_account));
  423. memzero((void*)model->xprv_extended, strlen(model->xprv_extended));
  424. memzero((void*)model->xpub_extended, strlen(model->xpub_extended));
  425. free((void*)model->xprv_root);
  426. free((void*)model->xprv_account);
  427. free((void*)model->xpub_account);
  428. free((void*)model->xprv_extended);
  429. free((void*)model->xpub_extended);
  430. }
  431. },
  432. true);
  433. flipbip_scene_1_clear_text();
  434. }
  435. void flipbip_scene_1_enter(void* context) {
  436. furi_assert(context);
  437. FlipBipScene1* instance = (FlipBipScene1*)context;
  438. FlipBip* app = instance->context;
  439. // BIP39 Strength setting
  440. int strength_setting = app->bip39_strength;
  441. int strength = 256; // FlipBipStrength256 // 24 words (256 bit)
  442. if(strength_setting == FlipBipStrength128)
  443. strength = 128; // 12 words (128 bit)
  444. else if(strength_setting == FlipBipStrength192)
  445. strength = 192; // 18 words (192 bit)
  446. // BIP44 Coin setting
  447. uint32_t coin = app->bip44_coin;
  448. // coin_name, derivation_path
  449. s_derivation_text = COIN_TEXT_ARRAY[coin][1];
  450. // Overwrite the saved seed with a new one setting
  451. bool overwrite = app->overwrite_saved_seed != 0;
  452. flipbip_play_happy_bump(app);
  453. flipbip_led_set_rgb(app, 255, 0, 0);
  454. with_view_model(
  455. instance->view,
  456. FlipBipScene1Model * model,
  457. {
  458. // s_busy = true;
  459. const int status = flipbip_scene_1_model_init(model, strength, coin, overwrite);
  460. // nonzero status, free the mnemonic
  461. if(status != 0) {
  462. memzero((void*)model->mnemonic, strlen(model->mnemonic));
  463. free((void*)model->mnemonic);
  464. }
  465. // if error, set the error message
  466. if(status == 1) {
  467. model->mnemonic = "ERROR:,Save error";
  468. model->page = 2;
  469. } else if(status == 2) {
  470. model->mnemonic = "ERROR:,Load error";
  471. model->page = 2;
  472. } else if(status == 3) {
  473. model->mnemonic = "ERROR:,Mnemonic check failed";
  474. model->page = 2;
  475. }
  476. // s_busy = false;
  477. // if overwrite is set and mnemonic generated, return from scene immediately
  478. if(status == -1) {
  479. instance->callback(FlipBipCustomEventScene1Back, instance->context);
  480. }
  481. },
  482. true);
  483. }
  484. FlipBipScene1* flipbip_scene_1_alloc() {
  485. FlipBipScene1* instance = malloc(sizeof(FlipBipScene1));
  486. instance->view = view_alloc();
  487. view_allocate_model(instance->view, ViewModelTypeLocking, sizeof(FlipBipScene1Model));
  488. view_set_context(instance->view, instance); // furi_assert crashes in events without this
  489. view_set_draw_callback(instance->view, (ViewDrawCallback)flipbip_scene_1_draw);
  490. view_set_input_callback(instance->view, flipbip_scene_1_input);
  491. view_set_enter_callback(instance->view, flipbip_scene_1_enter);
  492. view_set_exit_callback(instance->view, flipbip_scene_1_exit);
  493. return instance;
  494. }
  495. void flipbip_scene_1_free(FlipBipScene1* instance) {
  496. furi_assert(instance);
  497. with_view_model(
  498. instance->view, FlipBipScene1Model * model, { UNUSED(model); }, true);
  499. flipbip_scene_1_clear_text();
  500. view_free(instance->view);
  501. free(instance);
  502. }
  503. View* flipbip_scene_1_get_view(FlipBipScene1* instance) {
  504. furi_assert(instance);
  505. return instance->view;
  506. }