Sphereon-Opensource / SIOP-OID4VP

Self Issued OpenID Provider v2 (SIOP) with optional OpenID for Verifiable Presentations (OpenID4VP)
77 stars 25 forks source link

Feature/vdx 149/profiles enum #32

Closed hrehman-sphereon closed 2 years ago

codecov-commenter commented 2 years ago

Codecov Report

Merging #32 (d240b7d) into release/v2.0.0 (fb50c2e) will decrease coverage by 1.89%. The diff coverage is 15.78%.

@@                Coverage Diff                 @@
##           release/v2.0.0      #32      +/-   ##
==================================================
- Coverage           83.15%   81.25%   -1.90%     
==================================================
  Files                  30       31       +1     
  Lines                1312     1350      +38     
  Branches              342      346       +4     
==================================================
+ Hits                 1091     1097       +6     
- Misses                216      246      +30     
- Partials                5        7       +2     
Flag Coverage Δ
unittest 81.25% <15.78%> (-1.90%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/OPBuilder.ts 67.18% <0.00%> (-18.82%) :arrow_down:
src/main/RP.ts 92.45% <0.00%> (-3.63%) :arrow_down:
src/main/RPBuilder.ts 71.95% <0.00%> (-14.82%) :arrow_down:
src/main/OP.ts 87.80% <33.33%> (-2.07%) :arrow_down:
src/main/types/Profile.ts 100.00% <100.00%> (ø)
src/main/types/index.ts 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

hrehman-sphereon commented 2 years ago

public withProfiles(profiles: string | Profile | Array<Profile>): OPBuilder {
    if(typeof profiles === "string") {
      this.withProfileStr(profiles);
    } else if (profiles instanceof Profile) {
      this.addProfile(profiles as unknown as Profile);
    } else if (Array.isArray(profiles)) {
      this.withProfilesList(profiles);
    }

    return this;
  }

profiles instanceof Profile .... actually have to be implemented like so ... Array.isArray(profiles)

https://stackoverflow.com/questions/53672528/using-instanceof-with-typescript-union-types-customobject-customobject

This does not seem an elegant solution.

hrehman-sphereon commented 2 years ago

This document is not a specification, but a profile. It outlines existing specifications required for implementations to interoperate among each other.

Quoted from : https://identity.foundation/jwt-vc-presentation-profile/

I think the word "profile" does work... do you have a better word in mind ?