diff --git a/electron/sync/sync.js b/electron/sync/sync.js
index c9cfa64ce..b62537e72 100644
--- a/electron/sync/sync.js
+++ b/electron/sync/sync.js
@@ -22,20 +22,21 @@ export function checkHmac(serverWalletState, hmacKey, hmac) {
}
export function deriveSecrets(rootPassword, email, saltSeed, callback) {
- const encodedPassword = Buffer.from(rootPassword.normalize('NFKC'))
- const encodedEmail = Buffer.from(email)
+ const encodedPassword = Buffer.from(rootPassword.normalize('NFKC'));
+ const encodedEmail = Buffer.from(email);
const SCRYPT_N = 1 << 20;
const SCRYPT_R = 8;
const SCRYPT_P = 1;
const KEY_LENGTH = 32;
- const NUM_KEYS = 2;
+ const NUM_KEYS = 3;
const MAXMEM_MULTIPLIER = 256;
const DEFAULT_MAXMEM = MAXMEM_MULTIPLIER * SCRYPT_N * SCRYPT_R;
function getKeyParts(key) {
const lbryIdPassword = key.slice(0, KEY_LENGTH).toString('base64');
- const hmacKey = key.slice(KEY_LENGTH).toString('base64');
- return { lbryIdPassword, hmacKey }; // Buffer aa bb cc 6c
+ const hmacKey = key.slice(KEY_LENGTH, KEY_LENGTH * 2).toString('base64');
+ const dataKey = key.slice(KEY_LENGTH * 2).toString('base64');
+ return { lbryIdPassword, hmacKey, dataKey }; // Buffer aa bb cc 6c
}
const salt = generateSalt(encodedEmail, saltSeed);
diff --git a/electron/sync/testsync.js b/electron/sync/testsync.js
index 668fa585f..a30242eef 100644
--- a/electron/sync/testsync.js
+++ b/electron/sync/testsync.js
@@ -1,7 +1,7 @@
import test from 'tape';
// import sync from '../sync.js';
import { generateSalt, generateSaltSeed, deriveSecrets, walletHmac } from './sync.js';
-export default function doTest () {
+export default function doTest() {
test('Generate sync seed', (assert) => {
const seed = generateSaltSeed();
@@ -29,12 +29,11 @@ export default function doTest () {
const expectedHmacKey = 'bCxUIryLK0Lf9nKg9yiZDlGleMuGJkadLzTje1PAI+8='; //base64
const expectedLbryIdPassword = 'HKo/J+x4Hsy2NkMvj2JB9RI0yrvEiB4QSA/NHPaT/cA=';
- let result;
function cb(e, r) {
- console.log('result', r)
- assert.equal(r.keys.hmacKey, expectedHmacKey, 'hmac is expected value');
- assert.equal(r.keys.lbryIdPassword, expectedLbryIdPassword, 'lbryid password is expected value');
+ console.log('result', r);
+ assert.equal(r.hmacKey, expectedHmacKey, 'hmac is expected value');
+ assert.equal(r.lbryIdPassword, expectedLbryIdPassword, 'lbryid password is expected value');
assert.end();
}
@@ -51,8 +50,7 @@ export default function doTest () {
const hmacHex = walletHmac(input_str);
assert.equal(hmacHex, expectedHmacHex);
assert.end();
-
});
}
-doTest()
+doTest();
diff --git a/ui/component/header/index.js b/ui/component/header/index.js
index 1e24a0df7..d13775dd4 100644
--- a/ui/component/header/index.js
+++ b/ui/component/header/index.js
@@ -6,7 +6,7 @@ import { selectGetSyncErrorMessage } from 'redux/selectors/sync';
import { selectHasNavigated } from 'redux/selectors/app';
import { selectTotalBalance, selectBalance } from 'redux/selectors/wallet';
import * as SETTINGS from 'constants/settings';
-import { doLbrysyncRegister } from 'redux/actions/lbrysync';
+import { doLbrysyncRegister } from 'redux/actions/sync';
import Header from './view';
const select = (state) => ({
diff --git a/ui/page/settingsSync/index.js b/ui/page/settingsSync/index.js
index e5889d118..833ca02ec 100644
--- a/ui/page/settingsSync/index.js
+++ b/ui/page/settingsSync/index.js
@@ -17,7 +17,7 @@ import {
selectLbrySyncEncryptedHmacKey,
selectLbrySyncEncryptedRoot,
selectLbrySyncEncryptedProviderPass,
-} from 'redux/selectors/lbrysync';
+} from 'redux/selectors/sync';
import {
doLbrysyncGetSalt,
@@ -25,10 +25,10 @@ import {
doGenerateSaltSeed,
doDeriveSecrets,
doLbrysyncAuthenticate,
-} from 'redux/actions/lbrysync';
+} from 'redux/actions/sync';
const select = (state) => ({
- walletEncrypted: selectWalletIsEncrypted(state),
+ isWalletEncrypted: selectWalletIsEncrypted(state),
registering: selectLbrySyncRegistering(state),
registeredEmail: selectLbrySyncEmail(state),
registerError: selectLbrySyncRegisterError(state),
diff --git a/ui/page/settingsSync/view.jsx b/ui/page/settingsSync/view.jsx
index adf203c9d..4ddf27f12 100644
--- a/ui/page/settingsSync/view.jsx
+++ b/ui/page/settingsSync/view.jsx
@@ -5,7 +5,6 @@ import Card from 'component/common/card';
import Button from 'component/button';
import { Form, FormField } from 'component/common/form';
import I18nMessage from 'component/i18nMessage';
-import Spinner from 'component/spinner';
import * as ICONS from 'constants/icons';
type Props = {
@@ -55,6 +54,9 @@ export default function NotificationSettingsPage(props: Props) {
register,
} = props;
+ /*
+ Register / auth
+ */
const SIGN_IN_MODE = 'sign_in';
const SIGN_UP_MODE = 'sign_up';
const VERIFY_MODE = 'verify';
@@ -192,7 +194,7 @@ export default function NotificationSettingsPage(props: Props) {
/>
>
}
- label={__('Password Again')}
+ label={__('Password')}
value={pass}
onChange={(e) => setPass(e.target.value)}
/>
@@ -222,7 +224,7 @@ export default function NotificationSettingsPage(props: Props) {
setMode(SIGN_UP_MODE)} label={__('Sign in')} />,
+ sign_in: