Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Allow signing via Qr #4881

Merged
merged 65 commits into from
Mar 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
a7102a4
QR code scanning in-place
jacogr Mar 10, 2017
8f4e189
Merge branch 'master' into jg-external-accounts
jacogr Mar 10, 2017
bf75a44
QrScan component
jacogr Mar 11, 2017
fd9f48e
Update tests
jacogr Mar 11, 2017
adbd792
Merge branch 'master' into jg-external-accounts
jacogr Mar 11, 2017
c27d89e
s/store/createStore/ in props
jacogr Mar 13, 2017
08058e6
Create of actual accountsInfo entry
jacogr Mar 13, 2017
a1ae451
Merge branch 'master' into jg-external-accounts
jacogr Mar 13, 2017
865eca4
Exteral/hardware forget, no password change
jacogr Mar 13, 2017
23dd1c0
Add external accounts to accounts list
jacogr Mar 13, 2017
70fc7f9
Render external accounts in section (along with hw)
jacogr Mar 13, 2017
d4a8805
Manul test bugfixes
jacogr Mar 13, 2017
454f044
Display Qr code for tx signing
jacogr Mar 13, 2017
93a7bdf
Align QR code
jacogr Mar 13, 2017
c3f46fc
Merge branch 'master' into jg-external-sign
jacogr Mar 13, 2017
50db047
Hints for QR operations
jacogr Mar 13, 2017
a468b23
Merge branch 'master' into jg-external-sign
jacogr Mar 13, 2017
6e06238
Generate actual qr codes based on tx data
jacogr Mar 13, 2017
a55759f
Merge branch 'master' into jg-external-sign
jacogr Mar 13, 2017
36d0051
Add leading 0x if not found
jacogr Mar 14, 2017
a6e8e2b
Merge branch 'master' into jg-external-accounts
jacogr Mar 14, 2017
548ed31
Merge branch 'jg-external-accounts' into jg-external-sign
jacogr Mar 14, 2017
715323c
Update tests for 0x leading addition
jacogr Mar 14, 2017
c2a8c9c
Merge branch 'jg-external-accounts' into jg-external-sign
jacogr Mar 14, 2017
168a025
from & rpl without leading 0x
jacogr Mar 14, 2017
688ca00
Auto-detect QR code size (input length)
jacogr Mar 14, 2017
5347906
Confirm raw
jacogr Mar 14, 2017
2bcce8e
WIP (lots of logging)
jacogr Mar 15, 2017
a66d98d
WIP
jacogr Mar 15, 2017
461d818
Chain-replay protection
jacogr Mar 15, 2017
cfef553
Merge branch 'master' into jg-external-sign
jacogr Mar 15, 2017
c88c738
Readability
jacogr Mar 16, 2017
90950b9
Re-add r: chainId
jacogr Mar 16, 2017
a89a430
s = 0, r = 0, v = chainId
jacogr Mar 16, 2017
0f66750
Update eth_signTransaction to send transaction object
jacogr Mar 16, 2017
55450dd
And it actually works.
jacogr Mar 16, 2017
ddfb036
Merge branch 'master' into jg-external-sign
jacogr Mar 16, 2017
e63223e
Externalise createUnsigned/createSigned
jacogr Mar 17, 2017
047fa26
Merge branch 'master' into jg-external-sign
jacogr Mar 20, 2017
be43cff
Check for nonce updates (future: subscriptions)
jacogr Mar 20, 2017
af3e7ba
Merge branch 'master' into jg-external-sign
jacogr Mar 20, 2017
66a33e5
Allow gas overrides
jacogr Mar 20, 2017
0d1fb48
Expose formatted condition
jacogr Mar 20, 2017
c804fe9
Merge branch 'master' into jg-external-sign
jacogr Mar 22, 2017
73de72a
Merge branch 'master' into jg-external-sign
jacogr Mar 24, 2017
33fcbca
Extract calculation (cap at 40)
jacogr Mar 24, 2017
68afc24
Remove debug log
jacogr Mar 24, 2017
49fc414
Fix rename linting
jacogr Mar 24, 2017
db5a96a
Allow for signing hash & rlp (App support forthcoming)
jacogr Mar 24, 2017
e253c8e
WIP
jacogr Mar 24, 2017
cb34bfc
User original qrcode-generator package
jacogr Mar 24, 2017
899e153
Complete hash + rlp signing
jacogr Mar 24, 2017
495f7ea
Accurate QR code size calculation
jacogr Mar 24, 2017
09cf9a2
Simplify type calculation
jacogr Mar 24, 2017
375e8f0
R-eactivate current mobile interface (TODO for new)
jacogr Mar 24, 2017
cd8d2ac
Move napa to dep
jacogr Mar 24, 2017
377fc57
Merge branch 'master' into jg-external-sign
jacogr Mar 24, 2017
e9f9f48
Merge branch 'master' into jg-external-sign
jacogr Mar 27, 2017
e9ad844
Allow external accounts visibility in dapps
jacogr Mar 27, 2017
053836c
Allow napa install on CI
jacogr Mar 27, 2017
095d819
Merge branch 'master' into jg-external-sign
jacogr Mar 28, 2017
ebe1eb6
Merge branch 'master' into jg-external-sign
jacogr Mar 29, 2017
3fb9cb3
Allow new signTransaction & signTransactionHash functionality
jacogr Mar 29, 2017
6e0ca8a
Merge branch 'master' into jg-external-sign
jacogr Mar 30, 2017
306500c
Merge branch 'master' into jg-external-sign
jacogr Mar 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions js/.npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
save-prefix=''
unsafe-perm=true
7 changes: 6 additions & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"Promise"
],
"scripts": {
"install": "napa",
"analize": "npm run analize:lib && npm run analize:dll && npm run analize:app",
"analize:app": "WPANALIZE=1 webpack --config webpack/app --json > .build/analize.app.json && cat .build/analize.app.json | webpack-bundle-size-analyzer",
"analize:lib": "WPANALIZE=1 webpack --config webpack/libraries --json > .build/analize.lib.json && cat .build/analize.lib.json | webpack-bundle-size-analyzer",
Expand Down Expand Up @@ -63,6 +64,9 @@
"test:npm": "(cd .npmjs && npm i) && node test/npmParity && node test/npmJsonRpc && (rm -rf .npmjs/node_modules)",
"prepush": "npm run lint:cached"
},
"napa": {
"qrcode-generator": "kazuhikoarase/qrcode-generator"
},
"devDependencies": {
"babel-cli": "6.23.0",
"babel-core": "6.23.1",
Expand Down Expand Up @@ -181,10 +185,10 @@
"mobx-react": "4.0.3",
"mobx-react-devtools": "4.2.10",
"moment": "2.17.0",
"napa": "2.3.0",
"phoneformat.js": "1.0.3",
"promise-worker": "1.1.1",
"push.js": "0.0.11",
"qrcode-npm": "0.0.3",
"qs": "6.3.0",
"react": "15.4.2",
"react-ace": "4.1.0",
Expand All @@ -197,6 +201,7 @@
"react-intl": "2.1.5",
"react-markdown": "2.4.4",
"react-portal": "3.0.0",
"react-qr-reader": "1.0.3",
"react-redux": "4.4.6",
"react-router": "3.0.0",
"react-router-redux": "4.0.7",
Expand Down
4 changes: 2 additions & 2 deletions js/src/api/rpc/eth/eth.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ export default class Eth {
.execute('eth_sign', inAddress(address), inHash(hash));
}

signTransaction () {
signTransaction (options) {
return this._transport
.execute('eth_signTransaction');
.execute('eth_signTransaction', inOptions(options));
}

submitHashrate (hashrate, clientId) {
Expand Down
6 changes: 3 additions & 3 deletions js/src/modals/CreateAccount/AccountDetails/accountDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ import styles from '../createAccount.css';
@observer
export default class AccountDetails extends Component {
static propTypes = {
store: PropTypes.object.isRequired
createStore: PropTypes.object.isRequired
}

render () {
const { address, description, name } = this.props.store;
const { address, description, name } = this.props.createStore;

return (
<div className={ styles.details }>
Expand Down Expand Up @@ -79,7 +79,7 @@ export default class AccountDetails extends Component {
}

renderPhrase () {
const { phrase } = this.props.store;
const { phrase } = this.props.createStore;

if (!phrase) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function render () {
store = createStore();
component = shallow(
<AccountDetails
store={ store }
createStore={ store }
/>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ import styles from '../createAccount.css';
@observer
export default class AccountDetailsGeth extends Component {
static propTypes = {
store: PropTypes.object.isRequired
createStore: PropTypes.object.isRequired
}

render () {
const { gethAccountsAvailable, gethImported } = this.props.store;
const { gethAccountsAvailable, gethImported } = this.props.createStore;

const accounts = gethAccountsAvailable.filter((account) => gethImported.includes(account.address));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function render () {
store = createStore();
component = shallow(
<AccountDetailsGeth
store={ store }
createStore={ store }
/>
);

Expand Down
10 changes: 5 additions & 5 deletions js/src/modals/CreateAccount/ChangeVault/changeVault.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import { VaultSelect } from '~/ui';
@observer
export default class ChangeVault extends Component {
static propTypes = {
store: PropTypes.object.isRequired,
createStore: PropTypes.object.isRequired,
vaultStore: PropTypes.object
}

render () {
const { store, vaultStore } = this.props;
const { vaultName } = store;
const { createStore, vaultStore } = this.props;
const { vaultName } = createStore;

if (!vaultStore || vaultStore.vaultsOpened.length === 0) {
return null;
Expand All @@ -44,8 +44,8 @@ export default class ChangeVault extends Component {
}

onSelect = (vaultName) => {
const { store } = this.props;
const { createStore } = this.props;

store.setVaultName(vaultName);
createStore.setVaultName(vaultName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function createVaultStore () {
function render () {
component = shallow(
<ChangeVault
store={ createStore() }
createStore={ createStore() }
vaultStore={ createVaultStore() }
/>
);
Expand Down
53 changes: 34 additions & 19 deletions js/src/modals/CreateAccount/CreationType/creationType.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ const TYPES = [
),
key: 'fromPhrase'
},
{
description: (
<FormattedMessage
id='createAccount.creationType.fromQr.description'
defaultMessage='Attach an externally managed account via QR code'
/>
),
label: (
<FormattedMessage
id='createAccount.creationType.fromQr.label'
defaultMessage='External Account'
/>
),
key: 'fromQr'
},
{
description: (
<FormattedMessage
Expand Down Expand Up @@ -87,43 +102,43 @@ const TYPES = [
{
description: (
<FormattedMessage
id='createAccount.creationType.fromPresale.description'
defaultMessage='Import an Ethereum presale wallet file with the original password'
id='createAccount.creationType.fromRaw.description'
defaultMessage='Enter a previously created raw private key with a new password'
/>
),
label: (
<FormattedMessage
id='createAccount.creationType.fromPresale.label'
defaultMessage='Presale wallet'
id='createAccount.creationType.fromRaw.label'
defaultMessage='Private key'
/>
),
key: 'fromPresale'
key: 'fromRaw'
},
{
description: (
<FormattedMessage
id='createAccount.creationType.fromRaw.description'
defaultMessage='Enter a previously created raw private key with a new password'
id='createAccount.creationType.fromPresale.description'
defaultMessage='Import an Ethereum presale wallet file with the original password'
/>
),
label: (
<FormattedMessage
id='createAccount.creationType.fromRaw.label'
defaultMessage='Private key'
id='createAccount.creationType.fromPresale.label'
defaultMessage='Presale wallet'
/>
),
key: 'fromRaw'
key: 'fromPresale'
}
];

@observer
export default class CreationType extends Component {
static propTypes = {
store: PropTypes.object.isRequired
createStore: PropTypes.object.isRequired
}

render () {
const { createType } = this.props.store;
const { createType } = this.props.createStore;

return (
<div>
Expand Down Expand Up @@ -157,7 +172,7 @@ export default class CreationType extends Component {
<div className={ styles.selectItem }>
<TypeIcon
className={ styles.icon }
store={ this.props.store }
createStore={ this.props.createStore }
type={ item.key }
/>
<Title
Expand All @@ -171,21 +186,21 @@ export default class CreationType extends Component {
}

isSelected = (item) => {
const { createType } = this.props.store;
const { createType } = this.props.createStore;

return item.key === createType;
}

onChange = (item) => {
const { store } = this.props;
const { createStore } = this.props;

store.setCreateType(item.key);
createStore.setCreateType(item.key);
}

onSelect = (item) => {
const { store } = this.props;
const { createStore } = this.props;

store.setCreateType(item.key);
store.nextStage();
createStore.setCreateType(item.key);
createStore.nextStage();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function render () {
store = createStore();
component = shallow(
<CreationType
store={ store }
createStore={ store }
/>
);
instance = component.instance();
Expand Down
36 changes: 18 additions & 18 deletions js/src/modals/CreateAccount/NewAccount/newAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import styles from '../createAccount.css';
export default class CreateAccount extends Component {
static propTypes = {
newError: PropTypes.func.isRequired,
store: PropTypes.object.isRequired,
createStore: PropTypes.object.isRequired,
vaultStore: PropTypes.object
}

Expand All @@ -45,7 +45,7 @@ export default class CreateAccount extends Component {
}

render () {
const { name, nameError, password, passwordRepeat, passwordRepeatError, passwordHint } = this.props.store;
const { name, nameError, password, passwordRepeat, passwordRepeatError, passwordHint } = this.props.createStore;

return (
<Form>
Expand Down Expand Up @@ -126,7 +126,7 @@ export default class CreateAccount extends Component {
</div>
<PasswordStrength input={ password } />
<ChangeVault
store={ this.props.store }
createStore={ this.props.createStore }
vaultStore={ this.props.vaultStore }
/>
{ this.renderIdentitySelector() }
Expand Down Expand Up @@ -203,16 +203,16 @@ export default class CreateAccount extends Component {
}

createIdentities = () => {
const { store } = this.props;
const { createStore } = this.props;

return store
return createStore
.createIdentities()
.then((accounts) => {
const selectedAddress = Object.keys(accounts)[0];
const { phrase } = accounts[selectedAddress];

store.setAddress(selectedAddress);
store.setPhrase(phrase);
createStore.setAddress(selectedAddress);
createStore.setPhrase(phrase);

this.setState({
accounts,
Expand All @@ -225,7 +225,7 @@ export default class CreateAccount extends Component {
}

onChangeIdentity = (event) => {
const { store } = this.props;
const { createStore } = this.props;
const selectedAddress = event.target.value || event.target.getAttribute('value');

if (!selectedAddress) {
Expand All @@ -235,32 +235,32 @@ export default class CreateAccount extends Component {
this.setState({ selectedAddress }, () => {
const { phrase } = this.state.accounts[selectedAddress];

store.setAddress(selectedAddress);
store.setPhrase(phrase);
createStore.setAddress(selectedAddress);
createStore.setPhrase(phrase);
});
}

onEditPasswordHint = (event, passwordHint) => {
const { store } = this.props;
const { createStore } = this.props;

store.setPasswordHint(passwordHint);
createStore.setPasswordHint(passwordHint);
}

onEditAccountName = (event, name) => {
const { store } = this.props;
const { createStore } = this.props;

store.setName(name);
createStore.setName(name);
}

onEditPassword = (event, password) => {
const { store } = this.props;
const { createStore } = this.props;

store.setPassword(password);
createStore.setPassword(password);
}

onEditPasswordRepeat = (event, password) => {
const { store } = this.props;
const { createStore } = this.props;

store.setPasswordRepeat(password);
createStore.setPasswordRepeat(password);
}
}
2 changes: 1 addition & 1 deletion js/src/modals/CreateAccount/NewAccount/newAccount.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function render () {
store = createStore();
component = shallow(
<NewAccount
store={ store }
createStore={ store }
/>,
{
context: { api }
Expand Down
Loading