Skip to content

Commit 912a29b

Browse files
committed
fix: resolve TypeScript compilation errors
- Export OplogEntry from storage interface - Fix Buffer type incompatibility in decryption (use Buffer.from)
1 parent a25cee3 commit 912a29b

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

packages/core/src/storage/interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { HLCTimestamp, Document, OplogEntry } from '@entgldb/protocol';
2+
export type { OplogEntry };
23

34
/**
45
* Storage interface that must be implemented by persistence adapters

packages/network/src/tcp-client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ export class TcpSyncClient {
197197
const tag = messageData.subarray(2 + ivLen, 2 + ivLen + tagLen);
198198
const ciphertext = messageData.subarray(2 + ivLen + tagLen);
199199

200-
messageData = CryptoHelper.decrypt(ciphertext, iv, tag, this.cipherState.decryptKey);
200+
const decrypted = CryptoHelper.decrypt(ciphertext, iv, tag, this.cipherState.decryptKey);
201+
messageData = Buffer.from(decrypted);
201202
}
202203

203204
const messageType = messageData[0];

packages/network/src/tcp-server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ export class TcpSyncServer {
103103
const tag = messageData.subarray(2 + ivLen, 2 + ivLen + tagLen);
104104
const ciphertext = messageData.subarray(2 + ivLen + tagLen);
105105

106-
messageData = CryptoHelper.decrypt(ciphertext, iv, tag, cipherState.decryptKey);
106+
const decrypted = CryptoHelper.decrypt(ciphertext, iv, tag, cipherState.decryptKey);
107+
messageData = Buffer.from(decrypted);
107108
}
108109

109110
try {

0 commit comments

Comments
 (0)