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 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
Source§type ThreadChecker = SendablePyClass<Presigner>
type ThreadChecker = SendablePyClass<Presigner>
Source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
Source§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
Source§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.Source§impl RichcmpSigner for Presigner
impl RichcmpSigner for Presigner
Source§impl SignerTraitWrapper for Presigner
impl SignerTraitWrapper for Presigner
fn pubkey(&self) -> Pubkey
fn try_pubkey(&self) -> Result<Pubkey, SignerError>
fn sign_message(&self, message: &[u8]) -> Signature
fn try_sign_message(&self, message: &[u8]) -> Result<Signature, SignerError>
fn is_interactive(&self) -> bool
Source§impl ToSignerOriginal for Presigner
impl ToSignerOriginal for Presigner
fn to_inner(&self) -> Box<dyn SignerTrait>
impl StructuralPartialEq for Presigner
Auto Trait Implementations§
impl Freeze for Presigner
impl RefUnwindSafe for Presigner
impl Send for Presigner
impl Sync for Presigner
impl Unpin for Presigner
impl UnwindSafe for Presigner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, T> FromPyObject<'a> for T
impl<'a, T> FromPyObject<'a> for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more