Bip32.fromPrivateKey constructor

Bip32.fromPrivateKey({
  1. required Uint8List privateKey,
  2. required Uint8List chainCode,
  3. Bip32EccCurve? ecc,
})

Implementation

factory Bip32.fromPrivateKey({
  required Uint8List privateKey,
  required Uint8List chainCode,
  Bip32EccCurve? ecc,
}) {
  ecc ??= Bip32EccCurve();

  if (privateKey.length != 32) {
    throw ArgumentError(
        'Expected property privateKey of type Buffer(Length: 32)');
  }

  if (!ecc.isPrivate(privateKey)) {
    throw ArgumentError('Private key not in range [1, n]');
  }

  return Bip32(privateKey, null, chainCode, _bitcoinNetworkType);
}