Struct solders_keypair::presigner::Presigner
source · pub struct Presigner(pub Presigner);
Expand description
A signer that represents a :class:~solders.signature.Signature
that has been
constructed externally. Performs a signature verification against the
expected message upon sign()
requests to affirm its relationship to
the message
bytes.
Args: pubkey (Pubkey): The pubkey of the signer. signature (Signature): The signature created by signing the message.
Tuple Fields§
§0: Presigner
Implementations§
source§impl Presigner
impl Presigner
pub fn new(pubkey: &Pubkey, signature: &Signature) -> Self
sourcepub fn py_pubkey(&self) -> Pubkey
pub fn py_pubkey(&self) -> Pubkey
Get this signer’s :class:~solders.pubkey.Pubkey
.
Returns: Pubkey: The pubkey of the presigner.
Example: >>> from solders.keypair import Keypair >>> from solders.pubkey import Pubkey >>> seed_bytes = bytes([0] * 32) >>> pubkey_bytes = b“;j’\xbc\xce\xb6\xa4-b\xa3\xa8\xd0*o\rse2\x15w\x1d\xe2C\xa6:\xc0H\xa1\x8bY\xda)“ >>> kp = Keypair.from_bytes(seed_bytes + pubkey_bytes) >>> assert kp.pubkey() == Pubkey(pubkey_bytes)
sourcepub fn py_sign_message(&self, message: &[u8]) -> PyResult<Signature>
pub fn py_sign_message(&self, message: &[u8]) -> PyResult<Signature>
Verifies the signature of the presigner and returns it if valid.
Returns: Signature: The signature assigned to this object.
Raises: SignerError: if the signature is invalid.
Example:
>>> from solders.keypair import Keypair
>>> from solders.presigner import Presigner
>>> keypair = Keypair.from_seed(bytes([0] * 32))
>>> pubkey = keypair.pubkey()
>>> data = bytes([1])
>>> sig = keypair.sign_message(data)
>>> presigner = Presigner(pubkey, sig)
>>> assert presigner.pubkey() == pubkey
>>> assert presigner.sign_message(data) == sig
sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a new default presigner.
Returns: Presigner: The default presigner.
pub fn __hash__(&self) -> u64
pub fn __richcmp__(&self, other: Signer, op: CompareOp) -> PyResult<bool>
Trait Implementations§
source§impl From<Presigner> for Presigner
impl From<Presigner> for Presigner
source§fn from(signer: PresignerOriginal) -> Self
fn from(signer: PresignerOriginal) -> Self
source§impl PartialEq for Presigner
impl PartialEq for Presigner
source§impl PyClassImpl for Presigner
impl PyClassImpl for Presigner
source§const IS_BASETYPE: bool = true
const IS_BASETYPE: bool = true
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type ThreadChecker = ThreadCheckerStub<Presigner>
type ThreadChecker = ThreadCheckerStub<Presigner>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<Presigner> for PyClassImplCollector<Presigner>
impl PyClassNewTextSignature<Presigner> for PyClassImplCollector<Presigner>
fn new_text_signature(self) -> Option<&'static str>
source§impl PyMethods<Presigner> for PyClassImplCollector<Presigner>
impl PyMethods<Presigner> for PyClassImplCollector<Presigner>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for Presigner
impl PyTypeInfo for Presigner
§type AsRefTarget = PyCell<Presigner>
type AsRefTarget = PyCell<Presigner>
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
object
is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
object
is an instance of this type.