aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAleksi Lindeman <aleksi_888@hotmail.com>2018-02-10 03:38:47 +0100
committerAleksi Lindeman <aleksi_888@hotmail.com>2018-02-10 03:39:41 +0100
commitbe3c931f9b2db357c0b4306ad248c968d90254a3 (patch)
tree8b7943e750c27ed0be07c0354827eb3856423a71 /tests
parent28efc0068f47ec787791a07a63d720710068c095 (diff)
Add private/public key for users
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 5ddcbe9..a685ee6 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -7,9 +7,31 @@ using namespace odhtdb;
int main()
{
+ LocalUser *localUser = LocalUser::create(Signature::KeyPair(), "dec05eba");
+
+ std::string publicKeyStr = localUser->getPublicKey().toString();
+ printf("Local user public key: %s\n", publicKeyStr.c_str());
+
+ std::string privateKeyStr = localUser->getPrivateKey().toString();
+ printf("Local user private key: %s\n", privateKeyStr.c_str());
+/*
+ char hex_ed_pk[65];
+ unsigned char seed[crypto_sign_ed25519_SEEDBYTES];
+ unsigned char ed25519_skpk[crypto_sign_ed25519_SECRETKEYBYTES];
+ unsigned char ed25519_pk[crypto_sign_ed25519_PUBLICKEYBYTES];
+
+ crypto_sign_ed25519_sk_to_seed(seed, ed25519_skpk);
+ crypto_sign_ed25519_seed_keypair(ed25519_pk, ed25519_skpk, seed);
+ sodium_bin2hex(hex_ed_pk, 65, ed25519_pk, 32);
+ printf("public key: %s\n", hex_ed_pk);
+ */
+
+
+ //crypto_sign_ed25519_sk_to_seed
// TODO: For tests, dont run against bootstrap.ring.cx.
// Run against a bootstrap node made only for testing which doesn't persist added data.
- Database database("bootstrap.ring.cx", 4222);
+ /*
+ Database database("bootstrap.ring.cx", 4222, "storage");
database.seed();
LocalUser *localUser = LocalUser::create("dec05eba");
@@ -20,5 +42,6 @@ int main()
const char *data = "hello, world!";
database.add("galax.channel.latenight.chat", DataView{ (void*)data, strlen(data) });
database.commit();
+ */
return 0;
-} \ No newline at end of file
+}