The private key must be an instance of Buffer, Uint8Array or a string. The input will be used to
generate entropy and there is no limit in size.
The string is used as a set of raw bytes (in UTF-8) and is typically used to pass passwords or secret messages.
If you want to pass a bigint, a number or a hexadecimal, be sure to convert them to one of the supported types first.
The 'conversions' module in @zk-kit/utils provides a set of functions that may be useful in case you need to convert types.
Parameters
privateKey: string | Uint8Array | Buffer
The EdDSA private key for generating the associated public key.
Returns bigint
The derived secret scalar to be used to calculate public key and optimized for circuit calculations.
Derives a secret scalar from a given EdDSA private key.
This process involves hashing the private key with Blake1, pruning the resulting hash to retain the lower 32 bytes, and converting it into a little-endian integer. The use of the secret scalar streamlines the public key generation process by omitting steps 1, 2, and 3 as outlined in RFC 8032 section 5.1.5, enhancing circuit efficiency and simplicity. This method is crucial for fixed-base scalar multiplication operations within the correspondent cryptographic circuit. For detailed steps, see: https://datatracker.ietf.org/doc/html/rfc8032#section-5.1.5. For example usage in a circuit, see: https://github.com/semaphore-protocol/semaphore/blob/2c144fc9e55b30ad09474aeafa763c4115338409/packages/circuits/semaphore.circom#L21
The private key must be an instance of Buffer, Uint8Array or a string. The input will be used to generate entropy and there is no limit in size. The string is used as a set of raw bytes (in UTF-8) and is typically used to pass passwords or secret messages. If you want to pass a bigint, a number or a hexadecimal, be sure to convert them to one of the supported types first. The 'conversions' module in @zk-kit/utils provides a set of functions that may be useful in case you need to convert types.