Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
react-native-aes-crypto
Advanced tools
AES encryption/decryption for react-native
npm install --save react-native-aes-crypto
or
yarn add react-native-aes-crypto
...
include ':react-native-aes-crypto'
project(':react-native-aes-crypto').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-aes-crypto/android')
android/app/build.gradle
...
dependencies {
...
compile project(':react-native-aes-crypto')
}
......
import com.tectiv3.aes.RCTAesPackage;
......
@Override
protected List<ReactPackage> getPackages() {
......
new RCTAesPackage(),
......
}
import { NativeModules, Platform } from 'react-native'
var Aes = NativeModules.Aes
const generateKey = (password, salt, cost, length) => Aes.pbkdf2(password, salt, cost, length)
const encrypt = (text, keyBase64) => {
return Aes.randomKey(32).then(iv => {
return Aes.encrypt(text, keyBase64, iv).then(cipher => ({
cipher,
iv,
}))
})
}
const decrypt = (encryptedData, key) => Aes.decrypt(encryptedData.cipher, key, encryptedData.iv)
try {
generateKey('Arnold', 'salt', 5000, 512).then(key => {
console.log('Key:', key)
encrypt('These violent delights have violent ends', key)
.then(({ cipher, iv }) => {
console.log('Encrypted:', cipher)
decrypt({ cipher, iv }, key)
.then(text => {
console.log('Decrypted:', text)
})
.catch(error => {
console.log(error)
})
Aes.hmac256(cipher, key).then(hash => {
console.log('HMAC', hash)
})
})
.catch(error => {
console.log(error)
})
})
} catch (e) {
console.error(e)
}
async function asyncDecrypt(cipher, key, iv) {
try {
var text = await decrypt({ cipher, iv }, key)
console.log(text)
return text
} catch (e) {
console.error(e)
}
}
encrypt(text, key, iv)
decrypt(base64, key, iv)
pbkdf2(text, salt, cost, length)
hmac256(cipher, key)
sha1(text)
sha256(text)
sha512(text)
randomUuid()
randomKey(length)
FAQs
AES crypto native module for react-native
The npm package react-native-aes-crypto receives a total of 9,111 weekly downloads. As such, react-native-aes-crypto popularity was classified as popular.
We found that react-native-aes-crypto demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.