-
Notifications
You must be signed in to change notification settings - Fork 444
feat: completely factorize SubtleCrypto.generateKey() #2050
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
base: main
Are you sure you want to change the base?
feat: completely factorize SubtleCrypto.generateKey() #2050
Conversation
Thanks for the PR! This section of the codebase is owned by @saschanaz - if they write a comment saying "LGTM" then it will be merged. |
53beb15
to
0dc3d22
Compare
"typeParameters": [ | ||
{ | ||
"name": "T", | ||
"extends": "{ name: string }" | ||
} | ||
], | ||
"param": [ | ||
{ | ||
"name": "algorithm", | ||
"overrideType": "string | T" | ||
} | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary generic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this generic is needed, or else the fallback signature will fail to capture poosibly-work algorithm
object with extra attibutes other than name
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No-one's raised any issues with AlgorithmIdentifier
; this seems an arbitrary modification.
Opening this PR in favor of this comment from @Renegade334 in my another PR in DT repo.
Since https://nodejs.org/api/webcrypto.html#cryptokeyusages lists the usages in its own table, and it is closely aligned to the MDN reference in https://developer.mozilla.org/docs/Web/API/SubtleCrypto/generateKey, I believe it is possible to raise such change to
@types/web
as well.Potentially we can do this to other methods in the key-usages table, but let's see how reviewers think about this change, then we may perform the refactoring incrementally in subsequent PRs.
Fallback signature is also updated, in favor of matching richer shape of possible
Algorithm
object.