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

Require JSON serialization checks "in and out" #179

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

timcappalli
Copy link
Member

@timcappalli timcappalli commented Oct 8, 2024

Closes #125

The following tasks have been completed:

  • Modified Web platform tests (link)

Implementation commitment:

  • WebKit (link to issue)
  • Chromium (link to issue)
  • Gecko (link to issue)

Documentation and checks

  • Affects privacy
  • Affects security
  • Pinged MDN
  • Updated Explainer

Preview | Diff

Comment on lines +234 to +236
<p>
The object MUST only contain [=JSON type=] values.
</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

We probably don't need this. Serialization will throw automatically if it's not the case.

Suggested change
<p>
The object MUST only contain [=JSON type=] values.
</p>

Copy link
Member Author

Choose a reason for hiding this comment

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

Isn't this important for a reader of the spec to know? For example, someone working on OID4VP or a new protocol?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, but it's in the algorithm. It's redundant to state it twice.

Copy link
Collaborator

@marcoscaceres marcoscaceres Oct 14, 2024

Choose a reason for hiding this comment

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

Where it should be defined is part of the registry rules. That is, for your protocol to be registered, it must be JSON stringifiable. That would let new protocols know that it's a requirement.

Comment on lines +314 to +316
<li>If |requests| does not contain [=JSON type=] values,
[=exception/throw=] a {{TypeError}}.
</li>
Copy link
Collaborator

@marcoscaceres marcoscaceres Oct 11, 2024

Choose a reason for hiding this comment

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

This is not right here... you need to:

  1. [=List/for each=] |request| of |requests|:
    1.1. [=serialize a JavaScript value to a JSON string|Serialize=] |request| a to a JSON string. Rethrow any exceptions.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@timcappalli, we also would need this on the way out, when readonly attribute object data; is set... though there might not be enough spec text in the current spec to add this right now. However, it would be good to add something.

Copy link
Collaborator

@marcoscaceres marcoscaceres left a comment

Choose a reason for hiding this comment

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

Couple of small things...

@marcoscaceres marcoscaceres changed the title Require JSON Types Require JSON serialization checks "in and out" Oct 21, 2024
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.

[spec] DigitalCredentialRequestOptions and DigitalCredential objects must be JSON serializable
2 participants