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
303 stars 87 forks source link

Add feature to support custom `now_utc` implementations #1397

Closed frederikrothenberger closed 2 months ago

frederikrothenberger commented 2 months ago

Description of change

This PR adds a feature to identity_core to allow specifying a custom function to get the current time (Timestamp::now_utc). The feature is disabled by default.

Fixes #1391.

Type of change

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

How the change has been tested

Added an integration test to identity_core that uses the custom hook.

Change checklist

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

frederikrothenberger commented 2 months ago

@itsyaasir @UMR1352: There will need to be some CI changes as cargo test --workspace --all-features no longer compiles (since the test binaries are missing the custom time implementation but have custom_time enabled).

I.e. testing will need to be split into cargo test --test custom_time --features="custom_time" and running all other tests with custom_time disabled.

I did not touch CI (yet). How would you want me to approach that issue?

itsyaasir commented 2 months ago

@itsyaasir @UMR1352: There will need to be some CI changes as cargo test --workspace --all-features no longer compiles (since the test binaries are missing the custom time implementation but have custom_time enabled).

I.e. testing will need to be split into cargo test --test custom_time --features="custom_time" and running all other tests with custom_time disabled.

I did not touch CI (yet). How would you want me to approach that issue?

Yeah, I think splitting it will make sense in the CI

eike-hass commented 2 months ago

@itsyaasir @UMR1352: There will need to be some CI changes as cargo test --workspace --all-features no longer compiles (since the test binaries are missing the custom time implementation but have custom_time enabled).

I.e. testing will need to be split into cargo test --test custom_time --features="custom_time" and running all other tests with custom_time disabled.

I did not touch CI (yet). How would you want me to approach that issue?

We will take care of CI 👌

frederikrothenberger commented 2 months ago

Thanks a lot!

frederikrothenberger commented 2 months ago

@itsyaasir: In order to successfully compile identity_core for the target wasm32-unknown-unknown without having a dependency on js-sys, I needed to do the following additional changes: https://github.com/frederikrothenberger/identity.rs/commit/3dd5198c73dca238e98016e96e1cfd33b9ab27ff

Could we include that commit in this PR as well, or would you rather have that separately?

itsyaasir commented 2 months ago

@itsyaasir: In order to successfully compile identity_core for the target wasm32-unknown-unknown without having a dependency on js-sys, I needed to do the following additional changes: frederikrothenberger@3dd5198

Could we include that commit in this PR as well, or would you rather have that separately?

You can add it in this PR, no problem

eike-hass commented 2 months ago

@frederikrothenberger could you try to re-sign your commits? 🙏 Edit: Might mean you need to force push the branch

frederikrothenberger commented 2 months ago

@eike-hass: The commits are now signed 👍

itsyaasir commented 2 months ago

@frederikrothenberger Thanks for the contribution.