@@ -395,42 +395,78 @@ function secp256k1_ecdsa_recover($context, &$ecPublicKey, $ecdsaRecoverableSigna
395395 */
396396function secp256k1_ecdh ($ context , string &$ result , $ ecPublicKey , string $ privKey , ?callable $ hashfxn , ?int $ outputLen , $ data ): int {}
397397/**
398- * Serialize a Schnorr signature.
399- *
400- * Returns: 1
401- * Args: ctx: a secp256k1 context object
402- * Out: out64: pointer to a 64-byte array to store the serialized signature
403- * In: sig: pointer to the signature
404- *
405- * See secp256k1_schnorrsig_parse for details about the encoding.
406398 * @param resource $context
407- * @param string |null $sigout
408- * @param resource $schnorrsig
399+ * @param resource |null $pubkey
400+ * @param string $input32
409401 * @return int
410402 */
411- function secp256k1_schnorrsig_serialize ($ context , ?string &$ sigout , $ schnorrsig ): int {}
403+ function secp256k1_xonly_pubkey_parse ($ context , &$ pubkey , string $ input32 ): int {}
404+ /**
405+ * @param resource $context
406+ * @param string|null $pubkey
407+ * @return int
408+ */
409+ function secp256k1_xonly_pubkey_serialize ($ context , ?string &$ pubkey ): int {}
410+ /**
411+ * @param resource $context
412+ * @param resource|null $pubkey
413+ * @param int|null $pk_parity
414+ * @return int
415+ */
416+ function secp256k1_xonly_pubkey_from_pubkey ($ context , &$ pubkey , ?int &$ pk_parity ): int {}
417+ /**
418+ * @param resource $context
419+ * @param resource|null $output_pubkey
420+ * @param resource $internal_pubkey
421+ * @param string $tweak
422+ * @return int
423+ */
424+ function secp256k1_xonly_pubkey_tweak_add ($ context , &$ output_pubkey , $ internal_pubkey , string $ tweak ): int {}
425+ /**
426+ * @param resource $context
427+ * @param string $tweaked_pubkey32
428+ * @param int $tweaked_pubkey_parity
429+ * @param resource $internal_pubkey
430+ * @param string $tweak32
431+ * @return int
432+ */
433+ function secp256k1_xonly_pubkey_tweak_add_check ($ context , string $ tweaked_pubkey32 , int $ tweaked_pubkey_parity , $ internal_pubkey , string $ tweak32 ): int {}
412434/**
413- * Parse a Schnorr signature.
414- *
415- * Returns: 1 when the signature could be parsed, 0 otherwise.
416- * Args: ctx: a secp256k1 context object
417- * Out: sig: pointer to a signature object
418- * In: in64: pointer to the 64-byte signature to be parsed
419- *
420- * The signature is serialized in the form R||s, where R is a 32-byte public
421- * key (x-coordinate only; the y-coordinate is considered to be the unique
422- * y-coordinate satisfying the curve equation that is a quadratic residue)
423- * and s is a 32-byte big-endian scalar.
424- *
425- * After the call, sig will always be initialized. If parsing failed or the
426- * encoded numbers are out of range, signature validation with it is
427- * guaranteed to fail for every message and public key.
428435 * @param resource $context
429- * @param resource|null $sigout
430- * @param string $sigin
436+ * @param resource|null $keypair
437+ * @param string $seckey
431438 * @return int
432439 */
433- function secp256k1_schnorrsig_parse ($ context , &$ sigout , string $ sigin ): int {}
440+ function secp256k1_keypair_create ($ context , &$ keypair , string $ seckey ): int {}
441+ /**
442+ * @param resource $context
443+ * @param string|null $seckey
444+ * @param resource $keypair
445+ * @return int
446+ */
447+ function secp256k1_keypair_sec ($ context , ?string &$ seckey , $ keypair ): int {}
448+ /**
449+ * @param resource $context
450+ * @param resource|null $pubkey
451+ * @param resource $keypair
452+ * @return int
453+ */
454+ function secp256k1_keypair_pub ($ context , &$ pubkey , $ keypair ): int {}
455+ /**
456+ * @param resource $context
457+ * @param resource|null $pubkey
458+ * @param int|null $pk_parity
459+ * @param resource $keypair
460+ * @return int
461+ */
462+ function secp256k1_keypair_xonly_pub ($ context , &$ pubkey , ?int &$ pk_parity , $ keypair ): int {}
463+ /**
464+ * @param resource $context
465+ * @param resource $keypair
466+ * @param string $tweak32
467+ * @return int
468+ */
469+ function secp256k1_keypair_xonly_tweak_add ($ context , &$ keypair , string $ tweak32 ): int {}
434470/**
435471 * Create a Schnorr signature.
436472 *
@@ -442,14 +478,14 @@ function secp256k1_schnorrsig_parse($context, &$sigout, string $sigin): int {}
442478 * noncefp: pointer to a nonce generation function. If NULL, secp256k1_nonce_function_bipschnorr is used
443479 * ndata: pointer to arbitrary data used by the nonce generation function (can be NULL)
444480 * @param resource $context
445- * @param resource|null $ecdsaSignatureOut
481+ * @param resource|null $sig64
446482 * @param string $msg32
447- * @param string $secretKey
483+ * @param resource $keypair
448484 * @param callable|null $noncefp
449485 * @param $ndata
450486 * @return int
451487 */
452- function secp256k1_schnorrsig_sign ($ context , &$ ecdsaSignatureOut , string $ msg32 , string $ secretKey , ?callable $ noncefp , $ ndata ): int {}
488+ function secp256k1_schnorrsig_sign ($ context , &$ sig64 , string $ msg32 , $ keypair , ?callable $ noncefp , $ ndata ): int {}
453489/**
454490 * Verify a Schnorr signature.
455491 *
@@ -460,44 +496,19 @@ function secp256k1_schnorrsig_sign($context, &$ecdsaSignatureOut, string $msg32,
460496 * msg32: the 32-byte message being verified (cannot be NULL)
461497 * pubkey: pointer to a public key to verify with (cannot be NULL)
462498 * @param resource $context
463- * @param resource $schnorrsig
499+ * @param string $sig64
464500 * @param string $msg32
465501 * @param resource $pubkey
466502 * @return int
467503 */
468- function secp256k1_schnorrsig_verify ($ context , $ schnorrsig , string $ msg32 , $ pubkey ): int {}
504+ function secp256k1_schnorrsig_verify ($ context , string $ sig64 , string $ msg32 , $ pubkey ): int {}
469505/**
470- * Verifies a set of Schnorr signatures.
471- *
472- * Returns 1 if all succeeded, 0 otherwise. In particular, returns 1 if n_sigs is 0.
473- *
474- * Args: ctx: a secp256k1 context object, initialized for verification.
475- * scratch: scratch space used for the multiexponentiation
476- * In: sig: array of signatures, or NULL if there are no signatures
477- * msg32: array of messages, or NULL if there are no signatures
478- * pk: array of public keys, or NULL if there are no signatures
479- * n_sigs: number of signatures in above arrays. Must be smaller than
480- * 2^31 and smaller than half the maximum size_t value. Must be 0
481- * if above arrays are NULL.
482- * @param resource $context
483- * @param resource $scratch
484- * @param array $pubkeys
485- * @param array $msg32s
486- * @param array $sigs
487- * @param int $numsigs
488- * @return int
489- */
490- function secp256k1_schnorrsig_verify_batch ($ context , $ scratch , array $ pubkeys , array $ msg32s , array $ sigs , int $ numsigs ): int {}
491- /**
492- * An implementation of the nonce generation function as defined in BIP-schnorr.
493- * If a data pointer is passed, it is assumed to be a pointer to 32 bytes of
494- * extra entropy.
495506 * @param string|null $nonce32
496507 * @param string $msg32
497508 * @param string $key32
498- * @param string|null $algo16
509+ * @param string $xonly_pk32
510+ * @param string $algo16
499511 * @param $data
500- * @param int $attempt
501512 * @return int
502513 */
503- function secp256k1_nonce_function_bipschnorr (?string &$ nonce32 , string $ msg32 , string $ key32 , ? string $ algo16 , $ data , int $ attempt ): int {}
514+ function secp256k1_nonce_function_bip340 (?string &$ nonce32 , string $ msg32 , string $ key32 , string $ xonly_pk32 , string $ algo16 , $ data ): int {}
0 commit comments