OpenZeppelin / cairo-contracts

OpenZeppelin Contracts written in Cairo for Starknet, a decentralized ZK Rollup
https://docs.openzeppelin.com/contracts-cairo
MIT License
796 stars 320 forks source link

Add trait (Serde, Debug, Eq), store and is_valid_xxx_signature and tests for secp256r1 #987

Open 0xknwn opened 1 month ago

0xknwn commented 1 month ago

🧐 Motivation

OpenZeppelin/cairo-contracts includes a number of utils to support secp256k1:

These tools are used internally in OpenZeppelin/cairo-contracts to implement the Eth Account. They are also available for third party projects that uses your project as a library. We use them in our starknet-modular-account project.

We have implemented the same set of tools for secp256r1 that is also supported by the starknet corelib. We would like to submit a PR that them so that we can rely on them the same way we rely on your secp256k1 implementation.

πŸ“ Details

See PR #988 for details about the implementation. We've done the adaptation from secp256k1 to secp256r1 but, except for the mapping between the functions and features the implementation is the same.