@@ -30,9 +30,11 @@ Run `react-native link react-native-aes-crypto` after which you should be able t
30
30
### Installation (Android)
31
31
32
32
##### React Native 0.60 and higher
33
- - Linking is done automatically
33
+
34
+ - Linking is done automatically
34
35
35
36
##### Using React Native Link (React Native 0.59 and lower)
37
+
36
38
- In ` android/settings.gradle `
37
39
38
40
``` gradle
@@ -71,6 +73,10 @@ protected List<ReactPackage> getPackages() {
71
73
72
74
## Usage
73
75
76
+ ### Demo project
77
+
78
+ [ link] ( https://github.com/tectiv3/react-native-aes-demo )
79
+
74
80
### Example
75
81
76
82
``` js
@@ -81,14 +87,14 @@ const generateKey = (password, salt, cost, length) => Aes.pbkdf2(password, salt,
81
87
82
88
const encryptData = (text , key ) => {
83
89
return Aes .randomKey (16 ).then (iv => {
84
- return Aes .encrypt (text, key, iv).then (cipher => ({
90
+ return Aes .encrypt (text, key, iv, ' aes-256-cbc ' ).then (cipher => ({
85
91
cipher,
86
92
iv,
87
93
}))
88
94
})
89
95
}
90
96
91
- const decryptData = (encryptedData , key ) => Aes .decrypt (encryptedData .cipher , key, encryptedData .iv )
97
+ const decryptData = (encryptedData , key ) => Aes .decrypt (encryptedData .cipher , key, encryptedData .iv , ' aes-256-cbc ' )
92
98
93
99
try {
94
100
generateKey (' Arnold' , ' salt' , 5000 , 256 ).then (key => {
0 commit comments