Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Merge pull request #184 from LiskHQ/182-update_lisk-js
Browse files Browse the repository at this point in the history
Updating lisk-js - Closes #182
  • Loading branch information
karmacoma authored May 8, 2017
2 parents 27dfbf4 + 1edd820 commit f3c68fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/app/components/sign-verify/verify-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@ app.component('verifyMessage', {
try {
this.result = lisk.crypto.verifyMessageWithPublicKey(
this.signature.value, this.publicKey.value);
if (this.result && this.result.message) {
throw this.result;
}
} catch (e) {
if (e.message.substring(0, 4) === 'nacl' && this.publicKey.value) {
if (e.message.indexOf('Invalid publicKey') !== -1 && this.publicKey.value) {
this.publicKey.error.invalid = true;
} else if (e.message.indexOf('length') !== -1 && this.signature.value) {
} else if (e.message.indexOf('Invalid signature') !== -1 && this.signature.value) {
this.signature.error.invalid = true;
}
this.result = '';
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"bitcore-mnemonic": "=1.1.1",
"debug": "=2.2.0",
"jquery": "=2.2.4",
"lisk-js": "=0.4.0",
"lisk-js": "=0.4.1",
"lodash": "=4.16.4",
"moment": "=2.15.1",
"ng-infinite-scroll": "=1.3.0",
Expand Down
4 changes: 3 additions & 1 deletion src/test/components/sign-verify/sign-message.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ describe('Sign message component', () => {
const message = 'Hello world';
const result =
'-----BEGIN LISK SIGNED MESSAGE-----\n' +
'-----MESSAGE-----\n' +
'Hello world\n' +
'-----BEGIN SIGNATURE-----\n' +
'-----PUBLIC KEY-----\n' +
'9d3058175acab969f41ad9b86f7a2926c74258670fe56b37c429c01fca9f2f0f\n' +
'-----SIGNATURE-----\n' +
'dd01775ec30225b24a74ee2ff9578ed3515371ddf32ba50540dc79a5dab66252081d0a345be3ad5d' +
'fcb939f018d3dd911d9eacfe8998784879cc37fdfde1200448656c6c6f20776f726c64\n' +
'-----END LISK SIGNED MESSAGE-----';
Expand Down

0 comments on commit f3c68fb

Please sign in to comment.