exportPrivateKey method

  1. @override
Future<String> exportPrivateKey(
  1. int index
)
override

Exports the private key of an account from the HD wallet.

  • index: The index of the account.

Returns the private key as a String.

Implementation

@override
Future<String> exportPrivateKey(int index) async {
  final ethPrivateKey = await _getPrivateKey(index);
  Uint8List privKey = ethPrivateKey.privateKey;
  bool rlz = shouldRemoveLeadingZero(privKey);
  if (rlz) {
    privKey = privKey.sublist(1);
  }
  return hexlify(privKey);
}