[webrtc-pc] RTCCertificate.getAlgorithm() wording and serialization

henbos has just created a new issue for https://github.com/w3c/webrtc-pc:

== RTCCertificate.getAlgorithm() wording and serialization ==
RTCCertificate.getAlgorithm() is described as follows:

> Returns the value of _keygenAlgorithm_ passed in the call to generateCertificate().

Which refers to a `AlgorithmIdentifier keygenAlgorithm`.
The typedef is: `typedef (object or DOMString) AlgorithmIdentifier;`

As described by https://w3c.github.io/webcrypto/Overview.html#algorithm-normalization, the AlgorithmIdentifier is converted to one of the dictionaries inheriting from Algorithm by copying all the members that belong to that Algorithm from the input object (where a DOMString keygenAlgorithm is interpreted as object { name: keygenAlgorithm }).

Because keygenAlgorithm can be _any object_ that can be normalized, which could be any dictionary as long as it includes the same members as Algorithm & friends. Beyond those members, it could contain _anything_.
Because RTCCertificate is serializable, and getAlgorithm() should return the original keygenAlgorithm value, we are required by spec to be able to serialize almost _any_ dictionary. If the dictionary contains members of object types that are not serializable we are tasked with the impossible.

This is overkill. Can we change to wording to say:

> Returns an AlgorithmIdentifier corresponding to the one passed in the call to generateCertificate(), meaning an object that would produce the same result by the normalization process as the original _keygenAlgorithm_ value did.

As such, we are only tasked with serializing relevant members and don't have to remember if the original keygenAlgorithm was a string or an object.

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1121 using your GitHub account

Received on Tuesday, 11 April 2017 12:36:13 UTC