UNPKG

371 BJavaScriptView Raw
1//
2
3const stringify = require('json-stringify-deterministic');
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(stringify(args), signature, 'utf8', 'base64');
9};