Skip to content

Commit

Permalink
Merge pull request #144 from rmarscher/lucia-wasi-fix
Browse files Browse the repository at this point in the history
[lucia] Fix argon2 hashing
  • Loading branch information
timothymiller authored Feb 14, 2024
2 parents 93c8ee3 + 4372cb8 commit 3422edd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/api/src/utils/password/argon2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ export async function invoke(args: string[]) {
const instance = new WebAssembly.Instance(argon2, {
wasi_snapshot_preview1: wasi.wasiImport,
})
await wasi.start(instance)
const errors = await stderr.readable.getReader().read()
const errorsValue = new TextDecoder().decode(errors.value)
const promise = wasi.start(instance)
const errors = stderr.readable.getReader().read()
const ret = stdout.readable.getReader().read()
const [errorsStream, resultStream, _] = await Promise.all([errors, ret, promise])
const errorsValue = new TextDecoder().decode(errorsStream.value)
if (errorsValue) {
throw new Error(errorsValue)
}
const ret = await stdout.readable.getReader().read()
const retValue = new TextDecoder().decode(ret.value)
const retValue = new TextDecoder().decode(resultStream.value)
return retValue.trim()
}

Expand Down

0 comments on commit 3422edd

Please sign in to comment.