iotaledger / identity.rs

Implementation of the Decentralized Identity standards such as DID and Verifiable Credentials by W3C for the IOTA Tangle.
https://www.iota.org
Apache License 2.0
299 stars 85 forks source link

Mark `js-sys` as optional for identity_core #1405

Closed frederikrothenberger closed 1 month ago

frederikrothenberger commented 1 month ago

Description of change

In #1397 my intention was to make the js-sys dependency mutually exclusive with the feature custom_time. As it turns out, it's not that simple and mixing target specific dependencies with feature specific dependencies does not actually work. See here and here.

So this removes the broken feature reference in the dependency declaration and instead marks it as optional. Also, the feature custom_time takes precedence over js-sys so these do not actually conflict and one could enable both.

Type of change

Add an x to the boxes that are relevant to your changes.

How the change has been tested

Existing tests

Change checklist

Add an x to the boxes that are relevant to your changes.

frederikrothenberger commented 1 month ago

@itsyaasir: Sorry to bother you again, but I made a mistake in #1397 and this PR fixes it.

itsyaasir commented 1 month ago

@frederikrothenberger Thank you for your contribution! I noticed that in your changes, the js-sys dependency is marked as optional This means that the dependency won't be automatically included during the build process unless it is explicitly enabled (by feature IIRC). If you take a look at the github action which is building for wasm32-unknown-unkown it is failing to find the dep "js-sys" for the now_utc function. Since we are already compiling it conditionally according to the target, is the optional required here ?

frederikrothenberger commented 1 month ago

@itsyaasir: Yes, the optional is required, otherwise you cannot compile to wasm32-unknown-unknwon without it (breaking compatibility with the ICP platform).

But we should be able to enable it by default (still gated by the target). Would that be an option?

itsyaasir commented 1 month ago

@itsyaasir: Yes, the optional is required, otherwise you cannot compile to wasm32-unknown-unknwon without it (breaking compatibility with the ICP platform).

But we should be able to enable it by default (still gated by the target). Would that be an option?

That should be fine. We are also using the js-sys dependency for wasm bindings with ts

frederikrothenberger commented 1 month ago

@itsyaasir: I made it a default feature.

itsyaasir commented 1 month ago

@itsyaasir: I made it a default feature.

Did you forget to push the changes ? I can't see the dependency being a default feature.

You modified this default-features = true but this only activates the default features of the js-sys crate as show here

frederikrothenberger commented 1 month ago

@itsyaasir: Yes, my bad. I got confused about the default switches. Fixed now.