Module: Secp256k1

Defined in:
lib/rbsecp256k1.rb,
lib/rbsecp256k1/util.rb,
lib/rbsecp256k1/context.rb,
lib/rbsecp256k1/version.rb,
ext/rbsecp256k1/rbsecp256k1.c

Overview

Wraps libsecp256k1 in a ruby module and provides object interfaces.

Defined Under Namespace

Modules: Util Classes: Context, DeserializationError, Error, KeyPair, PrivateKey, PublicKey, RecoverableSignature, SchnorrSignature, SerializationError, SharedSecret, Signature, XOnlyPublicKey

Constant Summary collapse

VERSION =
'6.0.0'

Class Method Summary collapse

Class Method Details

.have_ecdh?Boolean

Indicates whether or not libsecp256k1 EC Diffie-Hellman module is installed.

Returns:

  • (Boolean)

    true if libsecp256k1 was build with the ECDH module, false otherwise.



1950
1951
1952
1953
1954
1955
1956
1957
1958
# File 'ext/rbsecp256k1/rbsecp256k1.c', line 1950

static VALUE
Secp256k1_have_ecdh(VALUE module)
{
#ifdef HAVE_SECP256K1_ECDH_H
  return Qtrue;
#else // HAVE_SECP256K1_ECDH_H
  return Qfalse;
#endif // HAVE_SECP256K1_ECDH_H
}

.have_recovery?Boolean

Indicates whether or not the libsecp256k1 recovery module is installed.

Returns:

  • (Boolean)

    true if libsecp256k1 was built with the recovery module, false otherwise.



1934
1935
1936
1937
1938
1939
1940
1941
1942
# File 'ext/rbsecp256k1/rbsecp256k1.c', line 1934

static VALUE
Secp256k1_have_recovery(VALUE module)
{
#ifdef HAVE_SECP256K1_RECOVERY_H
  return Qtrue;
#else // HAVE_SECP256K1_RECOVERY_H
  return Qfalse;
#endif // HAVE_SECP256K1_RECOVERY_H
}

.have_schnorr?Boolean

Indicates whether or not libsecp256k1 Schnorr signature module is installed.

Returns:

  • (Boolean)


1965
1966
1967
1968
1969
1970
1971
1972
1973
# File 'ext/rbsecp256k1/rbsecp256k1.c', line 1965

static VALUE
Secp256k1_have_schnorr(VALUE module)
{
#ifdef HAVE_SECP256K1_SCHNORRSIG_H
  return Qtrue;
#else
  return Qfalse;
#endif
}