@@ -50,6 +50,19 @@ typedef struct secp256k1_silentpayments_recipient {
5050 size_t index ;
5151} secp256k1_silentpayments_recipient ;
5252
53+ /* This struct contains details of the DLEQ proof
54+ *
55+ * Fields:
56+ * - shared_secret : 33-byte shared secret point
57+ * - proof: 64-byte serialized DLEQ proof
58+ * - index: Indicates which recipient the proof pertains to based on the original (not sorted) ordering of the addresses
59+ */
60+ typedef struct {
61+ unsigned char shared_secret [33 ];
62+ unsigned char proof [64 ];
63+ size_t index ;
64+ } secp256k1_silentpayments_dleq_data ;
65+
5366/** Create Silent Payment outputs for recipient(s).
5467 *
5568 * Given a list of n secret keys a_1...a_n (one for each silent payment
@@ -444,6 +457,30 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_recipien
444457 const uint32_t k
445458) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
446459
460+ /** Serialize a secp256k1_silentpayments_dleq_data object into a 101-byte sequence.
461+ * 101-byte sequence = 33 bytes shared secret + 64 bytes proof + 4 bytes index
462+ * where index is position in an array of pointers to silent payment recipients
463+ *
464+ * Out: output: pointer to a 101-byte array to place the serialized `secp256k1_silentpayments_dleq_data` in
465+ * In: dleq_data: pointer to an initialized secp256k1_silentpayments_dleq_data object
466+ */
467+ SECP256K1_API void secp256k1_silentpayments_dleq_data_serialize (
468+ unsigned char * output33 ,
469+ const secp256k1_silentpayments_dleq_data * dleq_data
470+ )SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 );
471+
472+ /** Parse a 101-byte sequence into a secp256k1_silentpayments_dleq_data object.
473+ * 101-byte sequence = 33 bytes shared secret + 64 bytes proof + 4 bytes index
474+ * where index is position in an array of pointers to silent payment recipients
475+ *
476+ * Out: dleq_data: pointer to a secp256k1_silentpayments_dleq_data object.
477+ * In: input: pointer to a serialized secp256k1_silentpayments_dleq_data.
478+ */
479+ SECP256K1_API void secp256k1_silentpayments_dleq_data_parse (
480+ secp256k1_silentpayments_dleq_data * dleq_data ,
481+ const unsigned char * input
482+ )SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 );
483+
447484#ifdef __cplusplus
448485}
449486#endif
0 commit comments