1
0
Fork 0
mirror of https://github.com/Luzifer/wasm-openssl.git synced 2024-11-09 15:20:06 +00:00
wasm-openssl/index.js
Knut Ahlers 64dd5ad67e
Improve error handling
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-09-18 14:13:33 +02:00

17 lines
498 B
JavaScript

function decryptResponse(plaintext, error) {
console.log(["decryptResponse", plaintext, error])
}
function encryptResponse(ciphertext, error) {
console.log(["encryptResponse", ciphertext, error])
if (error === null) {
decrypt(ciphertext, "password", decryptResponse)
}
}
function opensslLoaded() {
encrypt("Knut", "password", encryptResponse)
}
const go = new Go()
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then(async obj => await go.run(obj.instance))