Skip to content

Commit fb2f5fa

Browse files
authored
Adds ability to specify the curve while constructing Private Key (#4324)
* Adds ability to specify the curve while constructing Private Key * Adds signing functions without a curve * Migrates to new API * Use TWCoinTypeCurve * Adds Curve
1 parent 2c1e0fe commit fb2f5fa

File tree

99 files changed

+426
-284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+426
-284
lines changed

src/Aeternity/Signer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ using namespace TW;
1515
namespace TW::Aeternity {
1616

1717
Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
18-
auto privateKey = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
18+
auto privateKey = PrivateKey(Data(input.private_key().begin(), input.private_key().end()), TWCurveED25519);
1919
std::string sender_id = input.from_address();
2020
std::string recipient_id = input.to_address();
2121
std::string payload = input.payload();
@@ -34,7 +34,7 @@ Proto::SigningOutput Signer::sign(const TW::PrivateKey& privateKey, Transaction&
3434
auto msg = buildMessageToSign(txRlp);
3535

3636
/// sign ed25519
37-
auto sigRaw = privateKey.sign(msg, TWCurveED25519);
37+
auto sigRaw = privateKey.sign(msg);
3838
auto signature = Identifiers::prefixSignature + Base58::encodeCheck(sigRaw);
3939

4040
/// encode the message using rlp

src/Aion/Signer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ using namespace TW;
99
namespace TW::Aion {
1010

1111
Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
12-
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
12+
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()), TWCurveED25519);
1313
auto transaction = Signer::buildTransaction(input);
1414
Signer::sign(key, transaction);
1515

@@ -23,7 +23,7 @@ Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
2323
void Signer::sign(const PrivateKey& privateKey, Transaction& transaction) noexcept {
2424
auto encoded = transaction.encode();
2525
auto hashData = Hash::blake2b(encoded, 32);
26-
auto hashSignature = privateKey.sign(hashData, TWCurveED25519);
26+
auto hashSignature = privateKey.sign(hashData);
2727
auto publicKeyData = privateKey.getPublicKey(TWPublicKeyTypeED25519).bytes;
2828

2929
// Aion signature = pubKeyBytes + signatureBytes

src/Algorand/Signer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ const std::string ASSET_TRANSACTION = "axfer";
1818

1919
Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
2020
auto protoOutput = Proto::SigningOutput();
21-
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
21+
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()), TWCurveED25519);
2222
auto pubkey = key.getPublicKey(TWPublicKeyTypeED25519);
2323

2424
auto preImageData = Signer::preImage(pubkey, input);
25-
auto signature = key.sign(preImageData, TWCurveED25519);
25+
auto signature = key.sign(preImageData);
2626
return Signer::encodeTransaction(signature, pubkey, input);
2727
}
2828

@@ -37,7 +37,7 @@ Data Signer::sign(const PrivateKey& privateKey, const BaseTransaction& transacti
3737
Data data;
3838
append(data, TRANSACTION_TAG);
3939
append(data, transaction.serialize());
40-
auto signature = privateKey.sign(data, TWCurveED25519);
40+
auto signature = privateKey.sign(data);
4141
return {signature.begin(), signature.end()};
4242
}
4343

src/Bitcoin/SigningInput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ SigningInput::SigningInput(const Proto::SigningInput& input) {
1717
toAddress = input.to_address();
1818
changeAddress = input.change_address();
1919
for (auto&& key : input.private_key()) {
20-
privateKeys.emplace_back(key);
20+
privateKeys.emplace_back(key, TWCurveSECP256k1);
2121
}
2222
for (auto&& script : input.scripts()) {
2323
scripts[script.first] = Script(script.second.begin(), script.second.end());

src/Cardano/Signer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ Common::Proto::SigningError Signer::assembleSignatures(std::vector<std::pair<Dat
129129
}
130130

131131
// Add this private key and associated address
132-
const auto privateKey = PrivateKey(privateKeyData);
132+
const auto privateKey = PrivateKey(privateKeyData, TWCurveED25519ExtendedCardano);
133133
const auto publicKey = privateKey.getPublicKey(TWPublicKeyTypeED25519Cardano);
134134
const auto address = AddressV3(publicKey);
135135
privateKeys[address.string()] = privateKeyData;
@@ -190,9 +190,9 @@ Common::Proto::SigningError Signer::assembleSignatures(std::vector<std::pair<Dat
190190
return Common::Proto::Error_missing_private_key;
191191
}
192192
}
193-
const auto privateKey = PrivateKey(privateKeyData);
193+
const auto privateKey = PrivateKey(privateKeyData, TWCurveED25519ExtendedCardano);
194194
const auto publicKey = privateKey.getPublicKey(TWPublicKeyTypeED25519Cardano);
195-
const auto signature = privateKey.sign(txId, TWCurveED25519ExtendedCardano);
195+
const auto signature = privateKey.sign(txId);
196196
signatures.emplace_back(publicKey.bytes, signature);
197197
}
198198

src/Decred/Signer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Result<std::vector<Data>, Common::Proto::SigningError> Signer::signStep(Bitcoin:
181181
return Result<std::vector<Data>, Common::Proto::SigningError>::failure(Common::Proto::Error_missing_private_key);
182182
}
183183
} else {
184-
pubkey = PrivateKey(key).getPublicKey(TWPublicKeyTypeSECP256k1).bytes;
184+
pubkey = PrivateKey(key, TWCurveSECP256k1).getPublicKey(TWPublicKeyTypeSECP256k1).bytes;
185185
}
186186

187187
auto signature = createSignature(transactionToSign, script, key, data, index);
@@ -263,7 +263,7 @@ Data Signer::createSignature(const Transaction& transaction, const Bitcoin::Scri
263263
return externalSignature;
264264
}
265265

266-
auto pk = PrivateKey(key);
266+
auto pk = PrivateKey(key, TWCurveSECP256k1);
267267
auto signature = pk.signAsDER(Data(begin(sighash), end(sighash)));
268268
if (script.empty()) {
269269
return {};
@@ -275,7 +275,7 @@ Data Signer::createSignature(const Transaction& transaction, const Bitcoin::Scri
275275

276276
Data Signer::keyForPublicKeyHash(const Data& hash) const {
277277
for (auto& key : input.private_key()) {
278-
auto publicKey = PrivateKey(key).getPublicKey(TWPublicKeyTypeSECP256k1);
278+
auto publicKey = PrivateKey(key, TWCurveSECP256k1).getPublicKey(TWPublicKeyTypeSECP256k1);
279279
auto keyHash = TW::Hash::ripemd(TW::Hash::blake256(publicKey.bytes));
280280
if (std::equal(std::begin(keyHash), std::end(keyHash), std::begin(hash), std::end(hash))) {
281281
return Data(key.begin(), key.end());

src/EOS/Signer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/Ethereum/Barz.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ Data getAuthorizationHash(const Data& chainId, const std::string& contractAddres
243243

244244
std::vector<Data> getRSVY(const Data& hash, const std::string& privateKey) {
245245
auto privateKeyData = parse_hex(privateKey);
246-
auto privateKeyObj = PrivateKey(privateKeyData);
247-
auto signature = privateKeyObj.sign(hash, TWCurveSECP256k1);
246+
auto privateKeyObj = PrivateKey(privateKeyData, TWCurveSECP256k1);
247+
auto signature = privateKeyObj.sign(hash);
248248
if (signature.empty()) {
249249
return {};
250250
}

src/Everscale/Signer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace TW::Everscale {
1313

1414
Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
15-
auto key = PrivateKey(input.private_key());
15+
auto key = PrivateKey(input.private_key(), TWCurveED25519);
1616
auto publicKey = key.getPublicKey(TWPublicKeyTypeED25519);
1717

1818
auto protoOutput = Proto::SigningOutput();

src/FIO/TransactionBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ string TransactionBuilder::actionName(const Proto::SigningInput& input) {
7070
}
7171

7272
string TransactionBuilder::sign(Proto::SigningInput in) {
73-
PrivateKey privateKey(in.private_key());
73+
PrivateKey privateKey(in.private_key(), TWCurveSECP256k1);
7474
PublicKey publicKey = privateKey.getPublicKey(TWPublicKeyTypeSECP256k1);
7575
Address owner(publicKey);
7676

src/Filecoin/Signer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Proto::SigningOutput Signer::compile(const Data& signature, const PublicKey& pub
7777

7878
Proto::SigningOutput Signer::signSecp256k1(const Proto::SigningInput& input) {
7979
// Load private key and transaction from Protobuf input.
80-
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
80+
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()), TWCurveSECP256k1);
8181
auto pubkey = key.getPublicKey(TWPublicKeyTypeSECP256k1Extended);
8282

8383
auto transaction = Signer::buildTx(pubkey, input);
@@ -123,7 +123,7 @@ Transaction Signer::buildTx(const PublicKey& publicKey, const Proto::SigningInpu
123123
/// https://github.com/filecoin-project/lotus/blob/ce17546a762eef311069e13410d15465d832a45e/chain/messagesigner/messagesigner.go#L197-L211
124124
Proto::SigningOutput Signer::signDelegated(const Proto::SigningInput& input) {
125125
// Load private key from Protobuf input.
126-
auto privateKey = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
126+
auto privateKey = PrivateKey(Data(input.private_key().begin(), input.private_key().end()), TWCurveSECP256k1);
127127
auto pubkey = privateKey.getPublicKey(TWPublicKeyTypeSECP256k1Extended);
128128

129129
// Load the transaction params.
@@ -172,7 +172,7 @@ Proto::SigningOutput Signer::signDelegated(const Proto::SigningInput& input) {
172172

173173
auto preHash = data(ethOutput.data_hash());
174174
// Sign transaction as an Ethereum EIP1559 native transfer.
175-
Data signature = privateKey.sign(preHash, TWCurveSECP256k1);
175+
Data signature = privateKey.sign(preHash);
176176

177177
// Generate a Filecoin signed message.
178178
Transaction filecoinTransaction(

src/HDWallet.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ template <std::size_t seedSize>
147147
PrivateKey HDWallet<seedSize>::getMasterKey(TWCurve curve) const {
148148
auto node = getMasterNode(*this, curve);
149149
auto data = Data(node.private_key, node.private_key + PrivateKey::_size);
150-
return PrivateKey(data);
150+
return PrivateKey(data, curve);
151151
}
152152

153153
template <std::size_t seedSize>
154154
PrivateKey HDWallet<seedSize>::getMasterKeyExtension(TWCurve curve) const {
155155
auto node = getMasterNode(*this, curve);
156156
auto data = Data(node.private_key_extension, node.private_key_extension + PrivateKey::_size);
157-
return PrivateKey(data);
157+
return PrivateKey(data, curve);
158158
}
159159

160160
template <std::size_t seedSize>
@@ -173,7 +173,7 @@ PrivateKey HDWallet<seedSize>::getKeyByCurve(TWCurve curve, const DerivationPath
173173
case TWPrivateKeyTypeCardano: {
174174
if (derivationPath.indices.size() < 4 || derivationPath.indices[3].value > 1) {
175175
// invalid derivation path
176-
return PrivateKey(Data(PrivateKey::cardanoKeySize));
176+
return PrivateKey(Data(PrivateKey::cardanoKeySize), curve);
177177
}
178178
const DerivationPath stakingPath = cardanoStakingDerivationPath(derivationPath);
179179

@@ -188,17 +188,17 @@ PrivateKey HDWallet<seedSize>::getKeyByCurve(TWCurve curve, const DerivationPath
188188
auto chainCode2 = Data(node2.chain_code, node2.chain_code + PrivateKey::_size);
189189

190190
TW::memzero(&node);
191-
return PrivateKey(pkData, extData, chainCode, pkData2, extData2, chainCode2);
191+
return PrivateKey(pkData, extData, chainCode, pkData2, extData2, chainCode2, curve);
192192
}
193193
case TWPrivateKeyTypeDefault:
194194
default:
195195
// default path
196196
auto data = Data(node.private_key, node.private_key + PrivateKey::_size);
197197
TW::memzero(&node);
198198
if (curve == TWCurveStarkex) {
199-
return ImmutableX::getPrivateKeyFromEthPrivKey(PrivateKey(data));
199+
return ImmutableX::getPrivateKeyFromEthPrivKey(PrivateKey(data, curve));
200200
}
201-
return PrivateKey(data);
201+
return PrivateKey(data, curve);
202202
}
203203
}
204204

@@ -312,7 +312,7 @@ std::optional<PrivateKey> HDWallet<seedSize>::getPrivateKeyFromExtended(const st
312312
hdnode_private_ckd(&node, path.change());
313313
hdnode_private_ckd(&node, path.address());
314314

315-
return PrivateKey(Data(node.private_key, node.private_key + 32));
315+
return PrivateKey(Data(node.private_key, node.private_key + 32), curve);
316316
}
317317

318318
template <std::size_t seedSize>

src/Harmony/Signer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ std::string Signer::signJSON(const std::string& json, const Data& key) {
8686
}
8787

8888
Proto::SigningOutput Signer::signTransaction(const Proto::SigningInput& input) {
89-
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
89+
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()), TWCurveSECP256k1);
9090

9191
auto transaction = Signer::buildUnsignedTransaction(input);
9292

@@ -131,7 +131,7 @@ uint8_t Signer::getEnum<CollectRewards>() noexcept {
131131

132132
template <typename T>
133133
Proto::SigningOutput Signer::signStaking(const Proto::SigningInput &input, function<T(const Proto::SigningInput &input)> func) {
134-
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
134+
auto key = PrivateKey(Data(input.private_key().begin(), input.private_key().end()), TWCurveSECP256k1);
135135
auto stakingTx = buildUnsignedStakingTransaction(input, func);
136136

137137
auto signer = Signer(uint256_t(load(input.chain_id())));

src/Hedera/Signer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static inline Proto::SigningOutput sign(const proto::TransactionBody& body, cons
8686
namespace TW::Hedera {
8787

8888
Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
89-
auto privateKey = PrivateKey(Data(input.private_key().begin(), input.private_key().end()));
89+
auto privateKey = PrivateKey(Data(input.private_key().begin(), input.private_key().end()), TWCurveED25519);
9090
auto body = internals::transactionBodyPrerequisites(input);
9191

9292
switch (input.body().data_case()) {

src/IOST/Account.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ Account::Account(const Proto::AccountInfo& account) {
4747
}
4848

4949
Data Account::sign(const Data& digest, TWCurve curve) const {
50-
return PrivateKey(activeKey).sign(digest, curve);
50+
return PrivateKey(activeKey, curve).sign(digest);
5151
}
5252

5353
Data Account::publicActiveKey() const {
54-
return PrivateKey(activeKey).getPublicKey(TWPublicKeyTypeED25519).bytes;
54+
return PrivateKey(activeKey, TWCurveED25519).getPublicKey(TWPublicKeyTypeED25519).bytes;
5555
}
5656

5757
Data Account::publicOwnerKey() const {
58-
return PrivateKey(ownerKey).getPublicKey(TWPublicKeyTypeED25519).bytes;
58+
return PrivateKey(ownerKey, TWCurveED25519).getPublicKey(TWPublicKeyTypeED25519).bytes;
5959
}
6060

6161
std::string Account::address(const std::string& publickey) {

src/Icon/Signer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
7979
Proto::SigningOutput Signer::sign() const noexcept {
8080
const auto hash = Hash::sha3_256(Signer::preImage());
8181

82-
const auto key = PrivateKey(input.private_key());
83-
const auto signature = key.sign(hash, TWCurveSECP256k1);
82+
const auto key = PrivateKey(input.private_key(), TWCurveSECP256k1);
83+
const auto signature = key.sign(hash);
8484

8585
auto output = Proto::SigningOutput();
8686
output.set_signature(signature.data(), signature.size());

src/ImmutableX/StarkKey.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ std::string grindKey(const Data& seed) {
3434
PrivateKey getPrivateKeyFromSeed(const Data& seed, const DerivationPath& path) {
3535
auto key = HDWallet<32>::bip32DeriveRawSeed(TWCoinTypeEthereum, seed, path);
3636
auto data = parse_hex(grindKey(key.bytes), true);
37-
return PrivateKey(data);
37+
return PrivateKey(data, TWCurveStarkex);
3838
}
3939

4040
PrivateKey getPrivateKeyFromEthPrivKey(const PrivateKey& ethPrivKey) {
41-
return PrivateKey(parse_hex(ImmutableX::grindKey(ethPrivKey.bytes), true));
41+
return PrivateKey(parse_hex(ImmutableX::grindKey(ethPrivKey.bytes), true), TWCurveStarkex);
4242
}
4343

4444
PrivateKey getPrivateKeyFromRawSignature(const Data& signature, const DerivationPath& derivationPath) {

src/IoTeX/Signer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
1616
}
1717

1818
Data Signer::sign() const {
19-
auto key = PrivateKey(input.privatekey());
20-
return key.sign(hash(), TWCurveSECP256k1);
19+
auto key = PrivateKey(input.privatekey(), TWCurveSECP256k1);
20+
return key.sign(hash());
2121
}
2222

2323
Proto::SigningOutput Signer::build() const {
2424
auto signedAction = Proto::Action();
2525
signedAction.mutable_core()->MergeFrom(action);
26-
auto key = PrivateKey(input.privatekey());
26+
auto key = PrivateKey(input.privatekey(), TWCurveSECP256k1);
2727
auto pk = key.getPublicKey(TWPublicKeyTypeSECP256k1Extended).bytes;
2828
signedAction.set_senderpubkey(pk.data(), pk.size());
29-
auto sig = key.sign(hash(), TWCurveSECP256k1);
29+
auto sig = key.sign(hash());
3030
signedAction.set_signature(sig.data(), sig.size());
3131

3232
auto output = Proto::SigningOutput();

src/Keystore/StoredKey.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ StoredKey StoredKey::createWithPrivateKeyAddDefaultAddress(const std::string& na
6161
StoredKey key = createWithPrivateKey(name, password, privateKeyData, encryption);
6262
const auto derivationPath = TW::derivationPath(coin);
6363
const auto pubKeyType = TW::publicKeyType(coin);
64-
const auto pubKey = PrivateKey(privateKeyData).getPublicKey(pubKeyType);
64+
const auto pubKey = PrivateKey(privateKeyData, TWCoinTypeCurve(coin)).getPublicKey(pubKeyType);
6565
const auto address = TW::deriveAddress(coin, PrivateKey(privateKeyData));
6666
key.accounts.emplace_back(address, coin, TWDerivationDefault, derivationPath, hex(pubKey.bytes), "");
6767
return key;
@@ -261,7 +261,7 @@ const PrivateKey StoredKey::privateKey(TWCoinType coin, [[maybe_unused]] TWDeriv
261261
return wallet.getKey(coin, account.derivationPath);
262262
}
263263
// type == StoredKeyType::privateKey
264-
return PrivateKey(payload.decrypt(password));
264+
return PrivateKey(payload.decrypt(password), TWCoinTypeCurve(coin));
265265
}
266266

267267
void StoredKey::fixAddresses(const Data& password) {

src/MultiversX/Signer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ namespace TW::MultiversX {
1515
Proto::SigningOutput Signer::sign(const Proto::SigningInput& input) noexcept {
1616
TransactionFactory factory;
1717

18-
auto privateKey = PrivateKey(input.private_key());
18+
auto privateKey = PrivateKey(input.private_key(), TWCurveED25519);
1919
auto signableAsData = buildUnsignedTxBytes(input);
20-
auto signature = privateKey.sign(signableAsData, TWCurveED25519);
20+
auto signature = privateKey.sign(signableAsData);
2121

2222
return buildSigningOutput(input, signature);
2323
}

0 commit comments

Comments
 (0)