@polkadot/client-keyring
Version:
24 lines (21 loc) • 734 B
JavaScript
;
// Copyright 2017-2018 Jaco Greeff
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
var naclSign = require('@polkadot/util-crypto/nacl/sign');
var naclVerify = require('@polkadot/util-crypto/nacl/verify');
var u8aToString = require('@polkadot/util/u8a/toString');
module.exports = function pair(_ref) {
var publicKey = _ref.publicKey,
secretKey = _ref.secretKey;
return {
id: u8aToString(publicKey),
publicKey: publicKey,
sign: function sign(message) {
return naclSign(message, secretKey);
},
verify: function verify(message, signature) {
return naclVerify(message, signature, publicKey);
}
};
};