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

Extend/rewrite k6/crypto #2248

Closed
mstoykov opened this issue Nov 18, 2021 · 3 comments
Closed

Extend/rewrite k6/crypto #2248

mstoykov opened this issue Nov 18, 2021 · 3 comments
Assignees
Labels
evaluation needed proposal needs to be validated or tested before fully implementing it in k6 feature js-compat

Comments

@mstoykov
Copy link
Contributor

mstoykov commented Nov 18, 2021

Feature Description

A long time ago we got a pretty big PR extending k6/crypto in #1025 at the time one of the biggest problems was that ArrayBuffer was not supported. This meant that the returned data was pretty hard to work with and was very not js like.

Additionally (and likely even more importantly) having a custom crypto API that is absolutely nothing like anything else in the js ecosystem adds two problems:

  1. we need to design an API and hopefully do a good job at it
  2. users now have to learn it and if they use some other API for some code they want to reuse, they now need to either rewrite their code or make a proxy between the API they use and ours :(

At the time the major possible things to implement were webcrypto and node.js' crypto with the webcrypto being more of standard winning slightly. This though also leads to the fact that up to recently there was also no support for Promises in k6.

The combinations of all of those things and lack of actual resources to work on this either way lead to it being dropped and the PR was finally closed when an extension implementing some parts of this was created by a third party, thanks @szkiba.

Suggested Solution (optional)

While promises and event loops aren't yet (fully) functional in k6, it's now being worked on meaning that it's probably a good idea to start discussing and gathering info on what the API will look like and whether we will be copying just some other already existing API.

I am very much of the opinion that webcrypto is the way, but input from actual js developers who have had some interactions with crypto(graphy not currency) APIs will a lot more valuable. I know that some higher-level APIs just wrap around either webcrypto or nodejs' crypto and if that is the case for the most popular one, I guess we can just go with one of the lower levels once and call it a day.

After we have some more idea on what API we would like to implement, this will likely happen in a separate extension. The development will likely reveal problems that we haven't found so far and is unlikely to take less than 1 cycle.

Lists of things blocked on it(to be edited):

@mstoykov mstoykov added feature js-compat evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Nov 18, 2021
@na-- na-- changed the title [Feature Request]: Extend/rewrite k6/crypto Extend/rewrite k6/crypto Nov 22, 2021
@oleiade
Copy link
Member

oleiade commented Mar 24, 2022

For later reference: SubtleCrypto

@olegbespalov
Copy link
Contributor

Seems like we could close this since we already have a k6/experimental/webcrypto and #3154, WDYT?

@mstoykov
Copy link
Contributor Author

Close it in favor of #3154

@mstoykov mstoykov closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluation needed proposal needs to be validated or tested before fully implementing it in k6 feature js-compat
Projects
None yet
Development

No branches or pull requests

3 participants