rosetta_types/
signature_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/// SignatureType : SignatureType is the type of a cryptographic signature.  * ecdsa: `r (32-bytes) || s (32-bytes)` - `64 bytes` * ecdsa_recovery: `r (32-bytes) || s (32-bytes) || v (1-byte)` - `65 bytes` * ed25519: `R (32-byte) || s (32-bytes)` - `64 bytes` * schnorr_1: `r (32-bytes) || s (32-bytes)` - `64 bytes`  (schnorr signature implemented by Zilliqa where both `r` and `s` are scalars encoded as `32-bytes` values, most significant byte first.) * schnorr_poseidon: `r (32-bytes) || s (32-bytes)` where s = Hash(1st pk || 2nd pk || r) - `64 bytes`  (schnorr signature w/ Poseidon hash function implemented by O(1) Labs where both `r` and `s` are scalars encoded as `32-bytes` values, least significant byte first. https://github.com/CodaProtocol/signer-reference/blob/master/schnorr.ml )
12
13/// SignatureType is the type of a cryptographic signature.  * ecdsa: `r (32-bytes) || s (32-bytes)` - `64 bytes` * ecdsa_recovery: `r (32-bytes) || s (32-bytes) || v (1-byte)` - `65 bytes` * ed25519: `R (32-byte) || s (32-bytes)` - `64 bytes` * schnorr_1: `r (32-bytes) || s (32-bytes)` - `64 bytes`  (schnorr signature implemented by Zilliqa where both `r` and `s` are scalars encoded as `32-bytes` values, most significant byte first.) * schnorr_poseidon: `r (32-bytes) || s (32-bytes)` where s = Hash(1st pk || 2nd pk || r) - `64 bytes`  (schnorr signature w/ Poseidon hash function implemented by O(1) Labs where both `r` and `s` are scalars encoded as `32-bytes` values, least significant byte first. https://github.com/CodaProtocol/signer-reference/blob/master/schnorr.ml )
14#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
15pub enum SignatureType {
16    #[serde(rename = "ecdsa")]
17    Ecdsa,
18    #[serde(rename = "ecdsa_recovery")]
19    EcdsaRecovery,
20    #[serde(rename = "ed25519")]
21    Ed25519,
22    #[serde(rename = "schnorr_1")]
23    Schnorr1,
24    #[serde(rename = "schnorr_poseidon")]
25    SchnorrPoseidon,
26    #[serde(rename = "sr25519")]
27    Sr25519,
28}
29
30impl ToString for SignatureType {
31    fn to_string(&self) -> String {
32        match self {
33            Self::Ecdsa => String::from("ecdsa"),
34            Self::EcdsaRecovery => String::from("ecdsa_recovery"),
35            Self::Ed25519 => String::from("ed25519"),
36            Self::Schnorr1 => String::from("schnorr_1"),
37            Self::SchnorrPoseidon => String::from("schnorr_poseidon"),
38            Self::Sr25519 => String::from("sr25519"),
39        }
40    }
41}
42
43impl Default for SignatureType {
44    fn default() -> SignatureType {
45        Self::Ecdsa
46    }
47}