pub struct WasmPqcBinaryFormat { /* private fields */ }Expand description
WebAssembly wrapper for PqcBinaryFormat
Implementations§
Source§impl WasmPqcBinaryFormat
impl WasmPqcBinaryFormat
Sourcepub fn new(
algorithm: WasmAlgorithm,
metadata: WasmPqcMetadata,
data: Vec<u8>,
) -> WasmPqcBinaryFormat
pub fn new( algorithm: WasmAlgorithm, metadata: WasmPqcMetadata, data: Vec<u8>, ) -> WasmPqcBinaryFormat
Create a new PQC Binary Format structure
@param {WasmAlgorithm} algorithm - Algorithm to use @param {WasmPqcMetadata} metadata - Metadata container @param {Uint8Array} data - Encrypted data bytes @returns {WasmPqcBinaryFormat} New instance
Sourcepub fn with_flags(
algorithm: WasmAlgorithm,
flags: WasmFormatFlags,
metadata: WasmPqcMetadata,
data: Vec<u8>,
) -> WasmPqcBinaryFormat
pub fn with_flags( algorithm: WasmAlgorithm, flags: WasmFormatFlags, metadata: WasmPqcMetadata, data: Vec<u8>, ) -> WasmPqcBinaryFormat
Create with specific flags
@param {WasmAlgorithm} algorithm - Algorithm to use @param {WasmFormatFlags} flags - Format flags @param {WasmPqcMetadata} metadata - Metadata container @param {Uint8Array} data - Encrypted data bytes @returns {WasmPqcBinaryFormat} New instance
Sourcepub fn to_bytes(&self) -> Result<Vec<u8>, JsValue>
pub fn to_bytes(&self) -> Result<Vec<u8>, JsValue>
Serialize to bytes
@returns {Uint8Array} Serialized bytes @throws {Error} If serialization fails
Sourcepub fn from_bytes(data: &[u8]) -> Result<WasmPqcBinaryFormat, JsValue>
pub fn from_bytes(data: &[u8]) -> Result<WasmPqcBinaryFormat, JsValue>
Deserialize from bytes
@param {Uint8Array} data - Bytes to deserialize @returns {WasmPqcBinaryFormat} Deserialized instance @throws {Error} If deserialization fails
Sourcepub fn validate(&self) -> Result<(), JsValue>
pub fn validate(&self) -> Result<(), JsValue>
Validate the format structure
@throws {Error} If validation fails
Sourcepub fn algorithm(&self) -> WasmAlgorithm
pub fn algorithm(&self) -> WasmAlgorithm
Get algorithm
@returns {WasmAlgorithm} Algorithm used
Sourcepub fn flags(&self) -> WasmFormatFlags
pub fn flags(&self) -> WasmFormatFlags
Get format flags
@returns {WasmFormatFlags} Format flags
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Get total serialized size
@returns {number} Size in bytes
Trait Implementations§
Source§impl From<WasmPqcBinaryFormat> for JsValue
impl From<WasmPqcBinaryFormat> for JsValue
Source§fn from(value: WasmPqcBinaryFormat) -> Self
fn from(value: WasmPqcBinaryFormat) -> Self
Source§impl FromWasmAbi for WasmPqcBinaryFormat
impl FromWasmAbi for WasmPqcBinaryFormat
Source§impl IntoWasmAbi for WasmPqcBinaryFormat
impl IntoWasmAbi for WasmPqcBinaryFormat
Source§impl RefFromWasmAbi for WasmPqcBinaryFormat
impl RefFromWasmAbi for WasmPqcBinaryFormat
Source§type Anchor = RcRef<WasmPqcBinaryFormat>
type Anchor = RcRef<WasmPqcBinaryFormat>
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 TryFromJsValue for WasmPqcBinaryFormat
impl TryFromJsValue for WasmPqcBinaryFormat
Source§impl VectorFromWasmAbi for WasmPqcBinaryFormat
impl VectorFromWasmAbi for WasmPqcBinaryFormat
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[WasmPqcBinaryFormat]>
Source§impl VectorIntoWasmAbi for WasmPqcBinaryFormat
impl VectorIntoWasmAbi for WasmPqcBinaryFormat
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[WasmPqcBinaryFormat]>) -> Self::Abi
Source§impl WasmDescribeVector for WasmPqcBinaryFormat
impl WasmDescribeVector for WasmPqcBinaryFormat
impl SupportsConstructor for WasmPqcBinaryFormat
impl SupportsInstanceProperty for WasmPqcBinaryFormat
impl SupportsStaticProperty for WasmPqcBinaryFormat
Auto Trait Implementations§
impl Freeze for WasmPqcBinaryFormat
impl RefUnwindSafe for WasmPqcBinaryFormat
impl Send for WasmPqcBinaryFormat
impl Sync for WasmPqcBinaryFormat
impl Unpin for WasmPqcBinaryFormat
impl UnwindSafe for WasmPqcBinaryFormat
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
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
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.