question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect type declaration for CryptoKeyPair

See original GitHub issue

Bug Report

🔎 Search Terms

WebCrypto, CryptoKeyPair

🕗 Version & Regression Information

  • This changed between versions 4.3 and 4.4

Description

Here is W3C spec for CryptoKeyPair dictionary.

In TS v4.4.3 type declaration for CryptoKeyPair is:

interface CryptoKeyPair {
    privateKey?: CryptoKey;
    publicKey?: CryptoKey;
}

In TS v.4.3.5:

interface CryptoKeyPair {
    privateKey: CryptoKey;
    publicKey: CryptoKey;
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
saschanazcommented, Oct 25, 2021
0reactions
saschanazcommented, Oct 25, 2021

Hmm, given that CryptoKeyPair is only used as the return value of generateKey() and the algorithm always sets both fields together, I guess it’s right to set them as non-optional. I’ll go reopen the PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CryptoKeyPair - Web APIs - MDN Web Docs
A CryptoKey object representing the private key. For encryption and decryption algorithms, this key is used to decrypt. For signing and ...
Read more >
Web Cryptography API - W3C
Abstract. This specification describes a JavaScript API for performing basic cryptographic operations in web applications, such as hashing, ...
Read more >
How to use Jest to test functions using crypto or window ...
Use the following code to set up the crypto property globally. It will allow Jest to access. window.crypto in the browser environment ...
Read more >
CryptoKey - Web APIs
Chrome Edge Firefox Internet... CryptoKey Chrome Full support 37 Edge Full support ≤18 Firefox Full support 34 IE No s... algorithm Chrome Full support 37...
Read more >
SubtleCrypto.generateKey()
algorithm is a dictionary object defining the type of key to generate and ... algorithms) or a CryptoKeyPair (for public-key algorithms).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found