Skip to content

Commit 4e85fde

Browse files
author
LamNguyen176
committed
change
1 parent 0f9e277 commit 4e85fde

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/index.tsx

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
11
import { NativeModules } from 'react-native';
22

3-
const CryptoAlgorithmNative = NativeModules.CryptoAlgorithm;
3+
const { CryptoAlgorithm } = NativeModules;
44

55
export default class Crypto {
66
static hashSHA256 = (value: string) => {
7-
return CryptoAlgorithmNative.hashSHA256(value);
7+
return CryptoAlgorithm.hashSHA256(value);
88
};
99

1010
static encryptAES = (value: string, secretKey: string, ivKey?: string) => {
11-
return CryptoAlgorithmNative.encryptAES(value, secretKey, ivKey);
11+
return CryptoAlgorithm.encryptAES(value, secretKey, ivKey);
1212
};
1313

1414
static decryptAES = (value: string, secretKey: string, ivKey?: string) => {
15-
return CryptoAlgorithmNative.decryptAES(value, secretKey, ivKey);
15+
return CryptoAlgorithm.decryptAES(value, secretKey, ivKey);
1616
};
1717

1818
static genRSAKeyPair = () => {
19-
return CryptoAlgorithmNative.genRSAKeyPair();
19+
return CryptoAlgorithm.genRSAKeyPair();
2020
};
2121

2222
static encryptRSA = (value: string, publicKey: string) => {
23-
return CryptoAlgorithmNative.encryptRSA(value, publicKey);
23+
return CryptoAlgorithm.encryptRSA(value, publicKey);
2424
};
2525

2626
static decryptRSA = (value: any, privateKey: string) => {
27-
return CryptoAlgorithmNative.decryptRSA(value, privateKey);
27+
return CryptoAlgorithm.decryptRSA(value, privateKey);
2828
};
2929

3030
static genHmacSecretKey = () => {
31-
return CryptoAlgorithmNative.genSecretKey('Hmac');
31+
return CryptoAlgorithm.genSecretKey('Hmac');
3232
};
3333

3434
static encryptHmacAes = (value: string, privateKey: string)=> {
35-
return CryptoAlgorithmNative.encryptHmacAes(value, privateKey);
35+
return CryptoAlgorithm.encryptHmacAes(value, privateKey);
3636
};
3737

3838
static decryptHmacAes = (value: any, privateKey: string) => {
39-
return CryptoAlgorithmNative.decryptHmacAes(value, privateKey);
39+
return CryptoAlgorithm.decryptHmacAes(value, privateKey);
4040
};
4141

4242
static verifyHmac = (value: string, privateKey: string) => {
43-
return CryptoAlgorithmNative.verifyHmac(value, privateKey);
43+
return CryptoAlgorithm.verifyHmac(value, privateKey);
4444
};
4545
}

0 commit comments

Comments
 (0)