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

Node compat crypto.createSecretKey #17844

Closed
Jakob5358 opened this issue Jan 9, 2023 · 3 comments · Fixed by #18413
Closed

Node compat crypto.createSecretKey #17844

Jakob5358 opened this issue Jan 9, 2023 · 3 comments · Fixed by #18413
Assignees

Comments

@Jakob5358
Copy link

Is your feature request related to a problem? Please describe.

I'm trying to convert my sveltekit app to use deno, but I keep getting a problem from my auth library authjs that goes like: JWTSessionError: Not implemented: crypto.createSecretKey If you navigate to node/internal/keys.ts you find this piece of code which I think is the where the error is being thrown from:

export function createSecretKey(
  _key: string | ArrayBufferView,
  _encoding?: string,
): KeyObject {
  notImplemented("crypto.createSecretKey");
}

Describe the solution you'd like

I'd like the function to be implemented.

Describe alternatives you've considered

None

@Jakob5358
Copy link
Author

@bartlomieju

@bartlomieju
Copy link
Member

Appears it's quite popular in various Node.js libraries for auth. @kt3k could we prioritize this one?

@kt3k kt3k self-assigned this Jan 12, 2023
@kt3k kt3k mentioned this issue Feb 21, 2023
14 tasks
@iuioiua
Copy link
Contributor

iuioiua commented Jan 31, 2023

I'll give this a crack.

@kt3k kt3k transferred this issue from denoland/std Feb 21, 2023
littledivy added a commit that referenced this issue 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
mmastrac pushed a commit that referenced this issue 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants