mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
switching back to jsencrypt for key generation as rsa-native keys dont appear portable, even without keychain object
This commit is contained in:
parent
1b3c606c5b
commit
e5855ef188
@ -24,6 +24,7 @@
|
|||||||
"expo-keep-awake": "~10.2.0",
|
"expo-keep-awake": "~10.2.0",
|
||||||
"expo-splash-screen": "~0.16.2",
|
"expo-splash-screen": "~0.16.2",
|
||||||
"expo-status-bar": "~1.4.0",
|
"expo-status-bar": "~1.4.0",
|
||||||
|
"jsencrypt": "^3.3.1",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"react": "18.0.0",
|
"react": "18.0.0",
|
||||||
"react-dom": "18.0.0",
|
"react-dom": "18.0.0",
|
||||||
|
@ -171,7 +171,9 @@ export function useConversationContext() {
|
|||||||
if (conversationId.current) {
|
if (conversationId.current) {
|
||||||
const { cardId, channelId } = conversationId.current;
|
const { cardId, channelId } = conversationId.current;
|
||||||
const channelItem = getChannel(cardId, channelId);
|
const channelItem = getChannel(cardId, channelId);
|
||||||
setChannel(channelItem);
|
if (channelItem) {
|
||||||
|
setChannel(channelItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, [card, channel]);
|
}, [card, channel]);
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ import { AccountContext } from 'context/AccountContext';
|
|||||||
import { AppContext } from 'context/AppContext';
|
import { AppContext } from 'context/AppContext';
|
||||||
import config from 'constants/Config';
|
import config from 'constants/Config';
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
import { JSEncrypt } from 'jsencrypt'
|
||||||
|
|
||||||
import { RSA } from 'react-native-rsa-native';
|
import { RSA } from 'react-native-rsa-native';
|
||||||
|
|
||||||
export function useProfileBody() {
|
export function useProfileBody() {
|
||||||
@ -122,13 +124,13 @@ export function useProfileBody() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// generate rsa key for sealing channel, delay for activity indicator
|
// generate rsa key for sealing channel, delay for activity indicator
|
||||||
const keys = await RSA.generateKeys(2048);
|
const crypto = new JSEncrypt({ default_key_size: 2048 });
|
||||||
console.log("NEW KEYS", keys);
|
const key = crypto.getKey();
|
||||||
|
|
||||||
// encrypt private key
|
// encrypt private key
|
||||||
const iv = CryptoJS.lib.WordArray.random(128 / 8);
|
const iv = CryptoJS.lib.WordArray.random(128 / 8);
|
||||||
const privateKey = convertPem(keys.private);
|
const privateKey = convertPem(crypto.getPrivateKey());
|
||||||
const publicKey = convertPem(keys.public);
|
const publicKey = convertPem(crypto.getPublicKey());
|
||||||
const enc = CryptoJS.AES.encrypt(privateKey, aes, { iv: iv });
|
const enc = CryptoJS.AES.encrypt(privateKey, aes, { iv: iv });
|
||||||
|
|
||||||
const seal = {
|
const seal = {
|
||||||
|
@ -4344,6 +4344,11 @@ jscodeshift@^0.13.1:
|
|||||||
temp "^0.8.4"
|
temp "^0.8.4"
|
||||||
write-file-atomic "^2.3.0"
|
write-file-atomic "^2.3.0"
|
||||||
|
|
||||||
|
jsencrypt@^3.3.1:
|
||||||
|
version "3.3.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/jsencrypt/-/jsencrypt-3.3.1.tgz#5d47e6c1079bb50e714a36d009ba09ea81fbfa18"
|
||||||
|
integrity sha512-dVvV54GdFuJgmEKn+oBiaifDMen4p6o6j/lJh0OVMcouME8sST0bJ7bldIgKBQk4za0zyGn0/pm4vOznR25mLw==
|
||||||
|
|
||||||
jsesc@^2.5.1:
|
jsesc@^2.5.1:
|
||||||
version "2.5.2"
|
version "2.5.2"
|
||||||
resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz"
|
resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz"
|
||||||
|
Loading…
Reference in New Issue
Block a user