use crate::data::padding::Padded;
use crate::data::simple::{Attribute, Pseudonym};
use crate::data::wasm::simple::{WASMAttribute, WASMPseudonym};
use wasm_bindgen::prelude::*;
#[wasm_bindgen(js_name = pseudonymFromBytesPadded)]
pub fn wasm_pseudonym_from_bytes_padded(data: Vec<u8>) -> Option<WASMPseudonym> {
Pseudonym::from_bytes_padded(&data).ok().map(WASMPseudonym)
}
#[wasm_bindgen(js_name = pseudonymFromStringPadded)]
pub fn wasm_pseudonym_from_string_padded(text: &str) -> Option<WASMPseudonym> {
Pseudonym::from_string_padded(text).ok().map(WASMPseudonym)
}
#[wasm_bindgen(js_name = pseudonymToStringPadded)]
pub fn wasm_pseudonym_to_string_padded(pseudonym: &WASMPseudonym) -> Option<String> {
pseudonym.0.to_string_padded().ok()
}
#[wasm_bindgen(js_name = pseudonymToBytesPadded)]
pub fn wasm_pseudonym_to_bytes_padded(pseudonym: &WASMPseudonym) -> Option<Vec<u8>> {
pseudonym.0.to_bytes_padded().ok()
}
#[wasm_bindgen(js_name = attributeFromBytesPadded)]
pub fn wasm_attribute_from_bytes_padded(data: Vec<u8>) -> Option<WASMAttribute> {
Attribute::from_bytes_padded(&data).ok().map(WASMAttribute)
}
#[wasm_bindgen(js_name = attributeFromStringPadded)]
pub fn wasm_attribute_from_string_padded(text: &str) -> Option<WASMAttribute> {
Attribute::from_string_padded(text).ok().map(WASMAttribute)
}
#[wasm_bindgen(js_name = attributeToStringPadded)]
pub fn wasm_attribute_to_string_padded(attribute: &WASMAttribute) -> Option<String> {
attribute.0.to_string_padded().ok()
}
#[wasm_bindgen(js_name = attributeToBytesPadded)]
pub fn wasm_attribute_to_bytes_padded(attribute: &WASMAttribute) -> Option<Vec<u8>> {
attribute.0.to_bytes_padded().ok()
}