rosetta_types/
curve_type.rs

1/*
2 * Rosetta
3 *
4 * Build Once. Integrate Your Blockchain Everywhere.
5 *
6 * The version of the OpenAPI document: 1.4.13
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11/// CurveType : CurveType is the type of cryptographic curve associated with a PublicKey.  * secp256k1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * secp256r1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * edwards25519: `y (255-bits) || x-sign-bit (1-bit)` - `32 bytes` (https://ed25519.cr.yp.to/ed25519-20110926.pdf) * tweedle: 1st pk : Fq.t (32 bytes) || 2nd pk : Fq.t (32 bytes) (https://github.com/CodaProtocol/coda/blob/develop/rfcs/0038-rosetta-construction-api.md#marshal-keys) * pallas: `x (255 bits) || y-parity-bit (1-bit) - 32 bytes` (https://github.com/zcash/pasta)
12
13/// CurveType is the type of cryptographic curve associated with a PublicKey.  * secp256k1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * secp256r1: SEC compressed - `33 bytes` (https://secg.org/sec1-v2.pdf#subsubsection.2.3.3) * edwards25519: `y (255-bits) || x-sign-bit (1-bit)` - `32 bytes` (https://ed25519.cr.yp.to/ed25519-20110926.pdf) * tweedle: 1st pk : Fq.t (32 bytes) || 2nd pk : Fq.t (32 bytes) (https://github.com/CodaProtocol/coda/blob/develop/rfcs/0038-rosetta-construction-api.md#marshal-keys) * pallas: `x (255 bits) || y-parity-bit (1-bit) - 32 bytes` (https://github.com/zcash/pasta)
14#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
15pub enum CurveType {
16    #[serde(rename = "secp256k1")]
17    Secp256k1,
18    #[serde(rename = "secp256r1")]
19    Secp256r1,
20    #[serde(rename = "edwards25519")]
21    Edwards25519,
22    #[serde(rename = "tweedle")]
23    Tweedle,
24    #[serde(rename = "pallas")]
25    Pallas,
26    #[serde(rename = "schnorrkel")]
27    Schnorrkel,
28}
29
30impl ToString for CurveType {
31    fn to_string(&self) -> String {
32        match self {
33            Self::Secp256k1 => String::from("secp256k1"),
34            Self::Secp256r1 => String::from("secp256r1"),
35            Self::Edwards25519 => String::from("edwards25519"),
36            Self::Tweedle => String::from("tweedle"),
37            Self::Pallas => String::from("pallas"),
38            Self::Schnorrkel => String::from("schnorrkel"),
39        }
40    }
41}
42
43impl Default for CurveType {
44    fn default() -> CurveType {
45        Self::Secp256k1
46    }
47}