From f1da181f258faec0105fe05e634da9d6db344de8 Mon Sep 17 00:00:00 2001 From: rikardwissing Date: Fri, 5 Apr 2019 00:35:08 +0200 Subject: [PATCH 1/6] Update dependancies to add support for sign message with cryptocurrencies with alternate hashing --- yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index 04801e3..f88e696 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1568,7 +1568,7 @@ bitcoin-ops@^1.3.0: "bitcoinjs-lib@https://github.com/wlc-/bitcoinjs-lib": version "3.3.0" - resolved "https://github.com/wlc-/bitcoinjs-lib#be52a2da0f56beb67a5f502d2ccd4aee9f851618" + resolved "https://github.com/wlc-/bitcoinjs-lib#12fd8b3159da10f907e6f19b25dade5ec04f2da7" dependencies: bech32 "0.0.3" bigi "^1.4.0" @@ -1587,9 +1587,9 @@ bitcoin-ops@^1.3.0: varuint-bitcoin "^1.0.4" wif "https://github.com/COINiD/wif.git" -bitcoinjs-message@^2.0.0: +"bitcoinjs-message@https://github.com/COINiD/bitcoinjs-message.git#coinid-version": version "2.0.0" - resolved "https://registry.yarnpkg.com/bitcoinjs-message/-/bitcoinjs-message-2.0.0.tgz#e285d223607dabf2b33a6ee486a223b59d1b1548" + resolved "https://github.com/COINiD/bitcoinjs-message.git#a5b5962bef760e9de7f24050e401c6722c7d9af4" dependencies: bs58check "^2.0.2" buffer-equals "^1.0.3" @@ -1930,12 +1930,12 @@ code-point-at@^1.0.0: "coinid-private@https://github.com/wlc-/coinid-private": version "1.0.1" - resolved "https://github.com/wlc-/coinid-private#88d8c6982e2d73da32405de4e3b6a22cbd5ad43a" + resolved "https://github.com/wlc-/coinid-private#eee0c3072643e83e58e770f2b846ca14b8324796" dependencies: bip38-async "https://github.com/COINiD/bip38-async" bip39 "^2.4.0" bitcoinjs-lib "https://github.com/wlc-/bitcoinjs-lib" - bitcoinjs-message "^2.0.0" + bitcoinjs-message "https://github.com/COINiD/bitcoinjs-message.git#coinid-version" coinid-address-types "https://github.com/wlc-/coinid-address-types.git" md5 "^2.2.1" From 6be8184619b5f133d29165b99e10264137c35be5 Mon Sep 17 00:00:00 2001 From: rikardwissing Date: Fri, 5 Apr 2019 00:44:51 +0200 Subject: [PATCH 2/6] v1.5.0 --- android/app/build.gradle | 4 ++-- ios/COINiD.xcodeproj/project.pbxproj | 4 ++-- ios/COINiD/Info.plist | 4 ++-- package.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index c164a0e..91aa6db 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -127,8 +127,8 @@ android { applicationId "org.coinid.vault" minSdkVersion 16 targetSdkVersion 27 - versionCode 63 - versionName "1.4" + versionCode 64 + versionName "1.5.0" ndk { abiFilters "armeabi-v7a", "x86" } diff --git a/ios/COINiD.xcodeproj/project.pbxproj b/ios/COINiD.xcodeproj/project.pbxproj index b4e41a7..b6e2502 100644 --- a/ios/COINiD.xcodeproj/project.pbxproj +++ b/ios/COINiD.xcodeproj/project.pbxproj @@ -1556,7 +1556,7 @@ CODE_SIGN_ENTITLEMENTS = COINiD/COINiD.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 135; + CURRENT_PROJECT_VERSION = 136; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = RTXAQQG73Y; FRAMEWORK_SEARCH_PATHS = ""; @@ -1614,7 +1614,7 @@ CODE_SIGN_ENTITLEMENTS = COINiD/COINiD.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 135; + CURRENT_PROJECT_VERSION = 136; DEVELOPMENT_TEAM = RTXAQQG73Y; FRAMEWORK_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = ( diff --git a/ios/COINiD/Info.plist b/ios/COINiD/Info.plist index 6f62b8a..37dc26a 100644 --- a/ios/COINiD/Info.plist +++ b/ios/COINiD/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.4 + 1.5.0 CFBundleSignature ???? CFBundleURLTypes @@ -32,7 +32,7 @@ CFBundleVersion - 135 + 136 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes diff --git a/package.json b/package.json index 05bcd0c..a7004be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "COINiD", - "version": "0.0.1", + "version": "1.5.0", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", From 7811540583805f6d36e6e121e2a4a64c402bf273 Mon Sep 17 00:00:00 2001 From: rikardwissing Date: Fri, 5 Apr 2019 23:52:48 +0200 Subject: [PATCH 3/6] Fix tests --- .../__snapshots__/coinid-private-test.js.snap | 56 ++++++++++++++++--- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/__tests__/__snapshots__/coinid-private-test.js.snap b/__tests__/__snapshots__/coinid-private-test.js.snap index 3a4b621..56bf6f4 100644 --- a/__tests__/__snapshots__/coinid-private-test.js.snap +++ b/__tests__/__snapshots__/coinid-private-test.js.snap @@ -36,6 +36,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -88,6 +89,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -140,6 +142,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -195,6 +198,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -248,6 +252,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -333,6 +338,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -421,6 +427,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -530,6 +537,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -580,6 +588,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -624,6 +633,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -668,6 +678,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -715,6 +726,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -760,6 +772,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -829,6 +842,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -909,6 +923,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1010,6 +1025,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1060,6 +1076,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1104,6 +1121,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1148,6 +1166,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1195,6 +1214,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1240,6 +1260,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1309,6 +1330,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1389,6 +1411,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1490,6 +1513,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "GroestlCoin Signed Message: @@ -1548,6 +1572,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Myriadcoin Signed Message: @@ -1600,6 +1625,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Myriadcoin Signed Message: @@ -1652,6 +1678,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Myriadcoin Signed Message: @@ -1707,6 +1734,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Myriadcoin Signed Message: @@ -1760,6 +1788,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Myriadcoin Signed Message: @@ -1837,6 +1866,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Myriadcoin Signed Message: @@ -1923,6 +1953,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Myriadcoin Signed Message: @@ -2024,6 +2055,7 @@ Object { "confirmations": 12, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Myriadcoin Signed Message: @@ -2082,6 +2114,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -2095,7 +2128,7 @@ Object { "P2WPKH", ], "ticker": "tBTC", - "title": "Bitcoin", + "title": "Testnet", "wif": 239, }, "ownerCheck": "", @@ -2134,6 +2167,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -2147,7 +2181,7 @@ Object { "P2WPKH", ], "ticker": "tBTC", - "title": "Bitcoin", + "title": "Testnet", "wif": 239, }, "ownerCheck": "", @@ -2186,6 +2220,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -2199,7 +2234,7 @@ Object { "P2WPKH", ], "ticker": "tBTC", - "title": "Bitcoin", + "title": "Testnet", "wif": 239, }, "ownerCheck": "", @@ -2241,6 +2276,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -2254,7 +2290,7 @@ Object { "P2WPKH", ], "ticker": "tBTC", - "title": "Bitcoin", + "title": "Testnet", "wif": 239, }, "ownerCheck": "49-*1-*0-*1*0+2MTRGW", @@ -2294,6 +2330,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -2307,7 +2344,7 @@ Object { "P2WPKH", ], "ticker": "tBTC", - "title": "Bitcoin", + "title": "Testnet", "wif": 239, }, "ownerCheck": "49-*1-*0-*1*0+2MTRGW", @@ -2379,6 +2416,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -2392,7 +2430,7 @@ Object { "P2WPKH", ], "ticker": "tBTC", - "title": "Bitcoin", + "title": "Testnet", "wif": 239, }, "outputInfo": Object { @@ -2467,6 +2505,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -2480,7 +2519,7 @@ Object { "P2WPKH", ], "ticker": "tBTC", - "title": "Bitcoin", + "title": "Testnet", "wif": 239, }, "ownerCheck": "49-*1-*0-*1*0+2MTRGW", @@ -2576,6 +2615,7 @@ Object { "confirmations": 6, "hashFunctions": Object { "address": [Function], + "message": [Function], "transaction": [Function], }, "messagePrefix": "Bitcoin Signed Message: @@ -2589,7 +2629,7 @@ Object { "P2WPKH", ], "ticker": "tBTC", - "title": "Bitcoin", + "title": "Testnet", "wif": 239, }, "ownerCheck": "49-*1-*0-*1*0+2MTRGW", From fed807470be5d0eeda182974066d7e4b0313a5f8 Mon Sep 17 00:00:00 2001 From: rikardwissing Date: Fri, 5 Apr 2019 23:53:46 +0200 Subject: [PATCH 4/6] Update dependencies --- yarn.lock | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/yarn.lock b/yarn.lock index f88e696..cf6ceb9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1589,11 +1589,10 @@ bitcoin-ops@^1.3.0: "bitcoinjs-message@https://github.com/COINiD/bitcoinjs-message.git#coinid-version": version "2.0.0" - resolved "https://github.com/COINiD/bitcoinjs-message.git#a5b5962bef760e9de7f24050e401c6722c7d9af4" + resolved "https://github.com/COINiD/bitcoinjs-message.git#45ca80585b5ef75d90143171ecb7445f8c355605" dependencies: - bs58check "^2.0.2" + bitcoinjs-lib "https://github.com/wlc-/bitcoinjs-lib" buffer-equals "^1.0.3" - create-hash "^1.1.2" secp256k1 "^3.0.1" varuint-bitcoin "^1.0.1" @@ -1724,7 +1723,7 @@ bs58@^4.0.0: dependencies: base-x "^3.0.2" -bs58check@<3.0.0, bs58check@^2.0.0, bs58check@^2.0.2: +bs58check@<3.0.0, bs58check@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.1.tgz#8a5d0e587af97b784bf9cbf1b29f454d82bc0222" dependencies: @@ -1930,7 +1929,7 @@ code-point-at@^1.0.0: "coinid-private@https://github.com/wlc-/coinid-private": version "1.0.1" - resolved "https://github.com/wlc-/coinid-private#eee0c3072643e83e58e770f2b846ca14b8324796" + resolved "https://github.com/wlc-/coinid-private#7cc3ad15bd60a2396d292e59112a41a4fbe4f29d" dependencies: bip38-async "https://github.com/COINiD/bip38-async" bip39 "^2.4.0" From 37869c0ea22ef47ca4a2bcfb0c386e843d8bee9e Mon Sep 17 00:00:00 2001 From: rikardwissing Date: Sat, 6 Apr 2019 19:30:17 +0200 Subject: [PATCH 5/6] Add tests for message signing --- .../__snapshots__/coinid-private-test.js.snap | 264 ++++++++++++++++++ __tests__/coinid-private-test.js | 20 ++ __tests__/data/bitcoin.json | 3 +- __tests__/data/groestlcoin-testnet.json | 3 +- __tests__/data/groestlcoin.json | 3 +- __tests__/data/myriad.json | 3 +- __tests__/data/testnet.json | 3 +- 7 files changed, 294 insertions(+), 5 deletions(-) diff --git a/__tests__/__snapshots__/coinid-private-test.js.snap b/__tests__/__snapshots__/coinid-private-test.js.snap index 56bf6f4..3891d97 100644 --- a/__tests__/__snapshots__/coinid-private-test.js.snap +++ b/__tests__/__snapshots__/coinid-private-test.js.snap @@ -1,5 +1,61 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP +exports[`bitcoin COINiDPrivate MSG generates correct return data 1`] = `"IGqfHR/PVMDAafnYx0nvyeFabcBpwf120CCpzIfvJlhBA7pceh6zUTYtYF8q2Gb61naZuItvVRMsCMgGvAtErIw="`; + +exports[`bitcoin COINiDPrivate MSG generates correct return data 2`] = `"coinid-btc://MSG/IGqfHR/PVMDAafnYx0nvyeFabcBpwf120CCpzIfvJlhBA7pceh6zUTYtYF8q2Gb61naZuItvVRMsCMgGvAtErIw="`; + +exports[`bitcoin COINiDPrivate MSG parses info correct 1`] = ` +Object { + "derivationPath": "m/49'/0'/0'/0/5", + "message": "This is a test message", + "network": Object { + "bech32": "bc", + "bip32": Object { + "private": 76066276, + "public": 76067358, + }, + "bip44Derivation": 0, + "blockTime": 10, + "bridgeParameterArr": Array [ + Array [ + "blockbook", + "wss://btc-blockbook1.coinid.org", + ], + Array [ + "blockbook", + "wss://btc-blockbook2.coinid.org", + ], + Array [ + "blockbook", + "wss://btc-blockbook3.coinid.org", + ], + ], + "confirmations": 6, + "hashFunctions": Object { + "address": [Function], + "message": [Function], + "transaction": [Function], + }, + "messagePrefix": "Bitcoin Signed Message: +", + "pubKeyHash": 0, + "qrScheme": "bitcoin", + "scriptHash": 5, + "supportedAddressTypes": Array [ + "P2SH-P2WPKH", + "P2PKH", + "P2WPKH", + ], + "ticker": "BTC", + "title": "Bitcoin", + "wif": 128, + }, + "ownerCheck": "49-*0-*0-*0*5+3GO7JP", + "ticker": "BTC", + "type": "msg", +} +`; + exports[`bitcoin COINiDPrivate PUB generates correct return data 1`] = `"49-*0-*0-$xpub6CkbGcMGuz8YPkzfL9r3MrGjazWJYL8rFXKafGTdkFmeMHyLidvaFgWGvkwDTy9ze429K8AiEEoukhyJMw5AvwzwiBH9gjGEk636cnKKKGT"`; exports[`bitcoin COINiDPrivate PUB generates correct return data 2`] = `"44-*0-*0-$xpub6DP26N4oFK3btF9VGJmG4Dbco1hAu7hwg4TaMvdB3i7FptjZMJYad1iAEi6YTsE9au5CwoLXUwsurDoXeQS9TV6iLES7w74VCei4RpUsf44"`; @@ -560,6 +616,54 @@ Object { } `; +exports[`groestlcoin COINiDPrivate MSG generates correct return data 1`] = `"IBBoUR8KwpwrB9EohYzV9f/M+nRXyCEi8kGTGJSKOZPMfubRI0/QDcLzAkPJ3BfGEndJVYv+TkGh40WAMerEAvc="`; + +exports[`groestlcoin COINiDPrivate MSG generates correct return data 2`] = `"coinid-grs://MSG/IBBoUR8KwpwrB9EohYzV9f/M+nRXyCEi8kGTGJSKOZPMfubRI0/QDcLzAkPJ3BfGEndJVYv+TkGh40WAMerEAvc="`; + +exports[`groestlcoin COINiDPrivate MSG parses info correct 1`] = ` +Object { + "derivationPath": "m/49'/17'/0'/0/5", + "message": "This is a test message", + "network": Object { + "bech32": "grs", + "bip32": Object { + "private": 76066276, + "public": 76067358, + }, + "bip44Derivation": 17, + "blockTime": 1, + "bridgeParameterArr": Array [ + Array [ + "blockbook", + "wss://blockbook.groestlcoin.org", + ], + ], + "confirmations": 12, + "hashFunctions": Object { + "address": [Function], + "message": [Function], + "transaction": [Function], + }, + "messagePrefix": "GroestlCoin Signed Message: +", + "pubKeyHash": 36, + "qrScheme": "groestlcoin", + "scriptHash": 5, + "supportedAddressTypes": Array [ + "P2SH-P2WPKH", + "P2PKH", + "P2WPKH", + ], + "ticker": "GRS", + "title": "Groestlcoin", + "wif": 128, + }, + "ownerCheck": "49-*17-*0-*0*5+3LXPYO", + "ticker": "GRS", + "type": "msg", +} +`; + exports[`groestlcoin COINiDPrivate PUB generates correct return data 1`] = `"49-*17-*0-$xpub6C2to84hFLdu4JMxvaoaSiJ1r9buS5Y7nXQGPSuRRYPWX1ATTwB4zdvZq9XeS3C1Bkv1EJp3zQpW7hLN7N2ZjU2cbD1bHMP1NQ2HaAaFo4S"`; exports[`groestlcoin COINiDPrivate PUB generates correct return data 2`] = `"44-*17-*0-$xpub6DBEGvvZFPMwFakEFPZ9Xf3MPvVXiBgHrGZrJMwRSoAtKWhUyMSHQsrRYvdftodqdENyoiVXPE9Y2insgH823cXu7sPbLPvVv822VA9nR1Y"`; @@ -1048,6 +1152,54 @@ Object { } `; +exports[`groestlcoin-testnet COINiDPrivate MSG generates correct return data 1`] = `"IBCqq4n0DQ8lJQ/VZk+69VcxJQ32KEs0b1dnEjbiRm0AfsVwmmppVcYWCW3m/nOEID8FWpJVyKihbvfJnopEpb4="`; + +exports[`groestlcoin-testnet COINiDPrivate MSG generates correct return data 2`] = `"coinid-tgrs://MSG/IBCqq4n0DQ8lJQ/VZk+69VcxJQ32KEs0b1dnEjbiRm0AfsVwmmppVcYWCW3m/nOEID8FWpJVyKihbvfJnopEpb4="`; + +exports[`groestlcoin-testnet COINiDPrivate MSG parses info correct 1`] = ` +Object { + "derivationPath": "m/49'/1'/0'/0/5", + "message": "This is a test message", + "network": Object { + "bech32": "tgrs", + "bip32": Object { + "private": 70615956, + "public": 70617039, + }, + "bip44Derivation": 1, + "blockTime": 1, + "bridgeParameterArr": Array [ + Array [ + "blockbook", + "wss://blockbook-test.groestlcoin.org", + ], + ], + "confirmations": 12, + "hashFunctions": Object { + "address": [Function], + "message": [Function], + "transaction": [Function], + }, + "messagePrefix": "GroestlCoin Signed Message: +", + "pubKeyHash": 111, + "qrScheme": "groestlcoin", + "scriptHash": 196, + "supportedAddressTypes": Array [ + "P2SH-P2WPKH", + "P2PKH", + "P2WPKH", + ], + "ticker": "tGRS", + "title": "GRS Testnet", + "wif": 239, + }, + "ownerCheck": "49-*1-*0-*0*5+2N7UPZ", + "ticker": "tGRS", + "type": "msg", +} +`; + exports[`groestlcoin-testnet COINiDPrivate PUB generates correct return data 1`] = `"49-*1-*0-$tpubDDJYTZ5AfXWqpqguxVxCES2gszSiGbei96C5hcvecimptwhM6oTnQPFuiuCmBjAKVAamR1P9M4RD2rU74XrcfVy3Kbn8J5FgnLkSD8ZGWQh"`; exports[`groestlcoin-testnet COINiDPrivate PUB generates correct return data 2`] = `"44-*1-*0-$tpubDDebpBUs3pCHeXVsPgLHBBbPL76cwdEihX6Sdf5TFCheqK8j3WvDQs7SERyzhJXstJAGeryxipbR5BtsRXBy9GrrhJMYnYcxjFhU5nXZXb5"`; @@ -1536,6 +1688,62 @@ Object { } `; +exports[`myriad COINiDPrivate MSG generates correct return data 1`] = `"IFK83t6NlHfb0SPHhdnTdmL0hBFbJf+TEQ4ZVzFT4Kz6GHfTJyrQtOwfIO6ipBMdpd+sO9in21K2NNCST2Vtz9Y="`; + +exports[`myriad COINiDPrivate MSG generates correct return data 2`] = `"coinid-xmy://MSG/IFK83t6NlHfb0SPHhdnTdmL0hBFbJf+TEQ4ZVzFT4Kz6GHfTJyrQtOwfIO6ipBMdpd+sO9in21K2NNCST2Vtz9Y="`; + +exports[`myriad COINiDPrivate MSG parses info correct 1`] = ` +Object { + "derivationPath": "m/49'/90'/0'/0/5", + "message": "This is a test message", + "network": Object { + "bech32": "my", + "bip32": Object { + "private": 76066276, + "public": 76067358, + }, + "bip44Derivation": 90, + "blockTime": 1, + "bridgeParameterArr": Array [ + Array [ + "blockbook", + "wss://xmy-blockbook1.coinid.org", + ], + Array [ + "blockbook", + "wss://xmy-blockbook2.coinid.org", + ], + Array [ + "blockbook", + "wss://xmy-blockbook3.coinid.org", + ], + ], + "confirmations": 12, + "hashFunctions": Object { + "address": [Function], + "message": [Function], + "transaction": [Function], + }, + "messagePrefix": "Myriadcoin Signed Message: +", + "pubKeyHash": 50, + "qrScheme": "myriadcoin", + "scriptHash": 9, + "supportedAddressTypes": Array [ + "P2SH-P2WPKH", + "P2PKH", + "P2WPKH", + ], + "ticker": "XMY", + "title": "Myriad", + "wif": 178, + }, + "ownerCheck": "49-*90-*0-*0*5+4OV111", + "ticker": "XMY", + "type": "msg", +} +`; + exports[`myriad COINiDPrivate PUB generates correct return data 1`] = `"49-*90-*0-$xpub6CLcS66ooFPGSmHTjTJsMWHEQFX3gNgXuE8aQSxJtpo4BrjpVRqcx3s7uwvqnWDuirsT81c62gaAaWdY5oNSzCaNRxUbSyGpQ9SbQrNRtDu"`; exports[`myriad COINiDPrivate PUB generates correct return data 2`] = `"44-*90-*0-$xpub6CHoWiY52in9RiM2WXoeDajSrcUF9nGDbw3J2wijcodZqynKQFDWzhjNWWF4B5m2TGQyaY9xCVrUKit7nUyogK94WNfNA2DMSrJgAa4LSFb"`; @@ -2078,6 +2286,62 @@ Object { } `; +exports[`testnet COINiDPrivate MSG generates correct return data 1`] = `"H1ox+mmOF5Wh0LK8RgRtL5YSoSHt3l03qjEEMVLlJzCkEvUzfbEBClNji+OeJ65NepKHDB3vm99DHGqa5vTi/8w="`; + +exports[`testnet COINiDPrivate MSG generates correct return data 2`] = `"coinid-tbtc://MSG/H1ox+mmOF5Wh0LK8RgRtL5YSoSHt3l03qjEEMVLlJzCkEvUzfbEBClNji+OeJ65NepKHDB3vm99DHGqa5vTi/8w="`; + +exports[`testnet COINiDPrivate MSG parses info correct 1`] = ` +Object { + "derivationPath": "m/49'/1'/0'/0/5", + "message": "This is a test message", + "network": Object { + "bech32": "tb", + "bip32": Object { + "private": 70615956, + "public": 70617039, + }, + "bip44Derivation": 1, + "blockTime": 10, + "bridgeParameterArr": Array [ + Array [ + "blockbook", + "wss://testnet-blockbook1.coinid.org", + ], + Array [ + "blockbook", + "wss://testnet-blockbook2.coinid.org", + ], + Array [ + "blockbook", + "wss://testnet-blockbook3.coinid.org", + ], + ], + "confirmations": 6, + "hashFunctions": Object { + "address": [Function], + "message": [Function], + "transaction": [Function], + }, + "messagePrefix": "Bitcoin Signed Message: +", + "pubKeyHash": 111, + "qrScheme": "bitcoin", + "scriptHash": 196, + "supportedAddressTypes": Array [ + "P2SH-P2WPKH", + "P2PKH", + "P2WPKH", + ], + "ticker": "tBTC", + "title": "Testnet", + "wif": 239, + }, + "ownerCheck": "49-*1-*0-*0*5+2N7UPZ", + "ticker": "tBTC", + "type": "msg", +} +`; + exports[`testnet COINiDPrivate PUB generates correct return data 1`] = `"49-*1-*0-$tpubDDJYTZ5AfXWqpqguxVxCES2gszSiGbei96C5hcvecimptwhM6oTnQPFuiuCmBjAKVAamR1P9M4RD2rU74XrcfVy3Kbn8J5FgnLkSD6gEPxD"`; exports[`testnet COINiDPrivate PUB generates correct return data 2`] = `"44-*1-*0-$tpubDDebpBUs3pCHeXVsPgLHBBbPL76cwdEihX6Sdf5TFCheqK8j3WvDQs7SERyzhJXstJAGeryxipbR5BtsRXBy9GrrhJMYnYcxjFhU5r5ANde"`; diff --git a/__tests__/coinid-private-test.js b/__tests__/coinid-private-test.js index ab05ba0..5e7aa50 100644 --- a/__tests__/coinid-private-test.js +++ b/__tests__/coinid-private-test.js @@ -142,5 +142,25 @@ coinArray.forEach((coin) => { expect(returnUrl).toMatchSnapshot(); }); }); + + describe('COINiDPrivate MSG', () => { + const { coinid, variant, returnScheme } = getCOINiDFromUrl(COINiDUrls.msg); + + it('parses info correct', () => { + expect(coinid.getInfo()).toMatchSnapshot(); + }); + + it('generates correct return data', async () => { + const returnData = await coinid.getReturnData(mnemonic); + expect(returnData).toMatchSnapshot(); + + const returnUrl = coinid.buildReturnUrl({ + data: returnData, + variant, + returnScheme, + }); + expect(returnUrl).toMatchSnapshot(); + }); + }); }); }); diff --git a/__tests__/data/bitcoin.json b/__tests__/data/bitcoin.json index 3751ad3..3c63d22 100644 --- a/__tests__/data/bitcoin.json +++ b/__tests__/data/bitcoin.json @@ -8,6 +8,7 @@ "swp": "coinid://coinid-btc/SWP/BTC:49-*0-*0-*0*5+3GO7JP:49-*0-*0-*0*2", "tx": "coinid://coinid-btc/TX/BTC:49-*0-*0-*0*5+3GO7JP:49-*0-*0-*0*5+49-*0-*0-*1*2:0100000002A06364D80225EA2181D41AD469B2D5560E594F2C783BBB41CAAA652B493A104C020000000000000000A06364D80225EA2181D41AD469B2D5560E594F2C783BBB41CAAA652B493A104C01000000000000000005400D03000000000017A914A89F3493631D141E847A15CB3BA68234CC6ACC2E87B08F0600000000001976A9147E6257D509CCDD623F4AB33416F17A44A0A5F7BC88AC10270000000000001600147E6257D509CCDD623F4AB33416F17A44A0A5F7BC307500000000000017A91461F05801F6931D95CD0180917B6CACF84C767E818738FA01000000000017A914CD05CE4F0D4B88D2E00A9FE7CF3AA8FEEAF773628700000000:4:369796+430000", "swptx": "coinid://coinid-btc/SWPTX/BTC:49-*0-*0-*0*5+3GO7JP:3Go7JpcBu7XdYa93EUfvTD4hFbECWRr1Ew+49-*0-*0-*0*5+999864:P2SH-P2WPKH*2N14MWFaFKfFcsMgTXKZeRhPZunNUWFzWGy*ad84a0e7453ad2be696a9398eeceac30b1e8fe542937008e03ae0e99e54a0556*1*1000000", - "sah": "coinid://coinid-btc/SAH/BTC:49-*0-*0-*0*5+3GO7JP:49-*0-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D" + "sah": "coinid://coinid-btc/SAH/BTC:49-*0-*0-*0*5+3GO7JP:49-*0-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D", + "msg": "coinid://coinid-btc/MSG/BTC:49-*0-*0-*0*5+3GO7JP:49-*0-*0-*0*5:This%20is%20a%20test%20message" } } diff --git a/__tests__/data/groestlcoin-testnet.json b/__tests__/data/groestlcoin-testnet.json index 5577e7e..548dfe3 100644 --- a/__tests__/data/groestlcoin-testnet.json +++ b/__tests__/data/groestlcoin-testnet.json @@ -8,6 +8,7 @@ "swp": "coinid://coinid-tgrs/SWP/TGRS:49-*1-*0-*0*2+2NA5BU:49-*1-*0-*0*2", "tx": "coinid://coinid-tgrs/TX/TGRS:49-*1-*0-*0*2+2NA5BU:49-*1-*0-*0*2+49-*1-*0-*1*1:0100000002A06364D80225EA2181D41AD469B2D5560E594F2C783BBB41CAAA652B493A104C020000000000000000A06364D80225EA2181D41AD469B2D5560E594F2C783BBB41CAAA652B493A104C01000000000000000005400D03000000000017A914D7EF101DAA78E7656CA3C49B30B854E8C4D7A2BF87B08F0600000000001976A9147E8EB917EAB0DA74EE21769044B8E36562BF5D3288AC10270000000000001600147E8EB917EAB0DA74EE21769044B8E36562BF5D32307500000000000017A914E1BCEA2765A83B1D688CF113A93F78E2D119EA2A8738FA01000000000017A9142E95CFDD61B2F735E6BEDF5291B6F0873E4F1D008700000000:4:369796+430000", "swptx": "coinid://coinid-tgrs/SWPTX/TGRS:49-*1-*0-*0*2+2NA5BU:2NA5bUXmS96csYzmVJJs828MJehYm2zgQBr+49-*1-*0-*0*2+999864:P2PKH*mnrYq7qJsD2hXgpbPLAmYAQebzyi68wqZ8*ad84a0e7453ad2be696a9398eeceac30b1e8fe542937008e03ae0e99e54a0556*1*1000000", - "sah": "coinid://coinid-tgrs/SAH/TGRS:49-*1-*0-*0*2+2NA5BU:49-*1-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D" + "sah": "coinid://coinid-tgrs/SAH/TGRS:49-*1-*0-*0*2+2NA5BU:49-*1-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D", + "msg": "coinid://coinid-tgrs/MSG/tGRS:49-*1-*0-*0*5+2N7UPZ:49-*1-*0-*0*5:This%20is%20a%20test%20message" } } diff --git a/__tests__/data/groestlcoin.json b/__tests__/data/groestlcoin.json index fd360b3..70f12e1 100644 --- a/__tests__/data/groestlcoin.json +++ b/__tests__/data/groestlcoin.json @@ -8,6 +8,7 @@ "swp": "coinid://coinid-grs/SWP/GRS:49-*17-*0-*0*3+3HMJUS:49-*17-*0-*0*2", "tx": "coinid://coinid-grs/TX/GRS:49-*17-*0-*0*3+3HMJUS:49-*17-*0-*0*3+49-*17-*0-*1*1:0100000002A06364D80225EA2181D41AD469B2D5560E594F2C783BBB41CAAA652B493A104C020000000000000000A06364D80225EA2181D41AD469B2D5560E594F2C783BBB41CAAA652B493A104C01000000000000000005400D03000000000017A914C50D589AE0965FBB3484D51AF1271A6BC2851E8987B08F0600000000001976A914EF20271534095EA2A69064620164F248997D64CB88AC1027000000000000160014EF20271534095EA2A69064620164F248997D64CB307500000000000017A914609796DC6E5DFFB0948A3D268ACE1FCFE2B4A96B8738FA01000000000017A914263482828E92FF4510191F10A3FA2CDBC1D047118700000000:4:369796+430000", "swptx": "coinid://coinid-grs/SWPTX/GRS:49-*17-*0-*0*3+3HMJUS:3HmjusqAu6EtPPSpKW88w5tsjf2tx6236S+49-*17-*0-*0*3+999864:P2PKH*FtS9MQRCk4XXJMXUX9C8nN4UScLcNAk22v*ad84a0e7453ad2be696a9398eeceac30b1e8fe542937008e03ae0e99e54a0556*1*1000000", - "sah": "coinid://coinid-grs/SAH/GRS:49-*17-*0-*0*3+3HMJUS:49-*17-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D" + "sah": "coinid://coinid-grs/SAH/GRS:49-*17-*0-*0*3+3HMJUS:49-*17-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D", + "msg": "coinid://coinid-grs/MSG/GRS:49-*17-*0-*0*5+3LXPYO:49-*17-*0-*0*5:This%20is%20a%20test%20message" } } diff --git a/__tests__/data/myriad.json b/__tests__/data/myriad.json index d109700..bc9f636 100644 --- a/__tests__/data/myriad.json +++ b/__tests__/data/myriad.json @@ -8,6 +8,7 @@ "swp": "coinid://coinid-xmy/SWP/XMY:49-*90-*0-*0*2+4FY57D:49-*90-*0-*0*2", "tx": "coinid://coinid-xmy/TX/XMY:49-*90-*0-*0*2+4FY57D:49-*90-*0-*0*2:01000000010D4E4F1E87B9F1D14727A9472640F74F4A18BA448CB063ED3574D21FCF74673800000000000000000004400D0300000000001976A9149E9DCD04CF375691FDFA2D19A52AE404B9EF03DE88ACB08F06000000000017A914594F6D51146D61F84C7027A466069E47DE69712C871027000000000000160014293DBC2B6B7CED3D7F363496A4E00B332F209B94E9645E2C0100000017A914556AA879860E42C377B13639C27350469972A71B8700000000:3:5039991221", "swptx": "coinid://coinid-xmy/SWPTX/XMY:49-*90-*0-*0*2+4FY57D:4fy57d6G6L16DDJgUXPLEy2GBJ3DwmFpTT+49-*90-*0-*0*2+999864:P2PKH*MV7AERJ7BA8nDuftiPoCNsYvGrB1V3koew*ad84a0e7453ad2be696a9398eeceac30b1e8fe542937008e03ae0e99e54a0556*1*1000000", - "sah": "coinid://coinid-xmy/SAH/XMY:49-*90-*0-*0*2+4FY57D:49-*90-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D" + "sah": "coinid://coinid-xmy/SAH/XMY:49-*90-*0-*0*2+4FY57D:49-*90-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D", + "msg": "coinid://coinid-xmy/MSG/XMY:49-*90-*0-*0*5+4OV111:49-*90-*0-*0*5:This%20is%20a%20test%20message" } } diff --git a/__tests__/data/testnet.json b/__tests__/data/testnet.json index 1d6ed98..ec59c05 100644 --- a/__tests__/data/testnet.json +++ b/__tests__/data/testnet.json @@ -8,6 +8,7 @@ "swp": "coinid://coinid-tbtc/SWP/tBTC:49-*1-*0-*1*0+2MTRGW:49-*1-*0-*0*2", "tx": "coinid://coinid-tbtc/TX/TBTC:49-*1-*0-*1*0+2MTRGW:49-*1-*0-*1*0+49-*1-*0-*0*5:0100000002A06364D80225EA2181D41AD469B2D5560E594F2C783BBB41CAAA652B493A104C020000000000000000A06364D80225EA2181D41AD469B2D5560E594F2C783BBB41CAAA652B493A104C01000000000000000005400D03000000000017A91466A8A442F12B2B8A9C45D3D4CB1CCBDCA952D9A387B08F06000000000017A914D170EE37EA45FBB9DC81598C8445237EC47E8A678710270000000000001976A914F12F2C6E408B3CDFF1991B8783D1EB428F57814B88AC307500000000000016001408C3E3704FC510BEE9F2F05686CBF2A9F541E23F38FA01000000000017A9142E95CFDD61B2F735E6BEDF5291B6F0873E4F1D008700000000:4:369796+430000", "swptx": "coinid://coinid-tbtc/SWPTX/tBTC:49-*1-*0-*0*0+2NF5JN:2NF5JNAnFEjW5XagJoEsND8kcNoSJyEdRj6+49-*1-*0-*0*0+999864:P2SH-P2WPKH*2N14MWFaFKfFcsMgTXKZeRhPZunNUWFzWGy*ad84a0e7453ad2be696a9398eeceac30b1e8fe542937008e03ae0e99e54a0556*1*1000000", - "sah": "coinid://coinid-tbtc/SAH/tBTC:49-*1-*0-*1*0+2MTRGW:49-*1-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D" + "sah": "coinid://coinid-tbtc/SAH/tBTC:49-*1-*0-*1*0+2MTRGW:49-*1-*0-*1*1:unlock%20wallet%2005ic9gZoNv2xCc6BbmzvWw%3D%3D", + "msg": "coinid://coinid-tbtc/MSG/tBTC:49-*1-*0-*0*5+2N7UPZ:49-*1-*0-*0*5:This%20is%20a%20test%20message" } } From c2def4171bf46295828a04b440edc8e57ed0c317 Mon Sep 17 00:00:00 2001 From: rikardwissing Date: Wed, 10 Apr 2019 13:36:07 +0200 Subject: [PATCH 6/6] Update project files --- android/app/build.gradle | 2 +- ios/COINiD.xcodeproj/project.pbxproj | 4 ++-- ios/COINiD/Info.plist | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 91aa6db..33568a6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -127,7 +127,7 @@ android { applicationId "org.coinid.vault" minSdkVersion 16 targetSdkVersion 27 - versionCode 64 + versionCode 66 versionName "1.5.0" ndk { abiFilters "armeabi-v7a", "x86" diff --git a/ios/COINiD.xcodeproj/project.pbxproj b/ios/COINiD.xcodeproj/project.pbxproj index b6e2502..1cfbdd2 100644 --- a/ios/COINiD.xcodeproj/project.pbxproj +++ b/ios/COINiD.xcodeproj/project.pbxproj @@ -1556,7 +1556,7 @@ CODE_SIGN_ENTITLEMENTS = COINiD/COINiD.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 136; + CURRENT_PROJECT_VERSION = 139; DEAD_CODE_STRIPPING = NO; DEVELOPMENT_TEAM = RTXAQQG73Y; FRAMEWORK_SEARCH_PATHS = ""; @@ -1614,7 +1614,7 @@ CODE_SIGN_ENTITLEMENTS = COINiD/COINiD.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 136; + CURRENT_PROJECT_VERSION = 139; DEVELOPMENT_TEAM = RTXAQQG73Y; FRAMEWORK_SEARCH_PATHS = ""; HEADER_SEARCH_PATHS = ( diff --git a/ios/COINiD/Info.plist b/ios/COINiD/Info.plist index 37dc26a..3be5a75 100644 --- a/ios/COINiD/Info.plist +++ b/ios/COINiD/Info.plist @@ -32,7 +32,7 @@ CFBundleVersion - 136 + 139 ITSAppUsesNonExemptEncryption LSApplicationQueriesSchemes