Fixed imports after refactor.

This commit is contained in:
Richard Moore 2020-01-20 19:34:55 -05:00
parent 931da2f774
commit adf56229c6
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
2 changed files with 5 additions and 5 deletions

View File

@ -12,7 +12,7 @@ import { toUtf8Bytes, UnicodeNormalizationForm } from "@ethersproject/strings";
import { pbkdf2 } from "@ethersproject/pbkdf2"; import { pbkdf2 } from "@ethersproject/pbkdf2";
import { defineReadOnly } from "@ethersproject/properties"; import { defineReadOnly } from "@ethersproject/properties";
import { SigningKey } from "@ethersproject/signing-key"; import { SigningKey } from "@ethersproject/signing-key";
import { computeHmac, ripemd160, sha256, SupportedAlgorithms } from "@ethersproject/sha2"; import { computeHmac, ripemd160, sha256, SupportedAlgorithm } from "@ethersproject/sha2";
import { computeAddress } from "@ethersproject/transactions"; import { computeAddress } from "@ethersproject/transactions";
import { Wordlist, wordlists } from "@ethersproject/wordlists"; import { Wordlist, wordlists } from "@ethersproject/wordlists";
@ -190,7 +190,7 @@ export class HDNode implements ExternallyOwnedAccount {
// Data += ser_32(i) // Data += ser_32(i)
for (let i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); } for (let i = 24; i >= 0; i -= 8) { data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); }
const I = arrayify(computeHmac(SupportedAlgorithms.sha512, this.chainCode, data)); const I = arrayify(computeHmac(SupportedAlgorithm.sha512, this.chainCode, data));
const IL = I.slice(0, 32); const IL = I.slice(0, 32);
const IR = I.slice(32); const IR = I.slice(32);
@ -254,7 +254,7 @@ export class HDNode implements ExternallyOwnedAccount {
const seedArray: Uint8Array = arrayify(seed); const seedArray: Uint8Array = arrayify(seed);
if (seedArray.length < 16 || seedArray.length > 64) { throw new Error("invalid seed"); } if (seedArray.length < 16 || seedArray.length > 64) { throw new Error("invalid seed"); }
const I: Uint8Array = arrayify(computeHmac(SupportedAlgorithms.sha512, MasterSecret, seedArray)); const I: Uint8Array = arrayify(computeHmac(SupportedAlgorithm.sha512, MasterSecret, seedArray));
return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic); return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic);
} }

View File

@ -1,9 +1,9 @@
"use strict"; "use strict";
import { arrayify, BytesLike, hexlify } from "@ethersproject/bytes"; import { arrayify, BytesLike, hexlify } from "@ethersproject/bytes";
import { computeHmac, SupportedAlgorithms } from "@ethersproject/sha2"; import { computeHmac, SupportedAlgorithm } from "@ethersproject/sha2";
export function pbkdf2(password: BytesLike, salt: BytesLike, iterations: number, keylen: number, hashAlgorithm: SupportedAlgorithms): string { export function pbkdf2(password: BytesLike, salt: BytesLike, iterations: number, keylen: number, hashAlgorithm: SupportedAlgorithm): string {
password = arrayify(password); password = arrayify(password);
salt = arrayify(salt); salt = arrayify(salt);
let hLen; let hLen;