From: Chris Duncan Date: Sun, 19 Oct 2025 06:31:55 +0000 (-0700) Subject: Add Nano S+ test vectors. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=52fd1eacb3b9b3435a45bd0fa9928c5b075db1a1;p=libnemo.git Add Nano S+ test vectors. --- 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 7047ce0..e07bf8d 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 { @@ -147,7 +147,7 @@ await Promise.all([ await assert.resolves(async () => { await click( 'Unlock device again, then click to continue', - async () => {} + async () => { } ) }) assert.equal(wallet.isLocked, false) @@ -155,7 +155,7 @@ await Promise.all([ assert.equal(status, 'CONNECTED') }) - await test('switch between interfaces', { skip: false || isNode || navigator?.usb == null }, async () => { + await test('switch between interfaces', { skip: true || isNode || navigator?.usb == null }, async () => { await assert.resolves(async () => { await click( 'Verify current interface is HID, switch to unlocked Bluetooth device, then click to continue', @@ -189,7 +189,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') @@ -197,7 +198,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') @@ -210,9 +212,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 () => { @@ -220,7 +224,7 @@ await Promise.all([ assert.exists(accounts) assert.equal(accounts.size, 2) - for (const [index, account] of accounts) { + for (const [ index, account ] of accounts) { assert.ok(account instanceof Account) assert.exists(account.address) assert.exists(account.publicKey) @@ -232,7 +236,7 @@ await Promise.all([ const accounts = await wallet.refresh(rpc, 0, 2) assert.exists(accounts) - for (const [index, account] of accounts) { + for (const [ index, account ] of accounts) { assert.ok(account instanceof Account) assert.exists(account.address) assert.exists(account.publicKey) @@ -326,7 +330,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',