Skip to content

Commit 6e80401

Browse files
committed
Add namespace to typedef and bump ver to 2.0
1 parent 5bf0bae commit 6e80401

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

android/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
jcenter()
1515
}
1616
dependencies {
17-
classpath 'com.android.tools.build:gradle:3.4.1'
17+
classpath 'com.android.tools.build:gradle:4.0.1'
1818
}
1919
}
2020
}
@@ -65,6 +65,5 @@ dependencies {
6565
implementation 'com.facebook.react:react-native:+' // From node_modules
6666
implementation 'com.madgag.spongycastle:core:1.58.0.0'
6767
implementation 'com.madgag.spongycastle:prov:1.54.0.0'
68-
implementation 'com.madgag.spongycastle:pkix:1.54.0.0'
6968
implementation 'com.madgag.spongycastle:pg:1.54.0.0'
7069
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public String getName() {
5555
}
5656

5757
@ReactMethod
58-
public void encrypt(String data, String key, String iv, Promise promise) {
58+
public void encrypt(String data, String key, String iv, String algorithm, Promise promise) {
5959
try {
6060
String result = encrypt(data, key, iv);
6161
promise.resolve(result);
@@ -65,7 +65,7 @@ public void encrypt(String data, String key, String iv, Promise promise) {
6565
}
6666

6767
@ReactMethod
68-
public void decrypt(String data, String pwd, String iv, Promise promise) {
68+
public void decrypt(String data, String pwd, String iv, String algorithm, Promise promise) {
6969
try {
7070
String strs = decrypt(data, pwd, iv);
7171
promise.resolve(strs);

index.d.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
declare module 'react-native-aes-crypto' {
2-
function pbkdf2(password: string, salt: string, cost: number, length: number): Promise<string>
3-
function encrypt(text: string, key: string, iv: string, algorithm: string): Promise<string>
4-
function decrypt(ciphertext: string, key: string, iv: string): Promise<string>
5-
function hmac256(ciphertext: string, key: string): Promise<string>
6-
function hmac512(ciphertext: string, key: string): Promise<string>
7-
function randomKey(length: number): Promise<string>
8-
function sha1(text: string): Promise<string>
9-
function sha256(text: string): Promise<string>
10-
function sha512(text: string): Promise<string>
2+
namespace Aes {
3+
type Algorithms = 'aes-128-cbc' | 'aes-192-cbc' | 'aes-256-cbc'
4+
5+
function pbkdf2(password: string, salt: string, cost: number, length: number): Promise<string>
6+
function encrypt(text: string, key: string, iv: string, algorithm: Algorithms): Promise<string>
7+
function decrypt(ciphertext: string, key: string, iv: string, algorithm: Algorithms): Promise<string>
8+
function hmac256(ciphertext: string, key: string): Promise<string>
9+
function hmac512(ciphertext: string, key: string): Promise<string>
10+
function randomKey(length: number): Promise<string>
11+
function sha1(text: string): Promise<string>
12+
function sha256(text: string): Promise<string>
13+
function sha512(text: string): Promise<string>
14+
}
1115
}

index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict';
2-
import { NativeModules } from 'react-native';
1+
'use strict'
2+
import { NativeModules } from 'react-native'
33

4-
export default NativeModules.Aes;
4+
export default NativeModules.Aes

package.json

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

react-native-aes.podspec

+1-1
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.10'
4+
s.version = '2.0.0'
55
s.summary = 'Native module for AES encryption'
66
s.author = "tectiv3"
77
s.license = 'MIT'

0 commit comments

Comments
 (0)