[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 53/70: - more tests
From: |
gnunet |
Subject: |
[gnunet] 53/70: - more tests |
Date: |
Wed, 31 Aug 2022 18:00:47 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 6649bed3a0a6bd0edd3fccdf8a7c2edf7766146c
Author: Tristan Schwieren <tristan.schwieren@tum.de>
AuthorDate: Fri May 27 15:51:02 2022 +0200
- more tests
---
src/reclaim/test_did_helper.c | 53 +++++++++++++++++++++++++++++++------------
1 file changed, 38 insertions(+), 15 deletions(-)
diff --git a/src/reclaim/test_did_helper.c b/src/reclaim/test_did_helper.c
index 873cb85cf..8e895d031 100644
--- a/src/reclaim/test_did_helper.c
+++ b/src/reclaim/test_did_helper.c
@@ -31,43 +31,66 @@
#include "gnunet_gnsrecord_lib.h"
#include "did_helper.h"
-static const char test_privkey[32] = {
+static const char test_skey_bytes[32] = {
0x9b, 0x93, 0x7b, 0x81, 0x32, 0x2d, 0x81, 0x6c,
0xfa, 0xb9, 0xd5, 0xa3, 0xba, 0xac, 0xc9, 0xb2,
0xa5, 0xfe, 0xbe, 0x4b, 0x14, 0x9f, 0x12, 0x6b,
0x36, 0x30, 0xf9, 0x3a, 0x29, 0x52, 0x70, 0x17
};
-static const char *test_did =
"did:reclaim:000G0509BYD1MPAXVSTNV0KRD1JAT0YZMPJFQNM869B66S72PSF17K4Y8G";
+// TODO: Create a did manual from private key / independet of implementation
+static char *test_did =
+ "did:reclaim:000G0509BYD1MPAXVSTNV0KRD1JAT0YZMPJFQNM869B66S72PSF17K4Y8G";
-static struct GNUNET_IDENTITY_PrivateKey skey;
-static struct GNUNET_IDENTITY_PublicKey pkey;
+static struct GNUNET_IDENTITY_PrivateKey test_skey;
+static struct GNUNET_IDENTITY_PublicKey test_pkey;
-// TODO: Create a did manual from private key / independet of implementation
void
test_GNUNET_DID_pkey_to_did ()
{
char *str_did;
- str_did = GNUNET_DID_pkey_to_did(&pkey);
- GNUNET_assert(strcmp(test_did, str_did) == 0);
+ str_did = GNUNET_DID_pkey_to_did (&test_pkey);
+ GNUNET_assert (strcmp (test_did, str_did) == 0);
}
-int
-test_GNUNET_DID_did_to_pkey ();
+void
+test_GNUNET_DID_did_to_pkey ()
+{
+ struct GNUNET_IDENTITY_PublicKey pkey;
+ GNUNET_DID_did_to_pkey (test_did, &pkey);
-int
+ GNUNET_assert (test_pkey.type = pkey.type);
+ GNUNET_assert (0 == strcmp (pkey.eddsa_key.q_y,
+ test_pkey.eddsa_key.q_y));
+}
+
+void
test_GNUNET_DID_key_covert_multibase_base64_to_gnunet ();
-int
+void
test_GNUNET_DID_key_covert_gnunet_to_multibase_base64 ();
+void
+test_GNUNET_DID_pkey_to_did_document ()
+{
+ char *did_document = GNUNET_DID_pkey_to_did_document (&test_pkey);
+ printf("%s\n", did_document);
+
+ GNUNET_assert(0 == 0);
+}
+
int
main ()
{
- skey.type = htonl(GNUNET_IDENTITY_TYPE_EDDSA);
- memcpy (&(skey.eddsa_key), test_privkey, sizeof(struct
GNUNET_CRYPTO_EddsaPrivateKey));
- GNUNET_IDENTITY_key_get_public (&skey, &pkey);
+ // Setup
+ test_skey.type = htonl (GNUNET_IDENTITY_TYPE_EDDSA);
+ memcpy (&(test_skey.eddsa_key), test_skey_bytes, sizeof(struct
+
GNUNET_CRYPTO_EddsaPrivateKey));
+ GNUNET_IDENTITY_key_get_public (&test_skey, &test_pkey);
- test_GNUNET_DID_pkey_to_did();
+ // Do tests
+ test_GNUNET_DID_pkey_to_did ();
+ test_GNUNET_DID_did_to_pkey ();
+ test_GNUNET_DID_pkey_to_did_document ();
return 0;
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 45/70: fix bugs, (continued)
- [gnunet] 45/70: fix bugs, gnunet, 2022/08/31
- [gnunet] 66/70: - DID lib; renamed vars and moved a free, gnunet, 2022/08/31
- [gnunet] 63/70: - remove static variable from did_core, gnunet, 2022/08/31
- [gnunet] 55/70: - finished DID helper with tests, gnunet, 2022/08/31
- [gnunet] 60/70: - started with DID lib create func, gnunet, 2022/08/31
- [gnunet] 54/70: - default did document test without multibase, gnunet, 2022/08/31
- [gnunet] 68/70: - DID lib; simplify closure, gnunet, 2022/08/31
- [gnunet] 30/70: -DID refactor, uncrustify, not working didd create, gnunet, 2022/08/31
- [gnunet] 31/70: - did not working create, gnunet, 2022/08/31
- [gnunet] 46/70: -code review, gnunet, 2022/08/31
- [gnunet] 53/70: - more tests,
gnunet <=
- [gnunet] 61/70: - non working DID lib create func, gnunet, 2022/08/31
- [gnunet] 57/70: - changed did_core header, gnunet, 2022/08/31
- [gnunet] 59/70: - DID resolve using DID lib, gnunet, 2022/08/31
- [gnunet] 67/70: - DID lib; formatting, gnunet, 2022/08/31
- [gnunet] 51/70: - trying to make did_helper a lib, gnunet, 2022/08/31
- [gnunet] 64/70: - didlib; use expire value, gnunet, 2022/08/31
- [gnunet] 69/70: - added gitignores, gnunet, 2022/08/31
- [gnunet] 65/70: -m DID lib; added check for existing DID document, gnunet, 2022/08/31
- [gnunet] 22/70: -did mulitbase key and assert method for VCs, gnunet, 2022/08/31
- [gnunet] 25/70: -forgot the .c..., gnunet, 2022/08/31