1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#![allow(deprecated)]
use curve25519_dalek::{
constants::{RISTRETTO_BASEPOINT_COMPRESSED, RISTRETTO_BASEPOINT_POINT},
ristretto::RistrettoPoint,
};
extern crate secp256k1;
use crate::{
ecies::secp256k1::WedprSecp256k1Ecies, hash::keccak256::WedprKeccak256,
signature::secp256k1::WedprSecp256k1Recover,
};
use secp256k1::{All, Secp256k1, VerifyOnly};
use sha3::Sha3_512;
use wedpr_utils::coder::base_x::WedprBase64;
lazy_static! {
pub static ref BASEPOINT_G1: RistrettoPoint = RISTRETTO_BASEPOINT_POINT;
pub static ref BASEPOINT_G2: RistrettoPoint =
RistrettoPoint::hash_from_bytes::<Sha3_512>(
RISTRETTO_BASEPOINT_COMPRESSED.as_bytes()
);
pub static ref SECP256K1_VERIFY: Secp256k1<VerifyOnly> = Secp256k1::verification_only();
pub static ref SECP256K1_ALL: Secp256k1<All> = Secp256k1::new();
pub static ref CODER: WedprBase64 = WedprBase64::default();
pub static ref SIGNATURE: WedprSecp256k1Recover =
WedprSecp256k1Recover::default();
pub static ref HASH: WedprKeccak256 = WedprKeccak256::default();
pub static ref ECIES: WedprSecp256k1Ecies = WedprSecp256k1Ecies::default();
}
pub const RISTRETTO_POINT_SIZE_IN_BYTES: usize = 32;
pub mod tests {
pub const SECP256K1_TEST_SECRET_KEY: &str =
"EMGwfgpqDQVUsVO7jxUniSNYxTPjGcbbf6eikaAIKog=";
pub const SECP256K1_TEST_PUBLIC_KEY: &str =
"ApBrmk0PHxPp4ElvnhlmwEiAklVdDbX+MicqML591eC2";
pub const BASE64_ENCODED_TEST_MESSAGE: &str =
"g6sLGLyLvnkOSvBcQdKNSPx8m4XmAogueNMmE6V0Ico=";
}