diff --git a/.github/workflows/run-unittest.yml b/.github/workflows/run-unittest.yml new file mode 100644 index 00000000..185e84be --- /dev/null +++ b/.github/workflows/run-unittest.yml @@ -0,0 +1,64 @@ +name: Run Tcx Unit Testing + +on: + pull_request: + types: + - opened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + + +jobs: + build: + name: Run Tcx Unit Testing + runs-on: macos-12 + steps: + - name: Get the latest commit SHA + id: sha + uses: actions/github-script@v6 + with: + result-encoding: string + script: | + const { owner, repo, number } = context.issue + const pr = await github.rest.pulls.get({ + owner, + repo, + pull_number: number, + }) + return pr.data.head.sha + + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: ${{ steps.sha.outputs.result }} + fetch-depth: 5 + + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ~/.rustup + target + key: ${{ runner.os }}-nightly + + - name: Install Rust + run: | + rustup toolchain install nightly-2022-10-31 + rustup default nightly-2022-10-31-x86_64-apple-darwin + rustup show + + - name: Install dependency + run: | + brew install protobuf + + - name: Run TCX Unit Testing + run: | + make test-tcx diff --git a/token-core/test-data/.gitignore b/token-core/test-data/.gitignore index 15c8f302..a43583e6 100644 --- a/token-core/test-data/.gitignore +++ b/token-core/test-data/.gitignore @@ -19,4 +19,6 @@ wallets-ios-2_14_1/identity-wallet-ids.json !migrate-duplication-fixtures/wallets/** wallets/_migrated.json !identity-keystore-delete -!identity-keystore-delete/wallets/* \ No newline at end of file +!identity-keystore-delete/wallets/* +!reset-password-wallets +!reset-password-wallets/** diff --git a/token-core/test-data/reset-password-wallets/wallets/0551d81c-d923-4b8f-ac83-07b575eebcd4.json b/token-core/test-data/reset-password-wallets/wallets/0551d81c-d923-4b8f-ac83-07b575eebcd4.json new file mode 100644 index 00000000..9c408c80 --- /dev/null +++ b/token-core/test-data/reset-password-wallets/wallets/0551d81c-d923-4b8f-ac83-07b575eebcd4.json @@ -0,0 +1,35 @@ +{ + "crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": "2b5b0195707b2099ec1b9cfb8cb8e8ec" + }, + "ciphertext": "f26ad8777f7ce2051253773a6105ecc34aeaff4f8688beaa514f195b881c4a35", + "kdf": "pbkdf2", + "kdfparams": { + "c": 10240, + "dklen": 32, + "prf": "hmac-sha256", + "salt": "5a75d1902236879d4bd889cc0810f20ecc7bd842a4c544c1c6517b94a644393b" + }, + "mac": "e4181397a7b38c523feaac582041446495c3aa875d4da5995b9adeb31727cb10" + }, + "id": "0551d81c-d923-4b8f-ac83-07b575eebcd4", + "version": 3, + "address": "97d8c69afd4d0888197b9a87f265d75ec299e143", + "encMnemonic": { + "encStr": "b002a37fa81274f96300a2d5e0618d8add19c8dd5446ec378e2b0c14630cd82a9482134e9de29538dec3434c70f3e40ed953694002b87fef81f313671150e00beb609855983e700e5ad2", + "nonce": "299b303e92c90a4cc342f98cf7d9d81f" + }, + "mnemonicPath": "m/44'/60'/0'/0", + "imTokenMeta": { + "backup": [], + "chainType": "ETHEREUM", + "mode": "NORMAL", + "name": "ETH", + "passwordHint": "", + "source": "MNEMONIC", + "timestamp": 1719542012, + "walletType": "V3" + } +} \ No newline at end of file diff --git a/token-core/test-data/reset-password-wallets/wallets/97b9fb89-9343-4b44-88bc-d81472c36b26.json b/token-core/test-data/reset-password-wallets/wallets/97b9fb89-9343-4b44-88bc-d81472c36b26.json new file mode 100644 index 00000000..9ea1016a --- /dev/null +++ b/token-core/test-data/reset-password-wallets/wallets/97b9fb89-9343-4b44-88bc-d81472c36b26.json @@ -0,0 +1,42 @@ +{ + "crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": "3e923714ad24027b805455ceeaaa1a07" + }, + "ciphertext": "c4628170038a4ead6c8a81474300d2a343b61d10760b384a87d6c11db8cfed9630c8408233d2c932bcae8ef7ad70a4f16b9b993fc56a7f9d832d2ca4a7ee4b98e3649bcdaa521f24bcd93895417e3e15f47871aa529ed83dc388fd8fc6c566421339d7ac74fe906603989ed89402c5", + "kdf": "pbkdf2", + "kdfparams": { + "c": 10240, + "dklen": 32, + "prf": "hmac-sha256", + "salt": "00e485520e2abb0cf2f97c0fd7c0b07d4cb126c5243b68ee5837c63902ef9c5c" + }, + "mac": "4f3c564a4ec14076ad752af4a7656ce909d52f06329a72a3fcafa0b991a2fb5d" + }, + "id": "97b9fb89-9343-4b44-88bc-d81472c36b26", + "version": 44, + "address": "2MwN441dq8qudMvtM5eLVwC3u4zfKuGSQAB", + "encMnemonic": { + "encStr": "0a4e8c0506486f4aa8053e53c400fc2f38a7a90c6417eaaeca9e11c0f198f4597cdfd0d02eff2175a232f6bbcf867dee1858dbf93ed283cd94401bd5d3ada14dc6d42b10feaae4c5db97", + "nonce": "5025c706a4b2df9b4899dd7d0bd2b403" + }, + "info": { + "curve": "spec256k1", + "purpuse": "sign" + }, + "mnemonicPath": "m/49'/1'/0'", + "xpub": "tpubDCwNET9ErXmBracx3ZBfi6rXQZRjYkpitFe23FAW9M3RcCw4aveNC4SAV5yYrFDjtP3b46eFfv4VtiYP3EXoTZsbnJia2yNznExS8EEcACv", + "imTokenMeta": { + "backup": [], + "chainType": "BITCOIN", + "mode": "NORMAL", + "name": "BTC", + "network": "TESTNET", + "passwordHint": "", + "segWit": "P2WPKH", + "source": "RECOVERED_IDENTITY", + "timestamp": 1719541938, + "walletType": "HD" + } +} \ No newline at end of file diff --git a/token-core/test-data/reset-password-wallets/wallets/a7c5ed76-5249-4e23-adcc-a36c519383a5.json b/token-core/test-data/reset-password-wallets/wallets/a7c5ed76-5249-4e23-adcc-a36c519383a5.json new file mode 100644 index 00000000..b219f448 --- /dev/null +++ b/token-core/test-data/reset-password-wallets/wallets/a7c5ed76-5249-4e23-adcc-a36c519383a5.json @@ -0,0 +1,35 @@ +{ + "crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": "e366dd428b316fdbe3fc805100ac18bc" + }, + "ciphertext": "f5f8ae73f998c9da2ebbba1fcfbb4021804a231956cfccec411b8043ae207929", + "kdf": "pbkdf2", + "kdfparams": { + "c": 10240, + "dklen": 32, + "prf": "hmac-sha256", + "salt": "5598ff30dd2b5342fd015a291f85da34ea002eb467dfb410905be69785a2b0fd" + }, + "mac": "9cfdb84b0704aeae492c65a5db799d3d1725cdc669c54b3d59b8ef0f8b345bad" + }, + "id": "a7c5ed76-5249-4e23-adcc-a36c519383a5", + "version": 3, + "address": "048478fec8c5267df98e55c1d2a4bb794c21ac95", + "encMnemonic": { + "encStr": "0b5a899b3a9c75e0da203294663c238b45a27f2a298c7411ba30b39c9ca0b8018f256d4370bfce536029df52a61e2fe46bc901d5015f66d150a82e267e36a3d9fcd996737eea1b5a6345", + "nonce": "ca5f0308f699c89500627b2cd2cfcaee" + }, + "mnemonicPath": "m/44'/60'/1'/0/0", + "imTokenMeta": { + "backup": [], + "chainType": "ETHEREUM", + "mode": "NORMAL", + "name": "ETH", + "passwordHint": "", + "source": "MNEMONIC", + "timestamp": 1719542057, + "walletType": "V3" + } +} \ No newline at end of file diff --git a/token-core/test-data/reset-password-wallets/wallets/b7e27e86-6214-4e31-9f8f-ec493754e0fc.json b/token-core/test-data/reset-password-wallets/wallets/b7e27e86-6214-4e31-9f8f-ec493754e0fc.json new file mode 100644 index 00000000..7ed853b3 --- /dev/null +++ b/token-core/test-data/reset-password-wallets/wallets/b7e27e86-6214-4e31-9f8f-ec493754e0fc.json @@ -0,0 +1,35 @@ +{ + "crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": "7da71281e20b39ae913f1c9d997bb386" + }, + "ciphertext": "07a32107dc87d59db53a710e05f6d244d8f9d1424d06364a451d852bbdfec2b3", + "kdf": "pbkdf2", + "kdfparams": { + "c": 10240, + "dklen": 32, + "prf": "hmac-sha256", + "salt": "848b7bc8f313a3bf712671964def9964211763c6402598a10b2a9a57350eabf7" + }, + "mac": "10efda66739a539c9d1b2243b77d15904aa37d9fd888068f6fd2210cd376aeac" + }, + "id": "b7e27e86-6214-4e31-9f8f-ec493754e0fc", + "version": 3, + "address": "6031564e7b2f5cc33737807b2e58daff870b590b", + "encMnemonic": { + "encStr": "e3297ed29cc970136a838d51e219db3d35109121c62d7534b4b7d5599d4ee5b8a4818d38ef3ff78d581c02ef33e77bafa3ef6bbb7089ff36fafea79f782f5cbbd4278cf3c21c3352cfd4", + "nonce": "452b19a5350e79d883fc573b34764434" + }, + "mnemonicPath": "m/44'/60'/0'/0/0", + "imTokenMeta": { + "backup": [], + "chainType": "ETHEREUM", + "mode": "NORMAL", + "name": "ETH", + "passwordHint": "", + "source": "RECOVERED_IDENTITY", + "timestamp": 1719541938, + "walletType": "V3" + } +} \ No newline at end of file diff --git a/token-core/test-data/reset-password-wallets/wallets/fe127446-caa6-4a33-8af5-5688676b5517.json b/token-core/test-data/reset-password-wallets/wallets/fe127446-caa6-4a33-8af5-5688676b5517.json new file mode 100644 index 00000000..ab04bdc9 --- /dev/null +++ b/token-core/test-data/reset-password-wallets/wallets/fe127446-caa6-4a33-8af5-5688676b5517.json @@ -0,0 +1 @@ +{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"3713270811d7d72ae48a5a2fa972585e"},"ciphertext":"d2c70466df331b2bb80331141e89d383f52d0d4aeaca966a239b33120bf6fde6","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"21e7d97b4e88e9631f52cd659100d1d1bf1709b6f24930a5ec5f82c386eb1b5f"},"mac":"75590689cad477111ca9d908fe4697dc6003e673f59ec27ad22a233e49cf8f99"},"id":"fe127446-caa6-4a33-8af5-5688676b5517","version":3,"address":"cosmos1ajz9y0x3wekez7tz2td2j6l2dftn28v26dd992","encMnemonic":{"encStr":"d4856443485baf7a98876a8d060de6b956f43d064c99028e0dda69c392194706412b1e18e8759420e24204f679f4e5042bb33695eb0d50b8b207e7271d36e5f2b407217f5c3c04155446","nonce":"2e567d87240db65a51bac8faff442a42"},"mnemonicPath":"m/44'/118'/0'/0/0","imTokenMeta":{"backup":[],"chainType":"COSMOS","mode":"NORMAL","name":"Cosmos","passwordHint":"","source":"RECOVERED_IDENTITY","timestamp":1719541938,"walletType":"V3"}} \ No newline at end of file diff --git a/token-core/test-data/reset-password-wallets/wallets/identity.json b/token-core/test-data/reset-password-wallets/wallets/identity.json new file mode 100644 index 00000000..0ba47bd5 --- /dev/null +++ b/token-core/test-data/reset-password-wallets/wallets/identity.json @@ -0,0 +1 @@ +{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"db1192e8cda3491788909f75f33d055a"},"ciphertext":"234f52abf87208543b958e2429928f4f6183b9b1a9da8c13da3445e35c76e33c1965cb71b156214eaebef05747b6be9a00c9fd76f00184960b751f16644776bcecc2e570c7dc8afccb52cacbb074235181e83334eefa5e2ce7250bf194d55da31f01494a5bc60698a796da7c593860","kdf":"pbkdf2","kdfparams":{"c":10240,"dklen":32,"prf":"hmac-sha256","salt":"99c5193ab0b6298f2269bac13e1035142fca65a4bbcc8a9e107be721ff98c1d2"},"mac":"312392e1f90076a94a1246a5a8b34f279877e5a01d8ca656b163fcab82af8f3a"},"id":"f9747783-af54-48a5-9361-3d111e1d68c8","version":10000,"encAuthKey":{"encStr":"31941554a3f0049c169d09dbbb327bbe3d819ce4e1c6a91389b5c5d8c80da741","nonce":"7cf9ae242996fe0162155726e6a0c0c9"},"encKey":"9513617c9b398edebfb46080a8f0cf6cab6763866bb06daa63503722bea78907","encMnemonic":{"encStr":"91111355fec415b9482c617a6ec7d386d01988c135aabbc34a785addf01ac29629cd0e5976e492c0010105341d8908899805a7af8db39d9db85ad8edefab153d39dc65d2c5442ff95393","nonce":"860f8a79a637c5c96bd350f38a4c5b39"},"identifier":"im18MDKM8hcTykvMmhLnov9m2BaFqsdjoA7cwNg","ipfsId":"QmSTTidyfa4np9ak9BZP38atuzkCHy4K59oif23f4dNAGU","walletIDs":["b7e27e86-6214-4e31-9f8f-ec493754e0fc","97b9fb89-9343-4b44-88bc-d81472c36b26","fe127446-caa6-4a33-8af5-5688676b5517","0551d81c-d923-4b8f-ac83-07b575eebcd4","a7c5ed76-5249-4e23-adcc-a36c519383a5"],"imTokenMeta":{"backup":[],"mode":"NORMAL","name":"identity_name","network":"TESTNET","passwordHint":"","source":"RECOVERED_IDENTITY","timestamp":1719541938}} \ No newline at end of file