Skip to content

Commit e108d7b

Browse files
Daniel Newtonjgriffiths
authored andcommitted
gui: special case for swap recovey in bip85 UI
1 parent a8df12a commit e108d7b

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

main/process/get_bip85_entropy.c

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -183,21 +183,33 @@ static int get_bip85_bip39_entropy_data(const CborValue* params, bip85_data_t* b
183183
return CBOR_RPC_BAD_PARAMETERS;
184184
}
185185

186-
// User to confirm
187-
char nwordphrase[24];
188-
int ret = snprintf(nwordphrase, sizeof(nwordphrase), "%u word seed phrase", nwords);
189-
JADE_ASSERT(ret > 0 && ret < sizeof(nwordphrase));
190-
191-
char txtindex[24];
192-
ret = snprintf(txtindex, sizeof(txtindex), "for BIP85 index %u?", index);
193-
JADE_ASSERT(ret > 0 && ret < sizeof(txtindex));
194-
195-
const char* message[] = { "Export an encrypted", nwordphrase, txtindex };
196-
197-
if (!await_continueback_activity("Key Export", message, 3, false, "blkstrm.com/bip85")) {
198-
// User declined
199-
*errmsg = "User declined to export entropy";
200-
return CBOR_RPC_USER_CANCELLED;
186+
// Special case for cross-chain swaps
187+
if (nwords == 12 && index == 26589) {
188+
// User to confirm
189+
const char* message[] = { "Scan successful!", "Continue to pair", "with wallet app." };
190+
191+
if (!await_continueback_activity("Enable Swaps", message, 3, false, "blkstrm.com/bip85")) {
192+
// User declined
193+
*errmsg = "User declined to export entropy";
194+
return CBOR_RPC_USER_CANCELLED;
195+
}
196+
} else {
197+
// User to confirm
198+
char nwordphrase[24];
199+
int ret = snprintf(nwordphrase, sizeof(nwordphrase), "%u word seed phrase", nwords);
200+
JADE_ASSERT(ret > 0 && ret < sizeof(nwordphrase));
201+
202+
char txtindex[24];
203+
ret = snprintf(txtindex, sizeof(txtindex), "for BIP85 index %u?", index);
204+
JADE_ASSERT(ret > 0 && ret < sizeof(txtindex));
205+
206+
const char* message[] = { "Export an encrypted", nwordphrase, txtindex };
207+
208+
if (!await_continueback_activity("Key Export", message, 3, false, "blkstrm.com/bip85")) {
209+
// User declined
210+
*errmsg = "User declined to export entropy";
211+
return CBOR_RPC_USER_CANCELLED;
212+
}
201213
}
202214

203215
// Calculate encrypted entropy

0 commit comments

Comments
 (0)