From: Chris Duncan Date: Thu, 16 Oct 2025 19:56:38 +0000 (-0700) Subject: Add Ledger Nano S+ device test vectors and switch to them for testing while working... X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=9b8ba81ac030351cd0c17887181c5c9a0d18d856;p=libnemo.git Add Ledger Nano S+ device test vectors and switch to them for testing while working on fixes to hardware app. --- diff --git a/test/VECTORS.mjs b/test/VECTORS.mjs index a98a137..f948c70 100644 --- a/test/VECTORS.mjs +++ b/test/VECTORS.mjs @@ -221,19 +221,39 @@ export const CUSTOM_TEST_VECTORS = Object.freeze({ ADDRESS_3: "nano_1ddgc1m71fpyef9wg8jhmhnc8fodm6frgng3dp65om8s3hymqufp8jefijxu", // derived using BIP-44 from actual Ledger Nano S hardware wallet designated for dedicated testing - LEDGER_MNEMONIC: "slight govern pepper assist escape target bread repair long faith maid bread donor situate swamp toss garage master stage gift vendor jacket client upset", - LEDGER_SEED: "1913E77BCFD9AA95BCB5171B1E781EC0EA3531F1FC427686D8BBA3D655BEFA43FDED6985B5E5806199A33539332DF8780426EDAD17E7BC2D95324D678BEEEE34", - LEDGER_PRIVATE_0: "174A5E324A107D66E1AB17D9BCFC676D89F2940A4B90CB64A6656005756EBDA1", - LEDGER_PUBLIC_0: "4423C456B9AF40A82807114BA3F77822E5CE1E5B4C2885296C6BBE7B9B377D48", - LEDGER_ADDRESS_0: "nano_1j35rjddmdt1o1n1g6cdnhuqiaq7srh7pm3ainnprtxyhgfmgzcat494fyrr", - LEDGER_OPEN_BLOCK: { - account: "nano_1j35rjddmdt1o1n1g6cdnhuqiaq7srh7pm3ainnprtxyhgfmgzcat494fyrr", - previous: "0", - representative: "nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou", - balance: "0", - link: "5B2DA492506339C0459867AA1DA1E7EDAAC4344342FAB0848F43B46D248C8E99", - hash: "39BB7D1F877060337AF3FA6E56DAB42CB818335CDDDCF773D2F9543DF1024E4D", - signature: "452DD0AE06C79C6A987DE6A0F92356E34CB29B9B1FE6209439CCC1BDD0B382481C1796820126A9A1A3CC76F86BE48927492A0A5FA40C5F0012881690A7F8320E" + LEDGER_NANOS: { + MNEMONIC: "slight govern pepper assist escape target bread repair long faith maid bread donor situate swamp toss garage master stage gift vendor jacket client upset", + SEED: "1913E77BCFD9AA95BCB5171B1E781EC0EA3531F1FC427686D8BBA3D655BEFA43FDED6985B5E5806199A33539332DF8780426EDAD17E7BC2D95324D678BEEEE34", + PRIVATE_0: "174A5E324A107D66E1AB17D9BCFC676D89F2940A4B90CB64A6656005756EBDA1", + PUBLIC_0: "4423C456B9AF40A82807114BA3F77822E5CE1E5B4C2885296C6BBE7B9B377D48", + ADDRESS_0: "nano_1j35rjddmdt1o1n1g6cdnhuqiaq7srh7pm3ainnprtxyhgfmgzcat494fyrr", + OPEN_BLOCK: { + account: "nano_1j35rjddmdt1o1n1g6cdnhuqiaq7srh7pm3ainnprtxyhgfmgzcat494fyrr", + previous: "0", + representative: "nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou", + balance: "0", + link: "5B2DA492506339C0459867AA1DA1E7EDAAC4344342FAB0848F43B46D248C8E99", + hash: "39BB7D1F877060337AF3FA6E56DAB42CB818335CDDDCF773D2F9543DF1024E4D", + signature: "452DD0AE06C79C6A987DE6A0F92356E34CB29B9B1FE6209439CCC1BDD0B382481C1796820126A9A1A3CC76F86BE48927492A0A5FA40C5F0012881690A7F8320E" + } + }, + + // derived using BIP-44 from actual Ledger Nano S+ hardware wallet designated for dedicated testing + LEDGER_NANOSP: { + MNEMONIC: "flip quit unveil negative prosper salon agent twenty position slim vanish estate hospital cream mansion art pencil child razor morning soldier okay interest bird", + SEED: "6661BFAD647486ADCD1DD2A46A0F8583989722DFBCCF68DD59CFB6B29FE84B4B1AA887375141D3FA85DBFC0A9CCDC2BFE5C4D5DD609420091989CA02C8D9D1D5", + PRIVATE_0: "4B45EBFD9442FFEA5174D33B52C9FD57B9DEEB66AE48E0A8CE1FDD2F09543E4C", + PUBLIC_0: "BBE3AD06D297DF086B66D81FBCFE15132ACC315E56EA66D08BC2ABCA0A291785", + ADDRESS_0: "nano_3gz5on5f77yz33opfp1zqmz3c6scsirowoqceuaaqiodsa74k7w757ys89cm", + OPEN_BLOCK: { + account: "nano_3gz5on5f77yz33opfp1zqmz3c6scsirowoqceuaaqiodsa74k7w757ys89cm", + previous: "0", + representative: "nano_1stofnrxuz3cai7ze75o174bpm7scwj9jn3nxsn8ntzg784jf1gzn1jjdkou", + balance: "0", + link: "5B2DA492506339C0459867AA1DA1E7EDAAC4344342FAB0848F43B46D248C8E99", + hash: "39BB7D1F877060337AF3FA6E56DAB42CB818335CDDDCF773D2F9543DF1024E4D", + signature: "452DD0AE06C79C6A987DE6A0F92356E34CB29B9B1FE6209439CCC1BDD0B382481C1796820126A9A1A3CC76F86BE48927492A0A5FA40C5F0012881690A7F8320E" + } }, // block with valid signature using iOS non-deterministic nonce vs RFC 8032 diff --git a/test/test.ledger.mjs b/test/test.ledger.mjs index 2a34db2..791e5e4 100644 --- a/test/test.ledger.mjs +++ b/test/test.ledger.mjs @@ -29,7 +29,7 @@ await Promise.all([ suite('Ledger hardware wallet', { skip: isNode || navigator?.usb == null }, async () => { - const { LEDGER_MNEMONIC, LEDGER_SEED, LEDGER_PUBLIC_0, LEDGER_ADDRESS_0 } = CUSTOM_TEST_VECTORS + const { LEDGER_NANOS, LEDGER_NANOSP } = CUSTOM_TEST_VECTORS const { OPEN_BLOCK, RECEIVE_BLOCK, SEND_BLOCK } = NANO_TEST_VECTORS let wallet, account, openBlock, sendBlock, receiveBlock, restored try { @@ -174,7 +174,8 @@ await Promise.all([ 'Open Nano app, then click to continue', async () => wallet.unlock() ) - const isVerified = await wallet.verify(LEDGER_MNEMONIC) + // const isVerified = await wallet.verify(LEDGER_NANOS.MNEMONIC) + const isVerified = await wallet.verify(LEDGER_NANOSP.MNEMONIC) assert.exists(isVerified) assert.equal(typeof isVerified, 'boolean') @@ -182,7 +183,8 @@ await Promise.all([ }) await test('verify seed', async () => { - const isVerified = await wallet.verify(LEDGER_SEED) + // const isVerified = await wallet.verify(LEDGER_NANOS.SEED) + const isVerified = await wallet.verify(LEDGER_NANOSP.SEED) assert.exists(isVerified) assert.equal(typeof isVerified, 'boolean') @@ -195,9 +197,11 @@ await Promise.all([ assert.exists(account) assert.ok(account instanceof Account) assert.exists(account.publicKey) - assert.equal(account.publicKey, LEDGER_PUBLIC_0) + // assert.equal(account.publicKey, LEDGER_NANOS.PUBLIC_0) + assert.equal(account.publicKey, LEDGER_NANOSP.PUBLIC_0) assert.exists(account.address) - assert.equal(account.address, LEDGER_ADDRESS_0) + // assert.equal(account.address, LEDGER_NANOS.ADDRESS_0) + assert.equal(account.address, LEDGER_NANOSP.ADDRESS_0) }) await test('get second and third accounts', async () => { @@ -311,7 +315,8 @@ await Promise.all([ assert.exists(restored) await assert.resolves(restored.unlock()) - assert.equal(await restored.verify(LEDGER_MNEMONIC), true) + // assert.equal(await restored.verify(LEDGER_NANOS.MNEMONIC), true) + assert.equal(await restored.verify(LEDGER_NANOSP.MNEMONIC), true) await click( 'Click to finish Ledger tests by destroying wallet',