Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit d34ee31

Browse files
committed
Remove stuff
1 parent 8968a6e commit d34ee31

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ export default class Wallet {
399399
Buffer.from(json.Crypto.IV, 'hex'),
400400
'aes-128-cbc'
401401
)
402-
// const seed = runCipherBuffer(decipher, ciphertext)
403402
return new Wallet(Buffer.from(seed))
404403
}
405404

@@ -473,7 +472,7 @@ export default class Wallet {
473472
): Promise<Wallet> {
474473
const json: EthSaleKeystore = typeof input === 'object' ? input : JSON.parse(input)
475474

476-
const encseed = Buffer.from(json.encseed, 'hex')
475+
const encseed = Uint8Array.from(Buffer.from(json.encseed, 'hex'))
477476

478477
// key derivation
479478
const pass = Buffer.from(password, 'utf8')
@@ -489,9 +488,8 @@ export default class Wallet {
489488
'aes-128-cbc',
490489
true
491490
)
492-
// const seed = runCipherBuffer(decipher, encseed.slice(16))
493491

494-
const wallet = new Wallet(Buffer.from(keccak256(Buffer.from(seed))))
492+
const wallet = new Wallet(Buffer.from(keccak256(seed)))
495493
if (wallet.getAddress().toString('hex') !== json.ethaddr) {
496494
throw new Error('Decoded key mismatch - possibly wrong passphrase')
497495
}

src/thirdparty.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ function evp_kdf(data: Buffer, salt: Buffer, opts?: Partial<EvpKdfOpts>) {
7373
const tmp = Buffer.concat(ret)
7474

7575
return {
76-
key: tmp.slice(0, params.keysize),
77-
iv: tmp.slice(params.keysize, params.keysize + params.ivsize),
76+
key: tmp.subarray(0, params.keysize),
77+
iv: tmp.subarray(params.keysize, params.keysize + params.ivsize),
7878
}
7979
}
8080

8181
// http://stackoverflow.com/questions/25288311/cryptojs-aes-pattern-always-ends-with
8282
function decodeCryptojsSalt(input: string): { ciphertext: Buffer; salt?: Buffer } {
8383
const ciphertext = Buffer.from(input, 'base64')
84-
if (ciphertext.slice(0, 8).toString() === 'Salted__') {
84+
if (ciphertext.subarray(0, 8).toString() === 'Salted__') {
8585
return {
86-
salt: ciphertext.slice(8, 16),
87-
ciphertext: ciphertext.slice(16),
86+
salt: ciphertext.subarray(8, 16),
87+
ciphertext: ciphertext.subarray(16),
8888
}
8989
}
9090
return { ciphertext }
@@ -148,7 +148,6 @@ export async function fromEtherWallet(
148148
const evp = evp_kdf(Buffer.from(password), cipher.salt, { keysize: 32, ivsize: 16 })
149149

150150
const pr = await decrypt(Buffer.from(cipher.ciphertext), evp.key, evp.iv, 'aes-256-cbc')
151-
// privateKey = runCipherBuffer(decipher, )
152151

153152
// NOTE: yes, they've run it through UTF8
154153
privateKey = Buffer.from(bytesToUtf8(pr), 'hex')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy