Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

SignerP256

Inherits: AbstractSigner

*Implementation of {AbstractSigner} using xref:api:utils/cryptography#P256[P256] signatures. For {Account} usage, a {_setSigner} function is provided to set the {signer} public key. Doing so is easier for a factory, who is likely to use initializable clones of this contract. Example of usage:

contract MyAccountP256 is Account, SignerP256, Initializable {
function initialize(bytes32 qx, bytes32 qy) public initializer {
_setSigner(qx, qy);
}
}

IMPORTANT: Failing to call {_setSigner} either during construction (if used standalone) or during initialization (if used as a clone) may leave the signer either front-runnable or unusable.*

State Variables

_qx

bytes32 private _qx;

_qy

bytes32 private _qy;

Functions

constructor

constructor(bytes32 qx, bytes32 qy);

_setSigner

Sets the signer with a P256 public key. This function should be called during construction or through an initializer.

function _setSigner(bytes32 qx, bytes32 qy) internal;

signer

Return the signer's P256 public key.

function signer() public view virtual returns (bytes32 qx, bytes32 qy);

_rawSignatureValidation

Signature validation algorithm. WARNING: Implementing a signature validation algorithm is a security-sensitive operation as it involves cryptographic verification. It is important to review and test thoroughly before deployment. Consider using one of the signature verification libraries (xref:api:utils/cryptography#ECDSA[ECDSA], xref:api:utils/cryptography#P256[P256] or xref:api:utils/cryptography#RSA[RSA]).

function _rawSignatureValidation(bytes32 hash, bytes calldata signature)
    internal
    view
    virtual
    override
    returns (bool);

Errors

SignerP256InvalidPublicKey

error SignerP256InvalidPublicKey(bytes32 qx, bytes32 qy);