Skip to content

feat: add wasm-bindgen feature for wasm#231

Open
Its-Just-Nans wants to merge 10 commits intorusticata:masterfrom
Its-Just-Nans:time-wasm-bindgen
Open

feat: add wasm-bindgen feature for wasm#231
Its-Just-Nans wants to merge 10 commits intorusticata:masterfrom
Its-Just-Nans:time-wasm-bindgen

Conversation

@Its-Just-Nans
Copy link

@Its-Just-Nans Its-Just-Nans commented Jan 30, 2026

This MR add the wasm-bindgen feature of the time crate on wasm https://docs.rs/crate/time/latest/features

Without the feature we have the error

time not implemented on this platform

Test file

//! cargo add --dev wasm-bindgen-test
//! wasm-pack test --node
#![cfg(target_arch = "wasm32")]

use x509_parser::pem::{parse_x509_pem, Pem};
use x509_parser::{parse_x509_certificate, x509::X509Version};

static IGCA_PEM: &[u8] = include_bytes!("../assets/IGC_A.pem");



#[wasm_bindgen_test::wasm_bindgen_test]
fn test_x509_parse_pem() {
    let pem: Vec<Pem> = Pem::iter_from_buffer(IGCA_PEM)
        .collect::<Result<_, _>>()
        .ok()
        .unwrap();
    let x509 = pem[0].parse_x509().unwrap();
    assert_eq!(x509.validity.is_valid(), false);
}
cargo install wasm-pack

cargo add --dev wasm-bindgen-test
wasm-pack test --node

@Its-Just-Nans
Copy link
Author

Its-Just-Nans commented Jan 30, 2026

note that the tests/test01.rs needs to be restricted for non-wasm because usize is not the same in wasm

I can add that on this MR

Edit: DONE

cpu
cpu previously approved these changes Jan 30, 2026
Copy link
Collaborator

@cpu cpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, but is there a way to add CI coverage so that support doesn't accidentally regress?

@Its-Just-Nans
Copy link
Author

is there a way to add CI coverage so that support doesn't accidentally regress?

yes, I will add that

@Its-Just-Nans
Copy link
Author

Its-Just-Nans commented Jan 31, 2026

Unfortunalty it's seems not possible because of the current MSRV

Or i can add dymanicly in the CI the

cargo add --dev wasm-bindgen-test

@Its-Just-Nans Its-Just-Nans requested a review from cpu January 31, 2026 01:25
Its-Just-Nans added a commit to Its-Just-Nans/wombat that referenced this pull request Feb 1, 2026
@cpu cpu dismissed their stale review February 5, 2026 19:57

needs re-review with the latest pushes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants