mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-17 15:25:35 +00:00
39 lines
752 B
C++
39 lines
752 B
C++
#include <gtest/gtest.h>
|
|
#include <llarp/messages/exit.hpp>
|
|
|
|
using ObtainExitMessage = llarp::routing::ObtainExitMessage;
|
|
|
|
class ObtainExitTest : public ::testing::Test
|
|
{
|
|
public:
|
|
llarp_crypto crypto;
|
|
llarp::SecretKey alice;
|
|
|
|
ObtainExitTest()
|
|
{
|
|
llarp_crypto_init(&crypto);
|
|
}
|
|
|
|
~ObtainExitTest()
|
|
{
|
|
}
|
|
|
|
void
|
|
SetUp()
|
|
{
|
|
crypto.identity_keygen(alice);
|
|
}
|
|
};
|
|
|
|
TEST_F(ObtainExitTest, TestSignVerify)
|
|
{
|
|
ObtainExitMessage msg;
|
|
msg.Z.Zero();
|
|
msg.S = llarp_randint();
|
|
msg.T = llarp_randint();
|
|
ASSERT_TRUE(msg.Sign(&crypto, alice));
|
|
ASSERT_TRUE(msg.Verify(&crypto));
|
|
ASSERT_TRUE(msg.I == llarp::PubKey(llarp::seckey_topublic(alice)));
|
|
ASSERT_FALSE(msg.version != LLARP_PROTO_VERSION);
|
|
ASSERT_FALSE(msg.Z.IsZero());
|
|
}; |