Skip to content

Commit 0c34e57

Browse files
author
LamNguyen176
committed
add
1 parent 605489d commit 0c34e57

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,6 @@
192192
"version": "0.41.2"
193193
},
194194
"dependencies": {
195-
"react-native-crypto-algorithm": "^1.0.2"
195+
"react-native-crypto-algorithm": "1.0.2"
196196
}
197197
}

src/__tests__/Crypto.test.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import Crypto from 'react-native-crypto-algorithm';
22

3-
jest.mock('react-native-crypto-algorithm', () => ({
4-
hashSHA256: jest.fn(),
5-
encryptAES: jest.fn(),
6-
decryptAES: jest.fn(),
7-
genRSAKeyPair: jest.fn(),
8-
encryptRSA: jest.fn(),
9-
decryptRSA: jest.fn(),
10-
genHmacSecretKey: jest.fn(),
11-
encryptHmacAes: jest.fn(),
12-
decryptHmacAes: jest.fn(),
13-
verifyHmac: jest.fn(),
14-
}));
15-
163
describe('Crypto', () => {
4+
beforeEach(() => {
5+
jest.mock('react-native-crypto-algorithm', () => ({
6+
hashSHA256: jest.fn(),
7+
encryptAES: jest.fn(),
8+
decryptAES: jest.fn(),
9+
genRSAKeyPair: jest.fn(),
10+
encryptRSA: jest.fn(),
11+
decryptRSA: jest.fn(),
12+
genHmacSecretKey: jest.fn(),
13+
encryptHmacAes: jest.fn(),
14+
decryptHmacAes: jest.fn(),
15+
verifyHmac: jest.fn(),
16+
}));
17+
})
18+
1719
it('should hash value using SHA256', async () => {
1820
const mockValue = 'Hello123';
1921
const mockHash = '134563d4e440f0e418b0f382f23a2cf301af6d7f648ccfae9895018345d779a3';

yarn.lock

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10833,7 +10833,17 @@ __metadata:
1083310833
languageName: unknown
1083410834
linkType: soft
1083510835

10836-
"react-native-crypto-algorithm@^1.0.2, react-native-crypto-algorithm@workspace:., react-native-crypto-algorithm@workspace:^":
10836+
"react-native-crypto-algorithm@npm:1.0.2":
10837+
version: 1.0.2
10838+
resolution: "react-native-crypto-algorithm@npm:1.0.2"
10839+
peerDependencies:
10840+
react: "*"
10841+
react-native: "*"
10842+
checksum: 35cc06cc95b53d6520980041a875df5866883186ac8a1a152694ec027f7d2bcce85e1a6bdab8f26011b594cb75c928d65c2f75cdc06581e95f101316f226a4f4
10843+
languageName: node
10844+
linkType: hard
10845+
10846+
"react-native-crypto-algorithm@workspace:., react-native-crypto-algorithm@workspace:^":
1083710847
version: 0.0.0-use.local
1083810848
resolution: "react-native-crypto-algorithm@workspace:."
1083910849
dependencies:
@@ -10853,7 +10863,7 @@ __metadata:
1085310863
react: 18.3.1
1085410864
react-native: 0.75.4
1085510865
react-native-builder-bob: ^0.30.2
10856-
react-native-crypto-algorithm: ^1.0.2
10866+
react-native-crypto-algorithm: 1.0.2
1085710867
release-it: ^15.0.0
1085810868
turbo: ^1.10.7
1085910869
typescript: ^5.2.2

0 commit comments

Comments
 (0)