From cd6de2d5386e29ac03adb88d10dd3b577a995c47 Mon Sep 17 00:00:00 2001 From: Peter Hirn Date: Mon, 26 May 2025 10:23:40 +0200 Subject: [PATCH] wip: wasm component --- .gitignore | 1 + argon2.wit | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 argon2.wit diff --git a/.gitignore b/.gitignore index 46a0161b..e581566e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules/ coverage/ dist/ .emscripten/ +.wit-bindgen/ .e2e-results/ .run-playwright/ diff --git a/argon2.wit b/argon2.wit new file mode 100644 index 00000000..ba1c4392 --- /dev/null +++ b/argon2.wit @@ -0,0 +1,37 @@ +package phi-ag:argon2; + +interface types { + enum argon2-type { + argon2d, + argon2i, + argon2id + } + + enum argon2-version { + version10, + version13, + } + + record options { + hash-length: option, + time-cost: option, + memory-cost: option, + parallelism: option, + argon2-type: option, + argon2-version: option + } + + record data { + encoded: string, + // TODO: Use fixed size lists, see https://github.com/bytecodealliance/wit-bindgen/pull/1277 + hash: tuple + } +} + +world argon2 { + use types.{argon2-type, options, data}; + + export initialize: func(); + export hash: func(password: string, salt: list, options: option) -> result; + export verify: func(encoded: string, password: string, argon2-type: option) -> result; +}