pub struct SecureWasmKemContext { /* private fields */ }Expand description
Secure WASM KEM Context
This context provides secure KEM 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 SecureWasmKemContext
impl SecureWasmKemContext
Sourcepub fn new() -> Result<SecureWasmKemContext, JsValue>
pub fn new() -> Result<SecureWasmKemContext, JsValue>
Create a new secure WASM KEM 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 KEM keypair
Sourcepub fn encapsulate(
&self,
algorithm: &str,
public_key: &Uint8Array,
randomness: Option<Uint8Array>,
) -> Result<JsValue, JsValue>
pub fn encapsulate( &self, algorithm: &str, public_key: &Uint8Array, randomness: Option<Uint8Array>, ) -> Result<JsValue, JsValue>
Encapsulate a shared secret
Sourcepub fn decapsulate(
&self,
algorithm: &str,
private_key: &Uint8Array,
ciphertext: &Uint8Array,
) -> Result<JsValue, JsValue>
pub fn decapsulate( &self, algorithm: &str, private_key: &Uint8Array, ciphertext: &Uint8Array, ) -> Result<JsValue, JsValue>
Decapsulate a shared secret
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<SecureWasmKemContext> for JsValue
impl From<SecureWasmKemContext> for JsValue
Source§fn from(value: SecureWasmKemContext) -> Self
fn from(value: SecureWasmKemContext) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for SecureWasmKemContext
impl FromWasmAbi for SecureWasmKemContext
Source§impl IntoWasmAbi for SecureWasmKemContext
impl IntoWasmAbi for SecureWasmKemContext
Source§impl LongRefFromWasmAbi for SecureWasmKemContext
impl LongRefFromWasmAbi for SecureWasmKemContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmKemContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmKemContext>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRef<SecureWasmKemContext>
type Anchor = RcRef<SecureWasmKemContext>
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 SecureWasmKemContext
impl RefFromWasmAbi for SecureWasmKemContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmKemContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmKemContext>>
The Wasm ABI type references to
Self are recovered from.Source§type Anchor = RcRef<SecureWasmKemContext>
type Anchor = RcRef<SecureWasmKemContext>
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 SecureWasmKemContext
impl RefMutFromWasmAbi for SecureWasmKemContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmKemContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmKemContext>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<SecureWasmKemContext>
type Anchor = RcRefMut<SecureWasmKemContext>
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 SecureWasmKemContext
impl VectorFromWasmAbi for SecureWasmKemContext
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[SecureWasmKemContext]>
Source§impl VectorIntoWasmAbi for SecureWasmKemContext
impl VectorIntoWasmAbi for SecureWasmKemContext
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[SecureWasmKemContext]>) -> Self::Abi
Source§impl WasmDescribeVector for SecureWasmKemContext
impl WasmDescribeVector for SecureWasmKemContext
impl SupportsConstructor for SecureWasmKemContext
impl SupportsInstanceProperty for SecureWasmKemContext
impl SupportsStaticProperty for SecureWasmKemContext
Auto Trait Implementations§
impl Freeze for SecureWasmKemContext
impl !RefUnwindSafe for SecureWasmKemContext
impl Send for SecureWasmKemContext
impl Sync for SecureWasmKemContext
impl Unpin for SecureWasmKemContext
impl UnsafeUnpin for SecureWasmKemContext
impl !UnwindSafe for SecureWasmKemContext
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.