UNPKG

@plugnet/util-crypto

Version:
27 lines (21 loc) 844 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = schnorrkelVerify; require("../polyfill"); var _util = require("@plugnet/util"); var _wasmCrypto = require("@plugnet/wasm-crypto"); // Copyright 2017-2019 @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); }