1 #ifndef LIGHTNING_COMMON_KEY_DERIVE_H
2 #define LIGHTNING_COMMON_KEY_DERIVE_H
3 #include "config.h"
4 #include <ccan/short_types/short_types.h>
5 #include <stdbool.h>
6 
7 struct pubkey;
8 struct privkey;
9 struct secret;
10 
11 /* For `localkey`, `remotekey`, `local-delayedkey` and `remote-delayedkey` */
12 bool derive_simple_key(const struct pubkey *basepoint,
13 		       const struct pubkey *per_commitment_point,
14 		       struct pubkey *key);
15 
16 bool derive_simple_privkey(const struct secret *base_secret,
17 			   const struct pubkey *basepoint,
18 			   const struct pubkey *per_commitment_point,
19 			   struct privkey *key);
20 
21 /* For `revocationkey` */
22 bool derive_revocation_key(const struct pubkey *basepoint,
23 			   const struct pubkey *per_commitment_point,
24 			   struct pubkey *key);
25 
26 bool derive_revocation_privkey(const struct secret *base_secret,
27 			       const struct secret *per_commitment_secret,
28 			       const struct pubkey *basepoint,
29 			       const struct pubkey *per_commitment_point,
30 			       struct privkey *key);
31 
32 
33 struct ext_key;
34 bool bip32_pubkey(const struct ext_key *bip32_base,
35 		  struct pubkey *pubkey, u32 index);
36 #endif /* LIGHTNING_COMMON_KEY_DERIVE_H */
37