Hey team,
I'm working on a successor to Firebase, and was thinking of using wastime as a way to let users write code for permissions.
This is a noob question, but is there a way to provide "external functions" to wasmtime?
i.e say my server is on the JVM, and users write permissions in assemblyscript. If a user writes:
var foo = query("SELECT * FROM users")
Could I provide a function written in my host language, which gets called with the arguments of query
, and returns the result?
yes you can, see component model for more information (also wit-bindgen)
webassembly by itself allows exporting and importing foreign functions, but the only data types are 32 and 64 bit integers and floats
webassembly interface types let you specify higher order functions and wit-bindgen can autogenerate host and guest code that transparently convert the parameters and return value
https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md
Stepan Parunashvili has marked this topic as resolved.
Last updated: Dec 23 2024 at 12:05 UTC