Skip to content
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

Define return types of SubtleCrypto methods with more specific types #293

Closed
saschanaz opened this issue Oct 26, 2021 · 1 comment · Fixed by #388
Closed

Define return types of SubtleCrypto methods with more specific types #293

saschanaz opened this issue Oct 26, 2021 · 1 comment · Fixed by #388

Comments

@saschanaz
Copy link
Member

Currently most of them use just Promise<any>, but many algorithms always returns the same type of value:

  • encrypt: ArrayBuffer
  • decrypt: ArrayBuffer
  • sign: ArrayBuffer
  • verify: boolean
  • generateKey: (CryptoKey or CryptoKeyPair)
  • etc.

I guess it's any for extensibility but I doubt the above methods will have different return values, or can they?

@twiss
Copy link
Member

twiss commented Oct 26, 2021

Hey 👋 I think the rationale is/was that theoretically, another spec could define an algorithm (as per section 3.1) with operations which return a different type. That being said, I think that would obviously be a bad idea, and we may want to get rid of this extensibility anyway (as per #286 (comment)). After we get rid of that, we could make these types more specific, too 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants