pub struct JsSecpPublicKey { /* private fields */ }
Expand description
Secp256k1 public key
Implementations§
Source§impl JsSecpPublicKey
impl JsSecpPublicKey
Sourcepub fn new(key: &str) -> Result<JsSecpPublicKey, JsValue>
pub fn new(key: &str) -> Result<JsSecpPublicKey, JsValue>
Parses a string into a {@link SecpPublicKey}.
Sourcepub fn key_id(&self) -> JsSecpKeyId
pub fn key_id(&self) -> JsSecpKeyId
Calculates the key id (also called fingerprint or address in some literature) of the public key.
Sourcepub fn ark_key_id(&self) -> JsSecpKeyId
pub fn ark_key_id(&self) -> JsSecpKeyId
Calculates the key id of the public key the non-standard way ark.io and therefore Hydra uses.
Regular bitcoin-based chains use the ripemd160 hash of the sha2-256 hash of the public key, but ARK only uses ripemd160.
Sourcepub fn validate_id(&self, key_id: &JsSecpKeyId) -> bool
pub fn validate_id(&self, key_id: &JsSecpKeyId) -> bool
Validates if key_id
belongs to this public key
Sourcepub fn validate_ark_id(&self, key_id: &JsSecpKeyId) -> bool
pub fn validate_ark_id(&self, key_id: &JsSecpKeyId) -> bool
Validates if key_id
belongs to this public key if it was generated
the ark.io way.
Sourcepub fn validate_ecdsa(&self, data: &[u8], signature: &JsSecpSignature) -> bool
pub fn validate_ecdsa(&self, data: &[u8], signature: &JsSecpSignature) -> bool
This method can be used to verify if a given signature for a message was made using the private key that belongs to this public key.
Trait Implementations§
Source§impl Clone for JsSecpPublicKey
impl Clone for JsSecpPublicKey
Source§fn clone(&self) -> JsSecpPublicKey
fn clone(&self) -> JsSecpPublicKey
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for JsSecpPublicKey
impl Debug for JsSecpPublicKey
Source§impl From<JsSecpPublicKey> for JsValue
impl From<JsSecpPublicKey> for JsValue
Source§fn from(value: JsSecpPublicKey) -> JsValue
fn from(value: JsSecpPublicKey) -> JsValue
Converts to this type from the input type.
Source§impl From<SecpPublicKey> for JsSecpPublicKey
impl From<SecpPublicKey> for JsSecpPublicKey
Source§fn from(inner: SecpPublicKey) -> JsSecpPublicKey
fn from(inner: SecpPublicKey) -> JsSecpPublicKey
Converts to this type from the input type.
Source§impl FromWasmAbi for JsSecpPublicKey
impl FromWasmAbi for JsSecpPublicKey
Source§impl IntoWasmAbi for JsSecpPublicKey
impl IntoWasmAbi for JsSecpPublicKey
Source§impl LongRefFromWasmAbi for JsSecpPublicKey
impl LongRefFromWasmAbi for JsSecpPublicKey
Source§type Anchor = RcRef<JsSecpPublicKey>
type Anchor = RcRef<JsSecpPublicKey>
Same as
RefFromWasmAbi::Anchor
Source§unsafe fn long_ref_from_abi(
js: <JsSecpPublicKey as LongRefFromWasmAbi>::Abi,
) -> <JsSecpPublicKey as LongRefFromWasmAbi>::Anchor
unsafe fn long_ref_from_abi( js: <JsSecpPublicKey as LongRefFromWasmAbi>::Abi, ) -> <JsSecpPublicKey as LongRefFromWasmAbi>::Anchor
Same as
RefFromWasmAbi::ref_from_abi
Source§impl OptionFromWasmAbi for JsSecpPublicKey
impl OptionFromWasmAbi for JsSecpPublicKey
Source§fn is_none(abi: &<JsSecpPublicKey as FromWasmAbi>::Abi) -> bool
fn is_none(abi: &<JsSecpPublicKey as FromWasmAbi>::Abi) -> bool
Tests whether the argument is a “none” instance. If so it will be
deserialized as
None
, and otherwise it will be passed to
FromWasmAbi
.Source§impl OptionIntoWasmAbi for JsSecpPublicKey
impl OptionIntoWasmAbi for JsSecpPublicKey
Source§fn none() -> <JsSecpPublicKey as IntoWasmAbi>::Abi
fn none() -> <JsSecpPublicKey as IntoWasmAbi>::Abi
Returns an ABI instance indicating “none”, which JS will interpret as
the
None
branch of this option. Read moreSource§impl RefFromWasmAbi for JsSecpPublicKey
impl RefFromWasmAbi for JsSecpPublicKey
Source§type Anchor = RcRef<JsSecpPublicKey>
type Anchor = RcRef<JsSecpPublicKey>
The type that holds the reference to
Self
for the duration of the
invocation of the function that has an &Self
parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§unsafe fn ref_from_abi(
js: <JsSecpPublicKey as RefFromWasmAbi>::Abi,
) -> <JsSecpPublicKey as RefFromWasmAbi>::Anchor
unsafe fn ref_from_abi( js: <JsSecpPublicKey as RefFromWasmAbi>::Abi, ) -> <JsSecpPublicKey as RefFromWasmAbi>::Anchor
Source§impl RefMutFromWasmAbi for JsSecpPublicKey
impl RefMutFromWasmAbi for JsSecpPublicKey
Source§type Anchor = RcRefMut<JsSecpPublicKey>
type Anchor = RcRefMut<JsSecpPublicKey>
Same as
RefFromWasmAbi::Anchor
Source§unsafe fn ref_mut_from_abi(
js: <JsSecpPublicKey as RefMutFromWasmAbi>::Abi,
) -> <JsSecpPublicKey as RefMutFromWasmAbi>::Anchor
unsafe fn ref_mut_from_abi( js: <JsSecpPublicKey as RefMutFromWasmAbi>::Abi, ) -> <JsSecpPublicKey as RefMutFromWasmAbi>::Anchor
Same as
RefFromWasmAbi::ref_from_abi
Source§impl TryFromJsValue for JsSecpPublicKey
impl TryFromJsValue for JsSecpPublicKey
Source§fn try_from_js_value(
value: JsValue,
) -> Result<JsSecpPublicKey, <JsSecpPublicKey as TryFromJsValue>::Error>
fn try_from_js_value( value: JsValue, ) -> Result<JsSecpPublicKey, <JsSecpPublicKey as TryFromJsValue>::Error>
Performs the conversion.
Source§impl VectorFromWasmAbi for JsSecpPublicKey
impl VectorFromWasmAbi for JsSecpPublicKey
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi( js: <JsSecpPublicKey as VectorFromWasmAbi>::Abi, ) -> Box<[JsSecpPublicKey]>
Source§impl VectorIntoWasmAbi for JsSecpPublicKey
impl VectorIntoWasmAbi for JsSecpPublicKey
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi( vector: Box<[JsSecpPublicKey]>, ) -> <JsSecpPublicKey as VectorIntoWasmAbi>::Abi
Source§impl Wraps<SecpPublicKey> for JsSecpPublicKey
impl Wraps<SecpPublicKey> for JsSecpPublicKey
Source§fn inner(&self) -> &SecpPublicKey
fn inner(&self) -> &SecpPublicKey
Converts a reference to a WASM type to a reference to the underlying Rust type.
Auto Trait Implementations§
impl Freeze for JsSecpPublicKey
impl RefUnwindSafe for JsSecpPublicKey
impl Send for JsSecpPublicKey
impl Sync for JsSecpPublicKey
impl Unpin for JsSecpPublicKey
impl UnwindSafe for JsSecpPublicKey
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.