1
- use alloy:: network:: TxSigner ;
2
1
use anyhow:: Context ;
3
2
use async_trait:: async_trait;
4
- use aws_config:: { Region , SdkConfig , default_provider:: credentials:: DefaultCredentialsChain } ;
5
- #[ cfg( feature = "test-helpers" ) ]
6
- use aws_sdk_kms:: config:: Credentials ;
3
+ use aws_sdk_kms:: Client as InnerClient ;
7
4
use aws_sdk_kms:: primitives:: Blob ;
8
- use aws_sdk_kms:: { Client as InnerClient , config:: BehaviorVersion } ;
9
5
use k256:: {
10
6
ecdsa:: { RecoveryId , Signature , VerifyingKey } ,
11
7
pkcs8:: DecodePublicKey ,
@@ -18,7 +14,6 @@ pub struct Signer {
18
14
key_id : String ,
19
15
client : InnerClient ,
20
16
public_key : rust_eigenda_signers:: PublicKey ,
21
- k256_verifying_key : VerifyingKey ,
22
17
}
23
18
24
19
impl Signer {
@@ -47,7 +42,6 @@ impl Signer {
47
42
key_id,
48
43
client,
49
44
public_key : secp_pub_key,
50
- k256_verifying_key : k256_pub_key,
51
45
} )
52
46
}
53
47
@@ -172,28 +166,3 @@ impl eigenda::Sign for crate::eigen::kms::Signer {
172
166
self . public_key . into ( )
173
167
}
174
168
}
175
-
176
- // Helper function to determine k256 recovery ID.
177
- // Necessary because KMS returns a DER signature, and we need to extract R, S, and find V.
178
- fn determine_k256_recovery_id (
179
- sig : & k256:: ecdsa:: Signature ,
180
- message_hash : & [ u8 ; 32 ] ,
181
- expected_pubkey : & VerifyingKey ,
182
- ) -> anyhow:: Result < k256:: ecdsa:: RecoveryId > {
183
- let recid_0 = k256:: ecdsa:: RecoveryId :: from_byte ( 0 ) . context ( "Bad RecoveryId byte 0" ) ?;
184
- let recid_1 = k256:: ecdsa:: RecoveryId :: from_byte ( 1 ) . context ( "Bad RecoveryId byte 1" ) ?;
185
-
186
- if let Ok ( recovered_key) = VerifyingKey :: recover_from_prehash ( message_hash, sig, recid_0) {
187
- if & recovered_key == expected_pubkey {
188
- return Ok ( recid_0) ;
189
- }
190
- }
191
-
192
- if let Ok ( recovered_key) = VerifyingKey :: recover_from_prehash ( message_hash, sig, recid_1) {
193
- if & recovered_key == expected_pubkey {
194
- return Ok ( recid_1) ;
195
- }
196
- }
197
-
198
- anyhow:: bail!( "Could not recover correct public key from k256 signature" )
199
- }
0 commit comments