Struct iop_keyvault_wasm::JsMPublicKey
source · [−]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
sourceimpl 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) -> Self
pub fn from_secp(pk: &JsSecpPublicKey) -> Self
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
sourceimpl Clone for JsMPublicKey
impl Clone for JsMPublicKey
sourcefn clone(&self) -> JsMPublicKey
fn clone(&self) -> JsMPublicKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for JsMPublicKey
impl Debug for JsMPublicKey
sourceimpl From<JsMPublicKey> for JsValue
impl From<JsMPublicKey> for JsValue
sourcefn from(value: JsMPublicKey) -> Self
fn from(value: JsMPublicKey) -> Self
Converts to this type from the input type.
sourceimpl From<MPublicKey> for JsMPublicKey
impl From<MPublicKey> for JsMPublicKey
sourcefn from(inner: MPublicKey) -> Self
fn from(inner: MPublicKey) -> Self
Converts to this type from the input type.
sourceimpl FromWasmAbi for JsMPublicKey
impl FromWasmAbi for JsMPublicKey
sourceimpl IntoWasmAbi for JsMPublicKey
impl IntoWasmAbi for JsMPublicKey
sourceimpl OptionFromWasmAbi for JsMPublicKey
impl OptionFromWasmAbi for JsMPublicKey
sourceimpl OptionIntoWasmAbi for JsMPublicKey
impl OptionIntoWasmAbi for JsMPublicKey
sourceimpl RefFromWasmAbi for JsMPublicKey
impl RefFromWasmAbi for JsMPublicKey
type Anchor = Ref<'static, JsMPublicKey>
type Anchor = Ref<'static, JsMPublicKey>
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. Read more
sourceunsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_from_abi(js: Self::Abi) -> Self::Anchor
Recover a Self::Anchor
from Self::Abi
. Read more
sourceimpl RefMutFromWasmAbi for JsMPublicKey
impl RefMutFromWasmAbi for JsMPublicKey
type Anchor = RefMut<'static, JsMPublicKey>
type Anchor = RefMut<'static, JsMPublicKey>
Same as RefFromWasmAbi::Anchor
sourceunsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as RefFromWasmAbi::ref_from_abi
sourceimpl WasmDescribe for JsMPublicKey
impl WasmDescribe for JsMPublicKey
sourceimpl Wraps<MPublicKey> for JsMPublicKey
impl Wraps<MPublicKey> for JsMPublicKey
sourcefn inner(&self) -> &MPublicKey
fn inner(&self) -> &MPublicKey
Converts a reference to a WASM type to a reference to the underlying Rust type.
Auto Trait Implementations
impl RefUnwindSafe for JsMPublicKey
impl Send for JsMPublicKey
impl Sync for JsMPublicKey
impl Unpin for JsMPublicKey
impl UnwindSafe for JsMPublicKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi
sourcefn 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
. Read more