Async extensions

Hello! Lately, I’ve been trying to add asynchronous (as in the JS async keyword) extensions to my Snap! fork in src/extensions.js, but I can’t seem to figure out the proper way to accomplish it.

Normally, I would just use synchronous functions, but here I need to invoke asynchronous WebCrypto APIs.

Does anyone know what the proper method is here?

I would look at the cst_load(url) extension as that fetches the costume asynchronously while still being in one snap block call (the actual function is called repeatedly though)

There are two ways.
Implicit way - you may look at Web service access (https)
cst_load(url) @ extension.js.
Or explicit way i.e., return the closure that returns the computation result (placeholder).
And call those function in script until completion flag/result is returned.
Search the forum for js promise.