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

Commit

Permalink
Merge pull request #666 from NemProject/2.6.1
Browse files Browse the repository at this point in the history
2.6.1 post-launch opt-in extra security check
  • Loading branch information
rg911 authored Jun 14, 2021
2 parents 11dc220 + d93b855 commit ea49adf
Show file tree
Hide file tree
Showing 20 changed files with 316 additions and 63 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 2.6.1

- Added post-launch opt-in check NIS keys

## Version 2.6.0

- Added post-launch opt-in process
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": "NEM-Wallet",
"version": "2.6.0",
"version": "2.6.1",
"description": "Cross-platform lite wallet for NEM",
"author": "https://github.com/QuantumMechanics <qmnwdev@gmail.com>",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/app/config/app.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const AppConstants = {
//Application name
appName: 'NEM Wallet',

version: '2.6.0',
version: '2.6.1',

//Network
defaultNetwork: 104,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ class NormalOptInCtrl {
this.formData.password = "";
this.formData.confirmPassword = "";
this.formData.acceptPrivacy = false;
this.formData.addressConfirmed = false;
this.statusLoading = true;
this.isOptedIn = false;
this.formData.selectedAccount = this._DataStore.account.metaData.account;
this.isMultisig = false;
this.hasCosignatorySigned = true;
this.isConfirmAddressModalShown = false;
this.publicKeyError = false;
}

/**
Expand Down Expand Up @@ -167,10 +170,22 @@ class NormalOptInCtrl {
try {
if (this.multisigDestinationPublicKey.length !== 64) {
this.multisigDestinationAddress = null;
this.publicKeyError = false;
} else {
this.multisigDestinationAddress = PublicAccount.createFromPublicKey(this.multisigDestinationPublicKey, this.catapultNetwork).address.pretty();
this._CatapultOptin.checkIfNIS1PublicKeyOrPrivateKey(this.multisigDestinationPublicKey).then(result => {
this._$timeout(() => {
if (result) {
this.multisigDestinationAddress = PublicAccount.createFromPublicKey(this.multisigDestinationPublicKey, this.catapultNetwork).address.pretty();
this.publicKeyError = false;
} else {
this.multisigDestinationAddress = null;
this.publicKeyError = true;
}
});
});
}
} catch (e) {
this.publicKeyError = false;
this.multisigDestinationAddress = null;
}
}
Expand All @@ -192,11 +207,23 @@ class NormalOptInCtrl {
try {
if (this.optinPublicKey.length !== 64) {
this.optinAccount = null;
this.publicKeyError = false;
} else {
this.optinAccount = PublicAccount.createFromPublicKey(this.optinPublicKey, this.catapultNetwork);
this._CatapultOptin.checkIfNIS1PublicKeyOrPrivateKey(this.optinPublicKey).then(result => {
this._$timeout(() => {
if (result) {
this.optinAccount = PublicAccount.createFromPublicKey(this.optinPublicKey, this.catapultNetwork);
this.publicKeyError = false;
} else {
this.optinAccount = null;
this.publicKeyError = true;
}
});
});
}
} catch (e) {
this.optinAccount = null;
this.publicKeyError = false;
}
}

Expand All @@ -219,42 +246,54 @@ class NormalOptInCtrl {
}
}

/**
* Shows Symbol Address confirmation modal
*/
showConfirmAddressModal() {
this.formData.addressConfirmed = false;

if (this._Wallet.decrypt(this.common))
this.isConfirmAddressModalShown = true;
}

/**
* Hides Symbol Address confirmation modal
*/
hideConfirmAddressModal() {
this.isConfirmAddressModalShown = false;
}


/**
* Sends optin simple or multisig account by a valid form
*/
send() {
this.isConfirmAddressModalShown = false;
if (this._Wallet.decrypt(this.common)) {
if (this._DataStore.account.metaData.account.balance < this.fee) {
this._$timeout(() => {
this._Alert.insufficientBalance();
});
}
else {
this.step = 0;
this.statusLoading = true;
this._$timeout(() => {
if (!this.isMultisig) {
this._CatapultOptin.sendSimpleOptin(this.common, this.optinPublicKey).then(result => {
this.checkOptinStatus(this.formData.selectedAccount.address);
this.optinAccount = null;
this.optinPublicKey = '';
}).catch(e => {
// this
});
} else {
this._CatapultOptin.sendMultisigOptin(this.common, this.formData.selectedAccount.publicKey, this.multisigDestinationPublicKey).then(result => {
this.checkOptinStatus(this.formData.selectedAccount.address);
this.onMultisigSelectorChange();
this.optinAccount = null;
this.optinPublicKey = '';
this.multisigDestinationPublicKey = '';
this.multisigDestinationAddress = '';
}).catch(e => {
// this
});
}
});
}
this.step = 0;
this.statusLoading = true;
this._$timeout(() => {
if (!this.isMultisig) {
this._CatapultOptin.sendSimpleOptin(this.common, this.optinPublicKey).then(result => {
this.checkOptinStatus(this.formData.selectedAccount.address);
this.optinAccount = null;
this.optinPublicKey = '';
}).catch(e => {
// this
});
} else {
this._CatapultOptin.sendMultisigOptin(this.common, this.formData.selectedAccount.publicKey, this.multisigDestinationPublicKey).then(result => {
this.checkOptinStatus(this.formData.selectedAccount.address);
this.onMultisigSelectorChange();
this.optinAccount = null;
this.optinPublicKey = '';
this.multisigDestinationPublicKey = '';
this.multisigDestinationAddress = '';
}).catch(e => {
// this
});
}
});
}
this.common.password = '';
this.formData.acceptTerms = false;
Expand Down
66 changes: 62 additions & 4 deletions src/app/modules/catapultOptin/catapultOptin/catapultOptin.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ <h1>{{'CATAPULTOPTIN_ACCOUNT_UNLOCK' | translate}}</h1>
<div class="form-group" ng-show="$ctrl.isMultisig && $ctrl.optinStatus === 3">
<p>{{'POST_OPTIN_DEST_MSIG' | translate}}</p>
<input ng-show="$ctrl.optinStatus === 3" type="text" placeholder="{{ 'OPTIN_PUBLICKEY_PLACEHOLDER' | translate }}" class="optin-label-form" ng-model="$ctrl.multisigDestinationPublicKey" ng-change="$ctrl.calculateMultisigDestinationAddress()"/>
<p style="color: red; font-size: 14px; margin-top: 10px;" ng-show="$ctrl.publicKeyError">{{'OPTIN_NIS1_PUBLIC_KEY' | translate}}</p>
</div>
<div class="form-group" ng-show="$ctrl.isMultisig && $ctrl.multisigDestinationAddress">
<p>{{'POST_OPTIN_DEST_MSIG_ADDRESS' | translate}}</p>
Expand All @@ -129,6 +130,7 @@ <h1>{{'CATAPULTOPTIN_ACCOUNT_UNLOCK' | translate}}</h1>
<div class="form-group" ng-show="!$ctrl.isMultisig">
<p>{{'CATAPULTOPTIN_ACCOUNT_UNLOCK' | translate}}</p>
<input type="text" class="optin-label-form" placeholder="{{ 'OPTIN_PUBLICKEY_PLACEHOLDER' | translate }}" ng-model="$ctrl.optinPublicKey" ng-change="$ctrl.onPrivateKeyChange()"/>
<p style="color: red; font-size: 14px; margin-top: 10px;" ng-show="$ctrl.publicKeyError">{{'OPTIN_NIS1_PUBLIC_KEY' | translate}}</p>
</div>
<div class="form-group" ng-show="!$ctrl.isMultisig && $ctrl.optinAccount">
<p>{{'YOUR_SYMBOL_ADDRESS' | translate}}</p>
Expand All @@ -137,10 +139,10 @@ <h1>{{'CATAPULTOPTIN_ACCOUNT_UNLOCK' | translate}}</h1>
<div class="mt-4">
<div class="row">
<div class="col-md-6" style="padding: 0 16px;">
<button class="btn symbol-button symbol-button__block" style="float:left;" ng-click="$ctrl.step = 15; $ctrl.optinAccount = null; $ctrl.optinPublicKey = '';">{{'GENERAL_BACK' | translate}}</button>
<button class="btn symbol-button symbol-button__block" style="float:left;" ng-click="$ctrl.step = 15; $ctrl.optinAccount = null; $ctrl.optinPublicKey = ''; $ctrl.publicKeyError = false; $ctrl.multisigDestinationPublicKey = '';">{{'GENERAL_BACK' | translate}}</button>
</div>
<div class="col-md-6" style="padding: 0 16px;">
<button class="btn symbol-button symbol-button__block" style="float:left;" ng-show="(!$ctrl.isMultisig && !!$ctrl.optinAccount) || ($ctrl.isMultisig && $ctrl.isValidMultisigDestination())" ng-click="$ctrl.step = 17;">{{'GENERAL_NEXT' | translate}}</button>
<button class="btn symbol-button symbol-button__block" style="float:left;" ng-show="(!$ctrl.isMultisig && !!$ctrl.optinAccount) || ($ctrl.isMultisig && !!$ctrl.multisigDestinationAddress)" ng-click="$ctrl.step = 17;">{{'GENERAL_NEXT' | translate}}</button>
</div>
</div>
</div>
Expand All @@ -153,7 +155,7 @@ <h1>{{'CATAPULTOPTIN_ACCOUNT_UNLOCK' | translate}}</h1>
<h1 style="color: #44004E">{{'CATAPULTOPTIN_REVIEW_NORMAL_RESULT' | translate}}</h1>
</div>
</div>
<div class="col-md-8 col-md-offset-2" ng-show="$ctrl.step == 17">
<div class="col-md-8 col-md-offset-2" ng-show="$ctrl.step == 17 && $ctrl.isConfirmAddressModalShown == false">
<!-- Wallet type titles -->
<div ng-show="!$ctrl.isMultisig">
<div class="form-group">
Expand Down Expand Up @@ -199,12 +201,68 @@ <h1 style="color: #44004E">{{'CATAPULTOPTIN_REVIEW_NORMAL_RESULT' | translate}}<
<div class="col-md-6" style="padding: 0 16px;">
<button class="btn symbol-button symbol-button__block" style="float:left; background: rgb(255,0,255);
background: linear-gradient(42deg, rgba(255,0,255,1) 0%, rgba(255,255,255,1) 100%);"
ng-click="$ctrl.send()"
ng-click="$ctrl.showConfirmAddressModal()"
ng-disabled="!$ctrl.formData.acceptPrivacy || !$ctrl.formData.acceptTerms"
>{{ 'GENERAL_TAB_SEND' | translate }}</button>
</div>
</div>
</div>
</div>

<!-- CONFIRM ADDRESS MODAL -->
<div ng-show="$ctrl.isConfirmAddressModalShown == true" class="optin-confirm-bg container">
<div class="optin-confirm-modal col-sm-12 col-md-9">

<div class="row optin-confirm-modal-inner">
<div class="optin-confirm-modal-image-container col-xs-1 col-sm-4">
<img src="images/address-verify.png" class="optin-confirm-modal-image">
</div>

<div class="optin-confirm-modal-body pb-2 pt-2 col-xs-11 col-sm-8">
<div>
<h4 style="color: #44004E; font-weight: bold; font-size: 24px;">{{'POST_OPTIN_CONFIRM_MODAL_TITLE' | translate}}</h4>
</div>
<div ng-show="$ctrl.isMultisig == false" class="mt-2">
{{'POST_OPTIN_CONFIRM_MODAL_TEXT' | translate}}
</div>
<div ng-show="$ctrl.isMultisig == true" class="mt-2">
{{'POST_OPTIN_CONFIRM_MODAL_TEXT_MULTISIG' | translate}}
</div>
<div class="mt-4">
<div ng-show="!$ctrl.isMultisig" class="form-group">
<p class="purple-dark">{{'POST_OPTIN_DEST_ADDRESS' | translate}}</p>
<label class="text-left optin-label-form-white" style="width: 100%; text-align: left; padding-left: 30px;">{{$ctrl.optinAccount.address.pretty()}}</label>
</div>
<div ng-show="$ctrl.isMultisig" class="form-group">
<p class="purple-dark">{{'POST_OPTIN_DEST_MULTISIG_ADDRESS' | translate}}</p>
<label class="text-left optin-label-form-white" style="width: 100%; text-align: left; padding-left: 30px;">{{$ctrl.multisigDestinationAddress}}</label>
</div>
</div>
<div class="mt-4">
<input id="address_confirm" type="checkbox" ng-model="$ctrl.formData.addressConfirmed">
<label class="mt-2" for="address_confirm" class="purple-dark">
<b ng-show="$ctrl.isMultisig == false">{{ 'POST_OPTIN_CONFIRM_MODAL_CHECKBOX' | translate }}</b>
<b ng-show="$ctrl.isMultisig == true">{{ 'POST_OPTIN_CONFIRM_MODAL_CHECKBOX_MULTISIG' | translate }}</b>
</label>
</div>
<div class="mt-2">
<div class="row">
<div class="col-md-6" style="padding: 0 16px;">
<button class="btn symbol-button symbol-button__block" style="float:left;"
ng-click="$ctrl.hideConfirmAddressModal()">{{'GENERAL_BACK' |
translate}}</button>
</div>
<div class="col-md-6" style="padding: 0 16px;">
<button class="btn symbol-button symbol-button__block" style="float:left; background: rgb(255,0,255);
background: linear-gradient(42deg, rgba(255,0,255,1) 0%, rgba(255,255,255,1) 100%);" ng-click="$ctrl.send()"
ng-disabled="!$ctrl.formData.addressConfirmed">{{
'GENERAL_TAB_SEND' | translate }}</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
6 changes: 6 additions & 0 deletions src/app/modules/languages/cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,12 @@ function ChineseProvider($translateProvider) {
OPTIN_NOT_AVAILABLE: '您的快照模块上没有足够的余额, 亦或者您已在发布前选择加入。',
OPTIN_PUBLICKEY_PLACEHOLDER: '公钥只能是64位的Hex字符串',
OPTIN_DONE: '完成',
POST_OPTIN_CONFIRM_MODAL_TITLE: '注意!',
POST_OPTIN_CONFIRM_MODAL_TEXT: "请确认 Symbol 目标地址是您的 Symbol 帐户地址。您可以在 Symbol Wallet 主屏幕中找到您的 Symbol 帐户地址。如果不匹配,请重新开始该过程并提供您拥有的帐户的有效Symbol公钥。",
POST_OPTIN_CONFIRM_MODAL_CHECKBOX: "我确认Symbol目标地址与我的Symbol帐户地址匹配",
POST_OPTIN_CONFIRM_MODAL_TEXT_MULTISIG: "请确认 Symbol 目标地址是您的 Symbol 多重签名帐户地址。如果不匹配,请重新开始该过程并提供多重签名帐户的有效Symbol公钥。",
POST_OPTIN_CONFIRM_MODAL_CHECKBOX_MULTISIG: "我确认 Symbol 目标地址与 Symbol 多重签名帐户地址匹配",
OPTIN_NIS1_PUBLIC_KEY: '您输入的公钥是 NIS1 密钥!您需要输入一个Symbol公钥。'
});

}
Expand Down
9 changes: 7 additions & 2 deletions src/app/modules/languages/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -992,8 +992,13 @@ function GermanProvider($translateProvider) {
OPTIN_SYMBOL_READY: 'Your Symbol account is ready',
OPTIN_COPY_SUCCESS: 'Copied!',
OPTIN_TYPE_SELECT: 'Select the way you opted in this wallet',
CATAPULT_OPT_IN_ERROR_TOO_MUCH_COSIGNATORIES: 'This account has more than 8 cosignatories. Opt In protocol only allows multisig accounts with less than 9 cosignatories'

CATAPULT_OPT_IN_ERROR_TOO_MUCH_COSIGNATORIES: 'This account has more than 8 cosignatories. Opt In protocol only allows multisig accounts with less than 9 cosignatories',
POST_OPTIN_CONFIRM_MODAL_TITLE: "Warning!",
POST_OPTIN_CONFIRM_MODAL_TEXT: "Please verify that the Symbol destination address is your Symbol account address. You can find your Symbol account address in your Symbol Wallet home screen. If it doesn’t match, please start the process again and provide a valid Symbol public key of the account that you own.",
POST_OPTIN_CONFIRM_MODAL_CHECKBOX: "I confirm that the Symbol destination address matches my Symbol account address",
POST_OPTIN_CONFIRM_MODAL_TEXT_MULTISIG: "Please verify that the Symbol destination address is your Symbol multisig account address. If it doesn’t match, please start the process again and provide a valid Symbol public key of the multisig account.",
POST_OPTIN_CONFIRM_MODAL_CHECKBOX_MULTISIG: "I confirm that the Symbol destination address matches the Symbol multisig account address",
OPTIN_NIS1_PUBLIC_KEY: 'The public key you entered is a NIS1 key! You need to enter a Symbol public key.'
});

}
Expand Down
6 changes: 6 additions & 0 deletions src/app/modules/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,12 @@ function EnglishProvider($translateProvider) {
OPTIN_NOT_AVAILABLE: 'You didn\'t have enough XEM in Snapshot or you already claimed them in a pre-launch opt-in.',
OPTIN_PUBLICKEY_PLACEHOLDER: 'Public key must be 64 hexadecimal characters long.',
OPTIN_SIGNED: 'Signed',
POST_OPTIN_CONFIRM_MODAL_TITLE: "Warning!",
POST_OPTIN_CONFIRM_MODAL_TEXT: "Please verify that the Symbol destination address is your Symbol account address. You can find your Symbol account address in your Symbol Wallet home screen. If it doesn’t match, please start the process again and provide a valid Symbol public key of the account that you own.",
POST_OPTIN_CONFIRM_MODAL_CHECKBOX: "I confirm that the Symbol destination address matches my Symbol account address",
POST_OPTIN_CONFIRM_MODAL_TEXT_MULTISIG: "Please verify that the Symbol destination address is your Symbol multisig account address. If it doesn’t match, please start the process again and provide a valid Symbol public key of the multisig account.",
POST_OPTIN_CONFIRM_MODAL_CHECKBOX_MULTISIG: "I confirm that the Symbol destination address matches the Symbol multisig account address",
OPTIN_NIS1_PUBLIC_KEY: 'The public key you entered is a NIS1 key! You need to enter a Symbol public key.'
});
}

Expand Down
Loading

0 comments on commit ea49adf

Please sign in to comment.