gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 51/70: - trying to make did_helper a lib


From: gnunet
Subject: [gnunet] 51/70: - trying to make did_helper a lib
Date: Wed, 31 Aug 2022 18:00:45 +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 fab645cae7030595ef26a8bbb213d58ce8fc7cf7
Author: Tristan Schwieren <tristan.schwieren@tum.de>
AuthorDate: Fri May 27 12:51:40 2022 +0200

    - trying to make did_helper a lib
---
 src/reclaim/Makefile.am       | 24 +++++++++++++++++++-----
 src/reclaim/test_did_helper.c | 19 +++++++++----------
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index 32631427b..d9e27a0ee 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -35,7 +35,8 @@ pkgcfg_DATA = \
   reclaim.conf
 
 lib_LTLIBRARIES = \
-  libgnunetreclaim.la
+  libgnunetreclaim.la \
+  libgnunetdid.la
 plugin_LTLIBRARIES = \
   libgnunet_plugin_gnsrecord_reclaim.la \
   libgnunet_plugin_reclaim_attribute_basic.la \
@@ -138,6 +139,19 @@ libgnunetreclaim_la_LDFLAGS = \
   $(GN_LIB_LDFLAGS)   \
   -version-info 0:0:0
 
+libgnunetdid_la_SOURCES = \
+  did_helper.c \
+  did_helper.h
+libgnunetdid_la_LIBADD = \
+       $(top_builddir)/src/util/libgnunetutil.la \
+       $(top_builddir)/src/gns/libgnunetgns.la \
+       $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
+       $(top_builddir)/src/identity/libgnunetidentity.la \
+       $(top_builddir)/src/namestore/libgnunetnamestore.la \
+       -ljansson
+libgnunetdid_la_LDFLAGS = \
+  $(GN_LIB_LDFLAGS)   \
+  -version-info 0:0:0
 
 libgnunet_plugin_reclaim_attribute_basic_la_SOURCES = \
   plugin_reclaim_attribute_basic.c
@@ -190,14 +204,13 @@ test_reclaim_attribute_LDADD = \
 
 gnunet_did_SOURCES = \
        gnunet-did.c \
-  did_helper.h \
-  did_helper.c
 gnunet_did_LDADD = \
        $(top_builddir)/src/util/libgnunetutil.la \
        $(top_builddir)/src/gns/libgnunetgns.la \
        $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
        $(top_builddir)/src/identity/libgnunetidentity.la \
        $(top_builddir)/src/namestore/libgnunetnamestore.la \
+  libgnunetdid.la \
        -ljansson
 
 
@@ -213,7 +226,8 @@ test_did_helper_LDADD = \
        $(top_builddir)/src/gns/libgnunetgns.la \
        $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
        $(top_builddir)/src/identity/libgnunetidentity.la \
-       $(top_builddir)/src/namestore/libgnunetnamestore.la
+       $(top_builddir)/src/namestore/libgnunetnamestore.la \
+  libgnunetdid.la
 
 check_SCRIPTS = \
   test_reclaim_attribute.sh \
@@ -227,7 +241,7 @@ check_PROGRAMS = \
 
 if ENABLE_TEST_RUN
  AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export 
PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset 
XDG_CONFIG_HOME;
- TESTS = \ 
+ TESTS = \
   $(check_SCRIPTS) \
   $(check_PROGRAMS)
 endif
diff --git a/src/reclaim/test_did_helper.c b/src/reclaim/test_did_helper.c
index ddc967b6c..55b98b085 100644
--- a/src/reclaim/test_did_helper.c
+++ b/src/reclaim/test_did_helper.c
@@ -38,20 +38,15 @@ static char test_privkey[32] = {
   0x36, 0x30, 0xf9, 0x3a, 0x29, 0x52, 0x70, 0x17
 };
 
+static struct GNUNET_IDENTITY_PrivateKey skey;
+static struct GNUNET_IDENTITY_PublicKey pkey;
 
 int
 test_GNUNET_DID_pkey_to_did ()
 {
-  struct GNUNET_IDENTITY_PrivateKey skey;
-  struct GNUNET_IDENTITY_PublicKey pkey;
-  char *str_pkey;
-
-  skey.type = GNUNET_GNSRECORD_TYPE_EDKEY;
-  memcpy (&(skey.eddsa_key), test_privkey, sizeof(struct 
GNUNET_CRYPTO_EddsaPrivateKey));
-
-  GNUNET_IDENTITY_key_get_public (&skey, &pkey);
-
-  str_pkey = GNUNET_IDENTITY_public_key_to_string (&pkey);
+  char *str_did;
+  str_did = GNUNET_DID_pkey_to_did(&pkey);
+  printf("%s\n", str_did);
 
   // TODO: Give to function, compare to real DID
   return 0;
@@ -69,6 +64,10 @@ test_GNUNET_DID_key_covert_gnunet_to_multibase_base64 ();
 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);
+
   test_GNUNET_DID_pkey_to_did();
 
   GNUNET_assert (0 == 0);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]