fix: rekey explicitely when creating a group

pull/2963/head
Audric Ackermann 1 year ago
parent 1be85641cb
commit 1c58899558

@ -12,6 +12,7 @@ import { mnDecode } from '../../session/crypto/mnemonic';
import { recoveryPhraseModal } from '../../state/ducks/modalDialog';
import { SpacerSM } from '../basic/Text';
import { isAutoLogin } from '../../shared/env_vars';
import { saveQRCode } from '../../util/saveQRCode';
import { getCurrentRecoveryPhrase } from '../../util/storage';
import { SessionWrapperModal } from '../SessionWrapperModal';
@ -131,6 +132,12 @@ const Seed = (props: SeedProps) => {
dispatch(recoveryPhraseModal(null));
};
useMount(() => {
if (isAutoLogin()) {
copyRecoveryPhrase(recoveryPhrase);
}
});
return (
<>
<div className="session-modal__centered text-center">
@ -186,7 +193,7 @@ interface ModalInnerProps {
onClickOk?: () => any;
}
const SessionSeedModalInner = (props: ModalInnerProps) => {
export const SessionSeedModal = (props: ModalInnerProps) => {
const { onClickOk } = props;
const [loadingPassword, setLoadingPassword] = useState(true);
const [loadingSeed, setLoadingSeed] = useState(true);
@ -247,5 +254,3 @@ const SessionSeedModalInner = (props: ModalInnerProps) => {
</>
);
};
export const SessionSeedModal = SessionSeedModalInner;

@ -1,5 +1,6 @@
import classNames from 'classnames';
import React from 'react';
import useMount from 'react-use/lib/useMount';
import useTimeoutFn from 'react-use/lib/useTimeoutFn';
import { MAX_USERNAME_BYTES } from '../../session/constants';
import { isAutoLogin, isDevProd } from '../../shared/env_vars';
@ -26,7 +27,7 @@ function useAutoRegister(props: DisplayNameProps) {
}, 100);
useTimeoutFn(() => {
if (isDevProd() && props.displayName) {
if (isAutoLogin() && props.displayName) {
props.handlePressEnter();
}
}, 200);
@ -56,6 +57,14 @@ const RecoveryPhraseInput = (props: {
handlePressEnter: () => any;
stealAutoFocus?: boolean;
}) => {
useMount(() => {
if (isAutoLogin()) {
const seed = window.clipboard.readText() as string | undefined;
if (seed?.split(' ').length === 13) {
props.onSeedChanged(seed);
}
}
});
return (
<SessionInput
label={window.i18n('recoveryPhrase')}

@ -1,6 +1,6 @@
import React, { useContext, useEffect, useState } from 'react';
import useTimeoutFn from 'react-use/lib/useTimeoutFn';
import { isAutoLogin, isDevProd } from '../../shared/env_vars';
import { isAutoLogin } from '../../shared/env_vars';
import { Noop } from '../../types/Util';
import { Flex } from '../basic/Flex';
import { SessionButton } from '../basic/SessionButton';
@ -23,7 +23,7 @@ const CreateSessionIdButton = ({ createSessionID }: { createSessionID: any }) =>
function useAutoContinue(props: { continueSignUp: () => void }) {
useTimeoutFn(() => {
if (isDevProd() && isAutoLogin()) {
if (isAutoLogin()) {
props.continueSignUp();
}
}, 100);

@ -475,7 +475,7 @@ export async function innerHandleSwarmContentMessage({
* For a private conversation message, this is just the conversation with that user
*/
if (!isPrivateConversationMessage) {
console.warn('conversationModelForUIUpdate might need to be checked for groupv2 case');
console.info('conversationModelForUIUpdate might need to be checked for groupv2 case'); // debugger
// this is a closed group message, we have a second conversation to make sure exists
conversationModelForUIUpdate = await ConvoHub.use().getOrCreateAndWait(
envelope.source,
@ -818,7 +818,7 @@ async function handleMessageRequestResponse(
if (previousApprovedMe) {
await conversationToApprove.commit();
window.log.inf(
window.log.info(
`convo ${ed25519Str(conversationToApprove.id)} previousApprovedMe is already true. Nothing to do `
);
await IncomingMessageCache.removeFromCache(envelope);

@ -53,6 +53,7 @@ async function handleGroupSharedConfigMessages(
);
// do the merge with our current state
await MetaGroupWrapperActions.metaMerge(groupPk, toMerge);
// save updated dumps to the DB right away
await LibSessionUtil.saveDumpsToDb(groupPk);

@ -17,6 +17,7 @@ import { TTL_DEFAULT } from '../../../constants';
import { ConvoHub } from '../../../conversations';
import { GroupUpdateInfoChangeMessage } from '../../../messages/outgoing/controlMessage/group_v2/to_group/GroupUpdateInfoChangeMessage';
import { GroupUpdateMemberChangeMessage } from '../../../messages/outgoing/controlMessage/group_v2/to_group/GroupUpdateMemberChangeMessage';
import { ed25519Str } from '../../../onions/onionPath';
import { MessageSender } from '../../../sending/MessageSender';
import { PubKey } from '../../../types';
import { allowOnlyOneAtATime } from '../../Promise';
@ -288,9 +289,9 @@ class GroupSyncJob extends PersistedJob<GroupSyncPersistedData> {
public async run(): Promise<RunJobResult> {
const start = Date.now();
const thisJobDestination = this.persistedData.identifier;
try {
const thisJobDestination = this.persistedData.identifier;
if (!PubKey.is03Pubkey(thisJobDestination)) {
return RunJobResult.PermanentFailure;
}
@ -318,7 +319,9 @@ class GroupSyncJob extends PersistedJob<GroupSyncPersistedData> {
} catch (e) {
throw e;
} finally {
window.log.debug(`UserSyncJob run() took ${Date.now() - start}ms`);
window.log.debug(
`GroupSyncJob ${ed25519Str(thisJobDestination)} run() took ${Date.now() - start}ms`
);
// this is a simple way to make sure whatever happens here, we update the lastest timestamp.
// (a finally statement is always executed (no matter if exception or returns in other try/catch block)

@ -86,9 +86,9 @@ async function insertConvoFromDBIntoWrapperAndRefresh(convoId: string): Promise<
? timestampFromDbMs
: 0;
window.log.debug(
`inserting into convoVolatile wrapper: ${convoId} lastMessageReadTimestamp:${lastReadMessageTimestamp} forcedUnread:${isForcedUnread}...`
);
// window.log.debug(
// `inserting into convoVolatile wrapper: ${convoId} lastMessageReadTimestamp:${lastReadMessageTimestamp} forcedUnread:${isForcedUnread}...`
// );
const convoType = getConvoType(foundConvo);
switch (convoType) {

@ -40,7 +40,6 @@ function getIsMemberGroupChangePendingFromUI(state: StateType): boolean {
export function getLibAdminsPubkeys(state: StateType, convo?: string): Array<string> {
const members = getMembersOfGroup(state, convo);
return members.filter(m => m.promoted).map(m => m.pubkeyHex);
}

@ -565,6 +565,10 @@ export const MetaGroupWrapperActions: MetaGroupWrapperActionsCalls = {
callLibSessionWorker([`MetaGroupConfig-${groupPk}`, 'keysNeedsRekey']) as Promise<
ReturnType<MetaGroupWrapperActionsCalls['keysNeedsRekey']>
>,
keyGetAll: async (groupPk: GroupPubkeyType) =>
callLibSessionWorker([`MetaGroupConfig-${groupPk}`, 'keyGetAll']) as Promise<
ReturnType<MetaGroupWrapperActionsCalls['keyGetAll']>
>,
currentHashes: async (groupPk: GroupPubkeyType) =>
callLibSessionWorker([`MetaGroupConfig-${groupPk}`, 'currentHashes']) as Promise<
ReturnType<MetaGroupWrapperActionsCalls['currentHashes']>

Loading…
Cancel
Save