@@ -219,6 +219,35 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_create_o
219219 const unsigned char * label_tweak32
220220) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
221221
222+ /** Create Silent Payment output private key (for spending receiver's funds).
223+ *
224+ * Given a shared_secret, a recipient's spend private key b_spend, an output
225+ * counter k, and an optional label_tweak, calculate the corresponding
226+ * output private key d:
227+ *
228+ * b_m = b_spend + label_tweak
229+ * (if no label tweak is used, them b_m = b_spend)
230+ * d = (b_m + hash(shared_secret || ser_32(k))) mod n
231+ *
232+ * Returns: 1 if private key creation was successful. 0 if an error occured.
233+ * Args: ctx: pointer to a context object
234+ * Out: output_seckey: pointer to the resulting spending private key
235+ * In: shared_secret33: shared secret, derived from either sender's
236+ * or receiver's perspective with routines from above
237+ * receiver_spend_seckey: pointer to the receiver's spend private key
238+ * k: output counter (usually set to 0, should be increased for
239+ * every additional output to the same recipient)
240+ * label_tweak32: an optional 32-byte label tweak (NULL if no label is used)
241+ */
242+ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_create_output_seckey (
243+ const secp256k1_context * ctx ,
244+ unsigned char * output_seckey ,
245+ const unsigned char * shared_secret33 ,
246+ const unsigned char * receiver_spend_seckey ,
247+ unsigned int k ,
248+ const unsigned char * label_tweak32
249+ ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
250+
222251#ifdef __cplusplus
223252}
224253#endif
0 commit comments