@@ -170,6 +170,33 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_create_o
170170 const unsigned char * label_tweak32
171171) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
172172
173+ /** Create Silent Payment output private key (for spending receiver's funds).
174+ *
175+ * Given a shared_secret, a recipient's spend private key b_spend, and an
176+ * output counter k, calculate the corresponding output private key d:
177+ *
178+ * d = (b_spend + sha256(shared_secret || ser_32(k))) mod n
179+ *
180+ * Returns: 1 if private key creation was successful. 0 if an error occured.
181+ * Args: ctx: pointer to a context object
182+ * Out: output_seckey: pointer to the resulting spending private key
183+ * In: shared_secret33: shared secret, derived from either sender's
184+ * or receiver's perspective with routines from above
185+ * receiver_spend_seckey: pointer to the receiver's spend private key
186+ * k: output counter (usually set to 0, should be increased for
187+ * every additional output to the same recipient)
188+ * label_tweak32: an optional 32-byte label tweak
189+ * (not supported yet, must be set to NULL right now)
190+ */
191+ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_create_output_seckey (
192+ const secp256k1_context * ctx ,
193+ unsigned char * output_seckey ,
194+ const unsigned char * shared_secret33 ,
195+ const unsigned char * receiver_spend_seckey ,
196+ unsigned int k ,
197+ const unsigned char * label_tweak32
198+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
199+
173200#ifdef __cplusplus
174201}
175202#endif
0 commit comments