aboutsummaryrefslogtreecommitdiff
path: root/src/json/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/json/json.c')
-rw-r--r--src/json/json.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/json/json.c b/src/json/json.c
index bf3b2a0e7..da4472522 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -144,6 +144,9 @@ rfc8785encode (char **inp)
if ( (1 == mbl) &&
(val <= 0x1F) )
{
+ /* Should not happen, as input is produced by
+ * JSON stringification */
+ GNUNET_break (0);
lowdump (&buf,
val);
}
@@ -193,6 +196,12 @@ rfc8785encode (char **inp)
}
}
break;
+ default:
+ mbl = 2;
+ GNUNET_buffer_write (&buf,
+ pos,
+ mbl);
+ break;
}
}
else
@@ -1009,6 +1018,24 @@ TALER_deposit_extension_hash (const json_t *extensions,
}
+char *
+TALER_JSON_canonicalize (const json_t *input)
+{
+ char *wire_enc;
+
+ if (NULL == (wire_enc = json_dumps (input,
+ JSON_ENCODE_ANY
+ | JSON_COMPACT
+ | JSON_SORT_KEYS)))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
+ rfc8785encode (&wire_enc);
+ return wire_enc;
+}
+
+
enum GNUNET_GenericReturnValue
TALER_JSON_extensions_config_hash (const json_t *config,
struct TALER_ExtensionConfigHash *ech)