Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/PrivateKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ PrivateKey::PrivateKey(const Data& data, TWCurve curve) {
_impl = Rust::wrapTWPrivateKey(privkey);
}

PrivateKey::PrivateKey(const std::string& data, TWCurve curve) {
auto bytes = TW::data(data);
*this = PrivateKey(bytes, curve);
memzero(bytes.data(), bytes.size());
}

PrivateKey::PrivateKey(
const Data& key1, const Data& extension1, const Data& chainCode1,
const Data& key2, const Data& extension2, const Data& chainCode2,
Expand Down
2 changes: 1 addition & 1 deletion src/PrivateKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PrivateKey {

/// Initializes a private key from a string of bytes and a curve.
/// Signing functions will throw an exception if the provided curve is different from the one specified.
explicit PrivateKey(const std::string& data, TWCurve curve) : PrivateKey(TW::data(data), curve) {}
explicit PrivateKey(const std::string& data, TWCurve curve);

/// Initializes a Cardano style key with a specified curve.
/// Signing functions will throw an exception if the provided curve is different from the one specified.
Expand Down
Loading