Skip to content

TypeScript wrong WebCrypto Algorithm params #23057

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
microshine opened this issue Apr 2, 2018 · 1 comment
Closed

TypeScript wrong WebCrypto Algorithm params #23057

microshine opened this issue Apr 2, 2018 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@microshine
Copy link

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;
}
@mhegazy mhegazy added Bug A bug in TypeScript Help Wanted You can do this Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript labels Apr 2, 2018
@mhegazy mhegazy added this to the Community milestone Apr 2, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Apr 2, 2018

PRs welcomed. You can find more information about contributing lib.d.ts fixes at https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md#contributing-libdts-fixes.

@mhegazy mhegazy modified the milestones: Community, TypeScript 2.9 Apr 6, 2018
@mhegazy mhegazy self-assigned this Apr 6, 2018
@mhegazy mhegazy added the Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet label Apr 6, 2018
@mhegazy mhegazy modified the milestones: TypeScript 2.9, TypeScript 3.0 May 8, 2018
@mhegazy mhegazy added Fixed A PR has been merged for this issue and removed Fixed in TSJS repo Fix merged in https://github.com/Microsoft/TSJS-lib-generator, but not ported yet labels Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

2 participants