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; +}