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

Feature/cwall 199 #107

Merged
merged 10 commits into from
Jun 10, 2024
Merged

Feature/cwall 199 #107

merged 10 commits into from
Jun 10, 2024

Conversation

zoemaas
Copy link
Contributor

@zoemaas zoemaas commented May 7, 2024

No description provided.

@zoemaas zoemaas requested review from jcmelati, nklomp and sksadjad May 7, 2024 12:10
Copy link
Contributor

@nklomp nklomp left a comment

Choose a reason for hiding this comment

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

See remarks

packages/client/README.md Outdated Show resolved Hide resolved
requiredProperties: uri.includes('credential_offer_uri=') ? ['credential_offer_uri'] : ['credential_offer'],
}) as CredentialOfferV1_0_11;
if (credentialOffer?.credential_offer_uri === undefined && !credentialOffer?.credential_offer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this removed? There should never be a by value and by reference version together in a URL

Copy link
Contributor Author

@zoemaas zoemaas May 23, 2024

Choose a reason for hiding this comment

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

Two lines above there is a method call where the required properties are passed as parameters. The ternary operator is used to decide whether credential_offer_uri or credential_offer is present. The actual check happens inside the method. So the if statement is redundant.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, but the question is. This was a rather self-explanatory error message with a really simple condition. That raises the question, why would you even decide to remove that without consulting?

Copy link
Contributor

@nklomp nklomp May 24, 2024

Choose a reason for hiding this comment

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

Okay, please don't edit your response after you already got responses, as now my answer looks completely random.

That is only worse. The check is there to ensure that one option is set. You introduced a ternary that now assumes one is there or the other is there. So the correct approach would be to move that check to the top, so we at least know that only one is actually there and you can do your assumptions on what to pick

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't introduce a ternary. The ternary was already there. I just added the '=', to make it skip the scheme and split the string at the credential offer query param.

*/
export function convertURIToJsonObject(uri: string, opts?: DecodeURIAsJsonOpts): unknown {
if (!uri || (opts?.requiredProperties && !opts.requiredProperties?.every((p) => uri.includes(p)))) {
throw new Error(BAD_PARAMS);
}

if (opts?.arrayTypeProperties && opts.arrayTypeProperties.includes('credential_offer_uri')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does a generic function all of a sudden knows about credential_offers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a simple '=' to the required properties fixed the issue

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmzz, no sure I like that approach, so please create a TODO. It should probably have been solved by not mixing the outer param with the inner param

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The actual problem here is the input url. Usual url encoders encode the '='. In the examples provided in the specs of OID4VCI the '=' is not encoded. If we receive a fully encoded url it doesn't work.

packages/common/lib/functions/Encoding.ts Outdated Show resolved Hide resolved
@zoemaas
Copy link
Contributor Author

zoemaas commented May 24, 2024

Closing this PR since the changes are obsolete

@zoemaas zoemaas closed this May 24, 2024
@zoemaas zoemaas deleted the feature/CWALL-199 branch May 24, 2024 17:29
@nklomp
Copy link
Contributor

nklomp commented May 24, 2024

@maikel-maas What do you mean with that, as that is highly unlikely. This still has outstanding issues as well

@zoemaas zoemaas restored the feature/CWALL-199 branch May 30, 2024 07:47
@zoemaas zoemaas reopened this May 30, 2024
@zoemaas zoemaas merged commit 68c89f4 into develop Jun 10, 2024
2 checks passed
@zoemaas zoemaas deleted the feature/CWALL-199 branch June 10, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants