diff --git a/app/client/mobile/ios/Databag.xcodeproj/project.pbxproj b/app/client/mobile/ios/Databag.xcodeproj/project.pbxproj
index e97fb077..eeeac46c 100644
--- a/app/client/mobile/ios/Databag.xcodeproj/project.pbxproj
+++ b/app/client/mobile/ios/Databag.xcodeproj/project.pbxproj
@@ -483,7 +483,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.30;
+ MARKETING_VERSION = 1.31;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -515,7 +515,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.30;
+ MARKETING_VERSION = 1.31;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
diff --git a/app/client/mobile/package.json b/app/client/mobile/package.json
index 0a2f5223..1af01c99 100644
--- a/app/client/mobile/package.json
+++ b/app/client/mobile/package.json
@@ -17,8 +17,7 @@
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0",
"@react-navigation/stack": "^6.4.1",
- "@types/crypto-js": "^4.2.2",
- "crypto-js": "^4.2.0",
+ "crypto-js": "^3.3.0",
"databag-client-sdk": "^0.0.22",
"jsencrypt": "^3.3.2",
"react": "18.2.0",
diff --git a/app/client/mobile/src/NativeCrypto.ts b/app/client/mobile/src/NativeCrypto.ts
index d588749e..4fccab1d 100644
--- a/app/client/mobile/src/NativeCrypto.ts
+++ b/app/client/mobile/src/NativeCrypto.ts
@@ -2,13 +2,12 @@ import {Crypto} from 'databag-client-sdk';
import CryptoJS from 'crypto-js';
import {JSEncrypt} from 'jsencrypt';
import {RSA} from 'react-native-rsa-native';
-import {generateSecureRandom} from 'react-native-securerandom';
export class NativeCrypto implements Crypto {
// generate salt for pbk function
public async pbkdfSalt(): Promise<{saltHex: string}> {
- const salt = await generateSecureRandom(16);
- const saltHex = this.uint8ToHexStr(salt);
+ const salt = CryptoJS.lib.WordArray.random(128 / 8);
+ const saltHex = salt.toString();
return {saltHex};
}
@@ -26,15 +25,15 @@ export class NativeCrypto implements Crypto {
// generate random aes key
public async aesKey(): Promise<{aesKeyHex: string}> {
- const aesKey = await generateSecureRandom(32);
- const aesKeyHex = this.uint8ToHexStr(aesKey);
+ const aesKey = CryptoJS.lib.WordArray.random(256 / 8);
+ const aesKeyHex = aesKey.toString();
return {aesKeyHex};
}
// generate iv to use to aes function
public async aesIv(): Promise<{ivHex: string}> {
- const iv = await generateSecureRandom(16);
- const ivHex = this.uint8ToHexStr(iv);
+ const iv = CryptoJS.lib.WordArray.random(128 / 8);
+ const ivHex = iv.toString();
return {ivHex};
}
diff --git a/app/client/mobile/src/access/Access.styled.ts b/app/client/mobile/src/access/Access.styled.ts
index 0289992b..80008a63 100644
--- a/app/client/mobile/src/access/Access.styled.ts
+++ b/app/client/mobile/src/access/Access.styled.ts
@@ -42,6 +42,7 @@ export const styles = StyleSheet.create({
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
+ backgroundColor: 'transparent',
},
split: {
display: 'flex',
diff --git a/app/client/mobile/src/card/Card.styled.ts b/app/client/mobile/src/card/Card.styled.ts
index 2771551d..8e17072d 100644
--- a/app/client/mobile/src/card/Card.styled.ts
+++ b/app/client/mobile/src/card/Card.styled.ts
@@ -29,6 +29,7 @@ export const styles = StyleSheet.create({
display: 'flex',
flexDirection: 'column',
flexGrow: 1,
+ flexShrink: 1,
paddingLeft: 8,
paddingRight: 8,
},
diff --git a/app/client/mobile/src/card/Card.tsx b/app/client/mobile/src/card/Card.tsx
index f633689a..cc703834 100644
--- a/app/client/mobile/src/card/Card.tsx
+++ b/app/client/mobile/src/card/Card.tsx
@@ -27,11 +27,13 @@ export function Card({
- {name && {name}}
- {!name && {placeholder}}
- {node ? `${handle}/${node}` : handle}
+ {name && {name}}
+ {!name && {placeholder}}
+ {node ? `${handle}/${node}` : handle}
+
+
+ {actions}
- {actions}
);
diff --git a/app/client/mobile/src/constants/Strings.ts b/app/client/mobile/src/constants/Strings.ts
index 4e31643f..3cd407a8 100644
--- a/app/client/mobile/src/constants/Strings.ts
+++ b/app/client/mobile/src/constants/Strings.ts
@@ -5,6 +5,8 @@ export const en = {
sealed: 'Sealed',
notes: 'Notes',
server: 'Server',
+ token: 'Token',
+ delayMessage: 'Key generation can take several minutes.',
code: 'en',
settings: 'Settings',
@@ -256,6 +258,8 @@ export const fr = {
sealed: 'Scellé',
notes: 'Notes',
server: 'Serveur',
+ token: 'Code',
+ delayMessage: 'La génération de clé peut prendre plusieurs minutes.',
code: 'fr',
settings: 'Paramètres',
@@ -508,7 +512,9 @@ export const sp = {
sealed: 'Sellado',
notes: 'Notas',
server: 'Server',
-
+ token: 'Código',
+ delayMessage: 'La generación de claves puede tardar varios minutos.',
+
code: 'sp',
settings: 'Configuración',
contacts: 'Contactos',
@@ -759,7 +765,9 @@ export const pt = {
sealed: 'Selado',
notes: 'Notas',
server: 'Servidor',
-
+ token: 'Code',
+ delayMessage: 'A geração da chave pode levar vários minutos.',
+
code: 'pt',
settings: 'Configurações',
contacts: 'Contatos',
@@ -1010,6 +1018,8 @@ export const de = {
sealed: 'Versiegelt',
notes: 'Notizen',
server: 'Servierer',
+ token: 'Token',
+ delayMessage: 'Die Schlüsselgenerierung kann mehrere Minuten dauern.',
code: 'de',
settings: 'Einstellungen',
@@ -1261,6 +1271,8 @@ export const ru = {
sealed: 'Запечатано',
notes: 'Заметки',
server: 'Сервер',
+ token: 'Токен',
+ delayMessage: 'Генерация ключа может занять несколько минут.',
code: 'ru',
settings: 'Настройки',
diff --git a/app/client/mobile/src/content/Content.tsx b/app/client/mobile/src/content/Content.tsx
index b73afc0b..c19f8a13 100644
--- a/app/client/mobile/src/content/Content.tsx
+++ b/app/client/mobile/src/content/Content.tsx
@@ -7,6 +7,7 @@ import {Channel} from '../channel/Channel';
import {Focus} from 'databag-client-sdk';
import {BlurView} from '@react-native-community/blur';
import {Card} from '../card/Card';
+import {Confirm} from '../confirm/Confirm';
export function Content({select}: {select: (focus: Focus) => void}) {
const [add, setAdd] = useState(false);
@@ -14,10 +15,32 @@ export function Content({select}: {select: (focus: Focus) => void}) {
const [sealed, setSealed] = useState(false);
const {state, actions} = useContent();
const theme = useTheme();
- const members = useRef(new Set());
+ const [subject, setSubject] = useState('');
+ const [members, setMembers] = useState([]);
+ const [alert, setAlert] = useState(false);
+ const [alertParams] = useState({
+ title: state.strings.operationFailed,
+ prompt: state.strings.tryAgain,
+ confirm: {
+ label: state.strings.ok,
+ action: () => setAlert(false),
+ },
+ });
const addTopic = async () => {
- console.log('add topic');
+ setAdding(true);
+ try {
+ await actions.addTopic(sealed, subject, members);
+ setAdd(false);
+ setSubject('');
+ setMembers([]);
+ setSealed(false);
+ } catch (err) {
+ console.log(err);
+ setAdd(false);
+ setAlert(true);
+ }
+ setAdding(false);
};
const cards = sealed ? state.sealable : state.connected;
@@ -119,49 +142,45 @@ export function Content({select}: {select: (focus: Focus) => void}) {
underlineStyle={styles.inputUnderline}
placeholder={state.strings.subjectOptional}
left={}
- value={state.topic}
- onChangeText={value => actions.setTopic(value)}
+ value={subject}
+ onChangeText={value => setSubject(value)}
/>
-
-
-
- {
-
- const enable = ( {
- if (flag) {
- members.current.add(item.guid);
- } else {
- members.current.delete(item.guid);
- }
- }} />)
-
- return (
-
- );
- }}
- keyExtractor={card => card.cardId}
- />
-
-
-
+
+
+ {
+ const enable = ( cardId === item.cardId))} onValueChange={flag => {
+ if (flag) {
+ setMembers([ item.cardId, ...members ]);
+ } else {
+ setMembers(members.filter(cardId => cardId != item.cardId));
+ }
+ }} />)
+ return (
+
+ );
+ }}
+ keyExtractor={card => card.cardId}
+ />
+
+
@@ -183,6 +202,7 @@ export function Content({select}: {select: (focus: Focus) => void}) {
+
);
}
diff --git a/app/client/mobile/src/content/useContent.hook.ts b/app/client/mobile/src/content/useContent.hook.ts
index 0ea0dc33..5d992d96 100644
--- a/app/client/mobile/src/content/useContent.hook.ts
+++ b/app/client/mobile/src/content/useContent.hook.ts
@@ -56,7 +56,7 @@ export function useContent() {
useEffect(() => {
const channels = state.sorted.map(channel => {
- const {cardId, channelId, unread, sealed, members, data, lastTopic} = channel;
+ const {cardId, channelId, unread, sealed, members, dataType, data, lastTopic} = channel;
const contacts = [] as (Card | undefined)[];
if (cardId) {
const card = state.cards.find(contact => contact.cardId === cardId);
@@ -110,7 +110,7 @@ export function useContent() {
};
const getMessage = () => {
- if (!lastTopic) {
+ if (!lastTopic || !lastTopic.status) {
return '';
}
if (lastTopic.dataType === 'superbasictopic') {
@@ -219,9 +219,6 @@ export function useContent() {
}, []);
const actions = {
- addChannel: () => {
- console.log('add channel');
- },
setFilter: (filter: string) => {
updateState({filter});
},
@@ -231,6 +228,15 @@ export function useContent() {
getFocus: (cardId: string | null, channelId: string) => {
return app.state.session.setFocus(cardId, channelId);
},
+ addTopic: async (sealed: boolean, subject: string, contacts: string[]) => {
+ const content = app.state.session.getContent();
+ await new Promise(r => setTimeout(r, 2000));
+ if (sealed) {
+ await content.addChannel(true, 'sealed', {subject}, contacts);
+ } else {
+ await content.addChannel(false, 'superbasic', {subject}, contacts);
+ }
+ },
};
return {state, actions};
diff --git a/app/client/mobile/src/settings/Settings.tsx b/app/client/mobile/src/settings/Settings.tsx
index cf795c8b..509f69e4 100644
--- a/app/client/mobile/src/settings/Settings.tsx
+++ b/app/client/mobile/src/settings/Settings.tsx
@@ -747,7 +747,7 @@ export function Settings({showLogout}: {showLogout: boolean}) {
)}
{!state.config.sealSet && (
<>
- {state.strings.sealUnset}
+ {state.strings.sealCreate}
{state.strings.delayMessage}