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) -> Self
fn from(value: SecureWasmSignatureContext) -> Self
Converts to this type from the input type.
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: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§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§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: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
Same as
RefFromWasmAbi::ref_from_abiSource§impl VectorFromWasmAbi for SecureWasmSignatureContext
impl VectorFromWasmAbi for SecureWasmSignatureContext
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::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]>) -> Self::Abi
Source§impl WasmDescribeVector for SecureWasmSignatureContext
impl WasmDescribeVector for SecureWasmSignatureContext
impl SupportsConstructor for SecureWasmSignatureContext
impl SupportsInstanceProperty for SecureWasmSignatureContext
impl SupportsStaticProperty for SecureWasmSignatureContext
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> 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.