UNPKG

345 BJavaScriptView Raw
1//
2
3const hasher = require('./hasher');
4const NodeRSA = require('node-rsa');
5
6module.exports = (key , format = 'pkcs1-public-pem') => {
7 const publicKey = key instanceof NodeRSA ? key : new NodeRSA(key, format);
8 return (signature , ...args ) => publicKey.verify(hasher(args), signature, 'utf8', 'base64');
9};