Skip to content

TypeScript wrong WebCrypto Algorithm params  #23057

@microshine

Description

@microshine

TypeScript Version: 2.8.1

Search Terms:
WebCrypto, Algorithm

Problem
iv is required param for AesGcmParams in WebCrypto API, but TypeScript allows to use null value for it
The same problem for another algorithms like AesCbcParams, AesCtrParams, etc.

WebCrypto API https://www.w3.org/TR/WebCryptoAPI/#aes-gcm-params

dictionary AesGcmParams : Algorithm {
  // The initialization vector to use. May be up to 2^64-1 bytes long.
  required BufferSource iv;
  // The additional authentication data to include.
  BufferSource additionalData;
  // The desired length of the authentication tag. May be 0 - 128.
  [EnforceRange] octet tagLength;
};

TypeScript https://github.com/Microsoft/TypeScript/blob/master/lib/lib.dom.d.ts#L51-L55

interface AesGcmParams extends Algorithm {
    additionalData?: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null;
    iv: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null;
    tagLength?: number;
}

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: lib.d.tsThe issue relates to the different libraries shipped with TypeScriptFixedA PR has been merged for this issueHelp WantedYou can do this

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions