var __defProp = Object.defineProperty;
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
var __export = (target, all) => {
  __markAsModule(target);
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
__export(exports, {
  verify: () => verify
});
let wasm;
{
  const module2 = new WebAssembly.Module(require('fs').readFileSync(require('path').join(__dirname, '../../src/ed25519/ed25519.wasm')));
  const instance = new WebAssembly.Instance(module2);
  wasm = instance.exports;
}
class mem {
  static length() {
    return wasm.wlen();
  }
  static alloc(size) {
    return wasm.walloc(size);
  }
  static free(ptr, size) {
    return wasm.wfree(ptr, size);
  }
  static u8(ptr, size) {
    return new Uint8Array(wasm.memory.buffer, ptr, size);
  }
  static u32(ptr, size) {
    return new Uint32Array(wasm.memory.buffer, ptr, size);
  }
  static copy_and_free(ptr, size) {
    let slice = mem.u8(ptr, size).slice();
    return wasm.wfree(ptr, size), slice;
  }
}
function verify(key, sig, buffer) {
  const kptr = mem.alloc(32);
  const sptr = mem.alloc(64);
  const bptr = mem.alloc(buffer.length);
  mem.u8(kptr, 32).set(key);
  mem.u8(sptr, 64).set(sig);
  mem.u8(bptr, buffer.length).set(buffer);
  return !!wasm.verify(bptr, buffer.length, kptr, sptr);
}
