Extend/rewrite k6/crypto
#2248
Labels
evaluation needed
proposal needs to be validated or tested before fully implementing it in k6
feature
js-compat
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:
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):
The text was updated successfully, but these errors were encountered: