chore: add handling shared vault invites via websockets (#2475)

This commit is contained in:
Karol Sójko
2023-09-01 17:04:32 +02:00
committed by GitHub
parent 318a2caf08
commit 4ca291291c
12 changed files with 47 additions and 35 deletions

View File

@@ -211,7 +211,7 @@ export class AsymmetricMessageService
const result = this._getUntrustedPayload.execute({
privateKey: keys.getValue().encryption.privateKey,
message,
payload: message,
})
if (result.isFailed()) {
@@ -236,7 +236,7 @@ export class AsymmetricMessageService
privateKey: keys.getValue().encryption.privateKey,
sender: contact.getValue(),
ownUserUuid: this.sessions.userUuid,
message,
payload: message,
})
if (result.isFailed()) {

View File

@@ -18,7 +18,7 @@ describe('GetTrustedPayload', () => {
describe('execute', () => {
const mockDto = {
privateKey: 'test-private-key',
message: {} as AsymmetricMessageServerHash,
payload: {} as AsymmetricMessageServerHash,
sender: {} as TrustedContactInterface,
ownUserUuid: 'test-user-uuid',
}

View File

@@ -1,4 +1,4 @@
import { AsymmetricMessageServerHash } from '@standardnotes/responses'
import { AsymmetricMessageServerHash, SharedVaultInviteServerHash } from '@standardnotes/responses'
import { AsymmetricMessagePayload, TrustedContactInterface } from '@standardnotes/models'
import { DecryptMessage } from '../../Encryption/UseCase/Asymmetric/DecryptMessage'
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
@@ -8,12 +8,12 @@ export class GetTrustedPayload implements SyncUseCaseInterface<AsymmetricMessage
execute<M extends AsymmetricMessagePayload>(dto: {
privateKey: string
message: AsymmetricMessageServerHash
payload: AsymmetricMessageServerHash | SharedVaultInviteServerHash
sender: TrustedContactInterface
ownUserUuid: string
}): Result<M> {
const result = this.decryptMessage.execute<M>({
message: dto.message.encrypted_message,
message: dto.payload.encrypted_message,
sender: dto.sender,
privateKey: dto.privateKey,
})

View File

@@ -1,4 +1,4 @@
import { AsymmetricMessageServerHash } from '@standardnotes/responses'
import { AsymmetricMessageServerHash, SharedVaultInviteServerHash } from '@standardnotes/responses'
import { AsymmetricMessagePayload } from '@standardnotes/models'
import { DecryptMessage } from '../../Encryption/UseCase/Asymmetric/DecryptMessage'
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
@@ -8,10 +8,10 @@ export class GetUntrustedPayload implements SyncUseCaseInterface<AsymmetricMessa
execute<M extends AsymmetricMessagePayload>(dto: {
privateKey: string
message: AsymmetricMessageServerHash
payload: AsymmetricMessageServerHash | SharedVaultInviteServerHash
}): Result<M> {
const result = this.decryptMessage.execute<M>({
message: dto.message.encrypted_message,
message: dto.payload.encrypted_message,
sender: undefined,
privateKey: dto.privateKey,
})