Skip to content

wasm compatibility: switch from std:time to chrono crate#1

Open
anotherstarburst wants to merge 2 commits intoredasgard:mainfrom
anotherstarburst:wasm-compatible
Open

wasm compatibility: switch from std:time to chrono crate#1
anotherstarburst wants to merge 2 commits intoredasgard:mainfrom
anotherstarburst:wasm-compatible

Conversation

@anotherstarburst
Copy link
Copy Markdown

Pull Request

Description

A clear and concise description of what this PR does.

The crate was failing on my wasm-application due to std::time not being supported. I've switched out std::time to use chrono instead to be cross-compatible with more environments.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Security enhancement

Related Issues

Fixes #(issue number)
Closes #(issue number)
Related to #(issue number)

Changes Made

  • Adds chrono as a dependency with wasmbind and serde features.
  • Replaces use of std::time for validation_timestamp with chrono::Utc::now().timestamp().
  • Add validation timestamp test for ValidationEngine

Code Quality

  • Code follows the project's style guidelines
  • Self-review of the code has been performed
  • Code has been commented, particularly in hard-to-understand areas
  • No new warnings or errors are introduced

Testing

  • Tests have been added/updated for the changes
  • All existing tests pass
  • New tests cover the changes made
  • Tests have been run locally and pass

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • Security tests added/updated
  • Attack pattern tests added/updated

Security Considerations

  • This change affects security detection
  • This change involves new attack patterns
  • This change has been tested against known attack vectors
  • Security implications have been documented

Security Testing

  • Tested against prompt injection attacks
  • Tested against jailbreak attempts
  • Tested against Unicode attacks
  • Tested against false positives/negatives
  • Performance impact assessed

Documentation

  • Documentation has been updated
  • README.md updated (if applicable)
  • API documentation updated (if applicable)
  • Examples updated (if applicable)
  • CHANGELOG.md updated

Breaking Changes

  • This PR contains breaking changes
  • Breaking changes are documented
  • Migration guide provided (if applicable)

Performance Impact

  • No performance impact
  • Performance improvement
  • Performance regression (documented and justified)

Checklist

(fun fact - this duplicates some of the checklist items from above...)

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

Any additional information that reviewers should know.

Screenshots (if applicable)

Add screenshots to help explain your changes.

Reviewer Notes

Any specific areas you'd like reviewers to focus on or questions you have.

- Update all remaining security@asgardtech.com to security@redasgard.com
- Ensure consistent security contact information across all files
@anotherstarburst anotherstarburst changed the title Switch from std:time to chrono crate wasm compatibility: switch from std:time to chrono crate Nov 22, 2025
- Adds chrono as a dependency with wasmbind and serde features.
- Replaces use of std::time for validation_timestamp with chrono::Utc::now().timestamp().
- Makes this lib wasm-compatible

Add validation timestamp test for ValidationEngine
@anotherstarburst
Copy link
Copy Markdown
Author

Note, I did run

cargo test
cargo test --features tracing
cargo clippy
cargo fmt

per the contribution requirements, but the project doesn't pass even before this PR. I've made sure my changes pass fine - but didn't want to bloat the PR with a bunch of other changes that fix the pre-existing issue :)

@ilyk ilyk force-pushed the main branch 2 times, most recently from 340c5aa to c13c9d2 Compare January 26, 2026 00:41
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