pub struct JsMPublicKey { /* private fields */ }
Expand description
Multicipher public key
A public key (also called shared key or pk in some literature) is that part of an asymmetric keypair which can be used to verify the authenticity of the sender of a message or to encrypt a message that can only be decrypted by a single recipient. In both cases this other party owns the {@link PrivateKey} part of the keypair and never shares it with anyone else.
Implementations§
Source§impl JsMPublicKey
impl JsMPublicKey
Sourcepub fn new(pub_key_str: &str) -> Result<JsMPublicKey, JsValue>
pub fn new(pub_key_str: &str) -> Result<JsMPublicKey, JsValue>
Parses a string into a {@link PublicKey}.
Sourcepub fn from_secp(pk: &JsSecpPublicKey) -> JsMPublicKey
pub fn from_secp(pk: &JsSecpPublicKey) -> JsMPublicKey
Converts a {@link SecpPublicKey} into a multicipher {@link PublicKey}.
Sourcepub fn key_id(&self) -> JsMKeyId
pub fn key_id(&self) -> JsMKeyId
Calculates the key id (also called fingerprint or address in some literature) of the public key.
Sourcepub fn validate_id(&self, key_id: &JsMKeyId) -> bool
pub fn validate_id(&self, key_id: &JsMKeyId) -> bool
Validates if key_id
belongs to this public key
We do not yet have multiple versions of key ids for the same multicipher
public key, so for now this comparison is trivial. But when we introduce
newer versions, we need to take the version of the key_id
argument
into account and calculate that possibly older version from self
.
Sourcepub fn validate_ecdsa(&self, data: &[u8], signature: &JsMSignature) -> bool
pub fn validate_ecdsa(&self, data: &[u8], signature: &JsMSignature) -> 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.
@see PrivateKey.sign
Trait Implementations§
Source§impl Clone for JsMPublicKey
impl Clone for JsMPublicKey
Source§fn clone(&self) -> JsMPublicKey
fn clone(&self) -> JsMPublicKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for JsMPublicKey
impl Debug for JsMPublicKey
Source§impl From<JsMPublicKey> for JsValue
impl From<JsMPublicKey> for JsValue
Source§fn from(value: JsMPublicKey) -> JsValue
fn from(value: JsMPublicKey) -> JsValue
Source§impl From<MPublicKey> for JsMPublicKey
impl From<MPublicKey> for JsMPublicKey
Source§fn from(inner: MPublicKey) -> JsMPublicKey
fn from(inner: MPublicKey) -> JsMPublicKey
Source§impl FromWasmAbi for JsMPublicKey
impl FromWasmAbi for JsMPublicKey
Source§impl IntoWasmAbi for JsMPublicKey
impl IntoWasmAbi for JsMPublicKey
Source§impl LongRefFromWasmAbi for JsMPublicKey
impl LongRefFromWasmAbi for JsMPublicKey
Source§type Anchor = RcRef<JsMPublicKey>
type Anchor = RcRef<JsMPublicKey>
RefFromWasmAbi::Anchor
Source§unsafe fn long_ref_from_abi(
js: <JsMPublicKey as LongRefFromWasmAbi>::Abi,
) -> <JsMPublicKey as LongRefFromWasmAbi>::Anchor
unsafe fn long_ref_from_abi( js: <JsMPublicKey as LongRefFromWasmAbi>::Abi, ) -> <JsMPublicKey as LongRefFromWasmAbi>::Anchor
RefFromWasmAbi::ref_from_abi
Source§impl OptionFromWasmAbi for JsMPublicKey
impl OptionFromWasmAbi for JsMPublicKey
Source§fn is_none(abi: &<JsMPublicKey as FromWasmAbi>::Abi) -> bool
fn is_none(abi: &<JsMPublicKey as FromWasmAbi>::Abi) -> bool
None
, and otherwise it will be passed to
FromWasmAbi
.Source§impl OptionIntoWasmAbi for JsMPublicKey
impl OptionIntoWasmAbi for JsMPublicKey
Source§fn none() -> <JsMPublicKey as IntoWasmAbi>::Abi
fn none() -> <JsMPublicKey as IntoWasmAbi>::Abi
None
branch of this option. Read moreSource§impl RefFromWasmAbi for JsMPublicKey
impl RefFromWasmAbi for JsMPublicKey
Source§type Anchor = RcRef<JsMPublicKey>
type Anchor = RcRef<JsMPublicKey>
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: <JsMPublicKey as RefFromWasmAbi>::Abi,
) -> <JsMPublicKey as RefFromWasmAbi>::Anchor
unsafe fn ref_from_abi( js: <JsMPublicKey as RefFromWasmAbi>::Abi, ) -> <JsMPublicKey as RefFromWasmAbi>::Anchor
Source§impl RefMutFromWasmAbi for JsMPublicKey
impl RefMutFromWasmAbi for JsMPublicKey
Source§type Anchor = RcRefMut<JsMPublicKey>
type Anchor = RcRefMut<JsMPublicKey>
RefFromWasmAbi::Anchor
Source§unsafe fn ref_mut_from_abi(
js: <JsMPublicKey as RefMutFromWasmAbi>::Abi,
) -> <JsMPublicKey as RefMutFromWasmAbi>::Anchor
unsafe fn ref_mut_from_abi( js: <JsMPublicKey as RefMutFromWasmAbi>::Abi, ) -> <JsMPublicKey as RefMutFromWasmAbi>::Anchor
RefFromWasmAbi::ref_from_abi
Source§impl TryFromJsValue for JsMPublicKey
impl TryFromJsValue for JsMPublicKey
Source§fn try_from_js_value(
value: JsValue,
) -> Result<JsMPublicKey, <JsMPublicKey as TryFromJsValue>::Error>
fn try_from_js_value( value: JsValue, ) -> Result<JsMPublicKey, <JsMPublicKey as TryFromJsValue>::Error>
Source§impl VectorFromWasmAbi for JsMPublicKey
impl VectorFromWasmAbi for JsMPublicKey
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi( js: <JsMPublicKey as VectorFromWasmAbi>::Abi, ) -> Box<[JsMPublicKey]>
Source§impl VectorIntoWasmAbi for JsMPublicKey
impl VectorIntoWasmAbi for JsMPublicKey
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi( vector: Box<[JsMPublicKey]>, ) -> <JsMPublicKey as VectorIntoWasmAbi>::Abi
Source§impl Wraps<MPublicKey> for JsMPublicKey
impl Wraps<MPublicKey> for JsMPublicKey
Source§fn inner(&self) -> &MPublicKey
fn inner(&self) -> &MPublicKey
Auto Trait Implementations§
impl Freeze for JsMPublicKey
impl RefUnwindSafe for JsMPublicKey
impl Send for JsMPublicKey
impl Sync for JsMPublicKey
impl Unpin for JsMPublicKey
impl UnwindSafe for JsMPublicKey
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<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
IntoWasmAbi::Abi
Source§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi
, except that it may throw and never
return in the case of Err
.