From 677db58fc3b8fcd9b4bd2bac8a2991169109b74e Mon Sep 17 00:00:00 2001 From: pasta Date: Thu, 20 Apr 2023 23:50:36 -0500 Subject: [PATCH] add SerializeToArray for PrivateKey --- include/dashbls/privatekey.hpp | 1 + src/privatekey.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/dashbls/privatekey.hpp b/include/dashbls/privatekey.hpp index beebbb05a..d02a7d292 100644 --- a/include/dashbls/privatekey.hpp +++ b/include/dashbls/privatekey.hpp @@ -82,6 +82,7 @@ class PrivateKey { // Serialize the key into bytes void Serialize(uint8_t *buffer) const; std::vector Serialize(bool fLegacy = false) const; + std::array SerializeToArray(bool fLegacy = false) const; G2Element SignG2( const uint8_t *msg, diff --git a/src/privatekey.cpp b/src/privatekey.cpp index 865507dfc..d4dd32d11 100644 --- a/src/privatekey.cpp +++ b/src/privatekey.cpp @@ -284,6 +284,13 @@ std::vector PrivateKey::Serialize(const bool fLegacy) const return data; } +std::array PrivateKey::SerializeToArray(bool fLegacy) const +{ + std::array data{}; + Serialize(data.data()); + return data; +} + G2Element PrivateKey::SignG2( const uint8_t *msg, size_t len,