Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules/
coverage/
dist/
.emscripten/
.wit-bindgen/
.e2e-results/
.run-playwright/

Expand Down
37 changes: 37 additions & 0 deletions argon2.wit
Original file line number Diff line number Diff line change
@@ -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<u32>,
time-cost: option<u32>,
memory-cost: option<u32>,
parallelism: option<u32>,
argon2-type: option<argon2-type>,
argon2-version: option<argon2-version>
}

record data {
encoded: string,
// TODO: Use fixed size lists, see https://github.com/bytecodealliance/wit-bindgen/pull/1277
hash: tuple<u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8, u8>
}
}

world argon2 {
use types.{argon2-type, options, data};

export initialize: func();
export hash: func(password: string, salt: list<u8>, options: option<options>) -> result<data, string>;
export verify: func(encoded: string, password: string, argon2-type: option<argon2-type>) -> result<bool, string>;
}
Loading