encodeECPrivateKeyToRaw function
Implementation
Uint8List encodeECPrivateKeyToRaw(ECPrivateKey privateKey) {
// Pointy Castle's ECPrivateKey stores the d (scalar)
final dBytes = bigIntToUint8List(privateKey.d!);
// Ensure the private key is 32 bytes long for prime256v1
final paddedD = Uint8List(32);
paddedD.setRange(32 - dBytes.length, 32, dBytes);
return paddedD;
}