wasm-rquickjs-cli 0.4.15

Tool for wrapping JavaScript modules as WebAssembly components using the QuickJS engine
1
2
3
4
5
6
7
8
9
10
11
12
import assert from 'assert';
import bcrypt from 'bcrypt';

export const run = async () => {
  const password = 'correct horse battery staple';
  const hash = await bcrypt.hash(password, 4);

  assert.ok(hash.startsWith('$2'), 'Expected bcrypt hash prefix');
  assert.strictEqual(await bcrypt.compare(password, hash), true);

  return 'PASS: async hash/compare works';
};