@@ -43,6 +43,19 @@ typedef struct {
43
43
size_t index ;
44
44
} secp256k1_silentpayments_recipient ;
45
45
46
+ /* This struct contains details of the DLEQ proof
47
+ *
48
+ * Fields:
49
+ * - shared_secret : 33-byte shared secret point
50
+ * - proof: 64-byte serialized DLEQ proof
51
+ * - index: Indicates which recipient the proof pertains to based on the original (not sorted) ordering of the addresses
52
+ */
53
+ typedef struct {
54
+ unsigned char shared_secret [33 ];
55
+ unsigned char proof [64 ];
56
+ size_t index ;
57
+ } secp256k1_silentpayments_dleq_data ;
58
+
46
59
/** Create Silent Payment outputs for recipient(s).
47
60
*
48
61
* Given a list of n private keys a_1...a_n (one for each silent payment
@@ -399,6 +412,30 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_silentpayments_recipien
399
412
unsigned int k
400
413
) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_ARG_NONNULL (3 ) SECP256K1_ARG_NONNULL (4 );
401
414
415
+ /** Serialize a secp256k1_silentpayments_dleq_data object into a 101-byte sequence.
416
+ * 101-byte sequence = 33 bytes shared secret + 64 bytes proof + 4 bytes index
417
+ * where index is position in an array of pointers to silent payment recipients
418
+ *
419
+ * Out: output: pointer to a 101-byte array to place the serialized `secp256k1_silentpayments_dleq_data` in
420
+ * In: dleq_data: pointer to an initialized secp256k1_silentpayments_dleq_data object
421
+ */
422
+ SECP256K1_API void secp256k1_silentpayments_dleq_data_serialize (
423
+ unsigned char * output33 ,
424
+ const secp256k1_silentpayments_dleq_data * dleq_data
425
+ )SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 );
426
+
427
+ /** Parse a 101-byte sequence into a secp256k1_silentpayments_dleq_data object.
428
+ * 101-byte sequence = 33 bytes shared secret + 64 bytes proof + 4 bytes index
429
+ * where index is position in an array of pointers to silent payment recipients
430
+ *
431
+ * Out: dleq_data: pointer to a secp256k1_silentpayments_dleq_data object.
432
+ * In: input: pointer to a serialized secp256k1_silentpayments_dleq_data.
433
+ */
434
+ SECP256K1_API void secp256k1_silentpayments_dleq_data_parse (
435
+ secp256k1_silentpayments_dleq_data * dleq_data ,
436
+ const unsigned char * input
437
+ )SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 );
438
+
402
439
#ifdef __cplusplus
403
440
}
404
441
#endif
0 commit comments