pub struct SecureWasmAeadContext { /* private fields */ }Expand description
Secure WASM AEAD Context
This context provides secure AEAD 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 SecureWasmAeadContext
impl SecureWasmAeadContext
Sourcepub fn new() -> Result<SecureWasmAeadContext, JsValue>
pub fn new() -> Result<SecureWasmAeadContext, JsValue>
Create a new secure WASM AEAD context
Sourcepub fn encrypt(
&mut self,
algorithm: &str,
key: &Uint8Array,
nonce: &Uint8Array,
plaintext: &Uint8Array,
associated_data: Option<Uint8Array>,
) -> Result<JsValue, JsValue>
pub fn encrypt( &mut self, algorithm: &str, key: &Uint8Array, nonce: &Uint8Array, plaintext: &Uint8Array, associated_data: Option<Uint8Array>, ) -> Result<JsValue, JsValue>
Encrypt data
Sourcepub fn decrypt(
&self,
algorithm: &str,
key: &Uint8Array,
nonce: &Uint8Array,
ciphertext: &Uint8Array,
associated_data: Option<Uint8Array>,
) -> Result<JsValue, JsValue>
pub fn decrypt( &self, algorithm: &str, key: &Uint8Array, nonce: &Uint8Array, ciphertext: &Uint8Array, associated_data: Option<Uint8Array>, ) -> Result<JsValue, JsValue>
Decrypt data (Layer A Result ABI only; see crate::AeadDecryptSemantic for Layer B).
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<SecureWasmAeadContext> for JsValue
impl From<SecureWasmAeadContext> for JsValue
Source§fn from(value: SecureWasmAeadContext) -> Self
fn from(value: SecureWasmAeadContext) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for SecureWasmAeadContext
impl FromWasmAbi for SecureWasmAeadContext
Source§impl IntoWasmAbi for SecureWasmAeadContext
impl IntoWasmAbi for SecureWasmAeadContext
Source§impl LongRefFromWasmAbi for SecureWasmAeadContext
impl LongRefFromWasmAbi for SecureWasmAeadContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmAeadContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmAeadContext>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRef<SecureWasmAeadContext>
type Anchor = RcRef<SecureWasmAeadContext>
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 SecureWasmAeadContext
impl RefFromWasmAbi for SecureWasmAeadContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmAeadContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmAeadContext>>
The Wasm ABI type references to
Self are recovered from.Source§type Anchor = RcRef<SecureWasmAeadContext>
type Anchor = RcRef<SecureWasmAeadContext>
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 SecureWasmAeadContext
impl RefMutFromWasmAbi for SecureWasmAeadContext
Source§type Abi = WasmPtr<WasmRefCell<SecureWasmAeadContext>>
type Abi = WasmPtr<WasmRefCell<SecureWasmAeadContext>>
Same as
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<SecureWasmAeadContext>
type Anchor = RcRefMut<SecureWasmAeadContext>
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 SecureWasmAeadContext
impl VectorFromWasmAbi for SecureWasmAeadContext
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[SecureWasmAeadContext]>
Source§impl VectorIntoWasmAbi for SecureWasmAeadContext
impl VectorIntoWasmAbi for SecureWasmAeadContext
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[SecureWasmAeadContext]>) -> Self::Abi
Source§impl WasmDescribeVector for SecureWasmAeadContext
impl WasmDescribeVector for SecureWasmAeadContext
impl SupportsConstructor for SecureWasmAeadContext
impl SupportsInstanceProperty for SecureWasmAeadContext
impl SupportsStaticProperty for SecureWasmAeadContext
Auto Trait Implementations§
impl Freeze for SecureWasmAeadContext
impl !RefUnwindSafe for SecureWasmAeadContext
impl Send for SecureWasmAeadContext
impl Sync for SecureWasmAeadContext
impl Unpin for SecureWasmAeadContext
impl UnsafeUnpin for SecureWasmAeadContext
impl !UnwindSafe for SecureWasmAeadContext
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.