Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const generateDemo = async () => {
console.log('generateDemo')
const keys = await RSA.generate()
console.log('private:', keys.private) // the private key
console.log('public:', keys.public) // the public key
const encodedMessage = await RSA.encrypt('1234', keys.public)
console.log('encoded message:', encodedMessage)
const message = await RSA.decrypt(encodedMessage, keys.private)
console.log('decoded message:', message);
}