Skip to content

Commit

Permalink
XNET-40 | Validation of private key (#7)
Browse files Browse the repository at this point in the history
* feat: added valiadtion of private key

* chore: version update
  • Loading branch information
Pobepto committed Feb 20, 2020
1 parent f749b43 commit 51749ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-ots",
"version": "0.4.3",
"version": "0.4.4",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
9 changes: 9 additions & 0 deletions src/views/SignTX.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,19 @@ export default {
this.isZipFile = false
},
onSignAndDownload () {
const _keyPattern = (value) => {
const pattern = /^[A-Fa-f0-9]{64}$/
if (!pattern.test(value)) return false
return true
}
if (!this.sign.privateKey.length) {
this.$message.error('Private key can\'t be empty!')
return
}
if (!_keyPattern(this.sign.privateKey)) {
this.$message.error('Invalid private key!')
return
}
if (this.isZipFile) {
this.onSignZip()
.then(txs => this.onSaveTransactions(txs))
Expand Down

0 comments on commit 51749ea

Please sign in to comment.