fix: cleaned up SnodeRequestTypes and made sup_keys a single item

pull/3052/head
Audric Ackermann 11 months ago
parent a49a65c92b
commit 59a4048323

@ -1130,7 +1130,6 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
await GroupSync.pushChangesToGroupSwarmIfNeeded({ await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk: this.id, groupPk: this.id,
supplementalKeysSubRequest: [],
extraStoreRequests, extraStoreRequests,
}); });

@ -27,7 +27,7 @@ const forceNetworkDeletion = async (): Promise<Array<string> | null> => {
const maliciousSnodes = await pRetry( const maliciousSnodes = await pRetry(
async () => { async () => {
const snodeToMakeRequestTo = await SnodePool.getNodeFromSwarmOrThrow(usPk); const snodeToMakeRequestTo = await SnodePool.getNodeFromSwarmOrThrow(usPk);
const builtRequest = await request.buildAndSignParameters(); // we need the timestamp to verify the signature below const builtRequest = await request.build();
const ret = await BatchRequests.doSnodeBatchRequestNoRetries( const ret = await BatchRequests.doSnodeBatchRequestNoRetries(
[builtRequest], [builtRequest],
snodeToMakeRequestTo, snodeToMakeRequestTo,

@ -120,7 +120,7 @@ export class RetrieveUserSubRequest extends SnodeAPISubRequest {
this.namespace = namespace; this.namespace = namespace;
} }
public async buildAndSignParameters() { public async build() {
const { pubkey, pubkey_ed25519, signature, timestamp } = const { pubkey, pubkey_ed25519, signature, timestamp } =
await SnodeSignature.getSnodeSignatureParamsUs({ await SnodeSignature.getSnodeSignatureParamsUs({
method: this.method, method: this.method,
@ -173,7 +173,7 @@ export class RetrieveGroupSubRequest extends SnodeAPISubRequest {
this.groupDetailsNeededForSignature = groupDetailsNeededForSignature; this.groupDetailsNeededForSignature = groupDetailsNeededForSignature;
} }
public async buildAndSignParameters() { public async build() {
/** /**
* This will return the signature details we can use with the admin secretKey if we have it, * This will return the signature details we can use with the admin secretKey if we have it,
* or with the subaccount details if we don't. * or with the subaccount details if we don't.
@ -351,7 +351,7 @@ abstract class AbstractRevokeSubRequest extends SnodeAPISubRequest {
export class SubaccountRevokeSubRequest extends AbstractRevokeSubRequest { export class SubaccountRevokeSubRequest extends AbstractRevokeSubRequest {
public method = 'revoke_subaccount' as const; public method = 'revoke_subaccount' as const;
public async buildAndSignParameters() { public async build() {
const signature = await this.signWithAdminSecretKey(); const signature = await this.signWithAdminSecretKey();
return { return {
method: this.method, method: this.method,
@ -371,7 +371,7 @@ export class SubaccountUnrevokeSubRequest extends AbstractRevokeSubRequest {
/** /**
* For Revoke/unrevoke, this needs an admin signature * For Revoke/unrevoke, this needs an admin signature
*/ */
public async buildAndSignParameters() { public async build() {
const signature = await this.signWithAdminSecretKey(); const signature = await this.signWithAdminSecretKey();
return { return {
@ -405,7 +405,7 @@ export class GetExpiriesFromNodeSubRequest extends SnodeAPISubRequest {
/** /**
* For Revoke/unrevoke, this needs an admin signature * For Revoke/unrevoke, this needs an admin signature
*/ */
public async buildAndSignParameters() { public async build() {
const timestamp = GetNetworkTime.now(); const timestamp = GetNetworkTime.now();
const ourPubKey = UserUtils.getOurPubKeyStrFromCache(); const ourPubKey = UserUtils.getOurPubKeyStrFromCache();
@ -445,7 +445,7 @@ export class DeleteAllFromUserNodeSubRequest extends SnodeAPISubRequest {
public method = 'delete_all' as const; public method = 'delete_all' as const;
public readonly namespace = 'all'; // we can only delete_all for all namespaces currently, but the backend allows more public readonly namespace = 'all'; // we can only delete_all for all namespaces currently, but the backend allows more
public async buildAndSignParameters() { public async build() {
const signResult = await SnodeSignature.getSnodeSignatureParamsUs({ const signResult = await SnodeSignature.getSnodeSignatureParamsUs({
method: this.method, method: this.method,
namespace: this.namespace, namespace: this.namespace,
@ -492,7 +492,7 @@ export class DeleteAllFromGroupMsgNodeSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters() { public async build() {
const signDetails = await SnodeGroupSignature.getSnodeGroupSignature({ const signDetails = await SnodeGroupSignature.getSnodeGroupSignature({
method: this.method, method: this.method,
namespace: this.namespace, namespace: this.namespace,
@ -534,7 +534,7 @@ export class DeleteHashesFromUserNodeSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters() { public async build() {
const signResult = await SnodeSignature.getSnodeSignatureByHashesParams({ const signResult = await SnodeSignature.getSnodeSignatureByHashesParams({
method: this.method, method: this.method,
messagesHashes: this.messageHashes, messagesHashes: this.messageHashes,
@ -588,7 +588,7 @@ export class DeleteHashesFromGroupNodeSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters() { public async build() {
// Note: this request can only be made by an admin and will be denied otherwise, so we make the secretKey mandatory in the constructor. // Note: this request can only be made by an admin and will be denied otherwise, so we make the secretKey mandatory in the constructor.
const signResult = await SnodeGroupSignature.getGroupSignatureByHashesParams({ const signResult = await SnodeGroupSignature.getGroupSignatureByHashesParams({
method: this.method, method: this.method,
@ -631,7 +631,7 @@ export class UpdateExpiryOnNodeUserSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters() { public async build() {
const signResult = await SnodeSignature.generateUpdateExpiryOurSignature({ const signResult = await SnodeSignature.generateUpdateExpiryOurSignature({
shortenOrExtend: this.shortenOrExtend, shortenOrExtend: this.shortenOrExtend,
messagesHashes: this.messageHashes, messagesHashes: this.messageHashes,
@ -698,7 +698,7 @@ export class UpdateExpiryOnNodeGroupSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters() { public async build() {
const signResult = await SnodeGroupSignature.generateUpdateExpiryGroupSignature({ const signResult = await SnodeGroupSignature.generateUpdateExpiryGroupSignature({
shortenOrExtend: this.shortenOrExtend, shortenOrExtend: this.shortenOrExtend,
messagesHashes: this.messageHashes, messagesHashes: this.messageHashes,
@ -784,7 +784,7 @@ export class StoreGroupMessageSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters(): Promise<{ public async build(): Promise<{
method: 'store'; method: 'store';
params: StoreOnNodeNormalParams; params: StoreOnNodeNormalParams;
}> { }> {
@ -855,7 +855,7 @@ abstract class StoreGroupConfigSubRequest<
} }
} }
public async buildAndSignParameters(): Promise<{ public async build(): Promise<{
method: 'store'; method: 'store';
params: StoreOnNodeNormalParams; params: StoreOnNodeNormalParams;
}> { }> {
@ -947,7 +947,7 @@ export class StoreUserConfigSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters(): Promise<{ public async build(): Promise<{
method: 'store'; method: 'store';
params: StoreOnNodeNormalParams; params: StoreOnNodeNormalParams;
}> { }> {
@ -1027,7 +1027,7 @@ export class StoreUserMessageSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters(): Promise<{ public async build(): Promise<{
method: 'store'; method: 'store';
params: StoreOnNodeNormalParams; params: StoreOnNodeNormalParams;
}> { }> {
@ -1086,7 +1086,7 @@ export class StoreLegacyGroupMessageSubRequest extends SnodeAPISubRequest {
} }
} }
public async buildAndSignParameters(): Promise<{ public async build(): Promise<{
method: 'store'; method: 'store';
params: StoreOnNodeNormalParams; params: StoreOnNodeNormalParams;
}> { }> {
@ -1181,29 +1181,7 @@ export type RawSnodeSubRequests =
| GetExpiriesFromNodeSubRequest | GetExpiriesFromNodeSubRequest
| DeleteAllFromGroupMsgNodeSubRequest; | DeleteAllFromGroupMsgNodeSubRequest;
export type BuiltSnodeSubRequests = export type BuiltSnodeSubRequests = AwaitedReturn<RawSnodeSubRequests['build']>;
| ReturnType<RetrieveLegacyClosedGroupSubRequest['build']>
| AwaitedReturn<RetrieveUserSubRequest['buildAndSignParameters']>
| AwaitedReturn<RetrieveGroupSubRequest['buildAndSignParameters']>
| AwaitedReturn<StoreGroupInfoSubRequest['buildAndSignParameters']>
| AwaitedReturn<StoreGroupMembersSubRequest['buildAndSignParameters']>
| AwaitedReturn<StoreGroupKeysSubRequest['buildAndSignParameters']>
| AwaitedReturn<StoreGroupMessageSubRequest['buildAndSignParameters']>
| AwaitedReturn<StoreGroupRevokedRetrievableSubRequest['buildAndSignParameters']>
| AwaitedReturn<StoreUserConfigSubRequest['buildAndSignParameters']>
| AwaitedReturn<SwarmForSubRequest['build']>
| AwaitedReturn<OnsResolveSubRequest['build']>
| AwaitedReturn<GetServiceNodesSubRequest['build']>
| AwaitedReturn<NetworkTimeSubRequest['build']>
| AwaitedReturn<DeleteHashesFromGroupNodeSubRequest['buildAndSignParameters']>
| AwaitedReturn<DeleteHashesFromUserNodeSubRequest['buildAndSignParameters']>
| AwaitedReturn<DeleteAllFromUserNodeSubRequest['buildAndSignParameters']>
| AwaitedReturn<UpdateExpiryOnNodeUserSubRequest['buildAndSignParameters']>
| AwaitedReturn<UpdateExpiryOnNodeGroupSubRequest['buildAndSignParameters']>
| AwaitedReturn<SubaccountRevokeSubRequest['buildAndSignParameters']>
| AwaitedReturn<SubaccountUnrevokeSubRequest['buildAndSignParameters']>
| AwaitedReturn<GetExpiriesFromNodeSubRequest['buildAndSignParameters']>
| AwaitedReturn<DeleteAllFromGroupMsgNodeSubRequest['buildAndSignParameters']>;
export function builtRequestToLoggingId(request: BuiltSnodeSubRequests): string { export function builtRequestToLoggingId(request: BuiltSnodeSubRequests): string {
const { method, params } = request; const { method, params } = request;
@ -1242,7 +1220,7 @@ export function builtRequestToLoggingId(request: BuiltSnodeSubRequests): string
} }
// eslint-disable-next-line @typescript-eslint/array-type // eslint-disable-next-line @typescript-eslint/array-type
export type NonEmptyArray<T> = [T, ...T[]]; type NonEmptyArray<T> = [T, ...T[]];
export type BatchResultEntry = { export type BatchResultEntry = {
code: number; code: number;

@ -88,11 +88,11 @@ function makeStoreGroupKeysSubRequest({
group, group,
}: { }: {
group: Pick<UserGroupsGet, 'secretKey' | 'pubkeyHex'>; group: Pick<UserGroupsGet, 'secretKey' | 'pubkeyHex'>;
encryptedSupplementKeys: Array<Uint8Array>; encryptedSupplementKeys: Uint8Array | null;
}) { }) {
const groupPk = group.pubkeyHex; const groupPk = group.pubkeyHex;
if (!encryptedSupplementKeys.length) { if (!encryptedSupplementKeys?.length) {
return []; return undefined;
} }
// supplementalKeys are already encrypted, but we still need the secretKey to sign the request // supplementalKeys are already encrypted, but we still need the secretKey to sign the request
@ -106,12 +106,10 @@ function makeStoreGroupKeysSubRequest({
'pushChangesToGroupSwarmIfNeeded: keysEncryptedmessage not empty but we do not have the secretKey' 'pushChangesToGroupSwarmIfNeeded: keysEncryptedmessage not empty but we do not have the secretKey'
); );
} }
return encryptedSupplementKeys.map(encryptedData => { return new StoreGroupKeysSubRequest({
return new StoreGroupKeysSubRequest({ encryptedData: encryptedSupplementKeys,
encryptedData, groupPk,
groupPk, secretKey: group.secretKey,
secretKey: group.secretKey,
});
}); });
} }

@ -327,7 +327,6 @@ class ConvoController {
await MetaGroupWrapperActions.infoDestroy(groupPk); await MetaGroupWrapperActions.infoDestroy(groupPk);
const lastPushResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({ const lastPushResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk, groupPk,
supplementalKeysSubRequest: [],
deleteAllMessagesSubRequest, deleteAllMessagesSubRequest,
extraStoreRequests: [], extraStoreRequests: [],
}); });

@ -6,7 +6,6 @@ import { compact, isArray, isEmpty, isNumber, isString } from 'lodash';
import pRetry from 'p-retry'; import pRetry from 'p-retry';
import { Data, SeenMessageHashes } from '../../data/data'; import { Data, SeenMessageHashes } from '../../data/data';
import { SignalService } from '../../protobuf'; import { SignalService } from '../../protobuf';
import { assertUnreachable } from '../../types/sqlSharedTypes';
import { UserGroupsWrapperActions } from '../../webworker/workers/browser/libsession_worker_interface'; import { UserGroupsWrapperActions } from '../../webworker/workers/browser/libsession_worker_interface';
import { OpenGroupRequestCommonType } from '../apis/open_group_api/opengroupV2/ApiUtil'; import { OpenGroupRequestCommonType } from '../apis/open_group_api/opengroupV2/ApiUtil';
import { OpenGroupMessageV2 } from '../apis/open_group_api/opengroupV2/OpenGroupMessageV2'; import { OpenGroupMessageV2 } from '../apis/open_group_api/opengroupV2/OpenGroupMessageV2';
@ -17,19 +16,11 @@ import {
import { import {
BuiltSnodeSubRequests, BuiltSnodeSubRequests,
DeleteAllFromGroupMsgNodeSubRequest, DeleteAllFromGroupMsgNodeSubRequest,
DeleteAllFromUserNodeSubRequest,
DeleteHashesFromGroupNodeSubRequest, DeleteHashesFromGroupNodeSubRequest,
DeleteHashesFromUserNodeSubRequest, DeleteHashesFromUserNodeSubRequest,
GetExpiriesFromNodeSubRequest,
GetServiceNodesSubRequest,
MethodBatchType, MethodBatchType,
NetworkTimeSubRequest,
NotEmptyArrayOfBatchResults, NotEmptyArrayOfBatchResults,
OnsResolveSubRequest,
RawSnodeSubRequests, RawSnodeSubRequests,
RetrieveGroupSubRequest,
RetrieveLegacyClosedGroupSubRequest,
RetrieveUserSubRequest,
StoreGroupInfoSubRequest, StoreGroupInfoSubRequest,
StoreGroupKeysSubRequest, StoreGroupKeysSubRequest,
StoreGroupMembersSubRequest, StoreGroupMembersSubRequest,
@ -38,11 +29,6 @@ import {
StoreLegacyGroupMessageSubRequest, StoreLegacyGroupMessageSubRequest,
StoreUserConfigSubRequest, StoreUserConfigSubRequest,
StoreUserMessageSubRequest, StoreUserMessageSubRequest,
SubaccountRevokeSubRequest,
SubaccountUnrevokeSubRequest,
SwarmForSubRequest,
UpdateExpiryOnNodeGroupSubRequest,
UpdateExpiryOnNodeUserSubRequest,
} from '../apis/snode_api/SnodeRequestTypes'; } from '../apis/snode_api/SnodeRequestTypes';
import { BatchRequests } from '../apis/snode_api/batchRequest'; import { BatchRequests } from '../apis/snode_api/batchRequest';
import { GetNetworkTime } from '../apis/snode_api/getNetworkTime'; import { GetNetworkTime } from '../apis/snode_api/getNetworkTime';
@ -369,47 +355,7 @@ async function signSubRequests(
): Promise<Array<BuiltSnodeSubRequests>> { ): Promise<Array<BuiltSnodeSubRequests>> {
const signedRequests: Array<BuiltSnodeSubRequests> = await Promise.all( const signedRequests: Array<BuiltSnodeSubRequests> = await Promise.all(
params.map(p => { params.map(p => {
if ( return p.build();
p instanceof SubaccountRevokeSubRequest ||
p instanceof SubaccountUnrevokeSubRequest ||
p instanceof DeleteHashesFromUserNodeSubRequest ||
p instanceof DeleteHashesFromGroupNodeSubRequest ||
p instanceof DeleteAllFromUserNodeSubRequest ||
p instanceof StoreGroupInfoSubRequest ||
p instanceof StoreGroupMembersSubRequest ||
p instanceof StoreGroupKeysSubRequest ||
p instanceof StoreGroupRevokedRetrievableSubRequest ||
p instanceof StoreGroupMessageSubRequest ||
p instanceof StoreLegacyGroupMessageSubRequest ||
p instanceof StoreUserConfigSubRequest ||
p instanceof StoreUserMessageSubRequest ||
p instanceof RetrieveUserSubRequest ||
p instanceof RetrieveGroupSubRequest ||
p instanceof UpdateExpiryOnNodeUserSubRequest ||
p instanceof UpdateExpiryOnNodeGroupSubRequest ||
p instanceof GetExpiriesFromNodeSubRequest ||
p instanceof DeleteAllFromGroupMsgNodeSubRequest
) {
return p.buildAndSignParameters();
}
if (
p instanceof RetrieveLegacyClosedGroupSubRequest ||
p instanceof SwarmForSubRequest ||
p instanceof OnsResolveSubRequest ||
p instanceof GetServiceNodesSubRequest ||
p instanceof NetworkTimeSubRequest
) {
return p.build();
}
assertUnreachable(
p,
'If you see this error, you need to add the handling of the rawRequest above'
);
throw new Error(
'If you see this error, you need to add the handling of the rawRequest above'
);
}) })
); );

@ -1,7 +1,7 @@
/* eslint-disable no-await-in-loop */ /* eslint-disable no-await-in-loop */
import { GroupPubkeyType, WithGroupPubkey } from 'libsession_util_nodejs'; import { GroupPubkeyType, WithGroupPubkey } from 'libsession_util_nodejs';
import { to_hex } from 'libsodium-wrappers-sumo'; import { to_hex } from 'libsodium-wrappers-sumo';
import { isArray, isEmpty, isNumber } from 'lodash'; import { compact, isArray, isEmpty, isNumber } from 'lodash';
import { UserUtils } from '../..'; import { UserUtils } from '../..';
import { assertUnreachable } from '../../../../types/sqlSharedTypes'; import { assertUnreachable } from '../../../../types/sqlSharedTypes';
import { isSignInByLinking } from '../../../../util/storage'; import { isSignInByLinking } from '../../../../util/storage';
@ -85,7 +85,7 @@ async function pushChangesToGroupSwarmIfNeeded({
extraStoreRequests, extraStoreRequests,
}: WithGroupPubkey & }: WithGroupPubkey &
WithRevokeSubRequest & { WithRevokeSubRequest & {
supplementalKeysSubRequest: Array<StoreGroupKeysSubRequest>; supplementalKeysSubRequest?: StoreGroupKeysSubRequest;
deleteAllMessagesSubRequest?: DeleteAllFromGroupMsgNodeSubRequest; deleteAllMessagesSubRequest?: DeleteAllFromGroupMsgNodeSubRequest;
extraStoreRequests: Array<StoreGroupMessageSubRequest>; extraStoreRequests: Array<StoreGroupMessageSubRequest>;
}): Promise<RunJobResult> { }): Promise<RunJobResult> {
@ -136,7 +136,11 @@ async function pushChangesToGroupSwarmIfNeeded({
// Note: this is on purpose that supplementalKeysSubRequest is before pendingConfigRequests // Note: this is on purpose that supplementalKeysSubRequest is before pendingConfigRequests
// as this is to avoid a race condition where a device is polling right // as this is to avoid a race condition where a device is polling right
// while we are posting the configs (already encrypted with the new keys) // while we are posting the configs (already encrypted with the new keys)
storeRequests: [...supplementalKeysSubRequest, ...pendingConfigRequests, ...extraStoreRequests], storeRequests: compact([
supplementalKeysSubRequest,
...pendingConfigRequests,
...extraStoreRequests,
]),
destination: groupPk, destination: groupPk,
deleteHashesSubRequest, deleteHashesSubRequest,
revokeSubRequest, revokeSubRequest,
@ -146,8 +150,8 @@ async function pushChangesToGroupSwarmIfNeeded({
const expectedReplyLength = const expectedReplyLength =
pendingConfigRequests.length + // each of those are sent as a subrequest pendingConfigRequests.length + // each of those are sent as a subrequest
supplementalKeysSubRequest.length + // each of those are sent as a subrequest (supplementalKeysSubRequest ? 1 : 0) + // we are sending all the supplemental keys as a single subrequest
(allOldHashes.size ? 1 : 0) + // we are sending all hashes changes as a single subrequest (deleteHashesSubRequest ? 1 : 0) + // we are sending all hashes changes as a single subrequest
(revokeSubRequest ? 1 : 0) + // we are sending all revoke updates as a single subrequest (revokeSubRequest ? 1 : 0) + // we are sending all revoke updates as a single subrequest
(unrevokeSubRequest ? 1 : 0) + // we are sending all revoke updates as a single subrequest (unrevokeSubRequest ? 1 : 0) + // we are sending all revoke updates as a single subrequest
(deleteAllMessagesSubRequest ? 1 : 0) + // a delete_all sub request is a single subrequest (deleteAllMessagesSubRequest ? 1 : 0) + // a delete_all sub request is a single subrequest
@ -221,7 +225,6 @@ class GroupSyncJob extends PersistedJob<GroupSyncPersistedData> {
// return await so we catch exceptions in here // return await so we catch exceptions in here
return await GroupSync.pushChangesToGroupSwarmIfNeeded({ return await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk: thisJobDestination, groupPk: thisJobDestination,
supplementalKeysSubRequest: [],
extraStoreRequests: [], extraStoreRequests: [],
}); });

@ -209,7 +209,6 @@ const initNewGroupInWrapper = createAsyncThunk(
const result = await GroupSync.pushChangesToGroupSwarmIfNeeded({ const result = await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk, groupPk,
supplementalKeysSubRequest: [],
extraStoreRequests, extraStoreRequests,
}); });
if (result !== RunJobResult.Success) { if (result !== RunJobResult.Success) {
@ -499,7 +498,7 @@ async function handleWithHistoryMembers({
} }
const encryptedSupplementKeys = withHistory.length const encryptedSupplementKeys = withHistory.length
? await MetaGroupWrapperActions.generateSupplementKeys(groupPk, withHistory) ? await MetaGroupWrapperActions.generateSupplementKeys(groupPk, withHistory)
: []; : null;
return encryptedSupplementKeys; return encryptedSupplementKeys;
} }
@ -831,7 +830,6 @@ async function handleMemberRemovedFromUI({
// revoked pubkeys, update messages, and libsession groups config in a single batch call // revoked pubkeys, update messages, and libsession groups config in a single batch call
const sequenceResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({ const sequenceResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk, groupPk,
supplementalKeysSubRequest: [],
extraStoreRequests, extraStoreRequests,
}); });
if (sequenceResult !== RunJobResult.Success) { if (sequenceResult !== RunJobResult.Success) {
@ -910,7 +908,6 @@ async function handleNameChangeFromUI({
const batchResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({ const batchResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk, groupPk,
supplementalKeysSubRequest: [],
extraStoreRequests, extraStoreRequests,
}); });
@ -1030,7 +1027,6 @@ const triggerFakeAvatarUpdate = createAsyncThunk(
const batchResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({ const batchResult = await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk, groupPk,
supplementalKeysSubRequest: [],
extraStoreRequests, extraStoreRequests,
}); });
if (!batchResult) { if (!batchResult) {

@ -55,7 +55,7 @@ describe('ExpireRequest', () => {
throw Error('nothing was returned when building the request'); throw Error('nothing was returned when building the request');
} }
const signedReq = await request.buildAndSignParameters(); const signedReq = await request.build();
expect(signedReq, "method should be 'expire'").to.have.property('method', 'expire'); expect(signedReq, "method should be 'expire'").to.have.property('method', 'expire');
expect(signedReq.params.pubkey, 'should have a matching pubkey').to.equal(ourNumber); expect(signedReq.params.pubkey, 'should have a matching pubkey').to.equal(ourNumber);
@ -83,7 +83,7 @@ describe('ExpireRequest', () => {
if (!request) { if (!request) {
throw Error('nothing was returned when building the request'); throw Error('nothing was returned when building the request');
} }
const signedReq = await request.buildAndSignParameters(); const signedReq = await request.build();
expect(signedReq, "method should be 'expire'").to.have.property('method', 'expire'); expect(signedReq, "method should be 'expire'").to.have.property('method', 'expire');
expect(signedReq.params.pubkey, 'should have a matching pubkey').to.equal(ourNumber); expect(signedReq.params.pubkey, 'should have a matching pubkey').to.equal(ourNumber);
@ -111,7 +111,7 @@ describe('ExpireRequest', () => {
if (!request) { if (!request) {
throw Error('nothing was returned when building the request'); throw Error('nothing was returned when building the request');
} }
const signedReq = await request.buildAndSignParameters(); const signedReq = await request.build();
expect(signedReq, "method should be 'expire'").to.have.property('method', 'expire'); expect(signedReq, "method should be 'expire'").to.have.property('method', 'expire');
expect(signedReq.params.pubkey, 'should have a matching pubkey').to.equal(ourNumber); expect(signedReq.params.pubkey, 'should have a matching pubkey').to.equal(ourNumber);

@ -52,7 +52,7 @@ describe('GetExpiriesRequest', () => {
it('builds a valid request given the messageHashes and valid timestamp for now', async () => { it('builds a valid request given the messageHashes and valid timestamp for now', async () => {
const unsigned = new GetExpiriesFromNodeSubRequest(props); const unsigned = new GetExpiriesFromNodeSubRequest(props);
const request = await unsigned.buildAndSignParameters(); const request = await unsigned.build();
expect(request, 'should not return null').to.not.be.null; expect(request, 'should not return null').to.not.be.null;
expect(request, 'should not return undefined').to.not.be.undefined; expect(request, 'should not return undefined').to.not.be.undefined;
@ -77,7 +77,7 @@ describe('GetExpiriesRequest', () => {
let errorStr = 'fakeerror'; let errorStr = 'fakeerror';
try { try {
const unsigned = new GetExpiriesFromNodeSubRequest(props); const unsigned = new GetExpiriesFromNodeSubRequest(props);
const request = await unsigned.buildAndSignParameters(); const request = await unsigned.build();
if (request) { if (request) {
throw new Error('we should not have been able to build a request'); throw new Error('we should not have been able to build a request');
} }
@ -93,7 +93,7 @@ describe('GetExpiriesRequest', () => {
const unsigned = new GetExpiriesFromNodeSubRequest(props); const unsigned = new GetExpiriesFromNodeSubRequest(props);
try { try {
const request = await unsigned.buildAndSignParameters(); const request = await unsigned.build();
if (request) { if (request) {
throw new Error('should not be able to build the request'); throw new Error('should not be able to build the request');
} }

@ -275,7 +275,6 @@ describe('GroupSyncJob pushChangesToGroupSwarmIfNeeded', () => {
const result = await GroupSync.pushChangesToGroupSwarmIfNeeded({ const result = await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk, groupPk,
supplementalKeysSubRequest: [],
extraStoreRequests: [], extraStoreRequests: [],
}); });
expect(result).to.be.eq(RunJobResult.Success); expect(result).to.be.eq(RunJobResult.Success);
@ -299,7 +298,6 @@ describe('GroupSyncJob pushChangesToGroupSwarmIfNeeded', () => {
}); });
const result = await GroupSync.pushChangesToGroupSwarmIfNeeded({ const result = await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk, groupPk,
supplementalKeysSubRequest: [],
extraStoreRequests: [], extraStoreRequests: [],
}); });
@ -370,7 +368,6 @@ describe('GroupSyncJob pushChangesToGroupSwarmIfNeeded', () => {
]); ]);
const result = await GroupSync.pushChangesToGroupSwarmIfNeeded({ const result = await GroupSync.pushChangesToGroupSwarmIfNeeded({
groupPk, groupPk,
supplementalKeysSubRequest: [],
extraStoreRequests: [], extraStoreRequests: [],
}); });

Loading…
Cancel
Save