Skip to content

Commit 78a9133

Browse files
committed
Update parameters names to be consistent with implementation
#24
1 parent ef7816d commit 78a9133

File tree

7 files changed

+13
-19
lines changed

7 files changed

+13
-19
lines changed

.prettierrc.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,4 @@ module.exports = {
99
jsxBracketSameLine: false,
1010
arrowParens: 'avoid',
1111
proseWrap: 'never',
12-
overrides: [
13-
{
14-
files: '*.vue',
15-
options: {
16-
printWidth: 100,
17-
},
18-
parser: 'vue',
19-
},
20-
],
2112
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ var Aes = NativeModules.Aes
6666

6767
const generateKey = (password, salt, cost, length) => Aes.pbkdf2(password, salt, cost, length)
6868

69-
const encrypt = (text, keyBase64) => {
69+
const encrypt = (text, key) => {
7070
return Aes.randomKey(32).then(iv => {
71-
return Aes.encrypt(text, keyBase64, iv).then(cipher => ({
71+
return Aes.encrypt(text, key, iv).then(cipher => ({
7272
cipher,
7373
iv,
7474
}))

android/src/main/java/com/tectiv3/aes/RCTAes.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public class RCTAes extends ReactContextBaseJavaModule {
4444
private static final String CIPHER_ALGORITHM = "AES/CBC/PKCS7Padding";
4545
public static final String HMAC_SHA_256 = "HmacSHA256";
4646
private static final String KEY_ALGORITHM = "AES";
47-
private static final String SECRET_KEY_ALGORITHM = "PBEWithSHA256And256BitAES-CBC-BC";
4847

4948
public RCTAes(ReactApplicationContext reactContext) {
5049
super(reactContext);
@@ -56,9 +55,9 @@ public String getName() {
5655
}
5756

5857
@ReactMethod
59-
public void encrypt(String data, String keyBase64, String ivBase64, Promise promise) {
58+
public void encrypt(String data, String key, String iv, Promise promise) {
6059
try {
61-
String result = encrypt(data, keyBase64, ivBase64);
60+
String result = encrypt(data, key, iv);
6261
promise.resolve(result);
6362
} catch (Exception e) {
6463
promise.reject("-1", e.getMessage());

index.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
declare module '@tectiv3/react-native-aes-crypto' {
2-
function pbkdf2(password: string, salt: string): Promise<string>;
2+
function pbkdf2(password: string, salt: string, cost: number, length: number): Promise<string>;
33
function encrypt(text: string, key: string, iv: string): Promise<string>;
44
function decrypt(ciphertext: string, key: string, iv: string): Promise<string>;
55
function hmac256(ciphertext: string, key: string): Promise<string>;
6+
function randomKey(length: number): Promise<string>;
67
function sha1(text: string): Promise<string>;
78
function sha256(text: string): Promise<string>;
89
function sha512(text: string): Promise<string>;

ios/RCTAes.xcodeproj/project.pbxproj

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
32D980D51BE9F11C00FA27E5 /* Project object */ = {
106106
isa = PBXProject;
107107
attributes = {
108-
LastUpgradeCheck = 1010;
108+
LastUpgradeCheck = 1020;
109109
ORGANIZATIONNAME = tectiv3;
110110
TargetAttributes = {
111111
32D980DC1BE9F11C00FA27E5 = {
@@ -115,10 +115,11 @@
115115
};
116116
buildConfigurationList = 32D980D81BE9F11C00FA27E5 /* Build configuration list for PBXProject "RCTAes" */;
117117
compatibilityVersion = "Xcode 8.0";
118-
developmentRegion = English;
118+
developmentRegion = en;
119119
hasScannedForEncodings = 0;
120120
knownRegions = (
121121
en,
122+
Base,
122123
);
123124
mainGroup = 32D980D41BE9F11C00FA27E5;
124125
productRefGroup = 32D980DE1BE9F11C00FA27E5 /* Products */;
@@ -147,6 +148,7 @@
147148
isa = XCBuildConfiguration;
148149
buildSettings = {
149150
ALWAYS_SEARCH_USER_PATHS = NO;
151+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
150152
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
151153
CLANG_CXX_LIBRARY = "libc++";
152154
CLANG_ENABLE_MODULES = YES;
@@ -200,6 +202,7 @@
200202
isa = XCBuildConfiguration;
201203
buildSettings = {
202204
ALWAYS_SEARCH_USER_PATHS = NO;
205+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
203206
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
204207
CLANG_CXX_LIBRARY = "libc++";
205208
CLANG_ENABLE_MODULES = YES;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-aes-crypto",
3-
"version": "1.3.4",
3+
"version": "1.3.5",
44
"description": "AES crypto native module for react-native",
55
"main": "index.js",
66
"types": "index.d.ts",

react-native-aes.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Pod::Spec.new do |s|
33
s.name = 'react-native-aes'
4-
s.version = '1.3.2'
4+
s.version = '1.3.5'
55
s.summary = 'Native module for AES encryption'
66
s.author = "tectiv3"
77
s.license = 'MIT'

0 commit comments

Comments
 (0)