2016-01-21 21:11:48 +01:00
|
|
|
#ifndef LIGHTNING_DAEMON_SECRETS_H
|
|
|
|
#define LIGHTNING_DAEMON_SECRETS_H
|
|
|
|
/* Routines to handle private keys. */
|
|
|
|
#include "config.h"
|
2016-01-21 21:11:48 +01:00
|
|
|
#include <ccan/short_types/short_types.h>
|
2016-01-21 21:11:48 +01:00
|
|
|
|
|
|
|
struct peer;
|
|
|
|
struct lightningd_state;
|
|
|
|
struct signature;
|
2016-01-21 21:11:48 +01:00
|
|
|
struct sha256;
|
2016-01-21 21:11:48 +01:00
|
|
|
|
2016-08-18 06:53:46 +02:00
|
|
|
void privkey_sign(struct lightningd_state *dstate, const void *src, size_t len,
|
2016-01-21 21:11:48 +01:00
|
|
|
struct signature *sig);
|
|
|
|
|
2016-01-21 21:15:27 +01:00
|
|
|
void peer_sign_theircommit(const struct peer *peer,
|
|
|
|
struct bitcoin_tx *commit,
|
|
|
|
struct signature *sig);
|
2016-01-21 21:14:26 +01:00
|
|
|
|
2016-01-21 21:15:28 +01:00
|
|
|
void peer_sign_ourcommit(const struct peer *peer,
|
|
|
|
struct bitcoin_tx *commit,
|
|
|
|
struct signature *sig);
|
|
|
|
|
|
|
|
void peer_sign_spend(const struct peer *peer,
|
|
|
|
struct bitcoin_tx *spend,
|
2016-04-24 12:27:35 +02:00
|
|
|
const u8 *commit_witnessscript,
|
2016-01-21 21:15:28 +01:00
|
|
|
struct signature *sig);
|
|
|
|
|
2016-05-04 08:42:47 +02:00
|
|
|
void peer_sign_htlc_refund(const struct peer *peer,
|
|
|
|
struct bitcoin_tx *spend,
|
|
|
|
const u8 *htlc_witnessscript,
|
|
|
|
struct signature *sig);
|
|
|
|
|
2016-07-01 03:46:58 +02:00
|
|
|
void peer_sign_htlc_fulfill(const struct peer *peer,
|
|
|
|
struct bitcoin_tx *spend,
|
|
|
|
const u8 *htlc_witnessscript,
|
|
|
|
struct signature *sig);
|
|
|
|
|
2016-01-21 21:15:27 +01:00
|
|
|
void peer_sign_mutual_close(const struct peer *peer,
|
|
|
|
struct bitcoin_tx *close,
|
|
|
|
struct signature *sig);
|
|
|
|
|
2016-05-06 04:26:55 +02:00
|
|
|
void peer_sign_steal_input(const struct peer *peer,
|
|
|
|
struct bitcoin_tx *spend,
|
|
|
|
size_t i,
|
|
|
|
const u8 *witnessscript,
|
|
|
|
struct signature *sig);
|
|
|
|
|
2016-08-18 06:55:13 +02:00
|
|
|
const char *peer_secrets_for_db(const tal_t *ctx, struct peer *peer);
|
|
|
|
|
|
|
|
void peer_set_secrets_from_db(struct peer *peer,
|
|
|
|
const void *commit_privkey,
|
|
|
|
size_t commit_privkey_len,
|
|
|
|
const void *final_privkey,
|
|
|
|
size_t final_privkey_len,
|
|
|
|
const void *revocation_seed,
|
|
|
|
size_t revocation_seed_len);
|
|
|
|
|
2016-01-21 21:11:48 +01:00
|
|
|
void peer_secrets_init(struct peer *peer);
|
|
|
|
|
|
|
|
void peer_get_revocation_hash(const struct peer *peer, u64 index,
|
|
|
|
struct sha256 *rhash);
|
|
|
|
void peer_get_revocation_preimage(const struct peer *peer, u64 index,
|
|
|
|
struct sha256 *preimage);
|
|
|
|
|
2016-01-21 21:11:49 +01:00
|
|
|
void secrets_init(struct lightningd_state *dstate);
|
2016-01-21 21:11:48 +01:00
|
|
|
|
|
|
|
#endif /* LIGHTNING_DAEMON_SECRETS_H */
|