Skip to content

deriveBits length idl does not allow null #322

@panva

Description

@panva

webcrypto/spec/Overview.html

Lines 1258 to 1260 in 004f26a

Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm,
CryptoKey baseKey,
unsigned long length);

The SubtleCrypto.deriveBits function length argument's IDL does not allow null to be passed despite there being a special handling for its possible null value in all deriveBits operations, for most it throws but for ECDH, X25519, and X448 it is defined as returning all generated bits.

I believe the length argument of deriveBits should be made nullable like so?

Promise<ArrayBuffer> deriveBits(AlgorithmIdentifier algorithm, 
                         CryptoKey baseKey, 
                         unsigned long? length); 
                                      ^ nullable?

In WPT there are even tests for this behaviour.

https://github.com/web-platform-tests/wpt/blob/3174b85610804424ac4c6c2a194a08220402a00e/WebCryptoAPI/derive_bits_keys/ecdh_bits.js#L58-L66

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions