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

feat(ext/node): implement crypto.createSecretKey #18413

Merged
merged 4 commits into from
Mar 24, 2023

Conversation

littledivy
Copy link
Member

@littledivy littledivy commented Mar 24, 2023

This commit adds the crypto.createSecretKey API.

Key management: This follows the same approach as our WebCrypto CryptoKey impl where we use WeakMap for storing key material and a handle is passed around, such that (only internal) JS can access the key material and we don't have to explicitly close a Rust resource.

As a result, createHmac now accepts a secret KeyObject.

Closes #17844

@littledivy littledivy marked this pull request as ready for review March 24, 2023 12:53
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any tests you can enable for this feature?

ext/node/crypto/keys.rs Outdated Show resolved Hide resolved
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great works, it's nice you didn't have to add any ops

@littledivy littledivy enabled auto-merge (squash) March 24, 2023 14:09
@littledivy littledivy merged commit d740a9e into denoland:main Mar 24, 2023
mmastrac pushed a commit that referenced this pull request Mar 31, 2023
This commit adds the `crypto.createSecretKey` API.

Key management: This follows the same approach as our WebCrypto
CryptoKey impl where we use WeakMap for storing key material and a
handle is passed around, such that (only internal) JS can access the key
material and we don't have to explicitly close a Rust resource.

As a result, `createHmac` now accepts a secret KeyObject.

Closes #17844
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 this pull request may close these issues.

Node compat crypto.createSecretKey
2 participants