W3C home > Mailing lists > Public > public-webcrypto@w3.org > March 2014

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 19 Mar 2014 21:51:39 -0400
Message-ID: <532A49AB.5020302@mit.edu>
To: Ryan Sleevi <sleevi@google.com>, Mark Watson <watsonm@netflix.com>
CC: "public-webcrypto@w3.org" <public-webcrypto@w3.org>
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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:17:22 UTC