\r
async function CKDpriv ({ privateKey, chainCode }: ExtendedKey, index: number): Promise<ExtendedKey> {\r
const key = hex.toBytes(chainCode)\r
- const data = hex.toBytes(`00${bytes.toHex(ser256(privateKey))}${bytes.toHex(ser32(index))}`)\r
+ const data = hex.toBytes(`00${bytes.toHex(await ser256(privateKey))}${bytes.toHex(await ser32(index))}`)\r
const I = await hmac(key, data)\r
const IL = I.slice(0, I.length / 2)\r
const IR = I.slice(I.length / 2)\r
return ({ privateKey: IL, chainCode: IR })\r
}\r
\r
-function ser32 (integer: number): Uint8Array {\r
+async function ser32 (integer: number): Promise<Uint8Array> {\r
const bits = integer.toString(2)\r
if (bits.length > 32) {\r
throw new RangeError(`Expected 32-bit integer, received ${bits.length} bits: ${bits}`)\r
return result\r
}\r
\r
-function ser256 (integer: string): Uint8Array {\r
+async function ser256 (integer: string): Promise<Uint8Array> {\r
const bits = hex.toBin(integer)\r
if (bits.length > 256) {\r
throw new RangeError(`Expected 256-bit integer, received ${bits.length} bits: ${bits}`)\r