Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions packages/neuron-wallet/src/controllers/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ export default class WalletsController {
const keystoreObject = Keystore.fromJson(keystore)
const masterPrivateKey = keystoreObject.extendedPrivateKey(password)
const masterKeychain = new Keychain(
Buffer.from(masterPrivateKey.privateKey, 'hex'),
Buffer.from(masterPrivateKey.chainCode, 'hex')
Buffer.from(bytes.bytify(masterPrivateKey.privateKey)),
Buffer.from(bytes.bytify(masterPrivateKey.chainCode))
)
const accountKeychain = masterKeychain.derivePath(AccountExtendedPublicKey.ckbAccountPath)
const accountExtendedPublicKey = new AccountExtendedPublicKey(
Expand Down
5 changes: 3 additions & 2 deletions packages/neuron-wallet/src/services/sign-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ec as EC } from 'elliptic'
import { AddressNotFound } from '../exceptions'
import HardwareWalletService from './hardware'
import AddressParser from '../models/address-parser'
import { bytes } from '@ckb-lumos/codec'

export default class SignMessage {
static GENERATE_COUNT = 100
Expand Down Expand Up @@ -91,8 +92,8 @@ export default class SignMessage {
private static getPrivateKey(wallet: Wallet, path: string, password: string): string {
const masterPrivateKey = wallet.loadKeystore().extendedPrivateKey(password)
const masterKeychain = new Keychain(
Buffer.from(masterPrivateKey.privateKey, 'hex'),
Buffer.from(masterPrivateKey.chainCode, 'hex')
Buffer.from(bytes.bytify(masterPrivateKey.privateKey)),
Buffer.from(bytes.bytify(masterPrivateKey.chainCode))
)

return `0x${masterKeychain.derivePath(path).privateKey.toString('hex')}`
Expand Down