NethermindEth / StarknetByExample

A collection of examples of Cairo smart contracts for Starknet.
https://starknet-by-example.voyager.online/
MIT License
110 stars 82 forks source link

feat: recover public key (1.2.0) #16

Open enitrat opened 1 year ago

enitrat commented 1 year ago

In this example, we will demonstrate how to recover the public key from a signature and the signed message hash using recover_public_key_u32.

HansBhatia commented 1 year ago

I'll take this on!

HansBhatia commented 1 year ago

@enitrat do I use the secp256r1 or secp256k1 curve? Also I'm not entirely sure how to import the function. I tried -

use starknet::secp256_trait:: recover_public_key_u32;
use starknet::secp256k1::{Secp256k1Point, Secp256k1PointImpl};

Identifier not found: secp256_trait, Secp256k1Point, Secp256k1PointImpl.

enitrat commented 1 year ago

@HansBhatia I think you will need to upgrade Cairo to v2.x for this one