How to use the react-native-rsa-native.RSA.encrypt function in react-native-rsa-native

To help you get started, we’ve selected a few react-native-rsa-native examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amitaymolko / react-native-rsa-native / example / App / App.js View on Github external
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);
}
github amitaymolko / react-native-rsa-native / example / App / App.js View on Github external
const generateKeys4096Demo = async () => {
  console.log('generateKeys4096Demo')
  const keys = await RSA.generateKeys(4096)
  console.log('4096 private:', keys.private) // the private key
  console.log('4096 public:', keys.public) // the public key
  const encodedMessage = await RSA.encrypt('4096', keys.public)
  console.log('4096 encoded message:', encodedMessage)
  const message = await RSA.decrypt(encodedMessage, keys.private)
  console.log('4096 decoded message:', message);
}