W3C home > Mailing lists > Public > public-webcrypto@w3.org > April 2012

[DOMCRYPT] Crypto interface should use WebIDL overloads instead of a 'type check' step in the algorithm

From: Kyle Huey <me@kylehuey.com>
Date: Thu, 5 Apr 2012 20:59:12 -0700
Message-ID: <CAP045ArckCACeg6ajkDfEy==sNz8DVSE5E30UMjGDwRW1QVo7g@mail.gmail.com>
To: public-webcrypto@w3.org
Cc: Boris Zbarsky <bzbarsky@mit.edu>
Hi All,

In the draft at https://dvcs.w3.org/hg/domcrypt/raw-file/tip/Overview.html,
the current WebIDL snippet for the Crypto interface is

interface Crypto {
 ArrayBufferView getRandomValues(ArrayBufferView array);
};

And the first step of the algorithm for getRandom values is "If array is
not of an integer type (i.e., Int8Array, Uint8Array, Int16Array,
Uint16Array, Int32Array, or Uint32Array), throw a TypeMismatchError and
abort these steps."

I believe this should be written as

interface Crypto {
  Int8Array getRandomValues(Int8Array array);
  Uint8Array getRandomValues(Uint8Array array);
  Int16Array getRandomValues(Int16Array array);
  Uint16Array getRandomValues(Uint16Array array);
  Int32Array getRandomValues(Int32Array array);
  Uint32Array getRandomValues(Uint32Array array);
};

to use WebIDL overloading instead of the explicit type check step.

- Kyle
Received on Friday, 6 April 2012 03:59:41 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 16 May 2012 18:59:56 GMT