Re: JWK import/export as ECMAScript objects, rather than ArrayBuffer

On 3/19/14 8:57 PM, Ryan Sleevi wrote:
> +cc Boris, in the event there are intricacies of WebIDL that are being
> overlooked here.

I assume the relevant proposal is the one in 
http://lists.w3.org/Archives/Public/public-webcrypto/2014Mar/0116.html ?

The only WebIDL-relevant things I can see are:

1)  You can't use two different dictionary types in a union, because 
they're not distinguishable types.  Since as far as WebIDL is concerned 
any object can be used for any dictionary type, there is no way to tell 
which type was meant.  See http://heycam.github.io/webidl/#idl-union 
which says:

    Each pair of flattened member types in a union type, T and U, MUST
    be distinguishable.

You'll probably want to do "object" and manual coercion to dictionary 
types, as you note in 
http://lists.w3.org/Archives/Public/public-webcrypto/2014Mar/0118.html

2)  IDL array types are not implemented in any UA, and there are no 
plans by anyone I know of to implement them.  Chances are you just want 
sequence types here instead, unless the pass-by-reference aspect is in 
fact important somehow.

3)  Instead of manually calling [[DefineOwnProperty]], it might be 
better to just say that an IDL dictionary is set up and then converted 
to a JS value per <http://heycam.github.io/webidl/#es-dictionary>, if 
that's feasible in this case.  That would allow you to automatically 
track the ES spec when WebIDL is updated to track it (e.g. 
[[DefineOwnProperty]] in ES6 does not take a boolean argument).

-Boris

Received on Thursday, 20 March 2014 01:52:21 UTC