Skip to content

Commit

Permalink
MyEtherWallet-Satochip v5.7.31 with support for Satochip-2FA
Browse files Browse the repository at this point in the history
  • Loading branch information
Toporin committed Jun 22, 2021
1 parent a42cacc commit 9d35ca2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "myetherwallet",
"version": "5.7.30",
"version": "5.7.31",
"description": "Client side ethereum wallet",
"scripts": {
"build:offline": "WEBPACK_INTEGRITY=false npm run build:hash",
Expand Down
17 changes: 11 additions & 6 deletions src/wallets/hardware/satochip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import bip44Paths from '../../bip44';
import HDWalletInterface from '@/wallets/HDWalletInterface';
import * as HDKey from 'hdkey';
import { Transaction } from 'ethereumjs-tx';
import { hashPersonalMessage, toBuffer } from 'ethereumjs-util';
import { hashPersonalMessage, toBuffer, publicToAddress} from 'ethereumjs-util';
import {
getSignTransactionObject,
getBufferFromHex,
Expand Down Expand Up @@ -142,8 +142,10 @@ class SatochipWallet {
requestID: this.requestID++,
action: 'sign_tx_hash',
tx: tx_info.tx_serialized,
hash: tx_info.tx_hash_false, // EIP155 enabled
//hash: tx_info.tx_hash_true, // EIP155 disabled
hash: tx_info.tx_hash_false, // includeSignature:False
//hash: tx_info.tx_hash_true, // includeSignature:True
chainId: tx_info.chainId,
from: tx_info.address,
path: path
};
const request = JSON.stringify(msg);
Expand All @@ -168,6 +170,7 @@ class SatochipWallet {

signMessage= function(msg, path) {
console.log('Satochip: signMessage() START');
// message is a hex-string prefixed with 0x
if (!msg) {
throw Error('No message to sign');
}
Expand Down Expand Up @@ -213,10 +216,12 @@ class SatochipWallet {
});
const networkId = tx.getChainId();
const tx_serialized= tx.serialize().toString('hex')
const tx_hash_true= tx.hash(true).toString('hex') // legacy
const tx_hash_false= tx.hash(false).toString('hex') // EIP155
const tx_hash_true= tx.hash(true).toString('hex') // includeSignature:True
const tx_hash_false= tx.hash(false).toString('hex') // includeSignature:False
const path= this.basePath + '/' + idx;
const tx_info= {tx_serialized:tx_serialized, tx_hash_true:tx_hash_true, tx_hash_false:tx_hash_false, chainId:networkId}; // debugsatochip
const pubkey= this.hdKey.derive('m/' + idx).publicKey;
const address= publicToAddress(pubkey, true).toString('hex');
const tx_info= {tx_serialized:tx_serialized, tx_hash_true:tx_hash_true, tx_hash_false:tx_hash_false, chainId:networkId, address: address}; // debugsatochip
//console.log('Satochip: txSigner: tx_info:' + tx_info);
const result= await this.signRawTransaction(path, tx, tx_info)
console.log('Satochip: txSigner: result:' + result);
Expand Down

0 comments on commit 9d35ca2

Please sign in to comment.