Skip to content

Commit

Permalink
Fix device type checks based on alias
Browse files Browse the repository at this point in the history
This PR fixes checks for recovery devices and recovery phrases that
were based on the device name. This change is required because the
public endpoints no longer give information about the alias.
  • Loading branch information
Frederik Rothenberger committed Feb 13, 2023
1 parent f3fd4f8 commit dd2b8de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/frontend/src/flows/recovery/chooseRecoveryMechanism.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ export const chooseRecoveryMechanism = async ({
};

const hasRecoveryPhrase = (devices: DeviceData[]): boolean =>
devices.some((device) => device.alias === "Recovery phrase");
devices.some((device) => "seed_phrase" in device.key_type);
const hasRecoveryKey = (devices: DeviceData[]): boolean =>
devices.some((device) => device.alias === "Recovery key");
devices.some(
(device) =>
!("seed_phrase" in device.key_type) && "recovery" in device.purpose
);
2 changes: 1 addition & 1 deletion src/frontend/src/flows/recovery/pickRecoveryDevice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const init = (devices: DeviceData[]): Promise<DeviceData> =>
html`<div class="deviceItemAlias">
<button class="c-button c-button--secondary">
<span aria-hidden="true"
>${device.alias === "Recovery Phrase"
>${"seed_phrase" in device.key_type
? seedPhraseIcon
: securityKeyIcon}</span
>
Expand Down

0 comments on commit dd2b8de

Please sign in to comment.