rename background.js to main_start.js
This commit is contained in:
parent
15260c9718
commit
d99cdc48f4
|
@ -50,6 +50,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="js/background.js"></script>
|
||||
<script type="text/javascript" src="js/main_start.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -170,7 +170,7 @@
|
|||
]);
|
||||
} catch (error) {
|
||||
window.log.error(
|
||||
'background.js: ConversationController failed to load:',
|
||||
'main_start.js: ConversationController failed to load:',
|
||||
error && error.stack ? error.stack : error
|
||||
);
|
||||
} finally {
|
||||
|
@ -230,7 +230,7 @@
|
|||
});
|
||||
|
||||
// FIXME audric2 ExpiringMessagesListener Whisper.Expi
|
||||
throw new Error('plop');
|
||||
// throw new Error('plop');
|
||||
Whisper.ExpiringMessagesListener.init(Whisper.events);
|
||||
|
||||
if (Whisper.Registration.isDone() && !window.textsecure.storage.user.isSignInByLinking()) {
|
|
@ -4,7 +4,6 @@ const Crypto = require('./crypto');
|
|||
const Data = require('../../ts/data/data');
|
||||
const OS = require('../../ts/OS');
|
||||
const Util = require('../../ts/util');
|
||||
const { Message } = require('../../ts/components/conversation/message/message-item/Message');
|
||||
|
||||
// Components
|
||||
const {
|
||||
|
@ -19,7 +18,6 @@ exports.setup = () => {
|
|||
const Components = {
|
||||
SessionInboxView,
|
||||
SessionRegistrationView,
|
||||
Message,
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
|
@ -65,7 +65,7 @@ export async function signUp(signUpDetails: {
|
|||
value: true,
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
setSignWithRecoveryPhrase(false);
|
||||
await setSignWithRecoveryPhrase(false);
|
||||
trigger('openInbox');
|
||||
} catch (e) {
|
||||
await resetRegistration();
|
||||
|
@ -96,7 +96,7 @@ export async function signInWithRecovery(signInDetails: {
|
|||
await resetRegistration();
|
||||
|
||||
await registerSingleDevice(userRecoveryPhrase, 'english', trimName);
|
||||
setSignWithRecoveryPhrase(true);
|
||||
await setSignWithRecoveryPhrase(true);
|
||||
|
||||
trigger('openInbox');
|
||||
} catch (e) {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { setSignInByLinking } from '../../util/storage';
|
|||
|
||||
export const SessionRegistrationView = () => {
|
||||
useEffect(() => {
|
||||
setSignInByLinking(false);
|
||||
void setSignInByLinking(false);
|
||||
}, []);
|
||||
return (
|
||||
<SessionTheme>
|
||||
|
|
|
@ -145,7 +145,7 @@ export function handleRequest(plaintext: any, options: ReqOptions, messageHash:
|
|||
|
||||
// tslint:enable:cyclomatic-complexity max-func-body-length */
|
||||
/**
|
||||
* Used in background.js
|
||||
* Used in main_start.js
|
||||
*/
|
||||
export async function queueAllCached() {
|
||||
const items = await getAllFromCache();
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
import { randomBytes } from 'crypto';
|
||||
|
||||
const g = global as any;
|
||||
|
||||
// Because curve wrapper will populate this
|
||||
g.Internal = {};
|
||||
|
||||
// Because curve wrapper uses 'Module' to get at curve-provided functionality
|
||||
// tslint:disable-next-line
|
||||
g.Module = require('../../js/curve/curve25519_compiled');
|
||||
// tslint:disable-next-line
|
||||
require('../../js/curve/curve25519_wrapper');
|
||||
|
||||
export type BinaryType = Uint8Array | Buffer;
|
||||
|
||||
interface CurveType {
|
||||
keyPair: (
|
||||
privateKey: BinaryType
|
||||
) => {
|
||||
pubKey: BinaryType;
|
||||
privKey: BinaryType;
|
||||
};
|
||||
sign: (privateKey: BinaryType, message: BinaryType) => BinaryType;
|
||||
verify: (publicKey: BinaryType, message: BinaryType, signature: BinaryType) => boolean;
|
||||
}
|
||||
|
||||
const { keyPair: internalKeyPair, sign: internalSign, verify: internalVerify } = g.Internal
|
||||
.curve25519 as CurveType;
|
||||
|
||||
export function keyPair() {
|
||||
const privateKey = randomBytes(32);
|
||||
const { pubKey, privKey } = internalKeyPair(privateKey);
|
||||
|
||||
return {
|
||||
publicKey: pubKey,
|
||||
privateKey: privKey,
|
||||
};
|
||||
}
|
||||
|
||||
export function sign(privateKey: BinaryType, message: BinaryType) {
|
||||
return internalSign(privateKey, message);
|
||||
}
|
||||
|
||||
export function verify(publicKey: BinaryType, message: BinaryType, signature: BinaryType) {
|
||||
const failed = internalVerify(publicKey, message, signature);
|
||||
|
||||
return !failed;
|
||||
}
|
Loading…
Reference in New Issue