diff --git a/src/plugin.ts b/src/plugin.ts index 1ea14bb..7577f3f 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -647,10 +647,9 @@ export type HttpRequest = { method: string; }; -export const embeddedRuntime = - 'AGFzbQEAAAABMApgAX8AYAN/f38Bf2ACf38AYAF+AX5gAX4AYAF+AX9gAn5/AGACfn4AYAABfmAAAAMaGQABAQACAgMEAwUDBQMGBwcHCAgICAkECAgEBQFwAQMDBQMBABEGGQN/AUGAgMAAC38AQfiAwAALfwBBgIHAAAsHlQMWBm1lbW9yeQIADGV4dGlzbV9hbGxvYwAGC2V4dGlzbV9mcmVlAAcNZXh0aXNtX2xlbmd0aAAIDmV4dGlzbV9sb2FkX3U4AAkPZXh0aXNtX2xvYWRfdTY0AAoUZXh0aXNtX2lucHV0X2xvYWRfdTgACxVleHRpc21faW5wdXRfbG9hZF91NjQADA9leHRpc21fc3RvcmVfdTgADRBleHRpc21fc3RvcmVfdTY0AA4QZXh0aXNtX2lucHV0X3NldAAPEWV4dGlzbV9vdXRwdXRfc2V0ABATZXh0aXNtX2lucHV0X2xlbmd0aAARE2V4dGlzbV9pbnB1dF9vZmZzZXQAEhRleHRpc21fb3V0cHV0X2xlbmd0aAATFGV4dGlzbV9vdXRwdXRfb2Zmc2V0ABQMZXh0aXNtX3Jlc2V0ABUQZXh0aXNtX2Vycm9yX3NldAAWEGV4dGlzbV9lcnJvcl9nZXQAFxNleHRpc21fbWVtb3J5X2J5dGVzABgKX19kYXRhX2VuZAMBC19faGVhcF9iYXNlAwIJCAEAQQELAgMFCoYQGQQAAAALtQEBA38CQAJAIAJBD0sNACAAIQMMAQsgAEEAIABrQQNxIgRqIQUCQCAERQ0AIAAhAwNAIAMgAToAACADQQFqIgMgBUkNAAsLIAUgAiAEayIEQXxxIgJqIQMCQCACQQFIDQAgAUH/AXFBgYKECGwhAgNAIAUgAjYCACAFQQRqIgUgA0kNAAsLIARBA3EhAgsCQCACRQ0AIAMgAmohBQNAIAMgAToAACADQQFqI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gA3AgAgAUEBNgIMIAFBoIDAgAA2AgggAUGQgMCAADYCECABQQhqQbSAwIAAEISAgIAAAAtBACgC9IDAgABBEHQhAgsgAKdBdGoiA0UNACACKQMIIAJBEGqtfCAAWA0AIANBAjoAAAsgAUEgaiSAgICAAAuAAgMBfwF+An8jgICAgABBIGsiASSAgICAAEIAIQICQCAAUA0AQQBBAC0A8IDAgAAiA0EBIAMbOgDwgMCAAAJAAkAgAw0AQQBBAUAAIgM2AvSAwIAAAkAgA0F/Rg0AIANBEHQiA0IANwMAIANC8P8DNwMIIANBEHJBAEGQARCCgICAABoMAgsgAUEUakIANwIAIAFBATYCDCABQaCAwIAANgIIIAFBkIDAgAA2AhAgAUEIakG0gMCAABCEgICAAAALQQAoAvSAwIAAQRB0IQMLIACnQXRqIgRFDQAgAykDCCADQRBqrXwgAFgNACAENQIIIQILIAFBIGokgICAgAAgAgsIACAApy0AAAsIACAApykDAAsSAEEAKQPIgMCAACAAfKctAAALEgBBACkDyIDAgAAgAHynKQMACwoAIACnIAE6AAALCgAgAKcgATcDAAsYAEEAIAE3A9CAwIAAQQAgADcDyIDAgAALGABBACABNwPggMCAAEEAIAA3A9iAwIAACwsAQQApA9CAwIAACwsAQQApA8iAwIAACwsAQQApA+CAwIAACwsAQQApA9iAwIAAC/ABAQJ/I4CAgIAAQSBrIgAkgICAgABBAEIANwPogMCAAEEAQQAtAPCAwIAAIgFBASABGzoA8IDAgAACQAJAIAENAEEAQQFAACIBNgL0gMCAAAJAIAFBf0YNACABQRB0IgFCADcDACABQvD/AzcDCCABQRByQQBBkAEQgoCAgAAaDAILIABBFGpCADcCACAAQQE2AgwgAEGggMCAADYCCCAAQZCAwIAANgIQIABBCGpBtIDAgAAQhICAgAAAC0EAKAL0gMCAAEEQdCEBCyABQRBqQQAgASgCCBCCgICAABogAUIANwMAIABBIGokgICAgAALDQBBACAANwPogMCAAAsLAEEAKQPogMCAAAvWAQICfwF+I4CAgIAAQSBrIgAkgICAgABBAEEALQDwgMC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2oiAyAApyIKNgIIIAMgCjYCBCADQQE6AAALIANBDGqtQgAgAxshAgsgAUEgaiSAgICAACACC/kBAQJ/I4CAgIAAQSBrIgEkgICAgAACQAJAIABCAFENAEEAQQAtAPCAwIAAIgJBASACGzoA8IDAgAACQCACDQBBAEEBQAAiAjYC9IDAgAAgAkF/Rg0CIAJBEHQiAkIANwMAIAJC8P8DNwMIIAJBEHJBAEGQARCCgICAABoLIABCEFQNAD8AQRB0rSAAVA0AIACnQXRqQQI6AABBACkDyIDAgAAgAFINAEEAQgA3A9CAwIAACyABQSBqJICAgIAADwsgAUEUakIANwIAIAFBATYCDCABQaCAwIAANgIIIAFBkIDAgAA2AhAgAUEIakG0gMCAABCEgICAAAAL6AEDAX8BfgF/I4CAgIAAQSBrIgEkgICAgABCACECAkACQCAAUA0AQQBBAC0A8IDAgAAiA0EBIAMbOgDwgMCAAAJAIAMNAEEAQQFAACIDNgL0gMCAACADQX9GDQIgA0EQdCIDQgA3AwAgA0Lw/wM3AwggA0EQckEAQZABEIKAgIAAGgsgAEIQVA0APwBBEHStIABUDQAgAKdBfGo1AgAhAgsgAUEgaiSAgICAACACDwsgAUEUakIANwIAIAFBATYCDCABQaCAwIAANgIIIAFBkIDAgAA2AhAgAUEIakG0gMCAABCEgICAAAALJwEBf0EAIQECQCAAQhBUDQA/AEEQdK0gAFQNACAApy0AACEBCyABCywBAn5CACEBAkAgAEIHfCICQhBUDQAgAj8AQRB0rVYNACAApykDACEBCyABCy0BAX9BACEBAkBBACkD0IDAgAAgAFgNAEEAKQPIgMCAACAAfKctAAAhAQsgAQswAQF+QgAhAQJAIABCCHxBACkD0IDAgABWDQBBACkDyIDAgAAgAHynKQMAIQELIAELHwACQCAAQhBUDQA/AEEQdK0gAFQNACAApyABOgAACwsmAQF+AkAgAEIHfCICQhBUDQAgAj8AQRB0rVYNACAApyABNwMACwucAgICfwJ+I4CAgIAAQSBrIgIkgICAgABBAEEALQDwgMCAACIDQQEgAxs6APCAwIAAAkACQCAD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QBBAC0A8IDAgAAiAkEBIAIbOgDwgMCAAAJAAkAgAg0AQQBBAUAAIgI2AvSAwIAAAkAgAkF/Rg0AIAJBEHQiAkIANwMAIAJC8P8DNwMIIAJBEHJBAEGQARCCgICAABoMAgsgAUEUakIANwIAIAFBATYCDCABQaCAwIAANgIIIAFBkIDAgAA2AhAgAUEIakG0gMCAABCEgICAAAALQQAoAvSAwIAAQRB0IQILIAJBEGqtIgMgAFYNASACKQMIIAN8IABYDQELQQAgADcD6IDAgAALIAFBIGokgICAgAALCwBBACkD6IDAgAAL1gECAn8BfiOAgICAAEEgayIAJICAgIAAQQBBAC0A8IDAgAAiAUEBIAEbOgDwgMCAAAJAAkAgAQ0AQQBBAUAAIgE2AvSAwIAAAkAgAUF/Rg0AIAFBEHQiAUIANwMAIAFC8P8DNwMIIAFBEHJBAEGQARCCgICAABoMAgsgAEEUakIANwIAIABBATYCDCAAQaCAwIAANgIIIABBkIDAgAA2AhAgAEEIakG0gMCAABCEgICAAAALQQAoAvSAwIAAQRB0IQELIAEpAwghAiAAQSBqJICAgIAAIAILC00BAEGAgMAAC0QBAAAAAAAAAAEAAAACAAAAT3V0IG9mIG1lbW9yeQAAABAAEAANAAAAc3JjL2xpYi5ycwAAKAAQAAoAAACbAAAADQAAAA=='; -export const embeddedRuntimeHash = '1a8172a36acc75aa49c35663c1bb5d89c6ae681863540c7d0afc9e0b93727c59' +export const embeddedRuntimeHash = 'aab40a25b5edda3fc5c9d1de1bf17af9ce5d02cbac1bacf5bdfa495b4ab9fc39' class Allocator { #extism: WebAssembly.Instance; diff --git a/update-kernel.js b/update-kernel.js index 1656256..9b6561d 100644 --- a/update-kernel.js +++ b/update-kernel.js @@ -1,17 +1,25 @@ -const fs = require("fs") -const crypto = require("crypto") +const fs = require("fs"); +const crypto = require("crypto"); async function main() { - const pluginPath = 'src/plugin.ts' - let pluginContents = await fs.promises.readFile(pluginPath, 'utf8'); + const pluginPath = "src/plugin.ts"; + let pluginContents = await fs.promises.readFile(pluginPath, "utf8"); - const kernelPath = 'wasm/extism-runtime.wasm' - const wasmContents = await fs.promises.readFile(kernelPath); - const kernelBase64 = wasmContents.toString('base64'); - const kernelHash = await crypto.createHash('sha256').update(wasmContents).digest('hex'); + const kernelPath = "wasm/extism-runtime.wasm"; + const kernelContents = await fs.promises.readFile(kernelPath); + const kernelBase64 = kernelContents.toString("base64"); + const kernelHash = await crypto.createHash("sha256").update(kernelContents) + .digest("hex"); + console.log(kernelHash); - pluginContents = pluginContents.replace(/embeddedRuntime =\s*'.*'/, `embeddedRuntime =\n\t'${kernelBase64}'`); - pluginContents = pluginContents.replace(/embeddedRuntimeHash =\s*'.*''/, `embeddedRuntimeHash = '${kernelHash}'`); + pluginContents = pluginContents.replace( + /embeddedRuntime = '.*'/, + `embeddedRuntime = '${kernelBase64}'`, + ); + pluginContents = pluginContents.replace( + /embeddedRuntimeHash = '.*'/, + `embeddedRuntimeHash = '${kernelHash}'`, + ); await fs.promises.writeFile(pluginPath, pluginContents); } diff --git a/wasm/extism-runtime.wasm b/wasm/extism-runtime.wasm index 12043bc..5f3ead8 100755 Binary files a/wasm/extism-runtime.wasm and b/wasm/extism-runtime.wasm differ