mirror of
https://github.com/balzack/databag.git
synced 2025-03-13 00:50:03 +00:00
Merge branch 'e2e' of https://github.com/balzack/databag into e2e
This commit is contained in:
commit
896a2bc691
@ -9,8 +9,6 @@ PODS:
|
||||
- ReactCommon
|
||||
- EXConstants (13.2.4):
|
||||
- ExpoModulesCore
|
||||
- EXErrorRecovery (3.2.0):
|
||||
- ExpoModulesCore
|
||||
- EXFileSystem (14.1.0):
|
||||
- ExpoModulesCore
|
||||
- EXFont (10.2.0):
|
||||
@ -476,7 +474,6 @@ DEPENDENCIES:
|
||||
- EXApplication (from `../node_modules/expo-application/ios`)
|
||||
- EXAV (from `../node_modules/expo-av/ios`)
|
||||
- EXConstants (from `../node_modules/expo-constants/ios`)
|
||||
- EXErrorRecovery (from `../node_modules/expo-error-recovery/ios`)
|
||||
- EXFileSystem (from `../node_modules/expo-file-system/ios`)
|
||||
- EXFont (from `../node_modules/expo-font/ios`)
|
||||
- Expo (from `../node_modules/expo`)
|
||||
@ -555,8 +552,6 @@ EXTERNAL SOURCES:
|
||||
:path: "../node_modules/expo-av/ios"
|
||||
EXConstants:
|
||||
:path: "../node_modules/expo-constants/ios"
|
||||
EXErrorRecovery:
|
||||
:path: "../node_modules/expo-error-recovery/ios"
|
||||
EXFileSystem:
|
||||
:path: "../node_modules/expo-file-system/ios"
|
||||
EXFont:
|
||||
@ -664,7 +659,6 @@ SPEC CHECKSUMS:
|
||||
EXApplication: e418d737a036e788510f2c4ad6c10a7d54d18586
|
||||
EXAV: 596506c9bee54ad52f2f3b625cdaeb9d9f2dd6b7
|
||||
EXConstants: 7c44785d41d8e959d527d23d29444277a4d1ee73
|
||||
EXErrorRecovery: 74d71ee59f6814315457b09d68e86aa95cc7d05d
|
||||
EXFileSystem: 927e0a8885aa9c49e50fc38eaba2c2389f2f1019
|
||||
EXFont: a5d80bd9b3452b2d5abbce2487da89b0150e6487
|
||||
Expo: fcdb32274e2ca9c7638d3b21b30fb665c6869219
|
||||
@ -680,7 +674,7 @@ SPEC CHECKSUMS:
|
||||
FirebaseInstallations: 99d24bac0243cf8b0e96cf5426340d211f0bcc80
|
||||
FirebaseMessaging: 4487bbff9b9b927ba1dd3ea40d1ceb58e4ee3cb5
|
||||
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
|
||||
glog: 3d02b25ca00c2d456734d0bcff864cbc62f6ae1a
|
||||
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
|
||||
GoogleDataTransport: 1c8145da7117bd68bbbed00cf304edb6a24de00f
|
||||
GoogleUtilities: 1d20a6ad97ef46f67bbdec158ce00563a671ebb7
|
||||
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
|
||||
|
@ -400,7 +400,7 @@ export function useConversationContext() {
|
||||
setView.current++;
|
||||
conversationId.current = null;
|
||||
reset.current = true;
|
||||
updateState({ subject: null, logo: null, contacts: [], topics: new Map() });
|
||||
updateState({ subject: null, logo: null, locked: true, unlocked: false, contacts: [], topics: new Map() });
|
||||
}
|
||||
else if (selected.cardId !== conversationId.current?.cardId || selected.channelId !== conversationId.current?.channelId) {
|
||||
setView.current++;
|
||||
|
@ -161,7 +161,7 @@ export function useTopicItem(item, hosting, remove, sealed, sealKey) {
|
||||
const deletable = editable || hosting;
|
||||
|
||||
updateState({ logo, name, nameSet, known, sealed, message, fontSize, fontColor, timestamp, transform, status, assets, deletable, editable, editData: parsed, editMessage: message });
|
||||
}, [card, item]);
|
||||
}, [sealKey, card, item]);
|
||||
|
||||
const actions = {
|
||||
showCarousel: (index) => {
|
||||
|
@ -36,19 +36,29 @@ export function useConversation() {
|
||||
setState((s) => ({ ...s, ...value }));
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
let sealKey;
|
||||
unlockSeal = async () => {
|
||||
const { locked, seals } = conversation.state;
|
||||
if (seals?.length) {
|
||||
seals.forEach(seal => {
|
||||
if (seal.publicKey === account.state.sealKey?.public) {
|
||||
const key = '-----BEGIN RSA PRIVATE KEY-----\n' + account.state.sealKey.private + '\n-----END RSA PRIVATE KEY-----'
|
||||
RSA.decrypt(seal.sealedKey, key).then(sealKey => {
|
||||
updateState({ locked, sealKey });
|
||||
});
|
||||
try {
|
||||
let sealKey;
|
||||
if (seals?.length) {
|
||||
for (let i = 0; i < seals.length; i++) {
|
||||
const seal = seals[i];
|
||||
if (seal.publicKey === account.state.sealKey?.public) {
|
||||
const key = '-----BEGIN RSA PRIVATE KEY-----\n' + account.state.sealKey.private + '\n-----END RSA PRIVATE KEY-----'
|
||||
const sealKey = await RSA.decrypt(seal.sealedKey, key);
|
||||
return updateState({ locked, sealKey });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
return updateState({ locked, sealKey: null });
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
unlockSeal();
|
||||
}, [conversation.state.locked, conversation.state.seals, account.state.sealKey])
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -311,6 +311,22 @@ export function useCardContext() {
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
isUnsealed: (cardId, channelId, sealKey) => {
|
||||
try {
|
||||
const card = cards.current.get(cardId);
|
||||
const channel = card.channels.get(channelId);
|
||||
const { seals } = JSON.parse(channel.data.channelDetail.data);
|
||||
for (let i = 0; i < seals.length; i++) {
|
||||
if (seals[i].publicKey === sealKey.public) {
|
||||
return sealKey.private != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
unsealChannelSummary: (cardId, channelId, sealKey) => {
|
||||
try {
|
||||
const card = cards.current.get(cardId);
|
||||
|
@ -164,6 +164,21 @@ export function useChannelContext() {
|
||||
console.log(err);
|
||||
}
|
||||
},
|
||||
isUnsealed: (channelId, sealKey) => {
|
||||
try {
|
||||
const channel = channels.current.get(channelId);
|
||||
const { seals } = JSON.parse(channel.data.channelDetail.data);
|
||||
for (let i = 0; i < seals.length; i++) {
|
||||
if (seals[i].publicKey === sealKey.public) {
|
||||
return sealKey.private != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
console.log(err);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
unsealChannelSummary: (channelId, sealKey) => {
|
||||
try {
|
||||
const channel = channels.current.get(channelId);
|
||||
|
@ -21,7 +21,15 @@ export function ChannelItem({ item, openChannel, active }) {
|
||||
<SolutionOutlined />
|
||||
</div>
|
||||
<div class="details">
|
||||
<div class="subject">{ item.subject }</div>
|
||||
<div class="subject">
|
||||
{ item.locked && !item.unlocked && (
|
||||
<LockFilled style={{ paddingRight: 8 }}/>
|
||||
)}
|
||||
{ item.locked && item.unlocked && (
|
||||
<UnlockOutlined style={{ paddingRight: 8 }}/>
|
||||
)}
|
||||
<span>{ item.subject }</span>
|
||||
</div>
|
||||
<div class="message">{ item.message }</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -166,7 +166,12 @@ export function useChannels() {
|
||||
}
|
||||
}
|
||||
else {
|
||||
chan.unlocked = true;
|
||||
if (chan.cardId) {
|
||||
chan.unlocked = card.actions.isUnsealed(chan.cardId, chan.id, account.state.sealKey);
|
||||
}
|
||||
else {
|
||||
chan.unlocked = channel.actions.isUnsealed(chan.id, account.state.sealKey);
|
||||
}
|
||||
subject = chan.data.unsealedChannel.subject;
|
||||
}
|
||||
}
|
||||
@ -200,7 +205,7 @@ export function useChannels() {
|
||||
}
|
||||
|
||||
const setMessage = (chan) => {
|
||||
let message;
|
||||
let message = '';
|
||||
if (chan.data.channelSummary?.lastTopic?.dataType === 'superbasictopic') {
|
||||
try {
|
||||
message = JSON.parse(chan.data.channelSummary.lastTopic.data).text;
|
||||
@ -211,17 +216,20 @@ export function useChannels() {
|
||||
}
|
||||
if (chan.data.channelSummary?.lastTopic?.dataType === 'sealedtopic') {
|
||||
try {
|
||||
if (chan.data.unsealedSummary == null) {
|
||||
if (chan.cardId) {
|
||||
card.actions.unsealChannelSummary(chan.cardId, chan.id, account.state.sealKey);
|
||||
if (chan.unlocked) {
|
||||
message = "...";
|
||||
if (chan.data.unsealedSummary == null) {
|
||||
if (chan.cardId) {
|
||||
card.actions.unsealChannelSummary(chan.cardId, chan.id, account.state.sealKey);
|
||||
}
|
||||
else {
|
||||
channel.actions.unsealChannelSummary(chan.id, account.state.sealKey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
channel.actions.unsealChannelSummary(chan.id, account.state.sealKey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (typeof chan.data.unsealedSummary.message.text === 'string') {
|
||||
chan.message = chan.data.unsealedSummary.message.text;
|
||||
if (typeof chan.data.unsealedSummary.message.text === 'string') {
|
||||
message = chan.data.unsealedSummary.message.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,7 +277,7 @@ export function useChannels() {
|
||||
updateState({ channels: filtered });
|
||||
|
||||
// eslint-disable-next-line
|
||||
}, [channel, card, store, filter, state.sealable]);
|
||||
}, [account, channel, card, store, filter, state.sealable]);
|
||||
|
||||
useEffect(() => {
|
||||
updateState({ display: viewport.state.display });
|
||||
|
Loading…
Reference in New Issue
Block a user