pub struct SecureWasmSignatureContext { /* private fields */ }Expand description
Secure WASM Signature Context
This context provides secure signature operations with:
- Consistent error handling using Result<T, JsValue>
- Security validation for all inputs
- Protection against timing attacks
- Memory safety with automatic cleanup
Implementations§
Source§impl SecureWasmSignatureContext
impl SecureWasmSignatureContext
Sourcepub fn new() -> Result<SecureWasmSignatureContext, JsValue>
pub fn new() -> Result<SecureWasmSignatureContext, JsValue>
Create a new secure WASM signature context
Sourcepub fn generate_keypair(
&mut self,
algorithm: &str,
randomness: Option<Uint8Array>,
) -> Result<JsValue, JsValue>
pub fn generate_keypair( &mut self, algorithm: &str, randomness: Option<Uint8Array>, ) -> Result<JsValue, JsValue>
Generate a signature keypair
Sourcepub fn sign(
&self,
algorithm: &str,
private_key: &Uint8Array,
message: &Uint8Array,
randomness: Option<Uint8Array>,
) -> Result<JsValue, JsValue>
pub fn sign( &self, algorithm: &str, private_key: &Uint8Array, message: &Uint8Array, randomness: Option<Uint8Array>, ) -> Result<JsValue, JsValue>
Sign a message
Sourcepub fn verify(
&self,
algorithm: &str,
public_key: &Uint8Array,
message: &Uint8Array,
signature: &Uint8Array,
) -> Result<JsValue, JsValue>
pub fn verify( &self, algorithm: &str, public_key: &Uint8Array, message: &Uint8Array, signature: &Uint8Array, ) -> Result<JsValue, JsValue>
Verify a signature
Sourcepub fn get_supported_algorithms(&self) -> Result<JsValue, JsValue>
pub fn get_supported_algorithms(&self) -> Result<JsValue, JsValue>
Get supported algorithms
Trait Implementations§
Source§impl From<SecureWasmSignatureContext> for JsValue
impl From<SecureWasmSignatureContext> for JsValue
Source§fn from(value: SecureWasmSignatureContext) -> JsValue
fn from(value: SecureWasmSignatureContext) -> JsValue
Converts to this type from the input type.
Source§impl FromWasmAbi for SecureWasmSignatureContext
impl FromWasmAbi for SecureWasmSignatureContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
The Wasm ABI type that this converts from when coming back out from the
ABI boundary.
Source§unsafe fn from_abi(
js: <SecureWasmSignatureContext as FromWasmAbi>::Abi,
) -> SecureWasmSignatureContext
unsafe fn from_abi( js: <SecureWasmSignatureContext as FromWasmAbi>::Abi, ) -> SecureWasmSignatureContext
Source§impl IntoWasmAbi for SecureWasmSignatureContext
impl IntoWasmAbi for SecureWasmSignatureContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
The Wasm ABI type that this converts into when crossing the ABI
boundary.
Source§fn into_abi(self) -> <SecureWasmSignatureContext as IntoWasmAbi>::Abi
fn into_abi(self) -> <SecureWasmSignatureContext as IntoWasmAbi>::Abi
Convert
self into Self::Abi so that it can be sent across the wasm
ABI boundary.Source§impl LongRefFromWasmAbi for SecureWasmSignatureContext
impl LongRefFromWasmAbi for SecureWasmSignatureContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRef<SecureWasmSignatureContext>
type Anchor = RcRef<SecureWasmSignatureContext>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(
js: <SecureWasmSignatureContext as LongRefFromWasmAbi>::Abi,
) -> <SecureWasmSignatureContext as LongRefFromWasmAbi>::Anchor
unsafe fn long_ref_from_abi( js: <SecureWasmSignatureContext as LongRefFromWasmAbi>::Abi, ) -> <SecureWasmSignatureContext as LongRefFromWasmAbi>::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for SecureWasmSignatureContext
impl OptionFromWasmAbi for SecureWasmSignatureContext
Source§fn is_none(abi: &<SecureWasmSignatureContext as FromWasmAbi>::Abi) -> bool
fn is_none(abi: &<SecureWasmSignatureContext 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 SecureWasmSignatureContext
impl OptionIntoWasmAbi for SecureWasmSignatureContext
Source§fn none() -> <SecureWasmSignatureContext as IntoWasmAbi>::Abi
fn none() -> <SecureWasmSignatureContext 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 SecureWasmSignatureContext
impl RefFromWasmAbi for SecureWasmSignatureContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
The Wasm ABI type references to
Self are recovered from.Source§type Anchor = RcRef<SecureWasmSignatureContext>
type Anchor = RcRef<SecureWasmSignatureContext>
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: <SecureWasmSignatureContext as RefFromWasmAbi>::Abi,
) -> <SecureWasmSignatureContext as RefFromWasmAbi>::Anchor
unsafe fn ref_from_abi( js: <SecureWasmSignatureContext as RefFromWasmAbi>::Abi, ) -> <SecureWasmSignatureContext as RefFromWasmAbi>::Anchor
Source§impl RefMutFromWasmAbi for SecureWasmSignatureContext
impl RefMutFromWasmAbi for SecureWasmSignatureContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmSignatureContext>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<SecureWasmSignatureContext>
type Anchor = RcRefMut<SecureWasmSignatureContext>
Same as
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(
js: <SecureWasmSignatureContext as RefMutFromWasmAbi>::Abi,
) -> <SecureWasmSignatureContext as RefMutFromWasmAbi>::Anchor
unsafe fn ref_mut_from_abi( js: <SecureWasmSignatureContext as RefMutFromWasmAbi>::Abi, ) -> <SecureWasmSignatureContext as RefMutFromWasmAbi>::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl TryFromJsValue for SecureWasmSignatureContext
impl TryFromJsValue for SecureWasmSignatureContext
Source§fn try_from_js_value(
value: JsValue,
) -> Result<SecureWasmSignatureContext, JsValue>
fn try_from_js_value( value: JsValue, ) -> Result<SecureWasmSignatureContext, JsValue>
Performs the conversion.
Source§fn try_from_js_value_ref(value: &JsValue) -> Option<SecureWasmSignatureContext>
fn try_from_js_value_ref(value: &JsValue) -> Option<SecureWasmSignatureContext>
Performs the conversion.
Source§impl VectorFromWasmAbi for SecureWasmSignatureContext
impl VectorFromWasmAbi for SecureWasmSignatureContext
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi( js: <SecureWasmSignatureContext as VectorFromWasmAbi>::Abi, ) -> Box<[SecureWasmSignatureContext]>
Source§impl VectorIntoWasmAbi for SecureWasmSignatureContext
impl VectorIntoWasmAbi for SecureWasmSignatureContext
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi( vector: Box<[SecureWasmSignatureContext]>, ) -> <SecureWasmSignatureContext as VectorIntoWasmAbi>::Abi
Auto Trait Implementations§
impl Freeze for SecureWasmSignatureContext
impl !RefUnwindSafe for SecureWasmSignatureContext
impl Send for SecureWasmSignatureContext
impl Sync for SecureWasmSignatureContext
impl Unpin for SecureWasmSignatureContext
impl UnsafeUnpin for SecureWasmSignatureContext
impl !UnwindSafe for SecureWasmSignatureContext
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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::AbiSource§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.