importKey doesn't seem to define handling of the keyData argument in some cases

Consider an importKey call that passes "raw" as format and {} as 
keyData.  The spec says to clone the data, but 
https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#concept-clone-CryptoOperationData 
isn't defined for things that aren't CryptoOperationData.

Presumably importKey should be checking that keyData is a 
CryptoOperationData or some other union name that expands to the same 
thing (and throwing if not) before cloning it.

More generally, it's not clear to me why this argument is "object" 
instead of "(CryptoOperationData or JsonWebKey)", say.  The latter would 
mean conversion to the dictionary even if the format doesn't want a 
JsonWebKey, but that's OK: it would only affect erroneous usage cases 
which would simply throw after the conversion because they would detect 
that the type of the union doesn't match the passed-in format.

-Boris

Received on Tuesday, 15 July 2014 17:12:23 UTC