]> zoso.dev Git - libnemo.git/commitdiff
Add test vector data from publicly available tool at https://tools.nanos.cc/?tool...
authorChris Duncan <chris@zoso.dev>
Wed, 6 Nov 2024 04:48:12 +0000 (20:48 -0800)
committerChris Duncan <chris@zoso.dev>
Wed, 6 Nov 2024 04:48:12 +0000 (20:48 -0800)
test/TEST_VECTORS.js
test/import-wallet.test.mjs

index b985050a9c3ef55fbe76a8517713d31bfceebb38..e0ae8cf923f5d2d2ed042b31fc58fb240b8cea57 100644 (file)
@@ -47,21 +47,33 @@ export const TREZOR_TEST_VECTORS = Object.freeze({
        MNEMONIC_0: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art",
        SEED_0: "bda85446c68413707090a52022edd26a1c9462295029f2e60cd7c4f2bbd3097170af7a4d73245cafa9c3cca8d561a7c3de6f5d4a10be8ed2a5e608d68f92fcc8",
        BIP32_KEY_0: "xprv9s21ZrQH143K32qBagUJAMU2LsHg3ka7jqMcV98Y7gVeVyNStwYS3U7yVVoDZ4btbRNf4h6ibWpY22iRmXq35qgLs79f312g2kj5539ebPM",
+       NANOS_CC_PRIVATE_0: "9F0E444C69F77A49BD0BE89DB92C38FE713E0963165CCA12FAF5712D7657120F",
+       NANOS_CC_PUBLIC_0: "C008B814A7D269A1FA3C6528B19201A24D797912DB9996FF02A1FF356E45552B",
+       NANOS_CC_ADDRESS_0: "nano_3i1aq1cchnmbn9x5rsbap8b15akfh7wj7pwskuzi7ahz8oq6cobd99d4r3b7",
 
        ENTROPY_1: "7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f",
        MNEMONIC_1: "legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth useful legal winner thank year wave sausage worth title",
        SEED_1: "bc09fca1804f7e69da93c2f2028eb238c227f2e9dda30cd63699232578480a4021b146ad717fbb7e451ce9eb835f43620bf5c514db0f8add49f5d121449d3e87",
        BIP32_KEY_1: "xprv9s21ZrQH143K3Y1sd2XVu9wtqxJRvybCfAetjUrMMco6r3v9qZTBeXiBZkS8JxWbcGJZyio8TrZtm6pkbzG8SYt1sxwNLh3Wx7to5pgiVFU",
+       NANOS_CC_PRIVATE_1: "B73B723BF7BD042B66AD3332718BA98DE7312F95ED3D05A130C9204552A7AFFF",
+       NANOS_CC_PUBLIC_1: "E30D22B7935BCC25412FC07427391AB4C98A4AD68BAA733300D23D82C9D20AD3",
+       NANOS_CC_ADDRESS_1: "nano_3rrf6cus8pye6o1kzi5n6wwjof8bjb7ff4xcgesi3njxid6x64pms6onw1f9",
 
        ENTROPY_2: "8080808080808080808080808080808080808080808080808080808080808080",
        MNEMONIC_2: "letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic avoid letter advice cage absurd amount doctor acoustic bless",
        SEED_2: "c0c519bd0e91a2ed54357d9d1ebef6f5af218a153624cf4f2da911a0ed8f7a09e2ef61af0aca007096df430022f7a2b6fb91661a9589097069720d015e4e982f",
        BIP32_KEY_2: "xprv9s21ZrQH143K3CSnQNYC3MqAAqHwxeTLhDbhF43A4ss4ciWNmCY9zQGvAKUSqVUf2vPHBTSE1rB2pg4avopqSiLVzXEU8KziNnVPauTqLRo",
+       NANOS_CC_PRIVATE_2: "6A1804198020B080996BA45B5891F8227D7A4F41C8479824423780D234939D58",
+       NANOS_CC_PUBLIC_2: "2FEA520FE54F5D0DCA79D553D9C7F5AF7DB6AC17586DBCA6905794CAADC639DF",
+       NANOS_CC_ADDRESS_2: "nano_1dzcca9ycmtx3q79mocmu95zdduxptp3gp5fqkmb1ownscpweggzah8cb4rb",
 
        ENTROPY_3: "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
        MNEMONIC_3: "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo vote",
        SEED_3: "dd48c104698c30cfe2b6142103248622fb7bb0ff692eebb00089b32d22484e1613912f0a5b694407be899ffd31ed3992c456cdf60f5d4564b8ba3f05a69890ad",
-       BIP32_KEY_3: "xprv9s21ZrQH143K2WFF16X85T2QCpndrGwx6GueB72Zf3AHwHJaknRXNF37ZmDrtHrrLSHvbuRejXcnYxoZKvRquTPyp2JiNG3XcjQyzSEgqCB"
+       BIP32_KEY_3: "xprv9s21ZrQH143K2WFF16X85T2QCpndrGwx6GueB72Zf3AHwHJaknRXNF37ZmDrtHrrLSHvbuRejXcnYxoZKvRquTPyp2JiNG3XcjQyzSEgqCB",
+       NANOS_CC_PRIVATE_3: "E1FAE637AA8EBF1975589A90708BEDCB50B68605B6EBADC4FFA287B5A1C67AD9",
+       NANOS_CC_PUBLIC_3: "72F0E8D4C8FE99BF6E3AEC0D94D31245283E3CFF14E2113DB7DB26F1BEB091DB",
+       NANOS_CC_ADDRESS_3: "nano_1wqix5cejznsqxq5ou1fkmbj6jba9ryhy79446yuhps8y8zd36guwxji9oot"
 })
 
 export const BIP32_TEST_VECTORS = Object.freeze({
index 9aaa0672357e250478d8cd22be120c00180ef063..413c5a154ecd7c1ac5fc5cb9d767773611fd3f18 100644 (file)
@@ -137,6 +137,21 @@ describe('import wallet with test vectors test', () => {
                }\r
        })\r
 \r
+       it('should successfully import a BLAKE2b wallet with Trezor test vectors', async () => {\r
+               const wallet = await Blake2bWallet.fromMnemonic(TREZOR_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.MNEMONIC_1)\r
+               await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r
+               const accounts = await wallet.accounts()\r
+\r
+               assert.ok('mnemonic' in wallet)\r
+               assert.ok('seed' in wallet)\r
+               assert.ok(accounts[0] instanceof Account)\r
+               assert.equal(wallet.mnemonic, TREZOR_TEST_VECTORS.MNEMONIC_1)\r
+               assert.equal(wallet.seed, TREZOR_TEST_VECTORS.ENTROPY_1)\r
+               assert.equal(accounts[0].privateKey, NANO_TEST_VECTORS.NANOS_CC_PRIVATE_1)\r
+               assert.equal(accounts[0].publicKey, NANO_TEST_VECTORS.NANOS_CC_PUBLIC_1)\r
+               assert.equal(accounts[0].address, NANO_TEST_VECTORS.NANOS_CC_ADDRESS_1)\r
+       })\r
+\r
        it('should get identical BLAKE2b wallets when created with a seed versus with its derived mnemonic', async () => {\r
                const wallet = await Blake2bWallet.fromSeed(NANO_TEST_VECTORS.PASSWORD, TREZOR_TEST_VECTORS.ENTROPY_0)\r
                await wallet.unlock(NANO_TEST_VECTORS.PASSWORD)\r