Skip to content

Commit

Permalink
Merge pull request #1 from COINiD/feature/sign-message
Browse files Browse the repository at this point in the history
Feature/sign message
  • Loading branch information
rikardwissing authored Apr 10, 2019
2 parents af5bb9d + c2def41 commit 833d943
Show file tree
Hide file tree
Showing 12 changed files with 356 additions and 28 deletions.
320 changes: 312 additions & 8 deletions __tests__/__snapshots__/coinid-private-test.js.snap

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions __tests__/coinid-private-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});
});
3 changes: 2 additions & 1 deletion __tests__/data/bitcoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
3 changes: 2 additions & 1 deletion __tests__/data/groestlcoin-testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
3 changes: 2 additions & 1 deletion __tests__/data/groestlcoin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
3 changes: 2 additions & 1 deletion __tests__/data/myriad.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
3 changes: 2 additions & 1 deletion __tests__/data/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ android {
applicationId "org.coinid.vault"
minSdkVersion 16
targetSdkVersion 27
versionCode 63
versionName "1.4"
versionCode 66
versionName "1.5.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
Expand Down
4 changes: 2 additions & 2 deletions ios/COINiD.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 139;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = RTXAQQG73Y;
FRAMEWORK_SEARCH_PATHS = "";
Expand Down Expand Up @@ -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 = 139;
DEVELOPMENT_TEAM = RTXAQQG73Y;
FRAMEWORK_SEARCH_PATHS = "";
HEADER_SEARCH_PATHS = (
Expand Down
4 changes: 2 additions & 2 deletions ios/COINiD/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.4</string>
<string>1.5.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -32,7 +32,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>135</string>
<string>139</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
15 changes: 7 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -1587,13 +1587,12 @@ 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#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"

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -1930,12 +1929,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#7cc3ad15bd60a2396d292e59112a41a4fbe4f29d"
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"

Expand Down

0 comments on commit 833d943

Please sign in to comment.