lokinet/pybind/llarp/crypto/types.cpp

24 lines
670 B
C++
Raw Normal View History

#include <llarp/crypto/types.hpp>
#include <common.hpp>
2020-01-17 16:06:08 +01:00
namespace llarp
{
void
CryptoTypes_Init(py::module& mod)
{
py::class_<PubKey>(mod, "PubKey")
2020-01-17 16:06:08 +01:00
.def(py::init<>())
.def("FromHex", &PubKey::FromString)
.def("__repr__", &PubKey::ToString);
py::class_<SecretKey>(mod, "SecretKey")
2020-01-17 16:06:08 +01:00
.def(py::init<>())
.def("LoadFile", &SecretKey::LoadFromFile)
.def("SaveFile", &SecretKey::SaveToFile)
.def("ToPublic", &SecretKey::toPublic);
py::class_<Signature>(mod, "Signature")
2020-01-17 16:06:08 +01:00
.def(py::init<>())
2022-07-19 20:22:38 +02:00
.def("__repr__", [](const Signature& sig) { return sig.ToHex(); });
2020-01-17 16:06:08 +01:00
}
} // namespace llarp