@@ -17,6 +17,8 @@ Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
1717 auto signer = Signer (chainId);
1818 auto tx = signer.buildTx (input);
1919
20+ // values for Legacy and ModernK1
21+ TWCurve curve = TWCurveSECP256k1;
2022 // get key type
2123 EOS::Type type = Type::Legacy;
2224 switch (input.private_key_type ()) {
@@ -29,14 +31,15 @@ Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
2931 break ;
3032
3133 case Proto::KeyType::MODERNR1:
34+ curve = TWCurveNIST256p1;
3235 type = Type::ModernR1;
3336 break ;
3437 default :
3538 break ;
3639 }
3740
3841 // sign the transaction with a Signer
39- auto key = PrivateKey (Data (input.private_key ().begin (), input.private_key ().end ()));
42+ auto key = PrivateKey (Data (input.private_key ().begin (), input.private_key ().end ()), curve );
4043 signer.sign (key, type, tx);
4144
4245 // Pack the transaction and add the json encoding to Signing outputput
@@ -55,17 +58,14 @@ void Signer::sign(const PrivateKey& privateKey, Type type, Transaction& transact
5558 throw std::invalid_argument (" Invalid transaction!" );
5659 }
5760
58- // values for Legacy and ModernK1
59- TWCurve curve = TWCurveSECP256k1;
6061 auto canonicalChecker = isCanonical;
6162
6263 // Values for ModernR1
6364 if (type == Type::ModernR1) {
64- curve = TWCurveNIST256p1;
6565 canonicalChecker = nullptr ;
6666 }
6767
68- const Data result = privateKey.sign (hash (transaction), curve, canonicalChecker);
68+ const Data result = privateKey.sign (hash (transaction), canonicalChecker);
6969
7070 transaction.signatures .emplace_back (Signature (result, type));
7171}
0 commit comments