Closed BrandonDyer64 closed 11 months ago
2 is not great because that means you now need to set the timestamp everytime you use the library while I'm expecting a lot of Validation
struct to be mostly static
@Keats There is an open PR that adds specific wasm support (#318), but it needs to be merged
Yes. As mentioned in the PR, it's missing CI
@Keats The structure of Validation
does not generally imply being static as the sub
field is user specific. The original PR I submitted allowed for a user to choose to add a custom exp
timestamp if they want.
I made another PR that uses js_sys
when on wasm32-unknown-unknown
, but I heavily urge you to please find a way to let the user specify a timestamp for validation
fn get_current_timestamp() -> u64
usesSystemTime::now()
to get the current unix timestamp. Unfortunately,SystemTime
functions panic onwasm32-unknown-unknown
.There are a couple of approaches to fix this:
chrono
for getting the timestampValidation
, allow the user to supply a timestampAs a long-term solution, I prefer option 2 as it adds no cost, doesn't inflate the dependency tree, and allows for better customization.