Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bbapi_schnorr.cpp
Go to the documentation of this file.
1
5
#include "
barretenberg/bbapi/bbapi_schnorr.hpp
"
6
7
namespace
bb::bbapi
{
8
9
SchnorrComputePublicKey::Response
SchnorrComputePublicKey::execute
(
BB_UNUSED
BBApiRequest
& request) &&
10
{
11
return
{
grumpkin::g1::one
* private_key };
12
}
13
14
SchnorrConstructSignature::Response
SchnorrConstructSignature::execute
(
BB_UNUSED
BBApiRequest
& request) &&
15
{
16
grumpkin::g1::affine_element
pub_key =
grumpkin::g1::one
* private_key;
17
crypto::schnorr_key_pair<grumpkin::fr, grumpkin::g1>
key_pair = { private_key, pub_key };
18
19
std::string message_str(
reinterpret_cast<
const
char
*
>
(message.data()), message.size());
20
auto
sig = crypto::schnorr_construct_signature<crypto::Blake2sHasher, grumpkin::fq>(message_str, key_pair);
21
22
return
{ sig.s, sig.e };
23
}
24
25
SchnorrVerifySignature::Response
SchnorrVerifySignature::execute
(
BB_UNUSED
BBApiRequest
& request) &&
26
{
27
std::string message_str(
reinterpret_cast<
const
char
*
>
(message.data()), message.size());
28
crypto::schnorr_signature
sig = { s, e };
29
30
bool
result = crypto::schnorr_verify_signature<crypto::Blake2sHasher, grumpkin::fq, grumpkin::fr, grumpkin::g1>(
31
message_str, public_key, sig);
32
33
return
{ result };
34
}
35
36
}
// namespace bb::bbapi
bbapi_schnorr.hpp
Schnorr signature command definitions for the Barretenberg RPC API.
bb::group_elements::affine_element
Definition
affine_element.hpp:22
bb::group::one
static constexpr element one
Definition
group.hpp:46
BB_UNUSED
#define BB_UNUSED
Definition
compiler_hints.hpp:30
bb::bbapi
Definition
bbapi_chonk.cpp:13
bb::bbapi::BBApiRequest
Definition
bbapi_shared.hpp:147
bb::bbapi::SchnorrComputePublicKey::Response
Definition
bbapi_schnorr.hpp:27
bb::bbapi::SchnorrComputePublicKey::execute
Response execute(BBApiRequest &request) &&
Definition
bbapi_schnorr.cpp:9
bb::bbapi::SchnorrConstructSignature::Response
Definition
bbapi_schnorr.hpp:47
bb::bbapi::SchnorrConstructSignature::execute
Response execute(BBApiRequest &request) &&
Definition
bbapi_schnorr.cpp:14
bb::bbapi::SchnorrVerifySignature::Response
Definition
bbapi_schnorr.hpp:69
bb::bbapi::SchnorrVerifySignature::execute
Response execute(BBApiRequest &request) &&
Definition
bbapi_schnorr.cpp:25
bb::crypto::schnorr_key_pair
Definition
schnorr.hpp:22
bb::crypto::schnorr_signature
Definition
schnorr.hpp:30
src
barretenberg
bbapi
bbapi_schnorr.cpp
Generated by
1.9.8