Download the PHP package nicolasflamel/secp256k1-zkp without Composer
On this page you can find all versions of the php package nicolasflamel/secp256k1-zkp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nicolasflamel/secp256k1-zkp
More information about nicolasflamel/secp256k1-zkp
Files in nicolasflamel/secp256k1-zkp
Package secp256k1-zkp
Short Description PHP library for parts of libsecp256k1-zkp
License MIT
Informations about the package secp256k1-zkp
Secp256k1-zkp PHP Library
Description
PHP library for parts of libsecp256k1-zkp.
Installing
Run the following command from the root of your project to install this library and configure your project to use it.
Usage
After an Secp256k1Zkp
object has been created, it can be used to perform all the secp256k1-zkp functions that this library implements.
The following code briefly shows how to use this library. A more complete example is available here.
Functions
-
Secp256k1-zkp constructor:
constructor(): Secp256k1Zkp
This constructor is used to create a
Secp256k1Zkp
object and it returns the following value:Secp256k1Zkp
: AnSecp256k1Zkp
object.
-
Secp256k1-zkp is valid private key method:
isValidPrivateKey(string $privateKey): bool
This method is used to check if a provided private key is valid and it accepts the following parameters:
string $privateKey
: The private key to validate.
This method returns the following values:
bool
:TRUE
if the private key is valid orFALSE
if it is not.
-
Secp256k1-zkp get public key method:
getPublicKey(string $privateKey): string | FALSE
This method is used to get a provided private key's public key and it accepts the following parameters:
string $privateKey
: The private key to get the public key for.
This method returns the following values:
string
: The private key's public key.FALSE
: Getting the public key failed.
-
Secp256k1-zkp add private keys method:
addPrivateKeys(string &$firstPrivateKey, string $secondPrivateKey): bool
This method is used to add two private keys and it accepts the following parameters:
string &$firstPrivateKey
: The private key to add the second private key to. This variable will contain the sum of the private keys if the function returnedTRUE
.string $secondPrivateKey
: The private key to add to the first private key.
This method returns the following values:
bool
:TRUE
if adding private keys was successful orFALSE
if it failed.
-
Secp256k1-zkp get blinding factor method:
getBlindingFactor(string $blind, string $value): string | FALSE
This method is used to get the blinding factor from a provided blind and value and it accepts the following parameters:
string $blind
: The blind to use.string $value
: The value to use. This must be a non-negative integer.
This method returns the following values:
string
: The blinding factor for the provided blind and value.FALSE
: Getting the blinding factor failed.
-
Secp256k1-zkp get commitment method:
getCommitment(string $blindingFactor, string $value): string | FALSE
This method is used to get the commitment for a provided value using a provided blinding factor and it accepts the following parameters:
string $blindingFactor
: The blinding factor to use.string $value
: The value to commit. This must be a non-negative integer.
This method returns the following values:
string
: The commitment for the provided value using the provided blinding factor.FALSE
: Getting the commitment failed.
-
Secp256k1-zkp get Bulletproof method:
getBulletproof(string $blindingFactor, string $value, string $rewindNonce, string $privateNonce, string $message): string | FALSE
This method is used to get Bulletproof for a provided value committed with a provided blinding factor using a provided rewind nonce, private nonce, and message and it accepts the following parameters:
string $blindingFactor
: The blinding factor use to commit the value.string $value
: The value committed to. This must be a non-negative integer.string $rewindNonce
: The rewind nonce to use.string $privateNonce
: The private nonce to use.string $message
: The message to use.
This method returns the following values:
string
: The Bulletproof for the provided value committed with the provided blinding factor using the provided rewind nonce, private nonce, and message.FALSE
: Getting the Bulletproof failed.
-
Secp256k1-zkp get private nonce method:
getPrivateNonce(): string | FALSE
This method is used to get a random private nonce that can be used when creating a partial single-signer signature and it returns the following values:
string
: A private nonce.FALSE
: Getting a private nonce failed.
-
Secp256k1-zkp combine public keys method:
combinePublicKeys(array $publicKeys): string | FALSE
This method is used to get the combined public key for provided public keys and it accepts the following parameters:
array $publicKeys
: The public keys to combine.
This method returns the following values:
string
: The combined public key.FALSE
: Combing public keys failed.
-
Secp256k1-zkp get partial single-signer signature method:
getPartialSingleSignerSignature(string $privateKey, string $message, string $privateNonce, string $publicKey, string $publicNonce): string | FALSE
This method is used to get the partial single-signer signature for a provided message signed with a provided private key using a provided private nonce, public key, and public nonce and it accepts the following parameters:
string $privateKey
: The private key to use.string $message
: The message to sign.string $privateNonce
: The private nonce to use.string $publicKey
: The public key to use.string $publicNonce
: The public nonce to use.
This method returns the following values:
string
: The partial single-signer signature for the provided message signed with the provided private key using the provided private nonce, public key, and public nonce.FALSE
: Getting the partial single-signer signature failed.
-
Secp256k1-zkp public key to commitment method:
publicKeyToCommitment(string $publicKey): string | FALSE
This method is used to convert a provided public key to a commitment and it accepts the following parameters:
string $publicKey
: The public key to convert to a commitment.
This method returns the following values:
string
: The commitment.FALSE
: Converting the public key failed.