How to use the react-native-rsa-native.RSAKeychain.decrypt 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 keychainDemo = async () => {

  const keys = await RSAKeychain.generate(keyTag)
  console.log(keys.public);
  console.log(secret);

  const encodedMessage = await RSAKeychain.encrypt(secret, keyTag)
  console.log(encodedMessage);
  const message = await RSAKeychain.decrypt(encodedMessage, keyTag)
  console.log(message);
  const signature = await RSAKeychain.sign(secret, keyTag)
  console.log('signature', signature);
  const valid = await RSAKeychain.verify(signature, secret, keyTag)
  console.log('verified', valid);
  const publicKey = await RSAKeychain.getPublicKey(keyTag)
  console.log('getPublicKey', publicKey)
  const success = await RSAKeychain.deletePrivateKey(keyTag)
  console.log('delete success', success)
}