pull/1163/head
Vincent 5 years ago
parent 3a617934e2
commit a2844b48f4

@ -13,13 +13,13 @@ import * as MessageUtils from '../utils';
export class PendingMessageCache { export class PendingMessageCache {
public readonly isReady: Promise<boolean>; public readonly isReady: Promise<boolean>;
private cache: Array<any>; private cache: Array<RawMessage>;
constructor() { constructor() {
// Load pending messages from the database // Load pending messages from the database
// You should await isReady on making a new PendingMessageCache // You should await isReady on making a new PendingMessageCache
// if you'd like to have instant access to the cache // if you'd like to have instant access to the cache
this.cache = ['bleep']; this.cache = [];
this.isReady = new Promise(async resolve => { this.isReady = new Promise(async resolve => {
await this.loadFromDB(); await this.loadFromDB();
@ -116,7 +116,14 @@ export class PendingMessageCache {
const barePending = JSON.parse(String(data.value)); const barePending = JSON.parse(String(data.value));
const pending = barePending.map((message: any) => { const pending = barePending.map((message: any) => {
const { identifier, plainTextBuffer, timestamp, device, ttl, encryption } = message; const {
identifier,
plainTextBuffer,
timestamp,
device,
ttl,
encryption,
} = message;
return { return {
identifier, identifier,

@ -1,4 +1,3 @@
export class PubKey { export class PubKey {
public static readonly PUBKEY_LEN = 66; public static readonly PUBKEY_LEN = 66;
private static readonly regex: string = `^05[0-9a-fA-F]{${PubKey.PUBKEY_LEN - private static readonly regex: string = `^05[0-9a-fA-F]{${PubKey.PUBKEY_LEN -
@ -26,5 +25,4 @@ export class PubKey {
return false; return false;
} }
} }

@ -8,7 +8,6 @@ import { ImportMock } from 'ts-mock-imports';
import { PubKey } from '../../../ts/session/types'; import { PubKey } from '../../../ts/session/types';
import { ChatMessage } from '../../session/messages/outgoing'; import { ChatMessage } from '../../session/messages/outgoing';
const sandbox = sinon.createSandbox(); const sandbox = sinon.createSandbox();
// We have to do this in a weird way because Data uses module.exports // We have to do this in a weird way because Data uses module.exports

Loading…
Cancel
Save