"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = schnorrkelVerify;

require("../polyfill");

var _util = require("@polkadot/util");

var _wasmCrypto = require("@polkadot/wasm-crypto");

// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.

/**
 * @name schnorrkelVerify
 * @description Verifies the signature of `message`, using the supplied pair
 */
function schnorrkelVerify(message, signature, publicKey) {
  const messageU8a = (0, _util.u8aToU8a)(message);
  const signatureU8a = (0, _util.u8aToU8a)(signature);
  const publicKeyU8a = (0, _util.u8aToU8a)(publicKey);
  return (0, _wasmCrypto.sr25519Verify)(signatureU8a, messageU8a, publicKeyU8a);
}