apps-sdk 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apps-sdk",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Apps SDK",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,8 +10,8 @@
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "@react-native-async-storage/async-storage": "^1.21.0",
13
+ "crypto-es": "^2.1.0",
13
14
  "expo-constants": "^15.4.5",
14
- "expo-crypto": "^12.8.0",
15
15
  "expo-device": "^5.9.3",
16
16
  "expo-localization": "^14.8.3",
17
17
  "expo-notifications": "^0.23.0",
@@ -1,7 +1,7 @@
1
1
  import * as config from '../../config';
2
2
  import { default as storage } from './Storage';
3
3
  import Session from './Session';
4
- import * as Crypto from 'expo-crypto';
4
+ import CryptoES from "crypto-es";
5
5
 
6
6
  class Networking {
7
7
  constructor() {
@@ -95,12 +95,9 @@ class Networking {
95
95
 
96
96
  if (encrypt) {
97
97
  const secretKey = this.ENCRYPT_KEY;
98
- const encryptedData = await Crypto.digestStringAsync(
99
- Crypto.CryptoDigestAlgorithm.SHA256,
100
- JSON.stringify(data),
101
- { encoding: Crypto.CryptoEncoding.BASE64 }
102
- );
103
- data = { data: encryptedData };
98
+ const iv = CryptoES.lib.WordArray.random(128/8);
99
+ const encryptedData = CryptoES.AES.encrypt(JSON.stringify(data), secretKey, { iv: iv }).toString();
100
+ data = { data: iv.toString(CryptoES.enc.Base64) + '$' + encryptedData };
104
101
  headers['Content-Type'] = 'application/octet-stream';
105
102
  }
106
103