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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
use candid::CandidType;
use serde::{Deserialize, Serialize};
use crate::types::CanisterId;
pub const ECDSA_SIGNATURE_FEE: u128 = 10_000_000_000;
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default,
)]
pub struct EcdsaPublicKeyArgument {
pub canister_id: Option<CanisterId>,
pub derivation_path: Vec<Vec<u8>>,
pub key_id: EcdsaKeyId,
}
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default,
)]
pub struct EcdsaPublicKeyResponse {
pub public_key: Vec<u8>,
pub chain_code: Vec<u8>,
}
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default,
)]
pub struct SignWithEcdsaArgument {
pub message_hash: Vec<u8>,
pub derivation_path: Vec<Vec<u8>>,
pub key_id: EcdsaKeyId,
}
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default,
)]
pub struct SignWithEcdsaResponse {
pub signature: Vec<u8>,
}
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default,
)]
pub struct EcdsaKeyId {
pub curve: EcdsaCurve,
pub name: String,
}
#[derive(
CandidType, Serialize, Deserialize, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy,
)]
pub enum EcdsaCurve {
#[serde(rename = "secp256k1")]
Secp256k1,
}
impl Default for EcdsaCurve {
fn default() -> Self {
Self::Secp256k1
}
}