Skip to content

Commit

Permalink
chore: workaround to toggle blind signing on zemu tests
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelm41 committed Oct 30, 2024
1 parent 086f56d commit c50f223
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions tests_zemu/tests/legacy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************* */

import Zemu, { ButtonKind, isTouchDevice } from '@zondax/zemu'
import Zemu, {ButtonKind, isTouchDevice, TouchNavigation} from '@zondax/zemu'
import Kda from '@zondax/hw-app-kda'
import { PATH, defaultOptions, models } from './common'
import { blake2bFinal, blake2bInit, blake2bUpdate } from 'blakejs'
Expand Down Expand Up @@ -179,8 +179,17 @@ describe.each(HASH_TEST_CASES)('Hash transactions', function (data) {

const { publicKey } = await app.getPublicKey(data.path)

// Enable blind signing mode
await sim.toggleBlindSigning()
// Enable blind signing mode (this need to be fixed on zemu, as the current fn is not working anymore)
if(isTouchDevice(m.name)){
const nav = new TouchNavigation(m.name, [
ButtonKind.InfoButton,
ButtonKind.ToggleSettingButton3,
ButtonKind.SettingsQuitButton,
]);
await sim.navigate(".", `${m.prefix.toLowerCase()}-sign_${data.name}_legacy`, nav.schedule, true, false, 0)
} else {
await sim.toggleBlindSigning()
}

// do not wait here... we need to navigate
const signatureRequest = app.signHash(data.path, data.hash)
Expand Down
15 changes: 12 additions & 3 deletions tests_zemu/tests/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
******************************************************************************* */

import Zemu from '@zondax/zemu'
import Zemu, {ButtonKind, isTouchDevice, TouchNavigation} from '@zondax/zemu'
import { KadenaApp, TransferTxType, TransferCrossChainTxParams } from '@zondax/ledger-kadena'
import { PATH, defaultOptions, models } from './common'
import { blake2bFinal, blake2bInit, blake2bUpdate } from 'blakejs'
Expand Down Expand Up @@ -72,8 +72,17 @@ describe.each(HASH_TEST_CASES)('Hash transactions', function (data) {
const responseAddr = await app.getAddressAndPubKey(data.path)
const pubKey = responseAddr.pubkey

// Enable blind signing mode
await sim.toggleBlindSigning()
// Enable blind signing mode (this need to be fixed on zemu, as the current fn is not working anymore)
if(isTouchDevice(m.name)){
const nav = new TouchNavigation(m.name, [
ButtonKind.InfoButton,
ButtonKind.ToggleSettingButton3,
ButtonKind.SettingsQuitButton,
]);
await sim.navigate(".", `${m.prefix.toLowerCase()}-sign_${data.name}`, nav.schedule, true, false, 0)
} else {
await sim.toggleBlindSigning()
}

// do not wait here... we need to navigate
const signatureRequest = app.signHash(data.path, data.hash)
Expand Down

0 comments on commit c50f223

Please sign in to comment.