signWithHashType method
Sign with an explicit sighash type, keeping the digest's committed hashType consistent with the hashType byte embedded in the DER signature (GSPL callers compute both from the same value).
Implementation
String signWithHashType(String message, int hashType) {
final sig = ecc.sign(dynamicToUint8List(message), privateKey);
final signature = bscript.encodeSignature(sig, hashType);
return dynamicToString(signature);
}