Skip to content

Commit

Permalink
[native][web] remove unused device ID code
Browse files Browse the repository at this point in the history
Summary: this is a follow up (depends on D9556). we don't need any of this device ID code now that we're just using the content ed25519 public key as the device ID.

Test Plan: successfully built and ran native and web

Reviewers: kamil, inka

Reviewed By: kamil, inka

Subscribers: inka, ashoat, tomek, wyilio

Differential Revision: https://phab.comm.dev/D9612
  • Loading branch information
vdhanan committed Oct 30, 2023
1 parent e761a58 commit 7ee568f
Show file tree
Hide file tree
Showing 15 changed files with 1 addition and 381 deletions.
1 change: 0 additions & 1 deletion native/native_rust_library/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions native/native_rust_library/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ cxx = "1.0"
tokio = { version = "1.24", features = ["macros", "rt-multi-thread"] }
tonic = "0.9.1"
lazy_static = "1.4"
rand = "0.8"
tracing = "0.1"
regex = "1.6"
comm-opaque2 = {path = "../../shared/comm-opaque2"}
derive_more = "0.99"
serde = { version = "1.0", features = ["derive"] }
Expand Down
82 changes: 0 additions & 82 deletions native/native_rust_library/src/crypto_tools.rs

This file was deleted.

11 changes: 0 additions & 11 deletions native/native_rust_library/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ use tonic::Status;
use tracing::instrument;

mod argon2_tools;
mod crypto_tools;

use argon2_tools::compute_backup_key;
use crypto_tools::generate_device_id;

mod generated {
// We get the CODE_VERSION from this generated file
Expand Down Expand Up @@ -49,12 +47,6 @@ lazy_static! {
#[cxx::bridge]
mod ffi {

enum DeviceType {
KEYSERVER,
WEB,
MOBILE,
}

extern "Rust" {
#[cxx_name = "identityRegisterUser"]
fn register_user(
Expand Down Expand Up @@ -130,9 +122,6 @@ mod ffi {
#[cxx_name = "identityGenerateNonce"]
fn generate_nonce(promise_id: u32);

// Crypto Tools
fn generate_device_id(device_type: DeviceType) -> Result<String>;

// Argon2
fn compute_backup_key(password: &str, backup_id: &str) -> Result<[u8; 32]>;
}
Expand Down
2 changes: 0 additions & 2 deletions web/app.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import Topbar from './navigation-panels/topbar.react.js';
import useBadgeHandler from './push-notif/badge-handler.react.js';
import { PushNotificationsHandler } from './push-notif/push-notifs-handler.js';
import { updateNavInfoActionType } from './redux/action-types.js';
import DeviceIDUpdater from './redux/device-id-updater.js';
import DisconnectedBarVisibilityHandler from './redux/disconnected-bar-visibility-handler.js';
import DisconnectedBar from './redux/disconnected-bar.js';
import FocusHandler from './redux/focus-handler.react.js';
Expand Down Expand Up @@ -195,7 +194,6 @@ class App extends React.PureComponent<Props> {
<ChatMentionContextProvider>
<FocusHandler />
<VisibilityHandler />
<DeviceIDUpdater />
<PolicyAcknowledgmentHandler />
<PushNotificationsHandler />
<InviteLinkHandler />
Expand Down
1 change: 0 additions & 1 deletion web/redux/action-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type { InitialReduxState } from '../types/redux-types.js';
export const updateNavInfoActionType = 'UPDATE_NAV_INFO';
export const updateWindowDimensionsActionType = 'UPDATE_WINDOW_DIMENSIONS';
export const updateWindowActiveActionType = 'UPDATE_WINDOW_ACTIVE';
export const setDeviceIDActionType = 'SET_DEVICE_ID';
export const setInitialReduxState = 'SET_INITIAL_REDUX_STATE';

const getInitialReduxStateCallServerEndpointOptions = { timeout: 300000 };
Expand Down
1 change: 0 additions & 1 deletion web/redux/default-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const defaultWebState: AppState = Object.freeze({
notificationAccount: null,
notificationIdentityKeys: null,
},
deviceID: null,
windowDimensions: { width: window.width, height: window.height },
loadingStatuses: {},
calendarFilters: defaultCalendarFilters,
Expand Down
28 changes: 0 additions & 28 deletions web/redux/device-id-reducer.js

This file was deleted.

28 changes: 0 additions & 28 deletions web/redux/device-id-updater.js

This file was deleted.

1 change: 0 additions & 1 deletion web/redux/persist.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ const migrations = {

const persistWhitelist = [
'enabledApps',
'deviceID',
'cryptoStore',
'notifPermissionAlertInfo',
'commServicesAccessToken',
Expand Down
9 changes: 0 additions & 9 deletions web/redux/redux-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import { ashoatKeyserverID } from 'lib/utils/validation-utils.js';

import {
updateWindowActiveActionType,
setDeviceIDActionType,
updateNavInfoActionType,
updateWindowDimensionsActionType,
setInitialReduxState,
Expand All @@ -54,7 +53,6 @@ import {
setPickledNotificationAccount,
setPickledPrimaryAccount,
} from './crypto-store-reducer.js';
import { reduceDeviceID } from './device-id-reducer.js';
import reduceNavInfo from './nav-reducer.js';
import { getVisibility } from './visibility.js';
import { getDatabaseModule } from '../database/database-module-provider.js';
Expand All @@ -72,7 +70,6 @@ export type CommunityPickerStore = {

export type AppState = {
+navInfo: NavInfo,
+deviceID: ?string,
+currentUserInfo: ?CurrentUserInfo,
+draftStore: DraftStore,
+entryStore: EntryStore,
Expand Down Expand Up @@ -117,10 +114,6 @@ export type Action =
type: 'UPDATE_WINDOW_ACTIVE',
payload: boolean,
}
| {
type: 'SET_DEVICE_ID',
payload: string,
}
| { +type: 'SET_PRIMARY_IDENTITY_KEYS', payload: ?OLMIdentityKeys }
| { +type: 'SET_NOTIFICATION_IDENTITY_KEYS', payload: ?OLMIdentityKeys }
| { +type: 'SET_PICKLED_PRIMARY_ACCOUNT', payload: ?PickledOLMAccount }
Expand Down Expand Up @@ -202,7 +195,6 @@ export function reducer(oldState: AppState | void, action: Action): AppState {

if (
action.type !== updateNavInfoActionType &&
action.type !== setDeviceIDActionType &&
action.type !== setPrimaryIdentityKeys &&
action.type !== setNotificationIdentityKeys &&
action.type !== setPickledPrimaryAccount &&
Expand Down Expand Up @@ -246,7 +238,6 @@ export function reducer(oldState: AppState | void, action: Action): AppState {
action,
state.threadStore.threadInfos,
),
deviceID: reduceDeviceID(state.deviceID, action),
cryptoStore: reduceCryptoStore(state.cryptoStore, action),
communityPickerStore,
};
Expand Down
51 changes: 0 additions & 51 deletions web/utils/device-id.js

This file was deleted.

Loading

0 comments on commit 7ee568f

Please sign in to comment.