Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Wasm Credential and Presentation field getters and constructors #815

Merged
merged 29 commits into from
May 4, 2022

Conversation

cycraig
Copy link
Contributor

@cycraig cycraig commented Apr 19, 2022

Description of change

Adds typed constructors for the Credential and Presentation structs in the Wasm bindings, and adds Typescript interfaces for the fields contained in them.

This changes several field names in Rust for consistency and also gets rid of (I think) the last any function parameters in the Wasm bindings.

NOTE: this makes breaking changes to the Wasm examples incompatible with 0.5.0. This may confuse developers using version 0.5.0 if released to the wiki prior to 0.6.0.

Added

  • Add Wasm Credential field getter functions.
  • Add Wasm Presentation field getter functions.
  • Add Evidence Typescript interface.
  • Add Issuer Typescript interface.
  • Add Policy Typescript interface.
  • Add RefreshService Typescript interface.
  • Add Schema Typescript interface.
  • Add Status Typescript interface.
  • Add Subject Typescript interface.
  • Add Wasm Credential constructor.
  • Add Wasm Credential.BaseContext.
  • Add Wasm Credential.BaseType.
  • Add Wasm Presentation.BaseContext.
  • Add Wasm Presentation.BaseType.

Changed

  • Change Wasm Presentation constructor to use an interface.
  • Change WasmDocument.signCredential parameter from any to Credential.
  • Change WasmDocument.signPresentation parameter from any to Credential.
  • Rename Refresh to RefreshService.
  • Rename CredentialBuilder::refresh to refresh_service.
  • Rename CredentialBuilder::policy to terms_of_use.
  • Rename PresentationBuilder::refresh to refresh_service.
  • Rename PresentationBuilder::policy to terms_of_use.

Removed

  • Remove Wasm Credential.issue().
  • Remove Wasm Credential.extend().

Links to any relevant issues

Resolves #813.

Type of change

  • Bug fix (a non-breaking change which fixes an issue)
  • Enhancement (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Fix

How the change has been tested

Added multiple Mocha unit tests that pass with npm run test:unit:node. Wasm examples also pass locally.

Change checklist

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • 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

@cycraig cycraig added Wasm Related to Wasm bindings. Becomes part of the Wasm changelog Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Rust Related to the core Rust code. Becomes part of the Rust changelog. labels Apr 19, 2022
@cycraig cycraig changed the title [WIP] Add Wasm Credential and Presentation field getters and constructors Add Wasm Credential and Presentation field getters and constructors Apr 20, 2022
@cycraig cycraig marked this pull request as ready for review April 20, 2022 21:22
Copy link
Contributor

@abdulmth abdulmth left a comment

Choose a reason for hiding this comment

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

Looks good to me, minor comments, very readable proc-macro!

bindings/wasm/src/credential/credential.rs Show resolved Hide resolved
bindings/wasm/src/credential/credential_builder.rs Outdated Show resolved Hide resolved
bindings/wasm/src/credential/credential_builder.rs Outdated Show resolved Hide resolved
bindings/wasm/src/credential/presentation_builder.rs Outdated Show resolved Hide resolved
bindings/wasm/src/credential/presentation_builder.rs Outdated Show resolved Hide resolved
@cycraig cycraig merged commit 9fd9524 into dev May 4, 2022
@cycraig cycraig deleted the feat/credential-constructors branch May 4, 2022 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking change A change to the API that requires a major release. Part of "Changed" section in changelog Rust Related to the core Rust code. Becomes part of the Rust changelog. Wasm Related to Wasm bindings. Becomes part of the Wasm changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Improve Credential, Presentation creation in Wasm
3 participants