UNPKG

expresscheckout-nodejs

Version:

Juspay's official expresscheckout-nodejs sdk

35 lines 973 B
import crypto from 'crypto'; import JuspayCryptoError from './JuspayCryptoError.js'; function readPublicKey(keyString) { if (keyString == undefined) { throw new JuspayCryptoError('Public key cannot be undefined', 'IllegalPublicKey'); } try { return crypto.createPublicKey({ key: keyString, format: 'pem' }); } catch (error) { throw new JuspayCryptoError(error, 'IllegalPublicKey'); } } function readPrivateKey(keyString) { if (keyString == undefined) { throw new JuspayCryptoError('Private key cannot be undefined', 'IllegalPrivateKey'); } try { return crypto.createPrivateKey({ key: keyString, format: 'pem' }); } catch (error) { throw new JuspayCryptoError(error, 'IllegalPrivateKey'); } } export default { readPublicKey: readPublicKey, readPrivateKey: readPrivateKey }; //# sourceMappingURL=Keys.js.map