mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
json: Add wrapper to add a secret to a JSON result
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
committed by
Rusty Russell
parent
6f015b69fd
commit
c91483f605
@@ -440,3 +440,9 @@ void json_add_time(struct json_stream *result, const char *fieldname,
|
|||||||
(unsigned)ts.tv_nsec);
|
(unsigned)ts.tv_nsec);
|
||||||
json_add_string(result, fieldname, timebuf);
|
json_add_string(result, fieldname, timebuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void json_add_secret(struct json_stream *response, const char *fieldname,
|
||||||
|
const struct secret *secret)
|
||||||
|
{
|
||||||
|
json_add_hex(response, fieldname, secret, sizeof(struct secret));
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#ifndef LIGHTNING_LIGHTNINGD_JSON_H
|
#ifndef LIGHTNING_LIGHTNINGD_JSON_H
|
||||||
#define LIGHTNING_LIGHTNINGD_JSON_H
|
#define LIGHTNING_LIGHTNINGD_JSON_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include <bitcoin/privkey.h>
|
||||||
#include <ccan/short_types/short_types.h>
|
#include <ccan/short_types/short_types.h>
|
||||||
#include <ccan/tal/tal.h>
|
#include <ccan/tal/tal.h>
|
||||||
#include <ccan/time/time.h>
|
#include <ccan/time/time.h>
|
||||||
@@ -42,6 +43,11 @@ void json_add_pubkey(struct json_stream *response,
|
|||||||
const char *fieldname,
|
const char *fieldname,
|
||||||
const struct pubkey *key);
|
const struct pubkey *key);
|
||||||
|
|
||||||
|
/* '"fieldname" : "89abcdef..."' or "89abcdef..." if fieldname is NULL */
|
||||||
|
void json_add_secret(struct json_stream *response,
|
||||||
|
const char *fieldname,
|
||||||
|
const struct secret *secret);
|
||||||
|
|
||||||
/* '"fieldname" : "0289abcdef..."' or "0289abcdef..." if fieldname is NULL */
|
/* '"fieldname" : "0289abcdef..."' or "0289abcdef..." if fieldname is NULL */
|
||||||
void json_add_node_id(struct json_stream *response,
|
void json_add_node_id(struct json_stream *response,
|
||||||
const char *fieldname,
|
const char *fieldname,
|
||||||
|
|||||||
Reference in New Issue
Block a user