Skip to content

Commit b592d7f

Browse files
committed
feat(keys): use compressed representation when serializing verifying keys
1 parent 2bd02be commit b592d7f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/keys/src/verifying_keys.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ impl VerifyingKey {
7676
/// Returns the byte representation of the public key.
7777
pub fn to_bytes(&self) -> Vec<u8> {
7878
match self {
79-
VerifyingKey::Ed25519(vk) => vk.to_bytes().to_vec(),
80-
VerifyingKey::Secp256k1(vk) => vk.to_sec1_bytes().to_vec(),
81-
VerifyingKey::Secp256r1(vk) => vk.to_sec1_bytes().to_vec(),
82-
VerifyingKey::Eip191(vk) => vk.to_sec1_bytes().to_vec(),
83-
VerifyingKey::CosmosAdr36(vk) => vk.to_sec1_bytes().to_vec(),
79+
VerifyingKey::Ed25519(vk) => vk.as_bytes().to_vec(),
80+
VerifyingKey::Secp256k1(vk) => vk.to_encoded_point(true).as_bytes().to_vec(),
81+
VerifyingKey::Secp256r1(vk) => vk.to_encoded_point(true).as_bytes().to_vec(),
82+
VerifyingKey::Eip191(vk) => vk.to_encoded_point(true).as_bytes().to_vec(),
83+
VerifyingKey::CosmosAdr36(vk) => vk.to_encoded_point(true).as_bytes().to_vec(),
8484
}
8585
}
8686

0 commit comments

Comments
 (0)