Remove support for E164-based numbers

This commit is contained in:
Fedor Indutny 2023-11-01 23:55:30 +01:00 committed by GitHub
parent aa03ac36bc
commit 0ce593bf0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 469 additions and 916 deletions

View file

@ -692,23 +692,23 @@
},
"icu:SafetyNumberViewer__migration__text": {
"messageformat": "Safety numbers are being updated.",
"description": "An explanatory note in SafetyNumberViewer describing the safety number migration process."
"description": "(Deleted 11/01/2023) An explanatory note in SafetyNumberViewer describing the safety number migration process."
},
"icu:SafetyNumberViewer__migration__learn_more": {
"messageformat": "Learn more",
"description": "A link text in SafetyNumberViewer describing the safety number migration process."
"description": "(Deleted 11/01/2023) A link text in SafetyNumberViewer describing the safety number migration process."
},
"icu:SafetyNumberViewer__card__prev": {
"messageformat": "Previous Safety number",
"description": "An ARIA label for safety number navigation button."
"description": "(Deleted 11/01/2023) An ARIA label for safety number navigation button."
},
"icu:SafetyNumberViewer__card__next": {
"messageformat": "Next Safety number",
"description": "An ARIA label for safety number navigation button."
"description": "(Deleted 11/01/2023) An ARIA label for safety number navigation button."
},
"icu:SafetyNumberViewer__carousel__dot": {
"messageformat": "Safety number version, {index, number} of {total, number}",
"description": "An ARIA label for safety number carousel button."
"description": "(Deleted 11/01/2023) An ARIA label for safety number carousel button."
},
"icu:SafetyNumberViewer__markAsVerified": {
"messageformat": "Mark as verified",
@ -718,9 +718,17 @@
"messageformat": "Clear verification",
"description": "Safety number viewer, verification toggle button, when verified, clears verification state"
},
"icu:SafetyNumberViewer__hint": {
"messageformat": "To verify end-to-end encryption with {name}, compare the numbers above with their device. They can also scan your code with their device.",
"description": "Safety number viewer, text of the hint"
},
"icu:SafetyNumberViewer__learn_more": {
"messageformat": "Learn more",
"description": "Text of 'Learn more' button of SafetyNumberViewerModal modal"
},
"icu:SafetyNumberViewer__hint--migration": {
"messageformat": "To verify end-to-end encryption with {name}, match the color card above with their device and compare the numbers. If these dont match, try the other pair of safety numbers. Only one pair needs to match.",
"description": "Safety number viewer, text of the hint during migration period"
"description": "(Deleted 11/01/2023). Safety number viewer, text of the hint during migration period"
},
"icu:SafetyNumberViewer__hint--normal": {
"messageformat": "To verify end-to-end encryption with {name}, compare the numbers above with their device. They can also scan your code with their device.",
@ -728,23 +736,23 @@
},
"icu:SafetyNumberOnboarding__title": {
"messageformat": "Changes to safety numbers",
"description": "Title of Safety number onboarding modal"
"description": "(Deleted 11/01/2023) Title of Safety number onboarding modal"
},
"icu:SafetyNumberOnboarding__p1": {
"messageformat": "Safety numbers are being updated over a transition period to enable upcoming privacy features in Signal.",
"description": "Paragraph 1 of Safety number onboarding modal"
"description": "(Deleted 11/01/2023) Paragraph 1 of Safety number onboarding modal"
},
"icu:SafetyNumberOnboarding__p2": {
"messageformat": "To verify safety numbers, match the color card with your contacts device. If these dont match, try the other pair of safety numbers. Only one pair needs to match.",
"description": "Paragraph 2 of Safety number onboarding modal"
"description": "(Deleted 11/01/2023) Paragraph 2 of Safety number onboarding modal"
},
"icu:SafetyNumberOnboarding__help": {
"messageformat": "Need help?",
"description": "Text of a secondary button in Safety number onboarding modal"
"description": "(Deleted 11/01/2023) Text of a secondary button in Safety number onboarding modal"
},
"icu:SafetyNumberOnboarding__close": {
"messageformat": "Got it",
"description": "Text of a secondary button in Safety number onboarding modal"
"description": "(Deleted 11/01/2023) Text of a secondary button in Safety number onboarding modal"
},
"icu:SafetyNumberNotReady__body": {
"messageformat": "A safety number will be created with this person after you exchange messages with them.",

View file

@ -6,48 +6,14 @@
flex-direction: column;
align-items: center;
text-align: center;
gap: 16px;
gap: 20px;
padding-top: 16px;
padding-inline: 10px;
a {
text-decoration: none;
}
&__migration {
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
width: 100%;
margin-block: 0 8px;
&__text {
flex-grow: 1;
text-align: start;
@include font-subtitle;
@include light-theme {
color: $color-gray-60;
}
@include dark-theme {
color: $color-gray-25;
}
p {
margin: 0;
}
}
&__icon {
flex-shrink: 0;
display: inline-block;
width: 48px;
height: 48px;
background: url('../images/safety-number-migration.svg');
}
}
&__card-container {
position: relative;
display: flex;
@ -66,21 +32,7 @@
padding: 24px;
border-radius: 12px;
&--e164 {
background-color: $color-bright-gray;
.module-SafetyNumberViewer__card__number {
color: $color-gray-75;
}
}
&--aci {
background-color: $color-borage-blue;
.module-SafetyNumberViewer__card__number {
color: $color-white;
}
}
background-color: $color-borage-blue;
&__qr {
width: 120px;
@ -95,6 +47,7 @@
flex-wrap: wrap;
gap: 8px;
justify-content: center;
color: $color-white;
font-family: $monospace;
margin-block: 0 4px;
@ -105,86 +58,6 @@
}
}
}
&__prev,
&__next {
--height: 36px;
position: absolute;
top: calc(50% - var(--height) / 2);
width: 18px;
height: var(--height);
}
&__prev {
inset-inline-start: 0;
@include light-theme {
@include color-svg(
'../images/icons/v3/chevron/chevron-shallow-left.svg',
$color-gray-75
);
}
@include dark-theme {
@include color-svg(
'../images/icons/v3/chevron/chevron-shallow-left.svg',
$color-gray-15
);
}
}
&__next {
inset-inline-end: 0;
@include light-theme {
@include color-svg(
'../images/icons/v3/chevron/chevron-shallow-right.svg',
$color-gray-75
);
}
@include dark-theme {
@include color-svg(
'../images/icons/v3/chevron/chevron-shallow-right.svg',
$color-gray-15
);
}
}
}
&__carousel {
display: flex;
gap: 8px;
&__dot {
@include button-reset;
width: 8px;
height: 8px;
border-radius: 4px;
@include light-theme {
background: $color-gray-25;
}
@include dark-theme {
background: $color-gray-60;
}
@include keyboard-mode {
&:focus {
box-shadow: 0 0 0 3px $color-ultramarine;
}
}
&[aria-pressed='true'] {
@include light-theme {
background: $color-black;
}
@include dark-theme {
background: $color-white;
}
}
}
}
&__help {
@ -196,6 +69,8 @@
@include dark-theme {
color: $color-gray-25;
}
margin-top: 4px;
}
&__verification-status {

View file

@ -964,6 +964,10 @@ export async function startApp(): Promise<void> {
await window.Signal.Data.removeAllProfileKeyCredentials();
}
if (window.isBeforeVersion(lastVersion, 'v6.38.0-beta.1')) {
await window.storage.remove('hasCompletedSafetyNumberOnboarding');
}
// This one should always be last - it could restart the app
if (window.isBeforeVersion(lastVersion, 'v5.30.0-alpha')) {
await deleteAllLogs();

View file

@ -1,43 +1,25 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState, useCallback } from 'react';
import React from 'react';
import { isSafetyNumberNotAvailable } from '../util/isSafetyNumberNotAvailable';
import { Modal } from './Modal';
import type { PropsType as SafetyNumberViewerPropsType } from './SafetyNumberViewer';
import { SafetyNumberViewer } from './SafetyNumberViewer';
import { SafetyNumberOnboarding } from './SafetyNumberOnboarding';
import { SafetyNumberNotReady } from './SafetyNumberNotReady';
type PropsType = {
toggleSafetyNumberModal: () => unknown;
hasCompletedSafetyNumberOnboarding: boolean;
markHasCompletedSafetyNumberOnboarding: () => unknown;
} & Omit<SafetyNumberViewerPropsType, 'onClose'>;
export function SafetyNumberModal({
i18n,
toggleSafetyNumberModal,
hasCompletedSafetyNumberOnboarding,
markHasCompletedSafetyNumberOnboarding,
...safetyNumberViewerProps
}: PropsType): JSX.Element | null {
const { contact } = safetyNumberViewerProps;
const [isOnboarding, setIsOnboarding] = useState(
!hasCompletedSafetyNumberOnboarding
);
const showOnboarding = useCallback(() => {
setIsOnboarding(true);
}, [setIsOnboarding]);
const hideOnboarding = useCallback(() => {
setIsOnboarding(false);
markHasCompletedSafetyNumberOnboarding();
}, [setIsOnboarding, markHasCompletedSafetyNumberOnboarding]);
let title: string | undefined;
let content: JSX.Element;
let hasXButton = true;
@ -49,8 +31,6 @@ export function SafetyNumberModal({
/>
);
hasXButton = false;
} else if (isOnboarding) {
content = <SafetyNumberOnboarding i18n={i18n} onClose={hideOnboarding} />;
} else {
title = i18n('icu:SafetyNumberModal__title');
@ -58,7 +38,6 @@ export function SafetyNumberModal({
<SafetyNumberViewer
i18n={i18n}
onClose={toggleSafetyNumberModal}
showOnboarding={showOnboarding}
{...safetyNumberViewerProps}
/>
);

View file

@ -8,7 +8,7 @@ import { Modal } from './Modal';
import { Intl } from './Intl';
import { openLinkInWebBrowser } from '../util/openLinkInWebBrowser';
import type { LocalizerType } from '../types/Util';
import { SAFETY_NUMBER_MIGRATION_URL } from '../types/support';
import { SAFETY_NUMBER_URL } from '../types/support';
export type PropsType = {
i18n: LocalizerType;
@ -16,7 +16,7 @@ export type PropsType = {
};
function onLearnMore() {
openLinkInWebBrowser(SAFETY_NUMBER_MIGRATION_URL);
openLinkInWebBrowser(SAFETY_NUMBER_URL);
}
export function SafetyNumberNotReady({

View file

@ -1,20 +0,0 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './SafetyNumberOnboarding';
import { SafetyNumberOnboarding } from './SafetyNumberOnboarding';
import { setupI18n } from '../util/setupI18n';
import enMessages from '../../_locales/en/messages.json';
const i18n = setupI18n('en', enMessages);
export default {
title: 'Components/SafetyNumberOnboarding',
} satisfies Meta<PropsType>;
export function Default(): JSX.Element {
return <SafetyNumberOnboarding i18n={i18n} onClose={action('close')} />;
}

View file

@ -1,78 +0,0 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useCallback, useRef } from 'react';
import Lottie from 'lottie-react';
import type { LottieRefCurrentProps } from 'lottie-react';
import { Button, ButtonVariant } from './Button';
import { Intl } from './Intl';
import type { LocalizerType } from '../types/Util';
import { SAFETY_NUMBER_MIGRATION_URL } from '../types/support';
import { useReducedMotion } from '../hooks/useReducedMotion';
import animationData from '../../images/safety-number-onboarding.json';
import reducedAnimationData from '../../images/safety-number-onboarding-reduced-motion.json';
export type PropsType = {
i18n: LocalizerType;
onClose: () => void;
};
export function SafetyNumberOnboarding({
i18n,
onClose,
}: PropsType): JSX.Element | null {
const isMotionReduced = useReducedMotion();
const lottieRef = useRef<LottieRefCurrentProps | null>(null);
const onDOMLoaded = useCallback(() => {
if (isMotionReduced) {
lottieRef.current?.goToAndPlay(0);
return;
}
lottieRef.current?.playSegments(
[
[0, 360],
[60, 360],
],
true
);
}, [isMotionReduced]);
return (
<div className="module-SafetyNumberOnboarding">
<h2>
<Intl i18n={i18n} id="icu:SafetyNumberOnboarding__title" />
</h2>
<p>
<Intl i18n={i18n} id="icu:SafetyNumberOnboarding__p1" />
</p>
<p>
<Intl i18n={i18n} id="icu:SafetyNumberOnboarding__p2" />
</p>
<Lottie
lottieRef={lottieRef}
animationData={isMotionReduced ? reducedAnimationData : animationData}
onDOMLoaded={onDOMLoaded}
/>
<div className="module-SafetyNumberOnboarding__help">
<a
key="signal-support"
href={SAFETY_NUMBER_MIGRATION_URL}
rel="noreferrer"
target="_blank"
>
<Intl i18n={i18n} id="icu:SafetyNumberOnboarding__help" />
</a>
</div>
<Button
className="module-SafetyNumberOnboarding__close"
onClick={onClose}
variant={ButtonVariant.Primary}
>
<Intl i18n={i18n} id="icu:SafetyNumberOnboarding__close" />
</Button>
</div>
);
}

View file

@ -7,7 +7,6 @@ import type { Meta } from '@storybook/react';
import type { PropsType } from './SafetyNumberViewer';
import { SafetyNumberViewer } from './SafetyNumberViewer';
import { setupI18n } from '../util/setupI18n';
import { SafetyNumberIdentifierType } from '../types/safetyNumber';
import enMessages from '../../_locales/en/messages.json';
import { getDefaultConversation } from '../test-both/helpers/getDefaultConversation';
@ -69,13 +68,13 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
contact: overrideProps.contact || contactWithAllData,
generateSafetyNumber: action('generate-safety-number'),
i18n,
safetyNumbers: overrideProps.safetyNumbers ?? [
{
identifierType: SafetyNumberIdentifierType.ACIIdentifier,
numberBlocks: generateNumberBlocks(),
qrData: generateQRData(),
},
],
safetyNumber:
'safetyNumber' in overrideProps
? overrideProps.safetyNumber
: {
numberBlocks: generateNumberBlocks(),
qrData: generateQRData(),
},
toggleVerified: action('toggle-verified'),
verificationDisabled:
overrideProps.verificationDisabled !== undefined
@ -92,27 +91,6 @@ export function SafetyNumber(): JSX.Element {
return <SafetyNumberViewer {...createProps({})} />;
}
export function SafetyNumberE164Transition(): JSX.Element {
return (
<SafetyNumberViewer
{...createProps({
safetyNumbers: [
{
identifierType: SafetyNumberIdentifierType.E164Identifier,
numberBlocks: generateNumberBlocks(),
qrData: generateQRData(),
},
{
identifierType: SafetyNumberIdentifierType.ACIIdentifier,
numberBlocks: generateNumberBlocks(),
qrData: generateQRData(),
},
],
})}
/>
);
}
export function SafetyNumberNotVerified(): JSX.Element {
return (
<SafetyNumberViewer
@ -166,11 +144,12 @@ export function JustNumber(): JSX.Element {
);
}
export function NoPhoneNumberCannotVerify(): JSX.Element {
export function NoACICannotVerify(): JSX.Element {
return (
<SafetyNumberViewer
{...createProps({
contact: contactWithNothing,
safetyNumber: undefined,
})}
/>
);

View file

@ -1,8 +1,7 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState, useCallback } from 'react';
import classNames from 'classnames';
import React from 'react';
import { Button, ButtonVariant } from './Button';
import { QrCode } from './QrCode';
@ -11,18 +10,15 @@ import { Intl } from './Intl';
import { Emojify } from './conversation/Emojify';
import type { LocalizerType } from '../types/Util';
import type { SafetyNumberType } from '../types/safetyNumber';
import { SAFETY_NUMBER_MIGRATION_URL } from '../types/support';
import { SafetyNumberIdentifierType } from '../types/safetyNumber';
import { arrow } from '../util/keyboard';
import { SAFETY_NUMBER_URL } from '../types/support';
export type PropsType = {
contact: ConversationType;
generateSafetyNumber: (contact: ConversationType) => void;
i18n: LocalizerType;
onClose: () => void;
safetyNumbers?: ReadonlyArray<SafetyNumberType>;
safetyNumber?: SafetyNumberType;
toggleVerified: (contact: ConversationType) => void;
showOnboarding?: () => void;
verificationDisabled: boolean;
};
@ -31,12 +27,10 @@ export function SafetyNumberViewer({
generateSafetyNumber,
i18n,
onClose,
safetyNumbers,
safetyNumber,
toggleVerified,
showOnboarding,
verificationDisabled,
}: PropsType): JSX.Element | null {
const hasSafetyNumbers = safetyNumbers != null;
React.useEffect(() => {
if (!contact) {
return;
@ -47,42 +41,11 @@ export function SafetyNumberViewer({
// Keyboard navigation
const [selectedIndex, setSelectedIndex] = useState(0);
const selectPrevNumber = useCallback(() => {
setSelectedIndex(x => Math.max(x - 1, 0));
}, []);
const selectNextNumber = useCallback(() => {
if (!safetyNumbers || safetyNumbers.length === 0) {
setSelectedIndex(0);
return;
}
setSelectedIndex(x => Math.min(x + 1, safetyNumbers.length - 1));
}, [safetyNumbers]);
React.useEffect(() => {
const handleKeyDown = (ev: KeyboardEvent) => {
if (ev.key === arrow('start')) {
selectPrevNumber();
}
if (ev.key === arrow('end')) {
selectNextNumber();
}
};
document.addEventListener('keydown', handleKeyDown);
return () => {
document.removeEventListener('keydown', handleKeyDown);
};
}, [selectPrevNumber, selectNextNumber]);
if (!contact || !hasSafetyNumbers) {
if (!contact) {
return null;
}
if (!safetyNumbers.length) {
if (!safetyNumber) {
return (
<div className="module-SafetyNumberViewer">
<div>{i18n('icu:cannotGenerateSafetyNumber')}</div>
@ -110,121 +73,36 @@ export function SafetyNumberViewer({
? i18n('icu:SafetyNumberViewer__clearVerification')
: i18n('icu:SafetyNumberViewer__markAsVerified');
const visibleSafetyNumber = safetyNumbers.at(selectedIndex);
if (!visibleSafetyNumber) {
return null;
}
const cardClassName = classNames('module-SafetyNumberViewer__card', {
'module-SafetyNumberViewer__card--aci':
visibleSafetyNumber.identifierType ===
SafetyNumberIdentifierType.ACIIdentifier,
'module-SafetyNumberViewer__card--e164':
visibleSafetyNumber.identifierType ===
SafetyNumberIdentifierType.E164Identifier,
});
const numberBlocks = visibleSafetyNumber.numberBlocks.join(' ');
const numberBlocks = safetyNumber.numberBlocks.join(' ');
const safetyNumberCard = (
<div className="module-SafetyNumberViewer__card-container">
<div className={cardClassName}>
<div className="module-SafetyNumberViewer__card">
<QrCode
className="module-SafetyNumberViewer__card__qr"
data={visibleSafetyNumber.qrData}
data={safetyNumber.qrData}
alt={i18n('icu:Install__scan-this-code')}
/>
<div className="module-SafetyNumberViewer__card__number">
{numberBlocks}
</div>
{selectedIndex > 0 && (
<button
type="button"
aria-label={i18n('icu:SafetyNumberViewer__card__prev')}
className="module-SafetyNumberViewer__card__prev"
onClick={selectPrevNumber}
/>
)}
{selectedIndex < safetyNumbers.length - 1 && (
<button
type="button"
aria-label={i18n('icu:SafetyNumberViewer__card__next')}
className="module-SafetyNumberViewer__card__next"
onClick={selectNextNumber}
/>
)}
</div>
</div>
);
const carousel = (
<div className="module-SafetyNumberViewer__carousel">
{safetyNumbers.map(({ identifierType }, index) => {
return (
<button
type="button"
aria-label={i18n('icu:SafetyNumberViewer__carousel__dot', {
index: index + 1,
total: safetyNumbers.length,
})}
aria-pressed={index === selectedIndex}
key={identifierType}
className="module-SafetyNumberViewer__carousel__dot"
onClick={() => setSelectedIndex(index)}
/>
);
})}
</div>
);
return (
<div className="module-SafetyNumberViewer">
<div className="module-SafetyNumberViewer__migration">
<div className="module-SafetyNumberViewer__migration__icon" />
<div className="module-SafetyNumberViewer__migration__text">
<p>
<Intl i18n={i18n} id="icu:SafetyNumberViewer__migration__text" />
</p>
<p>
<a
href={SAFETY_NUMBER_MIGRATION_URL}
rel="noreferrer"
target="_blank"
onClick={e => {
if (showOnboarding) {
e.preventDefault();
showOnboarding();
}
}}
>
<Intl
i18n={i18n}
id="icu:SafetyNumberViewer__migration__learn_more"
/>
</a>
</p>
</div>
</div>
{safetyNumberCard}
{safetyNumbers.length > 1 && carousel}
<div className="module-SafetyNumberViewer__help">
<Intl
i18n={i18n}
id="icu:SafetyNumberViewer__hint--migration"
id="icu:SafetyNumberViewer__hint"
components={{ name: boldName }}
/>
<br />
<a href={SAFETY_NUMBER_MIGRATION_URL} rel="noreferrer" target="_blank">
<Intl
i18n={i18n}
id="icu:SafetyNumberViewer__migration__learn_more"
/>
<a href={SAFETY_NUMBER_URL} rel="noreferrer" target="_blank">
<Intl i18n={i18n} id="icu:SafetyNumberViewer__learn_more" />
</a>
</div>

View file

@ -85,7 +85,6 @@ export type ItemsActionType = ReadonlyDeep<
export const actions = {
addCustomColor,
editCustomColor,
markHasCompletedSafetyNumberOnboarding,
removeCustomColor,
resetDefaultChatColor,
savePreferredLeftPaneWidth,
@ -283,17 +282,6 @@ function savePreferredLeftPaneWidth(
};
}
function markHasCompletedSafetyNumberOnboarding(): ThunkAction<
void,
RootStateType,
unknown,
ItemPutAction
> {
return dispatch => {
dispatch(putItem('hasCompletedSafetyNumberOnboarding', true));
};
}
function toggleNavTabsCollapse(
navTabsCollapsed: boolean
): ThunkAction<void, RootStateType, unknown, ItemPutAction> {

View file

@ -5,7 +5,7 @@ import type { ReadonlyDeep } from 'type-fest';
import type { ThunkAction } from 'redux-thunk';
import { omit } from 'lodash';
import { generateSafetyNumbers } from '../../util/safetyNumber';
import { generateSafetyNumber } from '../../util/safetyNumber';
import type { SafetyNumberType } from '../../types/safetyNumber';
import type { ConversationType } from './conversations';
import {
@ -17,7 +17,7 @@ import * as Errors from '../../types/errors';
import type { StateType as RootStateType } from '../reducer';
export type SafetyNumberContactType = ReadonlyDeep<{
safetyNumbers: ReadonlyArray<SafetyNumberType>;
safetyNumber: SafetyNumberType;
safetyNumberChanged?: boolean;
verificationDisabled: boolean;
}>;
@ -44,7 +44,7 @@ type GenerateFulfilledActionType = ReadonlyDeep<{
type: 'safetyNumber/GENERATE_FULFILLED';
payload: {
contact: ConversationType;
safetyNumbers: ReadonlyArray<SafetyNumberType>;
safetyNumber: SafetyNumberType;
};
}>;
@ -59,7 +59,7 @@ type ToggleVerifiedFulfilledActionType = ReadonlyDeep<{
type: 'safetyNumber/TOGGLE_VERIFIED_FULFILLED';
payload: {
contact: ConversationType;
safetyNumbers?: ReadonlyArray<SafetyNumberType>;
safetyNumber?: SafetyNumberType;
safetyNumberChanged?: boolean;
};
}>;
@ -83,12 +83,12 @@ function generate(
): ThunkAction<void, RootStateType, unknown, GenerateFulfilledActionType> {
return async dispatch => {
try {
const safetyNumbers = await generateSafetyNumbers(contact);
const safetyNumber = await generateSafetyNumber(contact);
dispatch({
type: GENERATE_FULFILLED,
payload: {
contact,
safetyNumbers,
safetyNumber,
},
});
} catch (error) {
@ -128,13 +128,13 @@ function toggleVerified(
} catch (err) {
if (err.name === 'OutgoingIdentityKeyError') {
await reloadProfiles(contact.id);
const safetyNumbers = await generateSafetyNumbers(contact);
const safetyNumber = await generateSafetyNumber(contact);
dispatch({
type: TOGGLE_VERIFIED_FULFILLED,
payload: {
contact,
safetyNumbers,
safetyNumber,
safetyNumberChanged: true,
},
});
@ -224,7 +224,7 @@ export function reducer(
}
if (action.type === GENERATE_FULFILLED) {
const { contact, safetyNumbers } = action.payload;
const { contact, safetyNumber } = action.payload;
const { id } = contact;
const record = state.contacts[id];
return {
@ -232,7 +232,7 @@ export function reducer(
...state.contacts,
[id]: {
...record,
safetyNumbers,
safetyNumber,
},
},
};

View file

@ -93,12 +93,6 @@ export const getHasCompletedUsernameLinkOnboarding = createSelector(
Boolean(state.hasCompletedUsernameLinkOnboarding)
);
export const getHasCompletedSafetyNumberOnboarding = createSelector(
getItems,
(state: ItemsStateType): boolean =>
Boolean(state.hasCompletedSafetyNumberOnboarding)
);
export const getUsernameLinkColor = createSelector(
getItems,
(state: ItemsStateType): number | undefined => state.usernameLinkColor

View file

@ -7,7 +7,6 @@ import { SafetyNumberModal } from '../../components/SafetyNumberModal';
import type { StateType } from '../reducer';
import { getContactSafetyNumber } from '../selectors/safetyNumber';
import { getConversationSelector } from '../selectors/conversations';
import { getHasCompletedSafetyNumberOnboarding } from '../selectors/items';
import { getIntl } from '../selectors/user';
export type Props = {
@ -19,8 +18,6 @@ const mapStateToProps = (state: StateType, props: Props) => {
...props,
...getContactSafetyNumber(state, props),
contact: getConversationSelector(state)(props.contactID),
hasCompletedSafetyNumberOnboarding:
getHasCompletedSafetyNumberOnboarding(state),
i18n: getIntl(state),
};
};

View file

@ -1,13 +1,7 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
export enum SafetyNumberIdentifierType {
ACIIdentifier = 'ACIIdentifier',
E164Identifier = 'E164Identifier',
}
export type SafetyNumberType = Readonly<{
identifierType: SafetyNumberIdentifierType;
numberBlocks: ReadonlyArray<string>;
qrData: Uint8Array;
}>;

View file

@ -7,5 +7,5 @@ export const UNSUPPORTED_OS_URL =
'https://support.signal.org/hc/articles/5109141421850';
export const LINK_SIGNAL_DESKTOP =
'https://support.signal.org/hc/articles/360007320451#desktop_multiple_device';
export const SAFETY_NUMBER_MIGRATION_URL =
'https://support.signal.org/hc/en-us/articles/360007060632';
export const SAFETY_NUMBER_URL =
'https://support.signal.org/hc/articles/360007060632';

View file

@ -15,6 +15,88 @@
"updated": "2018-09-18T19:19:27.699Z",
"reasonDetail": "Part of runtime library for C++ transpiled code"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const ref = React.useRef(value);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const referenceRef = React.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const floatingRef = React.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const dataRef = React.useRef(data);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const isMountedRef = React.useRef(false);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.min.js",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const ref = React__namespace.useRef(value);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const referenceRef = React__namespace.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const floatingRef = React__namespace.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const dataRef = React__namespace.useRef(data);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const isMountedRef = React__namespace.useRef(false);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.min.js",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/@indutny/frameless-titlebar/dist/index.es.js",
@ -604,6 +686,13 @@
"reasonCategory": "falseMatch",
"updated": "2022-06-23T23:21:04.555Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.cjs.js",
"line": " const playgroundUrl = getPlaygroundUrl(element.innerHTML);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-outerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.cjs.js",
@ -632,6 +721,13 @@
"reasonCategory": "falseMatch",
"updated": "2022-06-23T23:21:04.555Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js",
"line": " const playgroundUrl = getPlaygroundUrl(element.innerHTML);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-outerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js",
@ -660,6 +756,13 @@
"reasonCategory": "falseMatch",
"updated": "2022-06-23T23:21:04.555Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.umd.js",
"line": "\t const playgroundUrl = getPlaygroundUrl(element.innerHTML);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-outerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.umd.js",
@ -714,27 +817,6 @@
"reasonCategory": "testCode",
"updated": "2022-06-23T23:21:04.555Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.cjs.js",
"line": " const playgroundUrl = getPlaygroundUrl(element.innerHTML);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js",
"line": " const playgroundUrl = getPlaygroundUrl(element.innerHTML);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/@testing-library/dom/dist/@testing-library/dom.umd.js",
"line": "\t const playgroundUrl = getPlaygroundUrl(element.innerHTML);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/@testing-library/dom/dist/screen.js",
@ -908,88 +990,6 @@
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const ref = React.useRef(value);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const referenceRef = React.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const floatingRef = React.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const dataRef = React.useRef(data);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js",
"line": " const isMountedRef = React.useRef(false);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.min.js",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const ref = React__namespace.useRef(value);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const referenceRef = React__namespace.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const floatingRef = React__namespace.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const dataRef = React__namespace.useRef(data);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.js",
"line": " const isMountedRef = React__namespace.useRef(false);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.umd.min.js",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-findDOMNode",
"path": "node_modules/focus-trap-react/dist/focus-trap-react.js",
@ -1077,190 +1077,6 @@
"updated": "2022-07-26T23:41:36.800Z",
"reasonDetail": "Part of keyword list for preservation in final minified build"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/dist/tocbot.js",
"line": " tocElement.innerHTML = ''",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/dist/tocbot.min.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/253-af2be75f8688092d.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/253-af2be75f8688092d.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/684-c4d85164cfbebace.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/tocbot/out/_next/static/chunks/684-c4d85164cfbebace.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/894.d8d3be35b7c84b33.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/894.d8d3be35b7c84b33.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/framework-3911a61406e859ea.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/framework-3911a61406e859ea.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/framework-3911a61406e859ea.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/tocbot/out/_next/static/chunks/framework-3911a61406e859ea.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/main-292648d00afc3512.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/main-292648d00afc3512.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/main-292648d00afc3512.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/tocbot/out/_next/static/chunks/main-292648d00afc3512.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/pages/_error-b0eae765db80170a.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/pages/_error-b0eae765db80170a.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/static/js/tocbot.js",
"line": " tocElement.innerHTML = ''",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/static/js/tocbot.min.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/src/components/Template/Tracking/index.js",
"line": " <script dangerouslySetInnerHTML={{ __html: getGaScript(props.siteId) }} />",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/src/components/Template/TryIt/index.js",
"line": " contentEl.innerHTML = marked(markdown)",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/src/components/Template/TryIt/index.js",
"line": " contentEl.innerHTML = backupHtml",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/src/components/Template/TryIt/index.js",
"line": " backupHtml = backupHtml && backupHtml.innerHTML",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/src/components/Template/index.js",
"line": " dangerouslySetInnerHTML={{ __html: props.tocHtml }}",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/src/components/Template/index.js",
"line": " dangerouslySetInnerHTML={{ __html: props.bodyHtml }}",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/src/js/index.js",
"line": " tocElement.innerHTML = ''",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/static/js/tocbot.js",
"line": " tocElement.innerHTML = ''",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/static/js/tocbot.min.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/intl-tel-input/build/js/intlTelInput-jquery.js",
@ -2213,104 +2029,6 @@
"updated": "2020-10-13T18:36:57.012Z",
"reasonDetail": "necessary for react-quill"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " // in case we pass a React ref using React.createRef()",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " _this.targetRef = createRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " _this.ref = createRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-findDOMNode",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " var currentElement = findDOMNode(_this);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " var skipResize = useRef(skipOnMount);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " var localRef = useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " var resizeHandler = useRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " // in case we pass a React ref using React.createRef()",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " _this.targetRef = React.createRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " _this.ref = React.createRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-findDOMNode",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " var currentElement = reactDom.findDOMNode(_this);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " var skipResize = React.useRef(skipOnMount);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " var localRef = React.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " var resizeHandler = React.useRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-remove-scroll/dist/es2015/SideEffect.js",
@ -2416,6 +2134,104 @@
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " // in case we pass a React ref using React.createRef()",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " _this.targetRef = createRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " _this.ref = createRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-findDOMNode",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " var currentElement = findDOMNode(_this);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " var skipResize = useRef(skipOnMount);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " var localRef = useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.esm.js",
"line": " var resizeHandler = useRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " // in case we pass a React ref using React.createRef()",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " _this.targetRef = React.createRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-createRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " _this.ref = React.createRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-findDOMNode",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " var currentElement = reactDom.findDOMNode(_this);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " var skipResize = React.useRef(skipOnMount);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " var localRef = React.useRef(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-resize-detector/build/index.js",
"line": " var resizeHandler = React.useRef();",
"reasonCategory": "usageTrusted",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/react-textarea-autosize/dist/react-textarea-autosize.browser.cjs.js",
@ -2521,7 +2337,6 @@
"reasonCategory": "usageTrusted",
"updated": "2022-06-16T23:23:32.306Z"
},
{
"rule": "eval",
"path": "node_modules/source-map-support/source-map-support.js",
@ -2550,6 +2365,190 @@
"reasonCategory": "falseMatch",
"updated": "2020-04-30T22:35:27.860Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/dist/tocbot.js",
"line": " tocElement.innerHTML = ''",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/dist/tocbot.min.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/253-af2be75f8688092d.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/253-af2be75f8688092d.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/684-c4d85164cfbebace.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/tocbot/out/_next/static/chunks/684-c4d85164cfbebace.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/894.d8d3be35b7c84b33.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/894.d8d3be35b7c84b33.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/framework-3911a61406e859ea.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/framework-3911a61406e859ea.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/framework-3911a61406e859ea.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/tocbot/out/_next/static/chunks/framework-3911a61406e859ea.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/main-292648d00afc3512.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/main-292648d00afc3512.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/main-292648d00afc3512.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/tocbot/out/_next/static/chunks/main-292648d00afc3512.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/out/_next/static/chunks/pages/_error-b0eae765db80170a.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-ref",
"path": "node_modules/tocbot/out/_next/static/chunks/pages/_error-b0eae765db80170a.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/static/js/tocbot.js",
"line": " tocElement.innerHTML = ''",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/out/static/js/tocbot.min.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/src/components/Template/Tracking/index.js",
"line": " <script dangerouslySetInnerHTML={{ __html: getGaScript(props.siteId) }} />",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/src/components/Template/TryIt/index.js",
"line": " contentEl.innerHTML = marked(markdown)",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/src/components/Template/TryIt/index.js",
"line": " contentEl.innerHTML = backupHtml",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/src/components/Template/TryIt/index.js",
"line": " backupHtml = backupHtml && backupHtml.innerHTML",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/src/components/Template/index.js",
"line": " dangerouslySetInnerHTML={{ __html: props.tocHtml }}",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-dangerouslySetInnerHTML",
"path": "node_modules/tocbot/src/components/Template/index.js",
"line": " dangerouslySetInnerHTML={{ __html: props.bodyHtml }}",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/src/js/index.js",
"line": " tocElement.innerHTML = ''",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/static/js/tocbot.js",
"line": " tocElement.innerHTML = ''",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "DOM-innerHTML",
"path": "node_modules/tocbot/static/js/tocbot.min.js",
"reasonCategory": "notExercisedByOurApp",
"updated": "2023-10-03T18:55:06.301Z"
},
{
"rule": "React-useRef",
"path": "node_modules/use-callback-ref/dist/es2015/assignRef.js",
@ -3405,13 +3404,6 @@
"updated": "2022-01-04T21:43:17.517Z",
"reasonDetail": "Used to change the style in non-production builds."
},
{
"rule": "React-useRef",
"path": "ts/components/SafetyNumberOnboarding.tsx",
"line": " const lottieRef = useRef<LottieRefCurrentProps | null>(null);",
"reasonCategory": "usageTrusted",
"updated": "2023-06-29T17:01:25.145Z"
},
{
"rule": "React-useRef",
"path": "ts/components/Slider.tsx",

View file

@ -5,30 +5,24 @@ import { PublicKey, Fingerprint } from '@signalapp/libsignal-client';
import type { ConversationType } from '../state/ducks/conversations';
import { assertDev } from './assert';
import { isNotNil } from './isNotNil';
import { missingCaseError } from './missingCaseError';
import { uuidToBytes } from './uuidToBytes';
import * as log from '../logging/log';
import * as Bytes from '../Bytes';
import type { SafetyNumberType } from '../types/safetyNumber';
import { SafetyNumberIdentifierType } from '../types/safetyNumber';
import { isAciString } from './isAciString';
const ITERATION_COUNT = 5200;
const E164_VERSION = 1;
const SERVICE_ID_VERSION = 2;
// Number of digits in a safety number block
const BLOCK_SIZE = 5;
export async function generateSafetyNumbers(
export async function generateSafetyNumber(
contact: ConversationType
): Promise<ReadonlyArray<SafetyNumberType>> {
): Promise<SafetyNumberType> {
const logId = `generateSafetyNumbers(${contact.id})`;
log.info(`${logId}: starting`);
const { storage } = window.textsecure;
const ourNumber = storage.user.getNumber();
const ourAci = storage.user.getCheckedAci();
const us = storage.protocol.getIdentityRecord(ourAci);
@ -53,55 +47,24 @@ export async function generateSafetyNumbers(
const ourKey = PublicKey.deserialize(Buffer.from(ourKeyBuffer));
const theirKey = PublicKey.deserialize(Buffer.from(theirKeyBuffer));
const identifierTypes = [
SafetyNumberIdentifierType.ACIIdentifier,
SafetyNumberIdentifierType.E164Identifier,
];
assertDev(theirAci, 'Should have their serviceId');
const fingerprint = Fingerprint.new(
ITERATION_COUNT,
SERVICE_ID_VERSION,
Buffer.from(uuidToBytes(ourAci)),
ourKey,
Buffer.from(uuidToBytes(theirAci)),
theirKey
);
return identifierTypes
.map(identifierType => {
let fingerprint: Fingerprint;
if (identifierType === SafetyNumberIdentifierType.E164Identifier) {
if (!contact.e164) {
log.error(
`${logId}: Attempted to generate security number for contact with no e164`
);
return undefined;
}
const securityNumber = fingerprint.displayableFingerprint().toString();
assertDev(ourNumber, 'Should have our number');
fingerprint = Fingerprint.new(
ITERATION_COUNT,
E164_VERSION,
Buffer.from(Bytes.fromString(ourNumber)),
ourKey,
Buffer.from(Bytes.fromString(contact.e164)),
theirKey
);
} else if (identifierType === SafetyNumberIdentifierType.ACIIdentifier) {
assertDev(theirAci, 'Should have their serviceId');
fingerprint = Fingerprint.new(
ITERATION_COUNT,
SERVICE_ID_VERSION,
Buffer.from(uuidToBytes(ourAci)),
ourKey,
Buffer.from(uuidToBytes(theirAci)),
theirKey
);
} else {
throw missingCaseError(identifierType);
}
const numberBlocks = [];
for (let i = 0; i < securityNumber.length; i += BLOCK_SIZE) {
numberBlocks.push(securityNumber.substring(i, i + BLOCK_SIZE));
}
const securityNumber = fingerprint.displayableFingerprint().toString();
const qrData = fingerprint.scannableFingerprint().toBuffer();
const numberBlocks = [];
for (let i = 0; i < securityNumber.length; i += BLOCK_SIZE) {
numberBlocks.push(securityNumber.substring(i, i + BLOCK_SIZE));
}
const qrData = fingerprint.scannableFingerprint().toBuffer();
return { identifierType, numberBlocks, qrData };
})
.filter(isNotNil);
return { numberBlocks, qrData };
}