1 | //
|
2 |
|
3 | const hasher = require('./hasher');
|
4 | const NodeRSA = require('node-rsa');
|
5 |
|
6 | module.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 | };
|