ArkProjectNFTs / ark-project

ArkProject is a liquidity layer for digital assets, uniting markets, empowering creators, and bridging the gap to mass adoption. Built on top of Starknet, ArkProject is designed to provide a fully decentralized and trustless orderbook on-chain.
https://arkproject.dev
Apache License 2.0
27 stars 26 forks source link

Add the hardware signer compatibility (secp256r1) #193

Open remiroyc opened 1 year ago

remiroyc commented 1 year ago

Problem

The Bravos wallets use secure enclave and NIST-P256 elliptic curve (secp256r1) to sign messages. We must implement this signer in Cairo to verify the order proof and be filly compatible with this kind of wallets.

Feature request

The task here is to add a variant to the SignerValidator enum to support this: https://github.com/starkware-libs/cairo/blob/v2.3.1/corelib/src/starknet/secp256r1.cairo

impl SignerValidator of SignatureChecker {
    fn verify(hash: felt252, signer: Signer) -> felt252 {
        match signer {
            Signer::WEIERSTRESS_STARKNET(sign_info) => {
                let is_valid = ecdsa::check_ecdsa_signature(
                    hash, sign_info.user_pubkey, sign_info.user_sig_r, sign_info.user_sig_s
                );
                assert(is_valid, 'INVALID_SIGNATURE');
                sign_info.user_pubkey
            }
        }
    }
}

#[derive(Serde, Copy, Drop)]
enum Signer {
    WEIERSTRESS_STARKNET: SignInfo,
}

Links

https://braavos.app/hardware-signer-2fa-security-crypto-smart-contract-wallets/

aji70 commented 2 months ago

hey i'm a solidity and cairo developer basecamp 7 graduate and would like to give this issue a go

MPSxDev commented 1 month ago

I am a member of the Dojo Coding community. I would like to work on this issue, I am immediately available to work. We can develop a solution until we achieve what we want.

od-hunter commented 1 month ago

Hi @kwiss , @remiroyc , let me get this done please, I’m ready to work. I’ve worked on this before, Kindly assign.

ShantelPeters commented 3 weeks ago

Please can I be assigned to this issue @kwiss @remiroyc